1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-09 13:23:51 +02:00
chroma/lexers/testdata/zig.expected
Robin Thrift bd463054be Add Zig lexer
Add a lexer for the Zig language (https://ziglang.org) based on the
pygments Zig lexer.
2020-05-16 21:36:07 +10:00

454 lines
18 KiB
Plaintext

[
{"type":"KeywordReserved","value":"const"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"std"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"="},
{"type":"TextWhitespace","value":" "},
{"type":"NameBuiltin","value":"@import"},
{"type":"Punctuation","value":"("},
{"type":"LiteralString","value":"\"std.zig\""},
{"type":"Punctuation","value":");"},
{"type":"TextWhitespace","value":"\n"},
{"type":"KeywordReserved","value":"const"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"builtin"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"="},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"std"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"builtin"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"KeywordReserved","value":"const"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"testing"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"="},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"std"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"testing"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n\n"},
{"type":"KeywordReserved","value":"pub"},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"fn"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"once"},
{"type":"Punctuation","value":"("},
{"type":"KeywordReserved","value":"comptime"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"f"},
{"type":"Operator","value":":"},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"fn"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"()"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordType","value":"void"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"Once"},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"f"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Keyword","value":"return"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"Once"},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"f"},
{"type":"Punctuation","value":"){};"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n\n"},
{"type":"CommentSingle","value":"/// An object that executes the function `f` just once.\n"},
{"type":"KeywordReserved","value":"pub"},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"fn"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"Once"},
{"type":"Punctuation","value":"("},
{"type":"KeywordReserved","value":"comptime"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"f"},
{"type":"Operator","value":":"},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"fn"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"()"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordType","value":"void"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordType","value":"type"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Keyword","value":"return"},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"struct"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Name","value":"done"},
{"type":"Operator","value":":"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordType","value":"bool"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"="},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordConstant","value":"false"},
{"type":"Punctuation","value":","},
{"type":"TextWhitespace","value":"\n "},
{"type":"Name","value":"mutex"},
{"type":"Operator","value":":"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"std"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"Mutex"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"="},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"std"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"Mutex"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"init"},
{"type":"Punctuation","value":"(),"},
{"type":"TextWhitespace","value":"\n\n "},
{"type":"CommentSingle","value":"/// Call the function `f`.\n"},
{"type":"TextWhitespace","value":" "},
{"type":"CommentSingle","value":"/// If `call` is invoked multiple times `f` will be executed only the\n"},
{"type":"TextWhitespace","value":" "},
{"type":"CommentSingle","value":"/// first time.\n"},
{"type":"TextWhitespace","value":" "},
{"type":"CommentSingle","value":"/// The invocations are thread-safe.\n"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordReserved","value":"pub"},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"fn"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"call"},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"self"},
{"type":"Operator","value":":"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"*"},
{"type":"NameBuiltin","value":"@This"},
{"type":"Punctuation","value":"())"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordType","value":"void"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Keyword","value":"if"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"("},
{"type":"NameBuiltin","value":"@atomicLoad"},
{"type":"Punctuation","value":"("},
{"type":"KeywordType","value":"bool"},
{"type":"Punctuation","value":","},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"\u0026"},
{"type":"Name","value":"self"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"done"},
{"type":"Punctuation","value":","},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"Acquire"},
{"type":"Punctuation","value":"))"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Keyword","value":"return"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n\n "},
{"type":"Keyword","value":"return"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"self"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"callSlow"},
{"type":"Punctuation","value":"();"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n\n "},
{"type":"Keyword","value":"fn"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"callSlow"},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"self"},
{"type":"Operator","value":":"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"*"},
{"type":"NameBuiltin","value":"@This"},
{"type":"Punctuation","value":"())"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordType","value":"void"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"NameBuiltin","value":"@setCold"},
{"type":"Punctuation","value":"("},
{"type":"KeywordConstant","value":"true"},
{"type":"Punctuation","value":");"},
{"type":"TextWhitespace","value":"\n\n "},
{"type":"KeywordReserved","value":"const"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"T"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"="},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"self"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"mutex"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"acquire"},
{"type":"Punctuation","value":"();"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Keyword","value":"defer"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"T"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"release"},
{"type":"Punctuation","value":"();"},
{"type":"TextWhitespace","value":"\n\n "},
{"type":"CommentSingle","value":"// The first thread to acquire the mutex gets to run the initializer\n"},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"if"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"("},
{"type":"Operator","value":"!"},
{"type":"Name","value":"self"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"done"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Name","value":"f"},
{"type":"Punctuation","value":"();"},
{"type":"TextWhitespace","value":"\n "},
{"type":"NameBuiltin","value":"@atomicStore"},
{"type":"Punctuation","value":"("},
{"type":"KeywordType","value":"bool"},
{"type":"Punctuation","value":","},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"\u0026"},
{"type":"Name","value":"self"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"done"},
{"type":"Punctuation","value":","},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordConstant","value":"true"},
{"type":"Punctuation","value":","},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"Release"},
{"type":"Punctuation","value":");"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Punctuation","value":"};"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n\n"},
{"type":"KeywordReserved","value":"var"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"global_number"},
{"type":"Operator","value":":"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordType","value":"i32"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"="},
{"type":"TextWhitespace","value":" "},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"KeywordReserved","value":"var"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"global_once"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"="},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"once"},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"incr"},
{"type":"Punctuation","value":");"},
{"type":"TextWhitespace","value":"\n\n"},
{"type":"Keyword","value":"fn"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"incr"},
{"type":"Punctuation","value":"()"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordType","value":"void"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Name","value":"global_number"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"+="},
{"type":"TextWhitespace","value":" "},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n\n"},
{"type":"Keyword","value":"test"},
{"type":"TextWhitespace","value":" "},
{"type":"LiteralString","value":"\"Once executes its function just once\""},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Keyword","value":"if"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"builtin"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"single_threaded"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Name","value":"global_once"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"call"},
{"type":"Punctuation","value":"();"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Name","value":"global_once"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"call"},
{"type":"Punctuation","value":"();"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"else"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"KeywordReserved","value":"var"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"threads"},
{"type":"Operator","value":":"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"["},
{"type":"LiteralNumberInteger","value":"10"},
{"type":"Punctuation","value":"]"},
{"type":"Operator","value":"*"},
{"type":"Name","value":"std"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"Thread"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"="},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordConstant","value":"undefined"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Keyword","value":"defer"},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"for"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"threads"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"|"},
{"type":"Name","value":"handle"},
{"type":"Operator","value":"|"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"handle"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"wait"},
{"type":"Punctuation","value":"();"},
{"type":"TextWhitespace","value":"\n\n "},
{"type":"Keyword","value":"for"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"threads"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"|*"},
{"type":"Name","value":"handle"},
{"type":"Operator","value":"|"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Name","value":"handle"},
{"type":"Punctuation","value":"."},
{"type":"Operator","value":"*"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":"="},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"try"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"std"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"Thread"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"spawn"},
{"type":"Punctuation","value":"("},
{"type":"NameBuiltin","value":"@as"},
{"type":"Punctuation","value":"("},
{"type":"KeywordType","value":"u8"},
{"type":"Punctuation","value":","},
{"type":"TextWhitespace","value":" "},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":"),"},
{"type":"TextWhitespace","value":" "},
{"type":"Keyword","value":"struct"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Keyword","value":"fn"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"thread_fn"},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"x"},
{"type":"Operator","value":":"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordType","value":"u8"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordType","value":"void"},
{"type":"TextWhitespace","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Name","value":"global_once"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"call"},
{"type":"Punctuation","value":"();"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Punctuation","value":"}."},
{"type":"Name","value":"thread_fn"},
{"type":"Punctuation","value":");"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n "},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n\n "},
{"type":"Name","value":"testing"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"expectEqual"},
{"type":"Punctuation","value":"("},
{"type":"NameBuiltin","value":"@as"},
{"type":"Punctuation","value":"("},
{"type":"KeywordType","value":"i32"},
{"type":"Punctuation","value":","},
{"type":"TextWhitespace","value":" "},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":"),"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"global_number"},
{"type":"Punctuation","value":");"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n"}
]