diff --git a/AUTHORS b/AUTHORS index 0e9f512718..92483e927d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -46,6 +46,7 @@ Other contributors, listed alphabetically, are: * chebee7i -- Python traceback lexer improvements * Hiram Chirino -- Scaml and Jade lexers * Mauricio Caceres -- SAS and Stata lexers. +* Michael Camilleri, John Gabriele, sogaiu -- Janet lexer * Ian Cooper -- VGL lexer * David Corbett -- Inform, Jasmin, JSGF, Snowball, and TADS 3 lexers * Leaf Corcoran -- MoonScript lexer diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index 234cba63f2..8d1f401317 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -234,6 +234,7 @@ 'JMESPathLexer': ('pygments.lexers.jmespath', 'JMESPath', ('jmespath', 'jp'), ('*.jp',), ()), 'JSLTLexer': ('pygments.lexers.jslt', 'JSLT', ('jslt',), ('*.jslt',), ('text/x-jslt',)), 'JagsLexer': ('pygments.lexers.modeling', 'JAGS', ('jags',), ('*.jag', '*.bug'), ()), + 'JanetLexer': ('pygments.lexers.lisp', 'Janet', ('janet',), ('*.janet', '*.jdn'), ('text/x-janet', 'application/x-janet')), 'JasminLexer': ('pygments.lexers.jvm', 'Jasmin', ('jasmin', 'jasminxt'), ('*.j',), ()), 'JavaLexer': ('pygments.lexers.jvm', 'Java', ('java',), ('*.java',), ('text/x-java',)), 'JavascriptDjangoLexer': ('pygments.lexers.templates', 'JavaScript+Django/Jinja', ('javascript+django', 'js+django', 'javascript+jinja', 'js+jinja'), ('*.js.j2', '*.js.jinja2'), ('application/x-javascript+django', 'application/x-javascript+jinja', 'text/x-javascript+django', 'text/x-javascript+jinja', 'text/javascript+django', 'text/javascript+jinja')), diff --git a/pygments/lexers/lisp.py b/pygments/lexers/lisp.py index 966b6063ab..75d375d97e 100644 --- a/pygments/lexers/lisp.py +++ b/pygments/lexers/lisp.py @@ -20,7 +20,7 @@ __all__ = ['SchemeLexer', 'CommonLispLexer', 'HyLexer', 'RacketLexer', 'NewLispLexer', 'EmacsLispLexer', 'ShenLexer', 'CPSALexer', - 'XtlangLexer', 'FennelLexer'] + 'XtlangLexer', 'FennelLexer', 'JanetLexer'] class SchemeLexer(RegexLexer): @@ -2846,3 +2846,351 @@ class FennelLexer(RegexLexer): (r'#', Punctuation), ] } + + +class JanetLexer(RegexLexer): + """A lexer for the Janet programming language. + + .. versionadded:: 2.17.0 + """ + name = 'Janet' + url = 'https://janet-lang.org/' + aliases = ['janet'] + filenames = ['*.janet', '*.jdn'] + mimetypes = ['text/x-janet', 'application/x-janet'] + + # XXX: gets too slow + #flags = re.MULTILINE | re.VERBOSE + + special_forms = ( + 'break', 'def', 'do', 'fn', 'if', 'quote', 'quasiquote', 'splice', + 'set', 'unquote', 'upscope', 'var', 'while' + ) + + builtin_macros = ( + '%=', '*=', '++', '+=', '--', '-=', '->', '->>', '-?>', + '-?>>', '/=', 'and', 'as->', 'as-macro', 'as?->', + 'assert', 'case', 'catseq', 'chr', 'comment', 'compif', + 'comptime', 'compwhen', 'cond', 'coro', 'def-', + 'default', 'defdyn', 'defer', 'defmacro', 'defmacro-', + 'defn', 'defn-', 'delay', 'doc', 'each', 'eachk', + 'eachp', 'edefer', 'ev/do-thread', 'ev/gather', + 'ev/spawn', 'ev/spawn-thread', 'ev/with-deadline', + 'ffi/defbind', 'fiber-fn', 'for', 'forever', 'forv', + 'generate', 'if-let', 'if-not', 'if-with', 'import', + 'juxt', 'label', 'let', 'loop', 'match', 'or', 'prompt', + 'protect', 'repeat', 'seq', 'short-fn', 'tabseq', + 'toggle', 'tracev', 'try', 'unless', 'use', 'var-', + 'varfn', 'when', 'when-let', 'when-with', 'with', + 'with-dyns', 'with-syms', 'with-vars', + # obsolete builtin macros + 'eachy' + ) + + builtin_functions = ( + '%', '*', '+', '-', '/', '<', '<=', '=', '>', '>=', + 'abstract?', 'accumulate', 'accumulate2', 'all', + 'all-bindings', 'all-dynamics', 'any?', 'apply', + 'array', 'array/clear', 'array/concat', 'array/ensure', + 'array/fill', 'array/insert', 'array/new', + 'array/new-filled', 'array/peek', 'array/pop', + 'array/push', 'array/remove', 'array/slice', + 'array/trim', 'array/weak', 'array?', 'asm', + 'bad-compile', 'bad-parse', 'band', 'blshift', 'bnot', + 'boolean?', 'bor', 'brshift', 'brushift', 'buffer', + 'buffer/bit', 'buffer/bit-clear', 'buffer/bit-set', + 'buffer/bit-toggle', 'buffer/blit', 'buffer/clear', + 'buffer/fill', 'buffer/format', 'buffer/from-bytes', + 'buffer/new', 'buffer/new-filled', 'buffer/popn', + 'buffer/push', 'buffer/push-at', 'buffer/push-byte', + 'buffer/push-string', 'buffer/push-word', + 'buffer/slice', 'buffer/trim', 'buffer?', 'bxor', + 'bytes?', 'cancel', 'cfunction?', 'cli-main', 'cmp', + 'comp', 'compare', 'compare<', 'compare<=', 'compare=', + 'compare>', 'compare>=', 'compile', 'complement', + 'count', 'curenv', 'debug', 'debug/arg-stack', + 'debug/break', 'debug/fbreak', 'debug/lineage', + 'debug/stack', 'debug/stacktrace', 'debug/step', + 'debug/unbreak', 'debug/unfbreak', 'debugger', + 'debugger-on-status', 'dec', 'deep-not=', 'deep=', + 'defglobal', 'describe', 'dictionary?', 'disasm', + 'distinct', 'div', 'doc*', 'doc-format', 'doc-of', + 'dofile', 'drop', 'drop-until', 'drop-while', 'dyn', + 'eflush', 'empty?', 'env-lookup', 'eprin', 'eprinf', + 'eprint', 'eprintf', 'error', 'errorf', + 'ev/acquire-lock', 'ev/acquire-rlock', + 'ev/acquire-wlock', 'ev/all-tasks', 'ev/call', + 'ev/cancel', 'ev/capacity', 'ev/chan', 'ev/chan-close', + 'ev/chunk', 'ev/close', 'ev/count', 'ev/deadline', + 'ev/full', 'ev/give', 'ev/give-supervisor', 'ev/go', + 'ev/lock', 'ev/read', 'ev/release-lock', + 'ev/release-rlock', 'ev/release-wlock', 'ev/rselect', + 'ev/rwlock', 'ev/select', 'ev/sleep', 'ev/take', + 'ev/thread', 'ev/thread-chan', 'ev/write', 'eval', + 'eval-string', 'even?', 'every?', 'extreme', 'false?', + 'ffi/align', 'ffi/call', 'ffi/calling-conventions', + 'ffi/close', 'ffi/context', 'ffi/free', 'ffi/jitfn', + 'ffi/lookup', 'ffi/malloc', 'ffi/native', + 'ffi/pointer-buffer', 'ffi/pointer-cfunction', + 'ffi/read', 'ffi/signature', 'ffi/size', 'ffi/struct', + 'ffi/trampoline', 'ffi/write', 'fiber/can-resume?', + 'fiber/current', 'fiber/getenv', 'fiber/last-value', + 'fiber/maxstack', 'fiber/new', 'fiber/root', + 'fiber/setenv', 'fiber/setmaxstack', 'fiber/status', + 'fiber?', 'file/close', 'file/flush', 'file/lines', + 'file/open', 'file/read', 'file/seek', 'file/tell', + 'file/temp', 'file/write', 'filter', 'find', + 'find-index', 'first', 'flatten', 'flatten-into', + 'flush', 'flycheck', 'freeze', 'frequencies', + 'from-pairs', 'function?', 'gccollect', 'gcinterval', + 'gcsetinterval', 'gensym', 'get', 'get-in', 'getline', + 'getproto', 'group-by', 'has-key?', 'has-value?', + 'hash', 'idempotent?', 'identity', 'import*', 'in', + 'inc', 'index-of', 'indexed?', 'int/s64', + 'int/to-bytes', 'int/to-number', 'int/u64', 'int?', + 'interleave', 'interpose', 'invert', 'juxt*', 'keep', + 'keep-syntax', 'keep-syntax!', 'keys', 'keyword', + 'keyword/slice', 'keyword?', 'kvs', 'last', 'length', + 'lengthable?', 'load-image', 'macex', 'macex1', + 'maclintf', 'make-env', 'make-image', 'map', 'mapcat', + 'marshal', 'math/abs', 'math/acos', 'math/acosh', + 'math/asin', 'math/asinh', 'math/atan', 'math/atan2', + 'math/atanh', 'math/cbrt', 'math/ceil', 'math/cos', + 'math/cosh', 'math/erf', 'math/erfc', 'math/exp', + 'math/exp2', 'math/expm1', 'math/floor', 'math/gamma', + 'math/gcd', 'math/hypot', 'math/lcm', 'math/log', + 'math/log-gamma', 'math/log10', 'math/log1p', + 'math/log2', 'math/next', 'math/pow', 'math/random', + 'math/rng', 'math/rng-buffer', 'math/rng-int', + 'math/rng-uniform', 'math/round', 'math/seedrandom', + 'math/sin', 'math/sinh', 'math/sqrt', 'math/tan', + 'math/tanh', 'math/trunc', 'max', 'max-of', 'mean', + 'memcmp', 'merge', 'merge-into', 'merge-module', 'min', + 'min-of', 'mod', 'module/add-paths', + 'module/expand-path', 'module/find', 'module/value', + 'nan?', 'nat?', 'native', 'neg?', 'net/accept', + 'net/accept-loop', 'net/address', 'net/address-unpack', + 'net/chunk', 'net/close', 'net/connect', 'net/flush', + 'net/listen', 'net/localname', 'net/peername', + 'net/read', 'net/recv-from', 'net/send-to', + 'net/server', 'net/setsockopt', 'net/shutdown', + 'net/write', 'next', 'nil?', 'not', 'not=', 'number?', + 'odd?', 'one?', 'os/arch', 'os/cd', 'os/chmod', + 'os/clock', 'os/compiler', 'os/cpu-count', + 'os/cryptorand', 'os/cwd', 'os/date', 'os/dir', + 'os/environ', 'os/execute', 'os/exit', 'os/getenv', + 'os/isatty', 'os/link', 'os/lstat', 'os/mkdir', + 'os/mktime', 'os/open', 'os/perm-int', 'os/perm-string', + 'os/pipe', 'os/posix-exec', 'os/posix-fork', + 'os/proc-close', 'os/proc-kill', 'os/proc-wait', + 'os/readlink', 'os/realpath', 'os/rename', 'os/rm', + 'os/rmdir', 'os/setenv', 'os/shell', 'os/sigaction', + 'os/sleep', 'os/spawn', 'os/stat', 'os/strftime', + 'os/symlink', 'os/time', 'os/touch', 'os/umask', + 'os/which', 'pairs', 'parse', 'parse-all', + 'parser/byte', 'parser/clone', 'parser/consume', + 'parser/eof', 'parser/error', 'parser/flush', + 'parser/has-more', 'parser/insert', 'parser/new', + 'parser/produce', 'parser/state', 'parser/status', + 'parser/where', 'partial', 'partition', 'partition-by', + 'peg/compile', 'peg/find', 'peg/find-all', 'peg/match', + 'peg/replace', 'peg/replace-all', 'pos?', 'postwalk', + 'pp', 'prewalk', 'prin', 'prinf', 'print', 'printf', + 'product', 'propagate', 'put', 'put-in', 'quit', + 'range', 'reduce', 'reduce2', 'repl', 'require', + 'resume', 'return', 'reverse', 'reverse!', + 'run-context', 'sandbox', 'scan-number', 'setdyn', + 'signal', 'slice', 'slurp', 'some', 'sort', 'sort-by', + 'sorted', 'sorted-by', 'spit', 'string', + 'string/ascii-lower', 'string/ascii-upper', + 'string/bytes', 'string/check-set', 'string/find', + 'string/find-all', 'string/format', 'string/from-bytes', + 'string/has-prefix?', 'string/has-suffix?', + 'string/join', 'string/repeat', 'string/replace', + 'string/replace-all', 'string/reverse', 'string/slice', + 'string/split', 'string/trim', 'string/triml', + 'string/trimr', 'string?', 'struct', 'struct/getproto', + 'struct/proto-flatten', 'struct/to-table', + 'struct/with-proto', 'struct?', 'sum', 'symbol', + 'symbol/slice', 'symbol?', 'table', 'table/clear', + 'table/clone', 'table/getproto', 'table/new', + 'table/proto-flatten', 'table/rawget', 'table/setproto', + 'table/to-struct', 'table/weak', 'table/weak-keys', + 'table/weak-values', 'table?', 'take', 'take-until', + 'take-while', 'thaw', 'trace', 'true?', 'truthy?', + 'tuple', 'tuple/brackets', 'tuple/setmap', + 'tuple/slice', 'tuple/sourcemap', 'tuple/type', + 'tuple?', 'type', 'unmarshal', 'untrace', 'update', + 'update-in', 'values', 'varglobal', 'walk', + 'warn-compile', 'xprin', 'xprinf', 'xprint', 'xprintf', + 'yield', 'zero?', 'zipcoll', + # obsolete builtin functions + 'tarray/buffer', 'tarray/copy-bytes', 'tarray/length', + 'tarray/new', 'tarray/properties', 'tarray/slice', + 'tarray/swap-bytes', 'thread/close', 'thread/current', + 'thread/exit', 'thread/new', 'thread/receive', + 'thread/send' + ) + + builtin_variables = ( + 'debugger-env', 'default-peg-grammar', 'janet/build', + 'janet/config-bits', 'janet/version', 'load-image-dict', + 'make-image-dict', 'math/-inf', 'math/e', 'math/inf', + 'math/int-max', 'math/int-min', 'math/int32-max', + 'math/int32-min', 'math/nan', 'math/pi', 'module/cache', + 'module/loaders', 'module/loading', 'module/paths', + 'root-env', 'stderr', 'stdin', 'stdout' + ) + + constants = ( + 'false', 'nil', 'true' + ) + + # XXX: this form not usable to pass to `suffix=` + #_token_end = r''' + # (?= # followed by one of: + # \s # whitespace + # | \# # comment + # | [)\]] # end delimiters + # | $ # end of file + # ) + #''' + + # ...so, express it like this + _token_end = r'(?=\s|#|[)\]]|$)' + + _first_char = r'[a-zA-Z!$%&*+./@^_-]' + _following_chars_mb = r'[0-9:a-zA-Z!$%&*+./@^_-]*' + + valid_name = _first_char + _following_chars_mb + + _sign_mb = r'[+-]?' + + _radix_unit = r''' + [0-9a-zA-Z]+ # one or more alphanumeric + ( # optional group of: + _* # zero or more underscores + [0-9a-zA-Z]+ # one or more alphanumeric + _* # zero or more underscores + )* + ''' + + _radix_exp_mb = rf''' + ( + & # exponent marker + {_sign_mb} # optional sign + [0-9a-zA-Z]+ # one or more alphanumeric + )? + ''' + + # 2af3__bee_ + _hex_unit = r''' + [0-9a-fA-F]+ # one or more hex digits + ( # followed by zero or more groups of: + _* # zero or more underscores + [0-9a-fA-F]+ # one or more hex digits + _* # zero or more underscores + )* + ''' + + # 12_000__ + _dec_unit = r''' + [0-9]+ # one or more digits + ( # followed by zero or more groups of: + _* # zero or more underscores + [0-9]+ # one or more digits + _* # zero or more underscores + )* + ''' + + # E-23 + _dec_exp_mb = rf''' + ( # optional group of: + [eE] # lower or uppercase e + {_sign_mb} # optional sign + [0-9]+ # one or more digits + )? + ''' + + _collection_delims = r'''(?x) + ( + @\( | # arrays and tuples + \( | + \) | + @\[ | + \[ | + \] | + @\{ | # tables and structs + \{ | + \} + ) + ''' + + tokens = { + 'root': [ + (r'#.*$', Comment.Single), + + (r'\s+', Whitespace), + + # radix number + (rf'''(?x) + {_sign_mb} [0-9][0-9]? r {_radix_unit} \. ({_radix_unit})? + {_radix_exp_mb} + ''', + Number), + + (rf'''(?x) + {_sign_mb} [0-9][0-9]? r (\.)? {_radix_unit} + {_radix_exp_mb} + ''', + Number), + + # hex number + (rf'(?x) {_sign_mb} 0x {_hex_unit} \. ({_hex_unit})?', + Number.Hex), + + (rf'(?x) {_sign_mb} 0x (\.)? {_hex_unit}', + Number.Hex), + + # decimal number + (rf'(?x) {_sign_mb} {_dec_unit} \. ({_dec_unit})? {_dec_exp_mb}', + Number.Float), + + (rf'(?x) {_sign_mb} (\.)? {_dec_unit} {_dec_exp_mb}', + Number.Float), + + # strings and buffers + (r'@?"(\\.|[^"])*"', String), + + # long-strings and long-buffers + (r'(?s)@?(`+).+?\1', String), + + # things that hang out on front + (r"('|~|,|;|\|)", Operator), + + # collection delimiters + (_collection_delims, Punctuation), + + # constants + (words(constants, suffix=_token_end), Keyword.Constants), + + # keywords + (r'(:' + _following_chars_mb + r'|:)', Name.Constant), + + # symbols + (words(builtin_variables, suffix=_token_end), + Name.Variable.Global), + + (words(special_forms, prefix=r'(?<=\()', suffix=_token_end), + Keyword.Reserved), + + (words(builtin_macros, prefix=r'(?<=\()', suffix=_token_end), + Name.Builtin), + + (words(builtin_functions, prefix=r'(?<=\()', suffix=_token_end), + Name.Function), + + # other symbols + (valid_name, Name.Variable), + ] + } diff --git a/tests/snippets/janet/bool_lit-false.txt b/tests/snippets/janet/bool_lit-false.txt new file mode 100644 index 0000000000..51ee6a416f --- /dev/null +++ b/tests/snippets/janet/bool_lit-false.txt @@ -0,0 +1,6 @@ +---input--- +false + +---tokens--- +'false' Keyword.Constants +'\n' Text.Whitespace diff --git a/tests/snippets/janet/bool_lit-true.txt b/tests/snippets/janet/bool_lit-true.txt new file mode 100644 index 0000000000..c0ffc77494 --- /dev/null +++ b/tests/snippets/janet/bool_lit-true.txt @@ -0,0 +1,6 @@ +---input--- +true + +---tokens--- +'true' Keyword.Constants +'\n' Text.Whitespace diff --git a/tests/snippets/janet/buf_lit-multiline.txt b/tests/snippets/janet/buf_lit-multiline.txt new file mode 100644 index 0000000000..bc59c4932d --- /dev/null +++ b/tests/snippets/janet/buf_lit-multiline.txt @@ -0,0 +1,7 @@ +---input--- +@"this is the first line +and what is this one?" + +---tokens--- +'@"this is the first line\nand what is this one?"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/buf_lit-simple.txt b/tests/snippets/janet/buf_lit-simple.txt new file mode 100644 index 0000000000..a47bc73495 --- /dev/null +++ b/tests/snippets/janet/buf_lit-simple.txt @@ -0,0 +1,6 @@ +---input--- +@"good bye" + +---tokens--- +'@"good bye"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/buf_lit-with-escape.txt b/tests/snippets/janet/buf_lit-with-escape.txt new file mode 100644 index 0000000000..847d4496bc --- /dev/null +++ b/tests/snippets/janet/buf_lit-with-escape.txt @@ -0,0 +1,6 @@ +---input--- +@"ant\fbee\rcougar" + +---tokens--- +'@"ant\\fbee\\rcougar"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/buf_lit-with-hex-escape.txt b/tests/snippets/janet/buf_lit-with-hex-escape.txt new file mode 100644 index 0000000000..685022b6e4 --- /dev/null +++ b/tests/snippets/janet/buf_lit-with-hex-escape.txt @@ -0,0 +1,6 @@ +---input--- +@"\x0f" + +---tokens--- +'@"\\x0f"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/buf_lit-with-utf8-four-hex-digits-escape.txt b/tests/snippets/janet/buf_lit-with-utf8-four-hex-digits-escape.txt new file mode 100644 index 0000000000..4ad5fc41d8 --- /dev/null +++ b/tests/snippets/janet/buf_lit-with-utf8-four-hex-digits-escape.txt @@ -0,0 +1,6 @@ +---input--- +@"\u89ee" + +---tokens--- +'@"\\u89ee"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/buf_lit-with-utf8-six-hex-digits-escape.txt b/tests/snippets/janet/buf_lit-with-utf8-six-hex-digits-escape.txt new file mode 100644 index 0000000000..2c8f9656a3 --- /dev/null +++ b/tests/snippets/janet/buf_lit-with-utf8-six-hex-digits-escape.txt @@ -0,0 +1,6 @@ +---input--- +@"\U01f6aa" + +---tokens--- +'@"\\U01f6aa"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/comment-multiple.txt b/tests/snippets/janet/comment-multiple.txt new file mode 100644 index 0000000000..566f9b11c6 --- /dev/null +++ b/tests/snippets/janet/comment-multiple.txt @@ -0,0 +1,10 @@ +---input--- +# first line +# second line + +---tokens--- +'# first line' Comment.Single +'\n' Text.Whitespace + +'# second line' Comment.Single +'\n' Text.Whitespace diff --git a/tests/snippets/janet/comment-simple.txt b/tests/snippets/janet/comment-simple.txt new file mode 100644 index 0000000000..c7aa787eaf --- /dev/null +++ b/tests/snippets/janet/comment-simple.txt @@ -0,0 +1,6 @@ +---input--- +# a comment + +---tokens--- +'# a comment' Comment.Single +'\n' Text.Whitespace diff --git a/tests/snippets/janet/kwd_lit-just-a-colon.txt b/tests/snippets/janet/kwd_lit-just-a-colon.txt new file mode 100644 index 0000000000..71208a3096 --- /dev/null +++ b/tests/snippets/janet/kwd_lit-just-a-colon.txt @@ -0,0 +1,6 @@ +---input--- +: + +---tokens--- +':' Name.Constant +'\n' Text.Whitespace diff --git a/tests/snippets/janet/kwd_lit-just-two-colons.txt b/tests/snippets/janet/kwd_lit-just-two-colons.txt new file mode 100644 index 0000000000..204a039dcc --- /dev/null +++ b/tests/snippets/janet/kwd_lit-just-two-colons.txt @@ -0,0 +1,6 @@ +---input--- +:: + +---tokens--- +'::' Name.Constant +'\n' Text.Whitespace diff --git a/tests/snippets/janet/kwd_lit-simple.txt b/tests/snippets/janet/kwd_lit-simple.txt new file mode 100644 index 0000000000..7a080238f5 --- /dev/null +++ b/tests/snippets/janet/kwd_lit-simple.txt @@ -0,0 +1,6 @@ +---input--- +:breathe + +---tokens--- +':breathe' Name.Constant +'\n' Text.Whitespace diff --git a/tests/snippets/janet/kwd_lit-with-leading-number.txt b/tests/snippets/janet/kwd_lit-with-leading-number.txt new file mode 100644 index 0000000000..d4220ad55e --- /dev/null +++ b/tests/snippets/janet/kwd_lit-with-leading-number.txt @@ -0,0 +1,6 @@ +---input--- +:0x0x0x0 + +---tokens--- +':0x0x0x0' Name.Constant +'\n' Text.Whitespace diff --git a/tests/snippets/janet/long_buf_lit-more-than-one-backtick-per-delim.txt b/tests/snippets/janet/long_buf_lit-more-than-one-backtick-per-delim.txt new file mode 100644 index 0000000000..8b89eff66a --- /dev/null +++ b/tests/snippets/janet/long_buf_lit-more-than-one-backtick-per-delim.txt @@ -0,0 +1,12 @@ +---input--- +@````Look, +more than three +backticks can be +used... +kinda poetic... +but not really +```` + +---tokens--- +'@````Look,\nmore than three\nbackticks can be\nused...\nkinda poetic...\nbut not really\n````' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/long_buf_lit-simple.txt b/tests/snippets/janet/long_buf_lit-simple.txt new file mode 100644 index 0000000000..bf2a0d310b --- /dev/null +++ b/tests/snippets/janet/long_buf_lit-simple.txt @@ -0,0 +1,7 @@ +---input--- +@`An ordinary +long-buffer` + +---tokens--- +'@`An ordinary\nlong-buffer`' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/long_str_lit-more-than-one-backtick-per-delim.txt b/tests/snippets/janet/long_str_lit-more-than-one-backtick-per-delim.txt new file mode 100644 index 0000000000..c04b389ff3 --- /dev/null +++ b/tests/snippets/janet/long_str_lit-more-than-one-backtick-per-delim.txt @@ -0,0 +1,9 @@ +---input--- +```More than +one backtick +can be used +``` + +---tokens--- +'```More than \none backtick \ncan be used\n```' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/long_str_lit-simple.txt b/tests/snippets/janet/long_str_lit-simple.txt new file mode 100644 index 0000000000..4ebe28e84f --- /dev/null +++ b/tests/snippets/janet/long_str_lit-simple.txt @@ -0,0 +1,7 @@ +---input--- +`A nice +long-string` + +---tokens--- +'`A nice\nlong-string`' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/nil_lit-the-only.txt b/tests/snippets/janet/nil_lit-the-only.txt new file mode 100644 index 0000000000..f79bab1db2 --- /dev/null +++ b/tests/snippets/janet/nil_lit-the-only.txt @@ -0,0 +1,6 @@ +---input--- +nil + +---tokens--- +'nil' Keyword.Constants +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-double-with-exponent.txt b/tests/snippets/janet/num_lit-double-with-exponent.txt new file mode 100644 index 0000000000..c7cef60a03 --- /dev/null +++ b/tests/snippets/janet/num_lit-double-with-exponent.txt @@ -0,0 +1,6 @@ +---input--- +3e8 + +---tokens--- +'3e8' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-double-with-negative-exponent.txt b/tests/snippets/janet/num_lit-double-with-negative-exponent.txt new file mode 100644 index 0000000000..1c9f886a0f --- /dev/null +++ b/tests/snippets/janet/num_lit-double-with-negative-exponent.txt @@ -0,0 +1,6 @@ +---input--- +2e-1 + +---tokens--- +'2e-1' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-double-with-underscores.txt b/tests/snippets/janet/num_lit-double-with-underscores.txt new file mode 100644 index 0000000000..6b203f3e19 --- /dev/null +++ b/tests/snippets/janet/num_lit-double-with-underscores.txt @@ -0,0 +1,6 @@ +---input--- +2_3_1__.1_2_e-1 + +---tokens--- +'2_3_1__.1_2_e-1' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-double.txt b/tests/snippets/janet/num_lit-double.txt new file mode 100644 index 0000000000..43bbd21749 --- /dev/null +++ b/tests/snippets/janet/num_lit-double.txt @@ -0,0 +1,6 @@ +---input--- +1.0 + +---tokens--- +'1.0' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-hex-with-fractional-part-and-underscores.txt b/tests/snippets/janet/num_lit-hex-with-fractional-part-and-underscores.txt new file mode 100644 index 0000000000..e8d21bf266 --- /dev/null +++ b/tests/snippets/janet/num_lit-hex-with-fractional-part-and-underscores.txt @@ -0,0 +1,6 @@ +---input--- +0x0_9_.1_f__ + +---tokens--- +'0x0_9_.1_f__' Literal.Number.Hex +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-hex-with-fractional-part.txt b/tests/snippets/janet/num_lit-hex-with-fractional-part.txt new file mode 100644 index 0000000000..0c9047f874 --- /dev/null +++ b/tests/snippets/janet/num_lit-hex-with-fractional-part.txt @@ -0,0 +1,6 @@ +---input--- +0x09.1F + +---tokens--- +'0x09.1F' Literal.Number.Hex +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-hex-with-underscores.txt b/tests/snippets/janet/num_lit-hex-with-underscores.txt new file mode 100644 index 0000000000..56228cebb2 --- /dev/null +++ b/tests/snippets/janet/num_lit-hex-with-underscores.txt @@ -0,0 +1,6 @@ +---input--- +0xF_F__F___F____ + +---tokens--- +'0xF_F__F___F____' Literal.Number.Hex +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-hex.txt b/tests/snippets/janet/num_lit-hex.txt new file mode 100644 index 0000000000..dc7522b782 --- /dev/null +++ b/tests/snippets/janet/num_lit-hex.txt @@ -0,0 +1,6 @@ +---input--- +0xaB + +---tokens--- +'0xaB' Literal.Number.Hex +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-integer-ending-with-underscores.txt b/tests/snippets/janet/num_lit-integer-ending-with-underscores.txt new file mode 100644 index 0000000000..3cde7f0af1 --- /dev/null +++ b/tests/snippets/janet/num_lit-integer-ending-with-underscores.txt @@ -0,0 +1,6 @@ +---input--- +1_3__0890__100__ + +---tokens--- +'1_3__0890__100__' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-integer-with-sequential-underscores.txt b/tests/snippets/janet/num_lit-integer-with-sequential-underscores.txt new file mode 100644 index 0000000000..2a4a43506c --- /dev/null +++ b/tests/snippets/janet/num_lit-integer-with-sequential-underscores.txt @@ -0,0 +1,6 @@ +---input--- +3__0890__100 + +---tokens--- +'3__0890__100' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-integer-with-underscores.txt b/tests/snippets/janet/num_lit-integer-with-underscores.txt new file mode 100644 index 0000000000..b5719ef158 --- /dev/null +++ b/tests/snippets/janet/num_lit-integer-with-underscores.txt @@ -0,0 +1,6 @@ +---input--- +1_000_000 + +---tokens--- +'1_000_000' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-integer.txt b/tests/snippets/janet/num_lit-integer.txt new file mode 100644 index 0000000000..fe7015f6cd --- /dev/null +++ b/tests/snippets/janet/num_lit-integer.txt @@ -0,0 +1,6 @@ +---input--- +1 + +---tokens--- +'1' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-negative-double.txt b/tests/snippets/janet/num_lit-negative-double.txt new file mode 100644 index 0000000000..1457104cbf --- /dev/null +++ b/tests/snippets/janet/num_lit-negative-double.txt @@ -0,0 +1,6 @@ +---input--- +-2.71828 + +---tokens--- +'-2.71828' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-negative-hex.txt b/tests/snippets/janet/num_lit-negative-hex.txt new file mode 100644 index 0000000000..979f08e810 --- /dev/null +++ b/tests/snippets/janet/num_lit-negative-hex.txt @@ -0,0 +1,6 @@ +---input--- +-0xFF + +---tokens--- +'-0xFF' Literal.Number.Hex +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-negative-integer.txt b/tests/snippets/janet/num_lit-negative-integer.txt new file mode 100644 index 0000000000..7b775cc106 --- /dev/null +++ b/tests/snippets/janet/num_lit-negative-integer.txt @@ -0,0 +1,6 @@ +---input--- +-2 + +---tokens--- +'-2' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-negative-radix.txt b/tests/snippets/janet/num_lit-negative-radix.txt new file mode 100644 index 0000000000..f71c7112ab --- /dev/null +++ b/tests/snippets/janet/num_lit-negative-radix.txt @@ -0,0 +1,6 @@ +---input--- +-36r20 + +---tokens--- +'-36r20' Literal.Number +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-radix-with-exponent.txt b/tests/snippets/janet/num_lit-radix-with-exponent.txt new file mode 100644 index 0000000000..ff16ce93ad --- /dev/null +++ b/tests/snippets/janet/num_lit-radix-with-exponent.txt @@ -0,0 +1,6 @@ +---input--- +3r01&02 + +---tokens--- +'3r01&02' Literal.Number +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-radix.txt b/tests/snippets/janet/num_lit-radix.txt new file mode 100644 index 0000000000..f7ce694e04 --- /dev/null +++ b/tests/snippets/janet/num_lit-radix.txt @@ -0,0 +1,6 @@ +---input--- +2r0101010001 + +---tokens--- +'2r0101010001' Literal.Number +'\n' Text.Whitespace diff --git a/tests/snippets/janet/num_lit-shouting-double-with-exponent.txt b/tests/snippets/janet/num_lit-shouting-double-with-exponent.txt new file mode 100644 index 0000000000..cad560d21d --- /dev/null +++ b/tests/snippets/janet/num_lit-shouting-double-with-exponent.txt @@ -0,0 +1,6 @@ +---input--- +1E9 + +---tokens--- +'1E9' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/par_arr_lit-empty.txt b/tests/snippets/janet/par_arr_lit-empty.txt new file mode 100644 index 0000000000..eeaf2642bf --- /dev/null +++ b/tests/snippets/janet/par_arr_lit-empty.txt @@ -0,0 +1,7 @@ +---input--- +@() + +---tokens--- +'@(' Punctuation +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/par_arr_lit-recursive.txt b/tests/snippets/janet/par_arr_lit-recursive.txt new file mode 100644 index 0000000000..3d8a794ae4 --- /dev/null +++ b/tests/snippets/janet/par_arr_lit-recursive.txt @@ -0,0 +1,24 @@ +---input--- +@(@(3 0 3) 8 @(3 0 3)) + +---tokens--- +'@(' Punctuation +'@(' Punctuation +'3' Literal.Number.Float +' ' Text.Whitespace +'0' Literal.Number.Float +' ' Text.Whitespace +'3' Literal.Number.Float +')' Punctuation +' ' Text.Whitespace +'8' Literal.Number.Float +' ' Text.Whitespace +'@(' Punctuation +'3' Literal.Number.Float +' ' Text.Whitespace +'0' Literal.Number.Float +' ' Text.Whitespace +'3' Literal.Number.Float +')' Punctuation +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/par_arr_lit-simple.txt b/tests/snippets/janet/par_arr_lit-simple.txt new file mode 100644 index 0000000000..03befb0956 --- /dev/null +++ b/tests/snippets/janet/par_arr_lit-simple.txt @@ -0,0 +1,12 @@ +---input--- +@(:hello :there :friend) + +---tokens--- +'@(' Punctuation +':hello' Name.Constant +' ' Text.Whitespace +':there' Name.Constant +' ' Text.Whitespace +':friend' Name.Constant +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/par_tup_lit-empty.txt b/tests/snippets/janet/par_tup_lit-empty.txt new file mode 100644 index 0000000000..b169faa78a --- /dev/null +++ b/tests/snippets/janet/par_tup_lit-empty.txt @@ -0,0 +1,7 @@ +---input--- +() + +---tokens--- +'(' Punctuation +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/par_tup_lit-recurisve.txt b/tests/snippets/janet/par_tup_lit-recurisve.txt new file mode 100644 index 0000000000..5d4a24c94f --- /dev/null +++ b/tests/snippets/janet/par_tup_lit-recurisve.txt @@ -0,0 +1,20 @@ +---input--- +(+ 1 2 (- 9 8)) + +---tokens--- +'(' Punctuation +'+' Name.Function +' ' Text.Whitespace +'1' Literal.Number.Float +' ' Text.Whitespace +'2' Literal.Number.Float +' ' Text.Whitespace +'(' Punctuation +'-' Name.Function +' ' Text.Whitespace +'9' Literal.Number.Float +' ' Text.Whitespace +'8' Literal.Number.Float +')' Punctuation +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/par_tup_lit-simple.txt b/tests/snippets/janet/par_tup_lit-simple.txt new file mode 100644 index 0000000000..1cfda7ac2a --- /dev/null +++ b/tests/snippets/janet/par_tup_lit-simple.txt @@ -0,0 +1,14 @@ +---input--- +(+ 1 2 3) + +---tokens--- +'(' Punctuation +'+' Name.Function +' ' Text.Whitespace +'1' Literal.Number.Float +' ' Text.Whitespace +'2' Literal.Number.Float +' ' Text.Whitespace +'3' Literal.Number.Float +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/qq_lit-paren-tuple.txt b/tests/snippets/janet/qq_lit-paren-tuple.txt new file mode 100644 index 0000000000..8a10e67f44 --- /dev/null +++ b/tests/snippets/janet/qq_lit-paren-tuple.txt @@ -0,0 +1,13 @@ +---input--- +~(1 2 3) + +---tokens--- +'~' Operator +'(' Punctuation +'1' Literal.Number.Float +' ' Text.Whitespace +'2' Literal.Number.Float +' ' Text.Whitespace +'3' Literal.Number.Float +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/qq_lit-simple.txt b/tests/snippets/janet/qq_lit-simple.txt new file mode 100644 index 0000000000..d57b053b21 --- /dev/null +++ b/tests/snippets/janet/qq_lit-simple.txt @@ -0,0 +1,7 @@ +---input--- +~1 + +---tokens--- +'~' Operator +'1' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/quote_lit-simple.txt b/tests/snippets/janet/quote_lit-simple.txt new file mode 100644 index 0000000000..38cc92c3f0 --- /dev/null +++ b/tests/snippets/janet/quote_lit-simple.txt @@ -0,0 +1,7 @@ +---input--- +':hobbes + +---tokens--- +"'" Operator +':hobbes' Name.Constant +'\n' Text.Whitespace diff --git a/tests/snippets/janet/quote_lit-tuple.txt b/tests/snippets/janet/quote_lit-tuple.txt new file mode 100644 index 0000000000..2bf12f69a0 --- /dev/null +++ b/tests/snippets/janet/quote_lit-tuple.txt @@ -0,0 +1,13 @@ +---input--- +'(:a :b :c) + +---tokens--- +"'" Operator +'(' Punctuation +':a' Name.Constant +' ' Text.Whitespace +':b' Name.Constant +' ' Text.Whitespace +':c' Name.Constant +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/short_fn_lit-call.txt b/tests/snippets/janet/short_fn_lit-call.txt new file mode 100644 index 0000000000..94bb407f4f --- /dev/null +++ b/tests/snippets/janet/short_fn_lit-call.txt @@ -0,0 +1,13 @@ +---input--- +|(= $ 1) + +---tokens--- +'|' Operator +'(' Punctuation +'=' Name.Function +' ' Text.Whitespace +'$' Name.Variable +' ' Text.Whitespace +'1' Literal.Number.Float +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/short_fn_lit-keyword.txt b/tests/snippets/janet/short_fn_lit-keyword.txt new file mode 100644 index 0000000000..d186a5bfd6 --- /dev/null +++ b/tests/snippets/janet/short_fn_lit-keyword.txt @@ -0,0 +1,7 @@ +---input--- +|:a-fine-keyword + +---tokens--- +'|' Operator +':a-fine-keyword' Name.Constant +'\n' Text.Whitespace diff --git a/tests/snippets/janet/short_fn_lit-number.txt b/tests/snippets/janet/short_fn_lit-number.txt new file mode 100644 index 0000000000..66e9bd00e8 --- /dev/null +++ b/tests/snippets/janet/short_fn_lit-number.txt @@ -0,0 +1,7 @@ +---input--- +|8 + +---tokens--- +'|' Operator +'8' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/janet/short_fn_lit-square-bracket-array.txt b/tests/snippets/janet/short_fn_lit-square-bracket-array.txt new file mode 100644 index 0000000000..288ae027a8 --- /dev/null +++ b/tests/snippets/janet/short_fn_lit-square-bracket-array.txt @@ -0,0 +1,11 @@ +---input--- +|@[8 9] + +---tokens--- +'|' Operator +'@[' Punctuation +'8' Literal.Number.Float +' ' Text.Whitespace +'9' Literal.Number.Float +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/short_fn_lit-square-bracket-tuple.txt b/tests/snippets/janet/short_fn_lit-square-bracket-tuple.txt new file mode 100644 index 0000000000..15325fed29 --- /dev/null +++ b/tests/snippets/janet/short_fn_lit-square-bracket-tuple.txt @@ -0,0 +1,11 @@ +---input--- +|[1 2] + +---tokens--- +'|' Operator +'[' Punctuation +'1' Literal.Number.Float +' ' Text.Whitespace +'2' Literal.Number.Float +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/short_fn_lit-string.txt b/tests/snippets/janet/short_fn_lit-string.txt new file mode 100644 index 0000000000..b8290f26ec --- /dev/null +++ b/tests/snippets/janet/short_fn_lit-string.txt @@ -0,0 +1,7 @@ +---input--- +|"nice string" + +---tokens--- +'|' Operator +'"nice string"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/short_fn_lit-struct.txt b/tests/snippets/janet/short_fn_lit-struct.txt new file mode 100644 index 0000000000..3762659df3 --- /dev/null +++ b/tests/snippets/janet/short_fn_lit-struct.txt @@ -0,0 +1,11 @@ +---input--- +|{:a 1} + +---tokens--- +'|' Operator +'{' Punctuation +':a' Name.Constant +' ' Text.Whitespace +'1' Literal.Number.Float +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/short_fn_lit-symbol.txt b/tests/snippets/janet/short_fn_lit-symbol.txt new file mode 100644 index 0000000000..bf5ccf4f77 --- /dev/null +++ b/tests/snippets/janet/short_fn_lit-symbol.txt @@ -0,0 +1,7 @@ +---input--- +|a-sym + +---tokens--- +'|' Operator +'a-sym' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/janet/splice_lit-in-call.txt b/tests/snippets/janet/splice_lit-in-call.txt new file mode 100644 index 0000000000..c5b0c8bb66 --- /dev/null +++ b/tests/snippets/janet/splice_lit-in-call.txt @@ -0,0 +1,17 @@ +---input--- +(+ ;[1 2 3]) + +---tokens--- +'(' Punctuation +'+' Name.Function +' ' Text.Whitespace +';' Operator +'[' Punctuation +'1' Literal.Number.Float +' ' Text.Whitespace +'2' Literal.Number.Float +' ' Text.Whitespace +'3' Literal.Number.Float +']' Punctuation +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sqr_arr_lit-empty.txt b/tests/snippets/janet/sqr_arr_lit-empty.txt new file mode 100644 index 0000000000..b7150745b2 --- /dev/null +++ b/tests/snippets/janet/sqr_arr_lit-empty.txt @@ -0,0 +1,7 @@ +---input--- +@[] + +---tokens--- +'@[' Punctuation +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sqr_arr_lit-recursive.txt b/tests/snippets/janet/sqr_arr_lit-recursive.txt new file mode 100644 index 0000000000..2d81a89e71 --- /dev/null +++ b/tests/snippets/janet/sqr_arr_lit-recursive.txt @@ -0,0 +1,24 @@ +---input--- +@[1 @[2 @[3 8]] @[9 0]] + +---tokens--- +'@[' Punctuation +'1' Literal.Number.Float +' ' Text.Whitespace +'@[' Punctuation +'2' Literal.Number.Float +' ' Text.Whitespace +'@[' Punctuation +'3' Literal.Number.Float +' ' Text.Whitespace +'8' Literal.Number.Float +']' Punctuation +']' Punctuation +' ' Text.Whitespace +'@[' Punctuation +'9' Literal.Number.Float +' ' Text.Whitespace +'0' Literal.Number.Float +']' Punctuation +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sqr_arr_lit-simple.txt b/tests/snippets/janet/sqr_arr_lit-simple.txt new file mode 100644 index 0000000000..2339515d41 --- /dev/null +++ b/tests/snippets/janet/sqr_arr_lit-simple.txt @@ -0,0 +1,18 @@ +---input--- +@[2 7 1 8 2 8] + +---tokens--- +'@[' Punctuation +'2' Literal.Number.Float +' ' Text.Whitespace +'7' Literal.Number.Float +' ' Text.Whitespace +'1' Literal.Number.Float +' ' Text.Whitespace +'8' Literal.Number.Float +' ' Text.Whitespace +'2' Literal.Number.Float +' ' Text.Whitespace +'8' Literal.Number.Float +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sqr_tup_lit-empty.txt b/tests/snippets/janet/sqr_tup_lit-empty.txt new file mode 100644 index 0000000000..5cd4aec05d --- /dev/null +++ b/tests/snippets/janet/sqr_tup_lit-empty.txt @@ -0,0 +1,7 @@ +---input--- +[] + +---tokens--- +'[' Punctuation +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sqr_tup_lit-recursive.txt b/tests/snippets/janet/sqr_tup_lit-recursive.txt new file mode 100644 index 0000000000..6506905790 --- /dev/null +++ b/tests/snippets/janet/sqr_tup_lit-recursive.txt @@ -0,0 +1,18 @@ +---input--- +[:html [:body [:p "surely you must be joking"]]] + +---tokens--- +'[' Punctuation +':html' Name.Constant +' ' Text.Whitespace +'[' Punctuation +':body' Name.Constant +' ' Text.Whitespace +'[' Punctuation +':p' Name.Constant +' ' Text.Whitespace +'"surely you must be joking"' Literal.String +']' Punctuation +']' Punctuation +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sqr_tup_lit-simple.txt b/tests/snippets/janet/sqr_tup_lit-simple.txt new file mode 100644 index 0000000000..4d6578db78 --- /dev/null +++ b/tests/snippets/janet/sqr_tup_lit-simple.txt @@ -0,0 +1,12 @@ +---input--- +[:alice :bob :carol] + +---tokens--- +'[' Punctuation +':alice' Name.Constant +' ' Text.Whitespace +':bob' Name.Constant +' ' Text.Whitespace +':carol' Name.Constant +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/str_lit-multiline.txt b/tests/snippets/janet/str_lit-multiline.txt new file mode 100644 index 0000000000..354a302895 --- /dev/null +++ b/tests/snippets/janet/str_lit-multiline.txt @@ -0,0 +1,7 @@ +---input--- +"this is the first line +and what is this one?" + +---tokens--- +'"this is the first line\nand what is this one?"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/str_lit-simple.txt b/tests/snippets/janet/str_lit-simple.txt new file mode 100644 index 0000000000..9379e3ac81 --- /dev/null +++ b/tests/snippets/janet/str_lit-simple.txt @@ -0,0 +1,6 @@ +---input--- +"hello there" + +---tokens--- +'"hello there"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/str_lit-with-escapes.txt b/tests/snippets/janet/str_lit-with-escapes.txt new file mode 100644 index 0000000000..996b188af8 --- /dev/null +++ b/tests/snippets/janet/str_lit-with-escapes.txt @@ -0,0 +1,6 @@ +---input--- +"first line\nsecond\tline" + +---tokens--- +'"first line\\nsecond\\tline"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/str_lit-with-hex-escape.txt b/tests/snippets/janet/str_lit-with-hex-escape.txt new file mode 100644 index 0000000000..627059926f --- /dev/null +++ b/tests/snippets/janet/str_lit-with-hex-escape.txt @@ -0,0 +1,6 @@ +---input--- +"\xAB" + +---tokens--- +'"\\xAB"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/str_lit-with-utf8-four-hex-digits-escape.txt b/tests/snippets/janet/str_lit-with-utf8-four-hex-digits-escape.txt new file mode 100644 index 0000000000..17fd915794 --- /dev/null +++ b/tests/snippets/janet/str_lit-with-utf8-four-hex-digits-escape.txt @@ -0,0 +1,6 @@ +---input--- +"\u23f1" + +---tokens--- +'"\\u23f1"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/str_lit-with-utf8-six-hex-digits-escape.txt b/tests/snippets/janet/str_lit-with-utf8-six-hex-digits-escape.txt new file mode 100644 index 0000000000..c689183b22 --- /dev/null +++ b/tests/snippets/janet/str_lit-with-utf8-six-hex-digits-escape.txt @@ -0,0 +1,6 @@ +---input--- +"\U01F609" + +---tokens--- +'"\\U01F609"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/janet/struct_lit-empty.txt b/tests/snippets/janet/struct_lit-empty.txt new file mode 100644 index 0000000000..8840ea281f --- /dev/null +++ b/tests/snippets/janet/struct_lit-empty.txt @@ -0,0 +1,7 @@ +---input--- +{} + +---tokens--- +'{' Punctuation +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/struct_lit-recursive.txt b/tests/snippets/janet/struct_lit-recursive.txt new file mode 100644 index 0000000000..b9ffe1cca1 --- /dev/null +++ b/tests/snippets/janet/struct_lit-recursive.txt @@ -0,0 +1,30 @@ +---input--- +{:alice {:likes :bob} :bob {:likes :carol} :carol {:likes :alice}} + +---tokens--- +'{' Punctuation +':alice' Name.Constant +' ' Text.Whitespace +'{' Punctuation +':likes' Name.Constant +' ' Text.Whitespace +':bob' Name.Constant +'}' Punctuation +' ' Text.Whitespace +':bob' Name.Constant +' ' Text.Whitespace +'{' Punctuation +':likes' Name.Constant +' ' Text.Whitespace +':carol' Name.Constant +'}' Punctuation +' ' Text.Whitespace +':carol' Name.Constant +' ' Text.Whitespace +'{' Punctuation +':likes' Name.Constant +' ' Text.Whitespace +':alice' Name.Constant +'}' Punctuation +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/struct_lit-simple.txt b/tests/snippets/janet/struct_lit-simple.txt new file mode 100644 index 0000000000..02d16508f7 --- /dev/null +++ b/tests/snippets/janet/struct_lit-simple.txt @@ -0,0 +1,14 @@ +---input--- +{:a 1 :b 2} + +---tokens--- +'{' Punctuation +':a' Name.Constant +' ' Text.Whitespace +'1' Literal.Number.Float +' ' Text.Whitespace +':b' Name.Constant +' ' Text.Whitespace +'2' Literal.Number.Float +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sym_lit-alphabetic.txt b/tests/snippets/janet/sym_lit-alphabetic.txt new file mode 100644 index 0000000000..b1157df82d --- /dev/null +++ b/tests/snippets/janet/sym_lit-alphabetic.txt @@ -0,0 +1,6 @@ +---input--- +var + +---tokens--- +'var' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sym_lit-ear-muffs.txt b/tests/snippets/janet/sym_lit-ear-muffs.txt new file mode 100644 index 0000000000..f5dec6061a --- /dev/null +++ b/tests/snippets/janet/sym_lit-ear-muffs.txt @@ -0,0 +1,6 @@ +---input--- +*global-var* + +---tokens--- +'*global-var*' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sym_lit-full-of-stars.txt b/tests/snippets/janet/sym_lit-full-of-stars.txt new file mode 100644 index 0000000000..1279c0f3e8 --- /dev/null +++ b/tests/snippets/janet/sym_lit-full-of-stars.txt @@ -0,0 +1,6 @@ +---input--- +***** + +---tokens--- +'*****' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sym_lit-kebab-case.txt b/tests/snippets/janet/sym_lit-kebab-case.txt new file mode 100644 index 0000000000..8e0c1cf181 --- /dev/null +++ b/tests/snippets/janet/sym_lit-kebab-case.txt @@ -0,0 +1,6 @@ +---input--- +kebab-case-symbol + +---tokens--- +'kebab-case-symbol' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sym_lit-legal-but-hard-to-read.txt b/tests/snippets/janet/sym_lit-legal-but-hard-to-read.txt new file mode 100644 index 0000000000..54701e51f3 --- /dev/null +++ b/tests/snippets/janet/sym_lit-legal-but-hard-to-read.txt @@ -0,0 +1,6 @@ +---input--- +!%$^*__--__._+++===-crazy-symbol + +---tokens--- +'!%$^*__--__._+++===-crazy-symbol' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sym_lit-name-with-module-name.txt b/tests/snippets/janet/sym_lit-name-with-module-name.txt new file mode 100644 index 0000000000..a1489f5801 --- /dev/null +++ b/tests/snippets/janet/sym_lit-name-with-module-name.txt @@ -0,0 +1,6 @@ +---input--- +my-module/my-function + +---tokens--- +'my-module/my-function' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/janet/sym_lit-snake-case.txt b/tests/snippets/janet/sym_lit-snake-case.txt new file mode 100644 index 0000000000..e7c7eb411e --- /dev/null +++ b/tests/snippets/janet/sym_lit-snake-case.txt @@ -0,0 +1,6 @@ +---input--- +snake_case_symbol + +---tokens--- +'snake_case_symbol' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/janet/tbl_lit-empty.txt b/tests/snippets/janet/tbl_lit-empty.txt new file mode 100644 index 0000000000..3bd99af813 --- /dev/null +++ b/tests/snippets/janet/tbl_lit-empty.txt @@ -0,0 +1,7 @@ +---input--- +@{} + +---tokens--- +'@{' Punctuation +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/tbl_lit-recursive.txt b/tests/snippets/janet/tbl_lit-recursive.txt new file mode 100644 index 0000000000..01bb089c05 --- /dev/null +++ b/tests/snippets/janet/tbl_lit-recursive.txt @@ -0,0 +1,30 @@ +---input--- +@{:ant @{:legs 6} :bee @{:legs 6} :cheetah @{:legs 4}} + +---tokens--- +'@{' Punctuation +':ant' Name.Constant +' ' Text.Whitespace +'@{' Punctuation +':legs' Name.Constant +' ' Text.Whitespace +'6' Literal.Number.Float +'}' Punctuation +' ' Text.Whitespace +':bee' Name.Constant +' ' Text.Whitespace +'@{' Punctuation +':legs' Name.Constant +' ' Text.Whitespace +'6' Literal.Number.Float +'}' Punctuation +' ' Text.Whitespace +':cheetah' Name.Constant +' ' Text.Whitespace +'@{' Punctuation +':legs' Name.Constant +' ' Text.Whitespace +'4' Literal.Number.Float +'}' Punctuation +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/tbl_lit-simple.txt b/tests/snippets/janet/tbl_lit-simple.txt new file mode 100644 index 0000000000..dcad4305b0 --- /dev/null +++ b/tests/snippets/janet/tbl_lit-simple.txt @@ -0,0 +1,18 @@ +---input--- +@{:x 0 :y 100 :z -80} + +---tokens--- +'@{' Punctuation +':x' Name.Constant +' ' Text.Whitespace +'0' Literal.Number.Float +' ' Text.Whitespace +':y' Name.Constant +' ' Text.Whitespace +'100' Literal.Number.Float +' ' Text.Whitespace +':z' Name.Constant +' ' Text.Whitespace +'-80' Literal.Number.Float +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/unquote_lit-in-compile-call.txt b/tests/snippets/janet/unquote_lit-in-compile-call.txt new file mode 100644 index 0000000000..c5d1acaa00 --- /dev/null +++ b/tests/snippets/janet/unquote_lit-in-compile-call.txt @@ -0,0 +1,30 @@ +---input--- +((compile (let [a 1] ~(+ ,a 1)))) + +---tokens--- +'(' Punctuation +'(' Punctuation +'compile' Name.Function +' ' Text.Whitespace +'(' Punctuation +'let' Name.Builtin +' ' Text.Whitespace +'[' Punctuation +'a' Name.Variable +' ' Text.Whitespace +'1' Literal.Number.Float +']' Punctuation +' ' Text.Whitespace +'~' Operator +'(' Punctuation +'+' Name.Function +' ' Text.Whitespace +',' Operator +'a' Name.Variable +' ' Text.Whitespace +'1' Literal.Number.Float +')' Punctuation +')' Punctuation +')' Punctuation +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/janet/unquote_lit-in-quasiquote.txt b/tests/snippets/janet/unquote_lit-in-quasiquote.txt new file mode 100644 index 0000000000..e4a2b1b4e6 --- /dev/null +++ b/tests/snippets/janet/unquote_lit-in-quasiquote.txt @@ -0,0 +1,14 @@ +---input--- +~(+ ,a 1) + +---tokens--- +'~' Operator +'(' Punctuation +'+' Name.Function +' ' Text.Whitespace +',' Operator +'a' Name.Variable +' ' Text.Whitespace +'1' Literal.Number.Float +')' Punctuation +'\n' Text.Whitespace