mirror of
https://github.com/alecthomas/chroma.git
synced 2025-02-21 19:06:18 +02:00
Using these examples: ~~~ 0x21 1_000 1e3 ~~~ Several languages failed that support these syntax. Here are ones I found: Lexer | 0x21 | 1_000 | 1e3 -----------|------|-------|----- C# | fail | fail | fail Go | | fail | JavaScript | | fail | fail PHP | | fail | Python | | fail | Ruby | | | fail I fixed these issues, and added tests.
89 lines
3.2 KiB
Plaintext
89 lines
3.2 KiB
Plaintext
[
|
|
{"type":"KeywordNamespace","value":"package"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameOther","value":"main"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"KeywordNamespace","value":"import"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralString","value":"\"fmt\""},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"KeywordDeclaration","value":"func"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameFunction","value":"main"},
|
|
{"type":"Punctuation","value":"()"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"NameOther","value":"fmt"},
|
|
{"type":"Punctuation","value":"."},
|
|
{"type":"NameFunction","value":"Println"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"LiteralString","value":"\"Hello World!\""},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"KeywordDeclaration","value":"var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameOther","value":"n"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"KeywordType","value":"int"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberHex","value":"0x21"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Operator","value":"+"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"1_000"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"KeywordDeclaration","value":"var"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameOther","value":"n2"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"KeywordType","value":"float64"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"="},
|
|
{"type":"Text","value":" "},
|
|
{"type":"LiteralNumberFloat","value":"1e3"},
|
|
{"type":"Text","value":"\n\n"},
|
|
{"type":"KeywordDeclaration","value":"func"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameFunction","value":"hello"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameOther","value":"a"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"KeywordType","value":"int"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"Text","value":"\n\t"},
|
|
{"type":"NameOther","value":"fmt"},
|
|
{"type":"Punctuation","value":"."},
|
|
{"type":"NameFunction","value":"Println"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"LiteralString","value":"\"Hello World!\""},
|
|
{"type":"Punctuation","value":")."},
|
|
{"type":"NameFunction","value":"Hello"},
|
|
{"type":"Punctuation","value":"()"},
|
|
{"type":"Text","value":"\n\n "},
|
|
{"type":"Keyword","value":"return"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"KeywordDeclaration","value":"func"},
|
|
{"type":"Punctuation","value":"()"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"KeywordType","value":"int"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"Keyword","value":"return"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"NameOther","value":"i"},
|
|
{"type":"Text","value":"\n "},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"Text","value":"\n"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"Text","value":" "},
|
|
{"type":"CommentSingle","value":"// One last thing\n"}
|
|
]
|