mirror of
https://github.com/alecthomas/chroma.git
synced 2025-02-13 13:28:27 +02:00
259 lines
9.2 KiB
Plaintext
259 lines
9.2 KiB
Plaintext
[
|
|
{"type":"CommentSingle","value":"# a file is a class!"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# inheritance"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"Keyword","value":"extends"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"BaseClass"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# member variables"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"Keyword","value":"var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"a"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"5"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Keyword","value":"var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"s"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralStringDouble","value":"\"Hello\""},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Keyword","value":"var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"arr"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"LiteralNumberInteger","value":"1"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"2"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"3"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Keyword","value":"var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"dict"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"LiteralStringDouble","value":"\"key\""},
|
|
{"type":"Punctuation","value":":"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralStringDouble","value":"\"value\""},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"2"},
|
|
{"type":"Punctuation","value":":"},
|
|
{"type":"LiteralNumberInteger","value":"3"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# constants"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"Keyword","value":"const"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"answer"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"42"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Keyword","value":"const"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"thename"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralStringDouble","value":"\"Charly\""},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# enums"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"Keyword","value":"enum"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"Name","value":"UNIT_NEUTRAL"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"UNIT_ENEMY"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"UNIT_ALLY"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Keyword","value":"enum"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"Named"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"Name","value":"THING_1"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"THING_2"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"ANOTHER_THING"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"-"},
|
|
{"type":"LiteralNumberInteger","value":"1"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# function"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"Keyword","value":"func"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"some_function"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"param1"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"param2"},
|
|
{"type":"Punctuation","value":"):"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"Keyword","value":"var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"local_var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"5"},
|
|
{"type":"Text","value":"\n\n "},
|
|
{"type":"Keyword","value":"if"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"param1"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"\u003c"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"local_var"},
|
|
{"type":"Punctuation","value":":"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"NameBuiltin","value":"print"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"param1"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"Keyword","value":"elif"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"param2"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"\u003e"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"5"},
|
|
{"type":"Punctuation","value":":"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"NameBuiltin","value":"print"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"param2"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"Keyword","value":"else"},
|
|
{"type":"Punctuation","value":":"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"NameBuiltin","value":"print"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"LiteralStringDouble","value":"\"fail!\""},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"Text","value":"\n\n "},
|
|
{"type":"Keyword","value":"for"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"i"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"OperatorWord","value":"in"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameBuiltin","value":"range"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"LiteralNumberInteger","value":"20"},
|
|
{"type":"Punctuation","value":"):"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"NameBuiltin","value":"print"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"i"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"Text","value":"\n\n "},
|
|
{"type":"Keyword","value":"while"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"param2"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"!="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"0"},
|
|
{"type":"Punctuation","value":":"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"Name","value":"param2"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"-="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"1"},
|
|
{"type":"Text","value":"\n\n "},
|
|
{"type":"Keyword","value":"var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"local_var2"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"param1"},
|
|
{"type":"Operator","value":"+"},
|
|
{"type":"LiteralNumberInteger","value":"3"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"Keyword","value":"return"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"local_var2"},
|
|
{"type":"Text","value":"\n\n\n"},
|
|
{"type":"CommentSingle","value":"# inner class"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"Keyword","value":"class"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"Something"},
|
|
{"type":"Punctuation","value":":"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"Keyword","value":"var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"a"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"10"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"CommentSingle","value":"# constructor"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"Keyword","value":"func"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"_init"},
|
|
{"type":"Punctuation","value":"():"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"NameBuiltin","value":"print"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"LiteralStringDouble","value":"\"constructed!\""},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"Keyword","value":"var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"lv"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Name","value":"Something"},
|
|
{"type":"Operator","value":"."},
|
|
{"type":"Name","value":"new"},
|
|
{"type":"Punctuation","value":"()"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"NameBuiltin","value":"print"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"lv"},
|
|
{"type":"Operator","value":"."},
|
|
{"type":"Name","value":"a"},
|
|
{"type":"Punctuation","value":")"}
|
|
]
|