From 7bf9334153a1ee252d4d0c049287ed3ff286d18c Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 18 Jul 2022 11:07:32 +0900 Subject: [PATCH] Imported Upstream version 2.9.0 --- AUTHORS | 3 + CHANGES | 72 +- PKG-INFO | 2 +- Pygments.egg-info/PKG-INFO | 2 +- Pygments.egg-info/SOURCES.txt | 343 +- doc/docs/cmdline.rst | 2 +- doc/docs/index.rst | 1 + doc/docs/lexers.rst | 2 +- doc/docs/quickstart.rst | 2 +- doc/docs/styledevelopment.rst | 83 + doc/docs/styles.rst | 77 +- doc/faq.rst | 1 + doc/languages.rst | 6 +- external/autopygmentize | 106 +- pygments/__init__.py | 2 +- pygments/formatters/_mapping.py | 1 + pygments/formatters/html.py | 27 +- pygments/formatters/pangomarkup.py | 83 + pygments/lexers/_julia_builtins.py | 401 + pygments/lexers/_mapping.py | 104 +- pygments/lexers/actionscript.py | 4 +- pygments/lexers/ambient.py | 2 +- pygments/lexers/amdgpu.py | 13 +- pygments/lexers/apdlexer.py | 448 + pygments/lexers/apl.py | 9 +- pygments/lexers/automation.py | 2 +- pygments/lexers/bibtex.py | 2 +- pygments/lexers/c_cpp.py | 87 +- pygments/lexers/c_like.py | 105 +- pygments/lexers/cddl.py | 2 +- pygments/lexers/chapel.py | 82 +- pygments/lexers/configs.py | 162 +- pygments/lexers/devicetree.py | 2 +- pygments/lexers/erlang.py | 2 +- pygments/lexers/futhark.py | 9 +- pygments/lexers/gcodelexer.py | 36 + pygments/lexers/graphics.py | 2 +- pygments/lexers/graphviz.py | 9 +- pygments/lexers/haskell.py | 8 +- pygments/lexers/haxe.py | 2 +- pygments/lexers/installers.py | 4 +- pygments/lexers/javascript.py | 18 +- pygments/lexers/julia.py | 318 +- pygments/lexers/jvm.py | 458 +- pygments/lexers/kuin.py | 299 + pygments/lexers/lisp.py | 2 +- pygments/lexers/markup.py | 6 +- pygments/lexers/matlab.py | 33 +- pygments/lexers/mime.py | 27 +- pygments/lexers/ml.py | 2 +- pygments/lexers/nimrod.py | 2 +- pygments/lexers/objective.py | 4 +- pygments/lexers/parsers.py | 2 +- pygments/lexers/promql.py | 2 +- pygments/lexers/python.py | 6 +- pygments/lexers/resource.py | 2 +- pygments/lexers/rnc.py | 2 +- pygments/lexers/ruby.py | 2 +- pygments/lexers/rust.py | 7 +- pygments/lexers/scripting.py | 14 +- pygments/lexers/shell.py | 4 +- pygments/lexers/supercollider.py | 2 +- pygments/lexers/teal.py | 88 + pygments/lexers/templates.py | 30 +- pygments/lexers/teraterm.py | 2 +- pygments/lexers/testing.py | 2 +- pygments/lexers/theorem.py | 6 +- pygments/lexers/thingsdb.py | 118 + pygments/lexers/trafficscript.py | 2 +- pygments/lexers/webassembly.py | 120 + pygments/style.py | 2 +- pygments/styles/__init__.py | 2 + pygments/styles/friendly.py | 1 + pygments/styles/gruvbox.py | 107 + pygments/styles/native.py | 1 + tests/examplefiles/amdgpu/amdgpu.isa | 3 +- tests/examplefiles/amdgpu/amdgpu.isa.output | 19 + tests/examplefiles/apdl/example1apdl.ans | 53 + .../examplefiles/apdl/example1apdl.ans.output | 285 + tests/examplefiles/apdl/example2apdl.ans | 69 + .../examplefiles/apdl/example2apdl.ans.output | 429 + tests/examplefiles/c/ceval.c.output | 60 +- tests/examplefiles/c/example.c.output | 78 +- .../chapel/99_bottles_of_beer.chpl.output | 62 +- tests/examplefiles/charmci/Charmci.ci.output | 10 +- tests/examplefiles/cpp/example.cpp.output | 54 +- tests/examplefiles/cpp/functions.cpp | 87 + tests/examplefiles/cpp/functions.cpp.output | 1405 ++ tests/examplefiles/cpp/namespace.cpp | 35 + tests/examplefiles/cpp/namespace.cpp.output | 276 + tests/examplefiles/ec/test.ec.output | 31 +- tests/examplefiles/gcode/SupportLogo.gcode | 67 + .../gcode/SupportLogo.gcode.output | 639 + tests/examplefiles/gcode/boomerangv4.gcode | 52 + .../gcode/boomerangv4.gcode.output | 349 + tests/examplefiles/groovy/quoted.groovy | 2 + .../examplefiles/groovy/quoted.groovy.output | 28 + tests/examplefiles/groovy/test.gradle.output | 2 +- tests/examplefiles/groovy/test.groovy.output | 6 +- tests/examplefiles/julia/string.jl | 1311 +- tests/examplefiles/julia/string.jl.output | 13232 +++------------- tests/examplefiles/kuin/example.kn | 37 + tests/examplefiles/kuin/example.kn.output | 366 + tests/examplefiles/mql/example.mqh.output | 4 +- tests/examplefiles/nt/test.nt | 32 + tests/examplefiles/nt/test.nt.output | 142 + tests/examplefiles/omg-idl/example.idl | 86 + tests/examplefiles/omg-idl/example.idl.output | 733 + tests/examplefiles/pike/FakeFile.pike.output | 18 +- .../ragel-cpp/ragel-cpp_rlscan.output | 8 +- tests/examplefiles/scala/Errors.scala | 23 - tests/examplefiles/scala/Errors.scala.output | 176 - tests/examplefiles/scala/char.scala.output | 6 +- tests/examplefiles/scala/comments.scala | 9 + .../examplefiles/scala/comments.scala.output | 51 + tests/examplefiles/scala/constants.scala | 18 + .../examplefiles/scala/constants.scala.output | 176 + tests/examplefiles/scala/declarations.scala | 177 + .../scala/declarations.scala.output | 2251 +++ .../examplefiles/scala/dependent-types.scala | 6 + .../scala/dependent-types.scala.output | 102 + .../examplefiles/scala/end-soft-keyword.scala | 1 + .../scala/end-soft-keyword.scala.output | 6 + tests/examplefiles/scala/end.scala | 52 + tests/examplefiles/scala/end.scala.output | 332 + tests/examplefiles/scala/exports.scala | 17 + tests/examplefiles/scala/exports.scala.output | 193 + tests/examplefiles/scala/extensions.scala | 25 + .../scala/extensions.scala.output | 388 + .../scala/for-comprehension.scala | 2 + .../scala/for-comprehension.scala.output | 53 + tests/examplefiles/scala/imports.scala | 16 + tests/examplefiles/scala/imports.scala.output | 171 + tests/examplefiles/scala/inheritance.scala | 11 + .../scala/inheritance.scala.output | 104 + tests/examplefiles/scala/inline.scala | 4 + tests/examplefiles/scala/inline.scala.output | 77 + tests/examplefiles/scala/interp.scala | 10 - tests/examplefiles/scala/interp.scala.output | 140 - .../scala/interpolated-string.scala | 25 + .../scala/interpolated-string.scala.output | 316 + tests/examplefiles/scala/match-types.scala | 10 + .../scala/match-types.scala.output | 113 + tests/examplefiles/scala/new.scala | 7 + tests/examplefiles/scala/new.scala.output | 44 + tests/examplefiles/scala/operators.scala | 7 + .../examplefiles/scala/operators.scala.output | 52 + tests/examplefiles/scala/package.scala | 3 + tests/examplefiles/scala/package.scala.output | 15 + .../examplefiles/scala/pattern-matching.scala | 11 + .../scala/pattern-matching.scala.output | 142 + tests/examplefiles/scala/quoted.scala | 2 + tests/examplefiles/scala/quoted.scala.output | 13 + .../examplefiles/scala/singleton-types.scala | 9 + .../scala/singleton-types.scala.output | 89 + tests/examplefiles/scala/soft-keywords.scala | 6 + .../scala/soft-keywords.scala.output | 45 + .../scala/storage-modifiers.scala | 17 + .../scala/storage-modifiers.scala.output | 179 + tests/examplefiles/scala/symbols.scala | 14 + tests/examplefiles/scala/symbols.scala.output | 41 + tests/examplefiles/scala/type-operators.scala | 6 + .../scala/type-operators.scala.output | 95 + tests/examplefiles/scala/using.scala | 9 + tests/examplefiles/scala/using.scala.output | 93 + tests/examplefiles/scaml/test.scaml.output | 16 +- tests/examplefiles/swig/swig_java.swg.output | 16 +- .../swig/swig_std_vector.i.output | 18 +- tests/examplefiles/teal/example.teal | 26 + tests/examplefiles/teal/example.teal.output | 93 + tests/examplefiles/terraform/example.tf | 224 - .../examplefiles/terraform/example.tf.output | 1003 -- tests/examplefiles/thingsdb/test.ti | 76 + tests/examplefiles/thingsdb/test.ti.output | 424 + tests/examplefiles/wat/fib.wat | 35 + tests/examplefiles/wat/fib.wat.output | 234 + ...p_1_start_1_special_0_anchor_filename.html | 6 + ..._start_1_special_0_anchor_nofilename.html} | 0 ...1_start_1_special_0_noanchor_filename.html | 6 + ...tart_1_special_0_noanchor_nofilename.html} | 0 ...p_1_start_1_special_3_anchor_filename.html | 6 + ..._start_1_special_3_anchor_nofilename.html} | 0 ...1_start_1_special_3_noanchor_filename.html | 6 + ...tart_1_special_3_noanchor_nofilename.html} | 0 ...p_1_start_8_special_0_anchor_filename.html | 6 + ..._start_8_special_0_anchor_nofilename.html} | 0 ...1_start_8_special_0_noanchor_filename.html | 6 + ...tart_8_special_0_noanchor_nofilename.html} | 0 ...p_1_start_8_special_3_anchor_filename.html | 6 + ..._start_8_special_3_anchor_nofilename.html} | 0 ...1_start_8_special_3_noanchor_filename.html | 6 + ...tart_8_special_3_noanchor_nofilename.html} | 0 ...p_2_start_1_special_0_anchor_filename.html | 6 + ..._start_1_special_0_anchor_nofilename.html} | 0 ...2_start_1_special_0_noanchor_filename.html | 6 + ...tart_1_special_0_noanchor_nofilename.html} | 0 ...p_2_start_1_special_3_anchor_filename.html | 6 + ..._start_1_special_3_anchor_nofilename.html} | 0 ...2_start_1_special_3_noanchor_filename.html | 6 + ...tart_1_special_3_noanchor_nofilename.html} | 0 ...p_2_start_8_special_0_anchor_filename.html | 6 + ..._start_8_special_0_anchor_nofilename.html} | 0 ...2_start_8_special_0_noanchor_filename.html | 6 + ...tart_8_special_0_noanchor_nofilename.html} | 0 ...p_2_start_8_special_3_anchor_filename.html | 6 + ..._start_8_special_3_anchor_nofilename.html} | 0 ...2_start_8_special_3_noanchor_filename.html | 6 + ...tart_8_special_3_noanchor_nofilename.html} | 0 ...p_1_start_1_special_0_anchor_filename.html | 6 + ..._start_1_special_0_anchor_nofilename.html} | 0 ...1_start_1_special_0_noanchor_filename.html | 6 + ...tart_1_special_0_noanchor_nofilename.html} | 0 ...p_1_start_1_special_3_anchor_filename.html | 6 + ..._start_1_special_3_anchor_nofilename.html} | 0 ...1_start_1_special_3_noanchor_filename.html | 6 + ...tart_1_special_3_noanchor_nofilename.html} | 0 ...p_1_start_8_special_0_anchor_filename.html | 6 + ..._start_8_special_0_anchor_nofilename.html} | 0 ...1_start_8_special_0_noanchor_filename.html | 6 + ...tart_8_special_0_noanchor_nofilename.html} | 0 ...p_1_start_8_special_3_anchor_filename.html | 6 + ..._start_8_special_3_anchor_nofilename.html} | 0 ...1_start_8_special_3_noanchor_filename.html | 6 + ...tart_8_special_3_noanchor_nofilename.html} | 0 ...p_2_start_1_special_0_anchor_filename.html | 6 + ..._start_1_special_0_anchor_nofilename.html} | 0 ...2_start_1_special_0_noanchor_filename.html | 6 + ...tart_1_special_0_noanchor_nofilename.html} | 0 ...p_2_start_1_special_3_anchor_filename.html | 6 + ..._start_1_special_3_anchor_nofilename.html} | 0 ...2_start_1_special_3_noanchor_filename.html | 6 + ...tart_1_special_3_noanchor_nofilename.html} | 0 ...p_2_start_8_special_0_anchor_filename.html | 6 + ..._start_8_special_0_anchor_nofilename.html} | 0 ...2_start_8_special_0_noanchor_filename.html | 6 + ...tart_8_special_0_noanchor_nofilename.html} | 0 ...p_2_start_8_special_3_anchor_filename.html | 6 + ..._start_8_special_3_anchor_nofilename.html} | 0 ...2_start_8_special_3_noanchor_filename.html | 6 + ...tart_8_special_3_noanchor_nofilename.html} | 0 ...p_1_start_1_special_0_anchor_filename.html | 25 + ..._start_1_special_0_anchor_nofilename.html} | 0 ...1_start_1_special_0_noanchor_filename.html | 25 + ...tart_1_special_0_noanchor_nofilename.html} | 0 ...p_1_start_1_special_3_anchor_filename.html | 25 + ..._start_1_special_3_anchor_nofilename.html} | 0 ...1_start_1_special_3_noanchor_filename.html | 25 + ...tart_1_special_3_noanchor_nofilename.html} | 0 ...p_1_start_8_special_0_anchor_filename.html | 25 + ..._start_8_special_0_anchor_nofilename.html} | 0 ...1_start_8_special_0_noanchor_filename.html | 25 + ...tart_8_special_0_noanchor_nofilename.html} | 0 ...p_1_start_8_special_3_anchor_filename.html | 25 + ..._start_8_special_3_anchor_nofilename.html} | 0 ...1_start_8_special_3_noanchor_filename.html | 25 + ...tart_8_special_3_noanchor_nofilename.html} | 0 ...p_2_start_1_special_0_anchor_filename.html | 25 + ..._start_1_special_0_anchor_nofilename.html} | 0 ...2_start_1_special_0_noanchor_filename.html | 25 + ...tart_1_special_0_noanchor_nofilename.html} | 0 ...p_2_start_1_special_3_anchor_filename.html | 25 + ..._start_1_special_3_anchor_nofilename.html} | 0 ...2_start_1_special_3_noanchor_filename.html | 25 + ...tart_1_special_3_noanchor_nofilename.html} | 0 ...p_2_start_8_special_0_anchor_filename.html | 25 + ..._start_8_special_0_anchor_nofilename.html} | 0 ...2_start_8_special_0_noanchor_filename.html | 25 + ...tart_8_special_0_noanchor_nofilename.html} | 0 ...p_2_start_8_special_3_anchor_filename.html | 25 + ..._start_8_special_3_anchor_nofilename.html} | 0 ...2_start_8_special_3_noanchor_filename.html | 25 + ...tart_8_special_3_noanchor_nofilename.html} | 0 ...p_1_start_1_special_0_anchor_filename.html | 25 + ..._start_1_special_0_anchor_nofilename.html} | 0 ...1_start_1_special_0_noanchor_filename.html | 25 + ...tart_1_special_0_noanchor_nofilename.html} | 0 ...p_1_start_1_special_3_anchor_filename.html | 25 + ..._start_1_special_3_anchor_nofilename.html} | 0 ...1_start_1_special_3_noanchor_filename.html | 25 + ...tart_1_special_3_noanchor_nofilename.html} | 0 ...p_1_start_8_special_0_anchor_filename.html | 25 + ..._start_8_special_0_anchor_nofilename.html} | 0 ...1_start_8_special_0_noanchor_filename.html | 25 + ...tart_8_special_0_noanchor_nofilename.html} | 0 ...p_1_start_8_special_3_anchor_filename.html | 25 + ..._start_8_special_3_anchor_nofilename.html} | 0 ...1_start_8_special_3_noanchor_filename.html | 25 + ...tart_8_special_3_noanchor_nofilename.html} | 0 ...p_2_start_1_special_0_anchor_filename.html | 25 + ..._start_1_special_0_anchor_nofilename.html} | 0 ...2_start_1_special_0_noanchor_filename.html | 25 + ...tart_1_special_0_noanchor_nofilename.html} | 0 ...p_2_start_1_special_3_anchor_filename.html | 25 + ..._start_1_special_3_anchor_nofilename.html} | 0 ...2_start_1_special_3_noanchor_filename.html | 25 + ...tart_1_special_3_noanchor_nofilename.html} | 0 ...p_2_start_8_special_0_anchor_filename.html | 25 + ..._start_8_special_0_anchor_nofilename.html} | 0 ...2_start_8_special_0_noanchor_filename.html | 25 + ...tart_8_special_0_noanchor_nofilename.html} | 0 ...p_2_start_8_special_3_anchor_filename.html | 25 + ..._start_8_special_3_anchor_nofilename.html} | 0 ...2_start_8_special_3_noanchor_filename.html | 25 + ...tart_8_special_3_noanchor_nofilename.html} | 0 .../snippets/apl/test_leading_underscore.txt | 26 + tests/snippets/c/test_preproc_file.txt | 8 + tests/snippets/c/test_preproc_file2.txt | 8 + tests/snippets/julia-repl/test_repl.txt | 51 + tests/snippets/julia/test_keywords.txt | 89 + tests/snippets/julia/test_macros.txt | 56 + tests/snippets/julia/test_names.txt | 148 + tests/snippets/julia/test_numbers.txt | 261 + tests/snippets/julia/test_operators.txt | 172 + tests/snippets/julia/test_strings.txt | 225 + tests/snippets/julia/test_symbols.txt | 78 + tests/snippets/julia/test_types.txt | 196 + .../snippets/octave/test_multilinecomment.txt | 27 + .../omg-idl/annotation_named_params.txt | 27 + tests/snippets/omg-idl/enumerators.txt | 18 + .../powershell/test_colon_punctuation.txt | 35 + .../powershell/test_remoting_session.txt | 4 +- tests/snippets/powershell/test_session.txt | 2 +- .../promql/test_complex_exp_single_quotes.txt | 35 + .../test_matching_operator_no_regex_match.txt | 16 + tests/snippets/python/test_floats.txt | 75 + tests/snippets/rust/test_rawstrings.txt | 117 + .../scala/test_colon_colon_function_name.txt | 33 + .../snippets/scala/test_default_parameter.txt | 37 + tests/snippets/scala/test_end_val.txt | 8 + tests/snippets/scala/test_end_valx.txt | 8 + .../scala/test_float_with_exponents.txt | 12 + .../scala/test_function_operator_name.txt | 18 + tests/snippets/scala/test_import_path.txt | 12 + .../test_invalid_symbol_and_invalid_char.txt | 8 + .../snippets/scala/test_open_soft_keyword.txt | 12 + tests/snippets/scala/test_package_name.txt | 11 + .../snippets/scala/test_prepend_operator.txt | 10 + tests/snippets/scala/test_qualified_name.txt | 10 + .../scala/test_qualified_name_class.txt | 10 + tests/snippets/scala/test_script_header.txt | 6 + .../scala/test_symbol_followed_by_op.txt | 7 + .../test_symbol_name_ending_with_star.txt | 6 + tests/snippets/scala/test_underscore_name.txt | 12 + tests/snippets/teal/test_comments.txt | 28 + tests/snippets/teal/test_literals.txt | 28 + tests/snippets/teal/test_strings.txt | 15 + tests/snippets/terraform/test_attributes.txt | 155 + tests/snippets/terraform/test_backend.txt | 44 + tests/snippets/terraform/test_comment.txt | 41 + tests/snippets/terraform/test_functions.txt | 56 + tests/snippets/terraform/test_module.txt | 32 + tests/snippets/terraform/test_resource.txt | 211 + tests/snippets/terraform/test_types.txt | 70 + .../terraform/test_variable_declaration.txt | 41 + .../snippets/terraform/test_variable_read.txt | 23 + ..._and_offset_accept_hexadecimal_numbers.txt | 14 + .../wat/test_comment_with_open_paren.txt | 10 + .../wat/test_comment_with_semicolon.txt | 10 + .../wat/test_i32_const_is_builtin.txt | 6 + tests/snippets/wat/test_multiline_comment.txt | 11 + tests/snippets/wat/test_nested_comment.txt | 14 + .../snippets/wat/test_string_byte_escape.txt | 9 + .../snippets/wat/test_string_with_escape.txt | 9 + .../wat/test_variable_name_pattern.txt | 6 + tests/test_devicetree_lexer.py | 32 + tests/test_html_formatter.py | 4 +- tests/test_html_formatter_linenos_elements.py | 5 +- tests/test_pangomarkup_formatter.py | 45 + tests/test_templates.py | 42 +- tests/test_thingsdb.py | 36 + 370 files changed, 21823 insertions(+), 14260 deletions(-) create mode 100644 doc/docs/styledevelopment.rst create mode 100644 pygments/formatters/pangomarkup.py create mode 100644 pygments/lexers/_julia_builtins.py create mode 100644 pygments/lexers/apdlexer.py create mode 100644 pygments/lexers/gcodelexer.py create mode 100644 pygments/lexers/kuin.py create mode 100644 pygments/lexers/teal.py create mode 100644 pygments/lexers/thingsdb.py create mode 100644 pygments/lexers/webassembly.py create mode 100644 pygments/styles/gruvbox.py create mode 100644 tests/examplefiles/apdl/example1apdl.ans create mode 100644 tests/examplefiles/apdl/example1apdl.ans.output create mode 100644 tests/examplefiles/apdl/example2apdl.ans create mode 100644 tests/examplefiles/apdl/example2apdl.ans.output create mode 100644 tests/examplefiles/cpp/functions.cpp create mode 100644 tests/examplefiles/cpp/functions.cpp.output create mode 100644 tests/examplefiles/cpp/namespace.cpp create mode 100644 tests/examplefiles/cpp/namespace.cpp.output create mode 100644 tests/examplefiles/gcode/SupportLogo.gcode create mode 100644 tests/examplefiles/gcode/SupportLogo.gcode.output create mode 100644 tests/examplefiles/gcode/boomerangv4.gcode create mode 100644 tests/examplefiles/gcode/boomerangv4.gcode.output create mode 100644 tests/examplefiles/groovy/quoted.groovy create mode 100644 tests/examplefiles/groovy/quoted.groovy.output create mode 100644 tests/examplefiles/kuin/example.kn create mode 100644 tests/examplefiles/kuin/example.kn.output create mode 100644 tests/examplefiles/nt/test.nt create mode 100644 tests/examplefiles/nt/test.nt.output create mode 100644 tests/examplefiles/omg-idl/example.idl create mode 100644 tests/examplefiles/omg-idl/example.idl.output delete mode 100644 tests/examplefiles/scala/Errors.scala delete mode 100644 tests/examplefiles/scala/Errors.scala.output create mode 100644 tests/examplefiles/scala/comments.scala create mode 100644 tests/examplefiles/scala/comments.scala.output create mode 100644 tests/examplefiles/scala/constants.scala create mode 100644 tests/examplefiles/scala/constants.scala.output create mode 100644 tests/examplefiles/scala/declarations.scala create mode 100644 tests/examplefiles/scala/declarations.scala.output create mode 100644 tests/examplefiles/scala/dependent-types.scala create mode 100644 tests/examplefiles/scala/dependent-types.scala.output create mode 100644 tests/examplefiles/scala/end-soft-keyword.scala create mode 100644 tests/examplefiles/scala/end-soft-keyword.scala.output create mode 100644 tests/examplefiles/scala/end.scala create mode 100644 tests/examplefiles/scala/end.scala.output create mode 100644 tests/examplefiles/scala/exports.scala create mode 100644 tests/examplefiles/scala/exports.scala.output create mode 100644 tests/examplefiles/scala/extensions.scala create mode 100644 tests/examplefiles/scala/extensions.scala.output create mode 100644 tests/examplefiles/scala/for-comprehension.scala create mode 100644 tests/examplefiles/scala/for-comprehension.scala.output create mode 100644 tests/examplefiles/scala/imports.scala create mode 100644 tests/examplefiles/scala/imports.scala.output create mode 100644 tests/examplefiles/scala/inheritance.scala create mode 100644 tests/examplefiles/scala/inheritance.scala.output create mode 100644 tests/examplefiles/scala/inline.scala create mode 100644 tests/examplefiles/scala/inline.scala.output delete mode 100644 tests/examplefiles/scala/interp.scala delete mode 100644 tests/examplefiles/scala/interp.scala.output create mode 100644 tests/examplefiles/scala/interpolated-string.scala create mode 100644 tests/examplefiles/scala/interpolated-string.scala.output create mode 100644 tests/examplefiles/scala/match-types.scala create mode 100644 tests/examplefiles/scala/match-types.scala.output create mode 100644 tests/examplefiles/scala/new.scala create mode 100644 tests/examplefiles/scala/new.scala.output create mode 100644 tests/examplefiles/scala/operators.scala create mode 100644 tests/examplefiles/scala/operators.scala.output create mode 100644 tests/examplefiles/scala/package.scala create mode 100644 tests/examplefiles/scala/package.scala.output create mode 100644 tests/examplefiles/scala/pattern-matching.scala create mode 100644 tests/examplefiles/scala/pattern-matching.scala.output create mode 100644 tests/examplefiles/scala/quoted.scala create mode 100644 tests/examplefiles/scala/quoted.scala.output create mode 100644 tests/examplefiles/scala/singleton-types.scala create mode 100644 tests/examplefiles/scala/singleton-types.scala.output create mode 100644 tests/examplefiles/scala/soft-keywords.scala create mode 100644 tests/examplefiles/scala/soft-keywords.scala.output create mode 100644 tests/examplefiles/scala/storage-modifiers.scala create mode 100644 tests/examplefiles/scala/storage-modifiers.scala.output create mode 100644 tests/examplefiles/scala/symbols.scala create mode 100644 tests/examplefiles/scala/symbols.scala.output create mode 100644 tests/examplefiles/scala/type-operators.scala create mode 100644 tests/examplefiles/scala/type-operators.scala.output create mode 100644 tests/examplefiles/scala/using.scala create mode 100644 tests/examplefiles/scala/using.scala.output create mode 100644 tests/examplefiles/teal/example.teal create mode 100644 tests/examplefiles/teal/example.teal.output delete mode 100644 tests/examplefiles/terraform/example.tf delete mode 100644 tests/examplefiles/terraform/example.tf.output create mode 100644 tests/examplefiles/thingsdb/test.ti create mode 100644 tests/examplefiles/thingsdb/test.ti.output create mode 100644 tests/examplefiles/wat/fib.wat create mode 100644 tests/examplefiles/wat/fib.wat.output create mode 100644 tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_1_start_1_special_0_anchor.html => inline_cls_step_1_start_1_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_1_start_1_special_0_noanchor.html => inline_cls_step_1_start_1_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_1_start_1_special_3_anchor.html => inline_cls_step_1_start_1_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_1_start_1_special_3_noanchor.html => inline_cls_step_1_start_1_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_1_start_8_special_0_anchor.html => inline_cls_step_1_start_8_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_1_start_8_special_0_noanchor.html => inline_cls_step_1_start_8_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_1_start_8_special_3_anchor.html => inline_cls_step_1_start_8_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_1_start_8_special_3_noanchor.html => inline_cls_step_1_start_8_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_2_start_1_special_0_anchor.html => inline_cls_step_2_start_1_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_2_start_1_special_0_noanchor.html => inline_cls_step_2_start_1_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_2_start_1_special_3_anchor.html => inline_cls_step_2_start_1_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_2_start_1_special_3_noanchor.html => inline_cls_step_2_start_1_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_2_start_8_special_0_anchor.html => inline_cls_step_2_start_8_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_2_start_8_special_0_noanchor.html => inline_cls_step_2_start_8_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_2_start_8_special_3_anchor.html => inline_cls_step_2_start_8_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_cls_step_2_start_8_special_3_noanchor.html => inline_cls_step_2_start_8_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_1_start_1_special_0_anchor.html => inline_nocls_step_1_start_1_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_1_start_1_special_0_noanchor.html => inline_nocls_step_1_start_1_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_1_start_1_special_3_anchor.html => inline_nocls_step_1_start_1_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_1_start_1_special_3_noanchor.html => inline_nocls_step_1_start_1_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_1_start_8_special_0_anchor.html => inline_nocls_step_1_start_8_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_1_start_8_special_0_noanchor.html => inline_nocls_step_1_start_8_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_1_start_8_special_3_anchor.html => inline_nocls_step_1_start_8_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_1_start_8_special_3_noanchor.html => inline_nocls_step_1_start_8_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_2_start_1_special_0_anchor.html => inline_nocls_step_2_start_1_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_2_start_1_special_0_noanchor.html => inline_nocls_step_2_start_1_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_2_start_1_special_3_anchor.html => inline_nocls_step_2_start_1_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_2_start_1_special_3_noanchor.html => inline_nocls_step_2_start_1_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_2_start_8_special_0_anchor.html => inline_nocls_step_2_start_8_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_2_start_8_special_0_noanchor.html => inline_nocls_step_2_start_8_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_2_start_8_special_3_anchor.html => inline_nocls_step_2_start_8_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{inline_nocls_step_2_start_8_special_3_noanchor.html => inline_nocls_step_2_start_8_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_1_start_1_special_0_anchor.html => table_cls_step_1_start_1_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_1_start_1_special_0_noanchor.html => table_cls_step_1_start_1_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_1_start_1_special_3_anchor.html => table_cls_step_1_start_1_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_1_start_1_special_3_noanchor.html => table_cls_step_1_start_1_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_1_start_8_special_0_anchor.html => table_cls_step_1_start_8_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_1_start_8_special_0_noanchor.html => table_cls_step_1_start_8_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_1_start_8_special_3_anchor.html => table_cls_step_1_start_8_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_1_start_8_special_3_noanchor.html => table_cls_step_1_start_8_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_2_start_1_special_0_anchor.html => table_cls_step_2_start_1_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_2_start_1_special_0_noanchor.html => table_cls_step_2_start_1_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_2_start_1_special_3_anchor.html => table_cls_step_2_start_1_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_2_start_1_special_3_noanchor.html => table_cls_step_2_start_1_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_2_start_8_special_0_anchor.html => table_cls_step_2_start_8_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_2_start_8_special_0_noanchor.html => table_cls_step_2_start_8_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_2_start_8_special_3_anchor.html => table_cls_step_2_start_8_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{table_cls_step_2_start_8_special_3_noanchor.html => table_cls_step_2_start_8_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_1_start_1_special_0_anchor.html => table_nocls_step_1_start_1_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_1_start_1_special_0_noanchor.html => table_nocls_step_1_start_1_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_1_start_1_special_3_anchor.html => table_nocls_step_1_start_1_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_1_start_1_special_3_noanchor.html => table_nocls_step_1_start_1_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_1_start_8_special_0_anchor.html => table_nocls_step_1_start_8_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_1_start_8_special_0_noanchor.html => table_nocls_step_1_start_8_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_1_start_8_special_3_anchor.html => table_nocls_step_1_start_8_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_1_start_8_special_3_noanchor.html => table_nocls_step_1_start_8_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_2_start_1_special_0_anchor.html => table_nocls_step_2_start_1_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_2_start_1_special_0_noanchor.html => table_nocls_step_2_start_1_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_2_start_1_special_3_anchor.html => table_nocls_step_2_start_1_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_2_start_1_special_3_noanchor.html => table_nocls_step_2_start_1_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_2_start_8_special_0_anchor.html => table_nocls_step_2_start_8_special_0_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_2_start_8_special_0_noanchor.html => table_nocls_step_2_start_8_special_0_noanchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_2_start_8_special_3_anchor.html => table_nocls_step_2_start_8_special_3_anchor_nofilename.html} (100%) create mode 100644 tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor_filename.html rename tests/html_linenos_expected_output/{table_nocls_step_2_start_8_special_3_noanchor.html => table_nocls_step_2_start_8_special_3_noanchor_nofilename.html} (100%) create mode 100644 tests/snippets/apl/test_leading_underscore.txt create mode 100644 tests/snippets/julia-repl/test_repl.txt create mode 100644 tests/snippets/julia/test_keywords.txt create mode 100644 tests/snippets/julia/test_macros.txt create mode 100644 tests/snippets/julia/test_names.txt create mode 100644 tests/snippets/julia/test_numbers.txt create mode 100644 tests/snippets/julia/test_operators.txt create mode 100644 tests/snippets/julia/test_strings.txt create mode 100644 tests/snippets/julia/test_symbols.txt create mode 100644 tests/snippets/julia/test_types.txt create mode 100644 tests/snippets/octave/test_multilinecomment.txt create mode 100644 tests/snippets/omg-idl/annotation_named_params.txt create mode 100644 tests/snippets/omg-idl/enumerators.txt create mode 100644 tests/snippets/powershell/test_colon_punctuation.txt create mode 100644 tests/snippets/promql/test_complex_exp_single_quotes.txt create mode 100644 tests/snippets/promql/test_matching_operator_no_regex_match.txt create mode 100644 tests/snippets/python/test_floats.txt create mode 100644 tests/snippets/rust/test_rawstrings.txt create mode 100644 tests/snippets/scala/test_colon_colon_function_name.txt create mode 100644 tests/snippets/scala/test_default_parameter.txt create mode 100644 tests/snippets/scala/test_end_val.txt create mode 100644 tests/snippets/scala/test_end_valx.txt create mode 100644 tests/snippets/scala/test_float_with_exponents.txt create mode 100644 tests/snippets/scala/test_function_operator_name.txt create mode 100644 tests/snippets/scala/test_import_path.txt create mode 100644 tests/snippets/scala/test_invalid_symbol_and_invalid_char.txt create mode 100644 tests/snippets/scala/test_open_soft_keyword.txt create mode 100644 tests/snippets/scala/test_package_name.txt create mode 100644 tests/snippets/scala/test_prepend_operator.txt create mode 100644 tests/snippets/scala/test_qualified_name.txt create mode 100644 tests/snippets/scala/test_qualified_name_class.txt create mode 100644 tests/snippets/scala/test_script_header.txt create mode 100644 tests/snippets/scala/test_symbol_followed_by_op.txt create mode 100644 tests/snippets/scala/test_symbol_name_ending_with_star.txt create mode 100644 tests/snippets/scala/test_underscore_name.txt create mode 100644 tests/snippets/teal/test_comments.txt create mode 100644 tests/snippets/teal/test_literals.txt create mode 100644 tests/snippets/teal/test_strings.txt create mode 100644 tests/snippets/terraform/test_attributes.txt create mode 100644 tests/snippets/terraform/test_backend.txt create mode 100644 tests/snippets/terraform/test_comment.txt create mode 100644 tests/snippets/terraform/test_functions.txt create mode 100644 tests/snippets/terraform/test_module.txt create mode 100644 tests/snippets/terraform/test_resource.txt create mode 100644 tests/snippets/terraform/test_types.txt create mode 100644 tests/snippets/terraform/test_variable_declaration.txt create mode 100644 tests/snippets/terraform/test_variable_read.txt create mode 100644 tests/snippets/wat/test_align_and_offset_accept_hexadecimal_numbers.txt create mode 100644 tests/snippets/wat/test_comment_with_open_paren.txt create mode 100644 tests/snippets/wat/test_comment_with_semicolon.txt create mode 100644 tests/snippets/wat/test_i32_const_is_builtin.txt create mode 100644 tests/snippets/wat/test_multiline_comment.txt create mode 100644 tests/snippets/wat/test_nested_comment.txt create mode 100644 tests/snippets/wat/test_string_byte_escape.txt create mode 100644 tests/snippets/wat/test_string_with_escape.txt create mode 100644 tests/snippets/wat/test_variable_name_pattern.txt create mode 100644 tests/test_devicetree_lexer.py create mode 100644 tests/test_pangomarkup_formatter.py create mode 100644 tests/test_thingsdb.py diff --git a/AUTHORS b/AUTHORS index e86b35b..e8df185 100644 --- a/AUTHORS +++ b/AUTHORS @@ -97,6 +97,7 @@ Other contributors, listed alphabetically, are: * Doug Hogan -- Mscgen lexer * Ben Hollis -- Mason lexer * Max Horn -- GAP lexer +* Fred Hornsey -- OMG IDL Lexer * Alastair Houghton -- Lexer inheritance facility * Tim Howard -- BlitzMax lexer * Dustin Howett -- Logos lexer @@ -208,6 +209,7 @@ Other contributors, listed alphabetically, are: * Tom Stuart -- Treetop lexer * Colin Sullivan -- SuperCollider lexer * Ben Swift -- Extempore lexer +* tatt61880 -- Kuin lexer * Edoardo Tenani -- Arduino lexer * Tiberius Teng -- default style overhaul * Jeremy Thurgood -- Erlang, Squid config lexers @@ -239,5 +241,6 @@ Other contributors, listed alphabetically, are: * 15b3 -- Image Formatter improvements * Fabian Neumann -- CDDL lexer * Thomas Duboucher -- CDDL lexer +* Philipp Imhof -- Pango Markup formatter Many thanks for all contributions! diff --git a/CHANGES b/CHANGES index 47295b4..1304754 100644 --- a/CHANGES +++ b/CHANGES @@ -7,11 +7,69 @@ pull request numbers to the requests at . -Version 2.8.1 +Version 2.9.0 ------------- -(released March 7, 2021) +(released May 3rd, 2021) +- Added lexers: + + * APDL, gcode (#1714) + * Kuin (#1300) + * NestedText (#1578) + * OMG IDL (#1595) + * TEAL (#1671) + * ThingsDB (#1295) + * WebAssembly (#1416, #1564) + +- Updated lexers: + + * AMDGPU (#1717, #1775) + * APL (#1747) + * C/C++: Improve namespace handling (#1722, #1561, #1719, #1746) + * Chapel (#1743) + * Coq (#1721) + * Cython (#853) + * Groovy (#1765) + * JavaScript (#1741) + * Julia (#1715) + * Octave: Allow multiline and block-percent comments (#1726) + * PowerShell: Improve lexing of ``:`` (#1682, #1758) + * PromQL (#1783) + * Python: Improve float parsing (#1768, #1740) + * Rust (#1061) + * Scala: Rewrite to support Scala3 (#1694, #1035, #1121) + * Swift (#1767) + * Terraform: Support 0.14 syntax (#1756) + * Velocity: Detect multi-line patterns (#1776) + +- Add Pango formatter (#1727) +- Autopygmentize uses ``file`` first instead of ``pygments -N`` (#1786) +- Fix links (#1716) - Fix issue with LaTeX formatter and ``minted`` (#1734, #1735, #1736, #1737) +- Improve alias order (#1780) +- Improve line number colors (#1779, #1778) +- Fix CTag related issue (#1724) +- Recognize ``.leex`` as Elixir templates + +- Updated `filename` handling in HTML formatter if `linenos='table'` (#1757) + + * Previously the filename would be emitted within the `` holding the + code, but outside the `
`. This would invariably break the alignment
+    with line numbers.
+  * Now if `filename` is specified, a separate `` is emitted before the
+    table content which contains a single `` with `colspan=2` so it
+    spans both the line number and code columns. The filename is still
+    within `...` so any existing styles
+    should still apply, although the CSS path may need to change.
+  * For an example of the new output format see
+    `table_cls_step_1_start_1_special_0_noanchor_filename.html`
+    in the `tests/html_linenos_expected_output/` directory.
+  * For more details and discussion see the issue
+    https://github.com/pygments/pygments/issues/1757
+
+- Added styles:
+
+  * Gruvbox light+dark (#1763)
 
 Version 2.8.0
 -------------
@@ -27,7 +85,7 @@ Version 2.8.0
 - Updated lexers:
 
   * AutoIt: Support single quoted strings (#1667, #1663)
-  * C/C++ & related: Fix mishandling '*/' (#1695)
+  * C/C++ & related: Fix mishandling ``*/`` (#1695)
   * Cocoa: Add builtin types (#1703)
   * Console (#1672)
   * Eiffel: Fix performance issues (#1658)
@@ -45,12 +103,12 @@ Version 2.8.0
   * Python: Improve handling of raw f-strings (#1681, #1683)
   * Ruby: Better method name handling (#1531)
   * Stata: Updated keywords (#1470)
-  
+
 - Added styles:
 
   * Material (#1662)
   * Zenburn (#1659)
-  
+
 - The `pygmentize` script now uses `argparse`, all options should work
   as before
 
@@ -112,7 +170,7 @@ Version 2.7.4
 
     - Lex trailing whitespace as part of the prompt (#1645)
     - Add missing ``in`` keyword (#1652)
-    
+
   - SQL - Fix keywords (#1668)
   - Typescript: Fix incorrect punctuation handling (#1510, #1511)
 
@@ -122,7 +180,7 @@ Version 2.7.4
 - Limit recursion with nesting Ruby heredocs (#1638)
 - Fix a few inefficient regexes for guessing lexers
 - Fix the raw token lexer handling of Unicode (#1616)
-- Revert a private API change in the HTML formatter (#1655) -- 
+- Revert a private API change in the HTML formatter (#1655) --
   please note that private APIs remain subject to change!
 - Fix several exponential/cubic-complexity regexes found by
   Ben Caller/Doyensec (#1675)
diff --git a/PKG-INFO b/PKG-INFO
index cd6ec3e..325ea69 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: Pygments
-Version: 2.8.1
+Version: 2.9.0
 Summary: Pygments is a syntax highlighting package written in Python.
 Home-page: https://pygments.org/
 Author: Georg Brandl
diff --git a/Pygments.egg-info/PKG-INFO b/Pygments.egg-info/PKG-INFO
index cd6ec3e..325ea69 100644
--- a/Pygments.egg-info/PKG-INFO
+++ b/Pygments.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: Pygments
-Version: 2.8.1
+Version: 2.9.0
 Summary: Pygments is a syntax highlighting package written in Python.
 Home-page: https://pygments.org/
 Author: Georg Brandl
diff --git a/Pygments.egg-info/SOURCES.txt b/Pygments.egg-info/SOURCES.txt
index 0a2beb7..c33fce1 100644
--- a/Pygments.egg-info/SOURCES.txt
+++ b/Pygments.egg-info/SOURCES.txt
@@ -57,6 +57,7 @@ doc/docs/moinmoin.rst
 doc/docs/plugins.rst
 doc/docs/quickstart.rst
 doc/docs/rstdirective.rst
+doc/docs/styledevelopment.rst
 doc/docs/styles.rst
 doc/docs/tokens.rst
 doc/docs/unicode.rst
@@ -91,6 +92,7 @@ pygments/formatters/img.py
 pygments/formatters/irc.py
 pygments/formatters/latex.py
 pygments/formatters/other.py
+pygments/formatters/pangomarkup.py
 pygments/formatters/rtf.py
 pygments/formatters/svg.py
 pygments/formatters/terminal.py
@@ -100,6 +102,7 @@ pygments/lexers/_asy_builtins.py
 pygments/lexers/_cl_builtins.py
 pygments/lexers/_cocoa_builtins.py
 pygments/lexers/_csound_builtins.py
+pygments/lexers/_julia_builtins.py
 pygments/lexers/_lasso_builtins.py
 pygments/lexers/_lua_builtins.py
 pygments/lexers/_mapping.py
@@ -122,6 +125,7 @@ pygments/lexers/algebra.py
 pygments/lexers/ambient.py
 pygments/lexers/amdgpu.py
 pygments/lexers/ampl.py
+pygments/lexers/apdlexer.py
 pygments/lexers/apl.py
 pygments/lexers/archetype.py
 pygments/lexers/arrow.py
@@ -169,6 +173,7 @@ pygments/lexers/foxpro.py
 pygments/lexers/freefem.py
 pygments/lexers/functional.py
 pygments/lexers/futhark.py
+pygments/lexers/gcodelexer.py
 pygments/lexers/gdscript.py
 pygments/lexers/go.py
 pygments/lexers/grammar_notation.py
@@ -190,6 +195,7 @@ pygments/lexers/j.py
 pygments/lexers/javascript.py
 pygments/lexers/julia.py
 pygments/lexers/jvm.py
+pygments/lexers/kuin.py
 pygments/lexers/lisp.py
 pygments/lexers/make.py
 pygments/lexers/markup.py
@@ -248,6 +254,7 @@ pygments/lexers/sql.py
 pygments/lexers/stata.py
 pygments/lexers/supercollider.py
 pygments/lexers/tcl.py
+pygments/lexers/teal.py
 pygments/lexers/templates.py
 pygments/lexers/teraterm.py
 pygments/lexers/testing.py
@@ -255,6 +262,7 @@ pygments/lexers/text.py
 pygments/lexers/textedit.py
 pygments/lexers/textfmts.py
 pygments/lexers/theorem.py
+pygments/lexers/thingsdb.py
 pygments/lexers/tnt.py
 pygments/lexers/trafficscript.py
 pygments/lexers/typoscript.py
@@ -264,6 +272,7 @@ pygments/lexers/usd.py
 pygments/lexers/varnish.py
 pygments/lexers/verification.py
 pygments/lexers/web.py
+pygments/lexers/webassembly.py
 pygments/lexers/webidl.py
 pygments/lexers/webmisc.py
 pygments/lexers/whiley.py
@@ -284,6 +293,7 @@ pygments/styles/default.py
 pygments/styles/emacs.py
 pygments/styles/friendly.py
 pygments/styles/fruity.py
+pygments/styles/gruvbox.py
 pygments/styles/igor.py
 pygments/styles/inkpot.py
 pygments/styles/lovelace.py
@@ -323,6 +333,7 @@ tests/test_cmdline.py
 tests/test_coffeescript.py
 tests/test_crystal.py
 tests/test_data.py
+tests/test_devicetree_lexer.py
 tests/test_guess.py
 tests/test_html_formatter.py
 tests/test_html_formatter_linenos_elements.py
@@ -335,6 +346,7 @@ tests/test_latex_formatter.py
 tests/test_markdown_lexer.py
 tests/test_modeline.py
 tests/test_mysql.py
+tests/test_pangomarkup_formatter.py
 tests/test_perllexer.py
 tests/test_raw_token.py
 tests/test_regexlexer.py
@@ -344,6 +356,7 @@ tests/test_ruby.py
 tests/test_sql.py
 tests/test_templates.py
 tests/test_terminal_formatter.py
+tests/test_thingsdb.py
 tests/test_tnt.py
 tests/test_token.py
 tests/test_unistring.py
@@ -389,6 +402,10 @@ tests/examplefiles/antlr/antlr_throws
 tests/examplefiles/antlr/antlr_throws.output
 tests/examplefiles/apacheconf/apache2.conf
 tests/examplefiles/apacheconf/apache2.conf.output
+tests/examplefiles/apdl/example1apdl.ans
+tests/examplefiles/apdl/example1apdl.ans.output
+tests/examplefiles/apdl/example2apdl.ans
+tests/examplefiles/apdl/example2apdl.ans.output
 tests/examplefiles/apl/test.apl
 tests/examplefiles/apl/test.apl.output
 tests/examplefiles/applescript/pppoe.applescript
@@ -519,6 +536,10 @@ tests/examplefiles/cpp/example.cpp
 tests/examplefiles/cpp/example.cpp.output
 tests/examplefiles/cpp/example2.cpp
 tests/examplefiles/cpp/example2.cpp.output
+tests/examplefiles/cpp/functions.cpp
+tests/examplefiles/cpp/functions.cpp.output
+tests/examplefiles/cpp/namespace.cpp
+tests/examplefiles/cpp/namespace.cpp.output
 tests/examplefiles/cpp/noexcept.cpp
 tests/examplefiles/cpp/noexcept.cpp.output
 tests/examplefiles/cpsa/yahalom.cpsa
@@ -655,6 +676,10 @@ tests/examplefiles/gap/example.gd
 tests/examplefiles/gap/example.gd.output
 tests/examplefiles/gap/example.gi
 tests/examplefiles/gap/example.gi.output
+tests/examplefiles/gcode/SupportLogo.gcode
+tests/examplefiles/gcode/SupportLogo.gcode.output
+tests/examplefiles/gcode/boomerangv4.gcode
+tests/examplefiles/gcode/boomerangv4.gcode.output
 tests/examplefiles/gdscript/gdscript_example.gd
 tests/examplefiles/gdscript/gdscript_example.gd.output
 tests/examplefiles/genshi/genshi_example.xml+genshi
@@ -683,6 +708,8 @@ tests/examplefiles/groff/perlfunc.1
 tests/examplefiles/groff/perlfunc.1.output
 tests/examplefiles/groovy/example.groovy
 tests/examplefiles/groovy/example.groovy.output
+tests/examplefiles/groovy/quoted.groovy
+tests/examplefiles/groovy/quoted.groovy.output
 tests/examplefiles/groovy/test.gradle
 tests/examplefiles/groovy/test.gradle.output
 tests/examplefiles/groovy/test.groovy
@@ -807,6 +834,8 @@ tests/examplefiles/koka/garcia-wachs.kk
 tests/examplefiles/koka/garcia-wachs.kk.output
 tests/examplefiles/kotlin/example.kt
 tests/examplefiles/kotlin/example.kt.output
+tests/examplefiles/kuin/example.kn
+tests/examplefiles/kuin/example.kn.output
 tests/examplefiles/lagda/example.lagda
 tests/examplefiles/lagda/example.lagda.output
 tests/examplefiles/lasso/json.lasso
@@ -935,6 +964,8 @@ tests/examplefiles/notmuch/notmuch_example
 tests/examplefiles/notmuch/notmuch_example.output
 tests/examplefiles/nsis/bigtest.nsi
 tests/examplefiles/nsis/bigtest.nsi.output
+tests/examplefiles/nt/test.nt
+tests/examplefiles/nt/test.nt.output
 tests/examplefiles/nusmv/guidance.smv
 tests/examplefiles/nusmv/guidance.smv.output
 tests/examplefiles/objective-c/objc_example.m
@@ -947,6 +978,8 @@ tests/examplefiles/odin/test.odin
 tests/examplefiles/odin/test.odin.output
 tests/examplefiles/odin/test2.odin
 tests/examplefiles/odin/test2.odin.output
+tests/examplefiles/omg-idl/example.idl
+tests/examplefiles/omg-idl/example.idl.output
 tests/examplefiles/opa/test.opa
 tests/examplefiles/opa/test.opa.output
 tests/examplefiles/openedge/example.cls
@@ -1125,12 +1158,58 @@ tests/examplefiles/rust/eval.rs
 tests/examplefiles/rust/eval.rs.output
 tests/examplefiles/sc/example.scd
 tests/examplefiles/sc/example.scd.output
-tests/examplefiles/scala/Errors.scala
-tests/examplefiles/scala/Errors.scala.output
 tests/examplefiles/scala/char.scala
 tests/examplefiles/scala/char.scala.output
-tests/examplefiles/scala/interp.scala
-tests/examplefiles/scala/interp.scala.output
+tests/examplefiles/scala/comments.scala
+tests/examplefiles/scala/comments.scala.output
+tests/examplefiles/scala/constants.scala
+tests/examplefiles/scala/constants.scala.output
+tests/examplefiles/scala/declarations.scala
+tests/examplefiles/scala/declarations.scala.output
+tests/examplefiles/scala/dependent-types.scala
+tests/examplefiles/scala/dependent-types.scala.output
+tests/examplefiles/scala/end-soft-keyword.scala
+tests/examplefiles/scala/end-soft-keyword.scala.output
+tests/examplefiles/scala/end.scala
+tests/examplefiles/scala/end.scala.output
+tests/examplefiles/scala/exports.scala
+tests/examplefiles/scala/exports.scala.output
+tests/examplefiles/scala/extensions.scala
+tests/examplefiles/scala/extensions.scala.output
+tests/examplefiles/scala/for-comprehension.scala
+tests/examplefiles/scala/for-comprehension.scala.output
+tests/examplefiles/scala/imports.scala
+tests/examplefiles/scala/imports.scala.output
+tests/examplefiles/scala/inheritance.scala
+tests/examplefiles/scala/inheritance.scala.output
+tests/examplefiles/scala/inline.scala
+tests/examplefiles/scala/inline.scala.output
+tests/examplefiles/scala/interpolated-string.scala
+tests/examplefiles/scala/interpolated-string.scala.output
+tests/examplefiles/scala/match-types.scala
+tests/examplefiles/scala/match-types.scala.output
+tests/examplefiles/scala/new.scala
+tests/examplefiles/scala/new.scala.output
+tests/examplefiles/scala/operators.scala
+tests/examplefiles/scala/operators.scala.output
+tests/examplefiles/scala/package.scala
+tests/examplefiles/scala/package.scala.output
+tests/examplefiles/scala/pattern-matching.scala
+tests/examplefiles/scala/pattern-matching.scala.output
+tests/examplefiles/scala/quoted.scala
+tests/examplefiles/scala/quoted.scala.output
+tests/examplefiles/scala/singleton-types.scala
+tests/examplefiles/scala/singleton-types.scala.output
+tests/examplefiles/scala/soft-keywords.scala
+tests/examplefiles/scala/soft-keywords.scala.output
+tests/examplefiles/scala/storage-modifiers.scala
+tests/examplefiles/scala/storage-modifiers.scala.output
+tests/examplefiles/scala/symbols.scala
+tests/examplefiles/scala/symbols.scala.output
+tests/examplefiles/scala/type-operators.scala
+tests/examplefiles/scala/type-operators.scala.output
+tests/examplefiles/scala/using.scala
+tests/examplefiles/scala/using.scala.output
 tests/examplefiles/scaml/test.scaml
 tests/examplefiles/scaml/test.scaml.output
 tests/examplefiles/scdoc/scdoc_manual.scd
@@ -1213,14 +1292,16 @@ tests/examplefiles/tcsh/test.tcsh
 tests/examplefiles/tcsh/test.tcsh.output
 tests/examplefiles/tea/example.tea
 tests/examplefiles/tea/example.tea.output
+tests/examplefiles/teal/example.teal
+tests/examplefiles/teal/example.teal.output
 tests/examplefiles/termcap/termcap
 tests/examplefiles/termcap/termcap.output
 tests/examplefiles/terminfo/terminfo
 tests/examplefiles/terminfo/terminfo.output
-tests/examplefiles/terraform/example.tf
-tests/examplefiles/terraform/example.tf.output
 tests/examplefiles/text/mysql.txt
 tests/examplefiles/text/mysql.txt.output
+tests/examplefiles/thingsdb/test.ti
+tests/examplefiles/thingsdb/test.ti.output
 tests/examplefiles/thrift/demo.thrift
 tests/examplefiles/thrift/demo.thrift.output
 tests/examplefiles/tid/TiddlyWiki5.tid
@@ -1275,6 +1356,8 @@ tests/examplefiles/vim/phpcomplete.vim
 tests/examplefiles/vim/phpcomplete.vim.output
 tests/examplefiles/vim/vimrc
 tests/examplefiles/vim/vimrc.output
+tests/examplefiles/wat/fib.wat
+tests/examplefiles/wat/fib.wat.output
 tests/examplefiles/wdiff/wdiff_example1.wdiff
 tests/examplefiles/wdiff/wdiff_example1.wdiff.output
 tests/examplefiles/wdiff/wdiff_example3.wdiff
@@ -1315,70 +1398,134 @@ tests/examplefiles/zephir/test.zep
 tests/examplefiles/zephir/test.zep.output
 tests/examplefiles/zig/example.zig
 tests/examplefiles/zig/example.zig.output
-tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor.html
-tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor.html
-tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor.html
-tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor.html
-tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor.html
-tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor.html
-tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor.html
-tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor.html
-tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor.html
-tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor.html
-tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor.html
-tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor.html
-tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor.html
-tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor.html
-tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor.html
-tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor.html
-tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor.html
-tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor.html
-tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor.html
-tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor.html
-tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor.html
-tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor.html
-tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor.html
-tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor.html
-tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor.html
-tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor.html
-tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor.html
-tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor.html
-tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor.html
-tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor.html
-tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor.html
-tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor.html
-tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor.html
-tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor.html
-tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor.html
-tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor.html
-tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor.html
-tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor.html
-tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor.html
-tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor.html
-tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor.html
-tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor.html
-tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor.html
-tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor.html
-tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor.html
-tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor.html
-tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor.html
-tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor.html
-tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor.html
-tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor.html
-tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor.html
-tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor.html
-tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor.html
-tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor.html
-tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor.html
-tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor.html
-tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor.html
-tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor.html
-tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor.html
-tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor.html
-tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor.html
-tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor.html
-tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor.html
-tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor_nofilename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor_filename.html
+tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor_nofilename.html
 tests/snippets/conftest.py
 tests/snippets/apacheconf/test_directive_no_args.txt
 tests/snippets/apacheconf/test_fix_lock_absolute_path.txt
@@ -1389,6 +1536,7 @@ tests/snippets/apacheconf/test_multi_include_globs_root.txt
 tests/snippets/apacheconf/test_multiline_argument.txt
 tests/snippets/apacheconf/test_multiline_comment.txt
 tests/snippets/apacheconf/test_normal_scoped_directive.txt
+tests/snippets/apl/test_leading_underscore.txt
 tests/snippets/asm/test_cpuid.txt
 tests/snippets/bibtex/test_basic_bst.txt
 tests/snippets/bibtex/test_comment.txt
@@ -1488,7 +1636,16 @@ tests/snippets/java/test_enhanced_for.txt
 tests/snippets/java/test_numeric_literals.txt
 tests/snippets/json/test_basic.txt
 tests/snippets/json/test_basic_bare.txt
+tests/snippets/julia/test_keywords.txt
+tests/snippets/julia/test_macros.txt
+tests/snippets/julia/test_names.txt
+tests/snippets/julia/test_numbers.txt
+tests/snippets/julia/test_operators.txt
+tests/snippets/julia/test_strings.txt
+tests/snippets/julia/test_symbols.txt
+tests/snippets/julia/test_types.txt
 tests/snippets/julia/test_unicode.txt
+tests/snippets/julia-repl/test_repl.txt
 tests/snippets/kotlin/test_can_cope_generics_in_destructuring.txt
 tests/snippets/kotlin/test_can_cope_with_backtick_names_in_functions.txt
 tests/snippets/kotlin/test_can_cope_with_commas_and_dashes_in_backtick_Names.txt
@@ -1541,10 +1698,14 @@ tests/snippets/objectivec/test_literal_number_expression.txt
 tests/snippets/objectivec/test_literal_number_int.txt
 tests/snippets/objectivec/test_literal_number_nested_expression.txt
 tests/snippets/objectivec/test_module_import.txt
+tests/snippets/octave/test_multilinecomment.txt
+tests/snippets/omg-idl/annotation_named_params.txt
+tests/snippets/omg-idl/enumerators.txt
 tests/snippets/peg/test_basic.txt
 tests/snippets/peg/test_modified_strings.txt
 tests/snippets/peg/test_operators.txt
 tests/snippets/php/test_string_escaping_run.txt
+tests/snippets/powershell/test_colon_punctuation.txt
 tests/snippets/powershell/test_remoting_session.txt
 tests/snippets/powershell/test_session.txt
 tests/snippets/praat/test_broken_unquoted_string.txt
@@ -1561,11 +1722,13 @@ tests/snippets/praat/test_interpolation_boundary.txt
 tests/snippets/praat/test_numeric_assignment.txt
 tests/snippets/praat/test_string_assignment.txt
 tests/snippets/praat/test_string_escaped_quotes.txt
+tests/snippets/promql/test_complex_exp_single_quotes.txt
 tests/snippets/promql/test_expression_and_comment.txt
 tests/snippets/promql/test_function_delta.txt
 tests/snippets/promql/test_function_multi_line.txt
 tests/snippets/promql/test_function_multi_line_with_offset.txt
 tests/snippets/promql/test_function_sum_with_args.txt
+tests/snippets/promql/test_matching_operator_no_regex_match.txt
 tests/snippets/promql/test_metric.txt
 tests/snippets/promql/test_metric_multiple_labels.txt
 tests/snippets/promql/test_metric_multiple_labels_with_spaces.txt
@@ -1577,6 +1740,7 @@ tests/snippets/properties/test_just_key.txt
 tests/snippets/properties/test_just_key_with_space.txt
 tests/snippets/properties/test_leading_whitespace_comments.txt
 tests/snippets/properties/test_space_delimited_kv_pair.txt
+tests/snippets/python/test_floats.txt
 tests/snippets/python/test_fstring_01a.txt
 tests/snippets/python/test_fstring_01b.txt
 tests/snippets/python/test_fstring_02a.txt
@@ -1669,6 +1833,24 @@ tests/snippets/ruby/test_operator_methods.txt
 tests/snippets/ruby/test_range_syntax1.txt
 tests/snippets/ruby/test_range_syntax2.txt
 tests/snippets/ruby/test_range_syntax3.txt
+tests/snippets/rust/test_rawstrings.txt
+tests/snippets/scala/test_colon_colon_function_name.txt
+tests/snippets/scala/test_default_parameter.txt
+tests/snippets/scala/test_end_val.txt
+tests/snippets/scala/test_end_valx.txt
+tests/snippets/scala/test_float_with_exponents.txt
+tests/snippets/scala/test_function_operator_name.txt
+tests/snippets/scala/test_import_path.txt
+tests/snippets/scala/test_invalid_symbol_and_invalid_char.txt
+tests/snippets/scala/test_open_soft_keyword.txt
+tests/snippets/scala/test_package_name.txt
+tests/snippets/scala/test_prepend_operator.txt
+tests/snippets/scala/test_qualified_name.txt
+tests/snippets/scala/test_qualified_name_class.txt
+tests/snippets/scala/test_script_header.txt
+tests/snippets/scala/test_symbol_followed_by_op.txt
+tests/snippets/scala/test_symbol_name_ending_with_star.txt
+tests/snippets/scala/test_underscore_name.txt
 tests/snippets/shell/test_array_nums.txt
 tests/snippets/shell/test_curly_no_escape_and_quotes.txt
 tests/snippets/shell/test_curly_with_escape.txt
@@ -1681,6 +1863,18 @@ tests/snippets/systemverilog/test_basic.txt
 tests/snippets/systemverilog/test_classes.txt
 tests/snippets/systemverilog/test_numbers.txt
 tests/snippets/systemverilog/test_operators.txt
+tests/snippets/teal/test_comments.txt
+tests/snippets/teal/test_literals.txt
+tests/snippets/teal/test_strings.txt
+tests/snippets/terraform/test_attributes.txt
+tests/snippets/terraform/test_backend.txt
+tests/snippets/terraform/test_comment.txt
+tests/snippets/terraform/test_functions.txt
+tests/snippets/terraform/test_module.txt
+tests/snippets/terraform/test_resource.txt
+tests/snippets/terraform/test_types.txt
+tests/snippets/terraform/test_variable_declaration.txt
+tests/snippets/terraform/test_variable_read.txt
 tests/snippets/turtle/test_prefixed_name_starting_with_number.txt
 tests/snippets/typescript/test_function_definition.txt
 tests/snippets/usd/test_attribute.txt
@@ -1700,6 +1894,15 @@ tests/snippets/vbscript/test_invalid_character.txt
 tests/snippets/vbscript/test_names.txt
 tests/snippets/vbscript/test_reject_almost_float.txt
 tests/snippets/vbscript/test_unterminated_string.txt
+tests/snippets/wat/test_align_and_offset_accept_hexadecimal_numbers.txt
+tests/snippets/wat/test_comment_with_open_paren.txt
+tests/snippets/wat/test_comment_with_semicolon.txt
+tests/snippets/wat/test_i32_const_is_builtin.txt
+tests/snippets/wat/test_multiline_comment.txt
+tests/snippets/wat/test_nested_comment.txt
+tests/snippets/wat/test_string_byte_escape.txt
+tests/snippets/wat/test_string_with_escape.txt
+tests/snippets/wat/test_variable_name_pattern.txt
 tests/snippets/whiley/test_whiley_operator.txt
 tests/snippets/yaml/test_yaml.txt
 tests/snippets/yang/test_float_value.txt
diff --git a/doc/docs/cmdline.rst b/doc/docs/cmdline.rst
index e4f94ea..afb0287 100644
--- a/doc/docs/cmdline.rst
+++ b/doc/docs/cmdline.rst
@@ -37,7 +37,7 @@ The above command could therefore also be given as::
 To create a full HTML document, including line numbers and stylesheet (using the
 "emacs" style), highlighting the Python file ``test.py`` to ``test.html``::
 
-    $ pygmentize -O full,style=emacs -o test.html test.py
+    $ pygmentize -O full,style=emacs,linenos=1 -o test.html test.py
 
 
 Options and filters
diff --git a/doc/docs/index.rst b/doc/docs/index.rst
index 1c96e62..c3baa47 100644
--- a/doc/docs/index.rst
+++ b/doc/docs/index.rst
@@ -37,6 +37,7 @@ Pygments documentation
    lexerdevelopment
    formatterdevelopment
    filterdevelopment
+   styledevelopment
    plugins
 
 **Hints and tricks**
diff --git a/doc/docs/lexers.rst b/doc/docs/lexers.rst
index ef40f14..446c5a9 100644
--- a/doc/docs/lexers.rst
+++ b/doc/docs/lexers.rst
@@ -63,7 +63,7 @@ module:
     >>> i.next()
     ('Delphi', ('delphi', 'objectpascal', 'pas', 'pascal'), ('*.pas',), ('text/x-pascal',))
     >>> i.next()
-    ('XML+Ruby', ('xml+erb', 'xml+ruby'), (), ())
+    ('XML+Ruby', ('xml+ruby', 'xml+erb'), (), ())
 
 As you can see, the return value is an iterator which yields tuples
 in the form ``(name, aliases, filetypes, mimetypes)``.
diff --git a/doc/docs/quickstart.rst b/doc/docs/quickstart.rst
index 3a823e7..b2a9c29 100644
--- a/doc/docs/quickstart.rst
+++ b/doc/docs/quickstart.rst
@@ -201,5 +201,5 @@ it can be created with::
 
 where ``default`` is the style name.
 
-More options and tricks and be found in the :doc:`command line reference
+More options and tricks can be found in the :doc:`command line reference
 `.
diff --git a/doc/docs/styledevelopment.rst b/doc/docs/styledevelopment.rst
new file mode 100644
index 0000000..0183869
--- /dev/null
+++ b/doc/docs/styledevelopment.rst
@@ -0,0 +1,83 @@
+.. -*- mode: rst -*-
+
+.. _creating-own-styles:
+
+Creating Own Styles
+===================
+
+So, how to create a style? All you have to do is to subclass `Style` and
+define some styles:
+
+.. sourcecode:: python
+
+    from pygments.style import Style
+    from pygments.token import Keyword, Name, Comment, String, Error, \
+         Number, Operator, Generic
+
+    class YourStyle(Style):
+        default_style = ""
+        styles = {
+            Comment:                'italic #888',
+            Keyword:                'bold #005',
+            Name:                   '#f00',
+            Name.Function:          '#0f0',
+            Name.Class:             'bold #0f0',
+            String:                 'bg:#eee #111'
+        }
+
+That's it. There are just a few rules. When you define a style for `Name`
+the style automatically also affects `Name.Function` and so on. If you
+defined ``'bold'`` and you don't want boldface for a subtoken use ``'nobold'``.
+
+(Philosophy: the styles aren't written in CSS syntax since this way
+they can be used for a variety of formatters.)
+
+`default_style` is the style inherited by all token types.
+
+To make the style usable for Pygments, you must
+
+* either register it as a plugin (see :doc:`the plugin docs `)
+* or drop it into the `styles` subpackage of your Pygments distribution one style
+  class per style, where the file name is the style name and the class name is
+  `StylenameClass`. For example, if your style should be called
+  ``"mondrian"``, name the class `MondrianStyle`, put it into the file
+  ``mondrian.py`` and this file into the ``pygments.styles`` subpackage
+  directory.
+
+
+Style Rules
+===========
+
+Here a small overview of all allowed styles:
+
+``bold``
+    render text as bold
+``nobold``
+    don't render text as bold (to prevent subtokens being highlighted bold)
+``italic``
+    render text italic
+``noitalic``
+    don't render text as italic
+``underline``
+    render text underlined
+``nounderline``
+    don't render text underlined
+``bg:``
+    transparent background
+``bg:#000000``
+    background color (black)
+``border:``
+    no border
+``border:#ffffff``
+    border color (white)
+``#ff0000``
+    text color (red)
+``noinherit``
+    don't inherit styles from supertoken
+
+Note that there may not be a space between ``bg:`` and the color value
+since the style definition string is split at whitespace.
+Also, using named colors is not allowed since the supported color names
+vary for different formatters.
+
+Furthermore, not all lexers might support every style.
diff --git a/doc/docs/styles.rst b/doc/docs/styles.rst
index 570293a..b58d896 100644
--- a/doc/docs/styles.rst
+++ b/doc/docs/styles.rst
@@ -39,82 +39,7 @@ Or you can also import your own style (which must be a subclass of
 Creating Own Styles
 ===================
 
-So, how to create a style? All you have to do is to subclass `Style` and
-define some styles:
-
-.. sourcecode:: python
-
-    from pygments.style import Style
-    from pygments.token import Keyword, Name, Comment, String, Error, \
-         Number, Operator, Generic
-
-    class YourStyle(Style):
-        default_style = ""
-        styles = {
-            Comment:                'italic #888',
-            Keyword:                'bold #005',
-            Name:                   '#f00',
-            Name.Function:          '#0f0',
-            Name.Class:             'bold #0f0',
-            String:                 'bg:#eee #111'
-        }
-
-That's it. There are just a few rules. When you define a style for `Name`
-the style automatically also affects `Name.Function` and so on. If you
-defined ``'bold'`` and you don't want boldface for a subtoken use ``'nobold'``.
-
-(Philosophy: the styles aren't written in CSS syntax since this way
-they can be used for a variety of formatters.)
-
-`default_style` is the style inherited by all token types.
-
-To make the style usable for Pygments, you must
-
-* either register it as a plugin (see :doc:`the plugin docs `)
-* or drop it into the `styles` subpackage of your Pygments distribution one style
-  class per style, where the file name is the style name and the class name is
-  `StylenameClass`. For example, if your style should be called
-  ``"mondrian"``, name the class `MondrianStyle`, put it into the file
-  ``mondrian.py`` and this file into the ``pygments.styles`` subpackage
-  directory.
-
-
-Style Rules
-===========
-
-Here a small overview of all allowed styles:
-
-``bold``
-    render text as bold
-``nobold``
-    don't render text as bold (to prevent subtokens being highlighted bold)
-``italic``
-    render text italic
-``noitalic``
-    don't render text as italic
-``underline``
-    render text underlined
-``nounderline``
-    don't render text underlined
-``bg:``
-    transparent background
-``bg:#000000``
-    background color (black)
-``border:``
-    no border
-``border:#ffffff``
-    border color (white)
-``#ff0000``
-    text color (red)
-``noinherit``
-    don't inherit styles from supertoken
-
-Note that there may not be a space between ``bg:`` and the color value
-since the style definition string is split at whitespace.
-Also, using named colors is not allowed since the supported color names
-vary for different formatters.
-
-Furthermore, not all lexers might support every style.
+See :ref:`creating-own-styles`.
 
 
 Builtin Styles
diff --git a/doc/faq.rst b/doc/faq.rst
index 2e133b0..2f1ebe5 100644
--- a/doc/faq.rst
+++ b/doc/faq.rst
@@ -136,6 +136,7 @@ This is an (incomplete) list of projects and sites known to use the Pygments hig
   Environment, uses pygments for the multi-language syntax highlighting in its
   `editor `_.
 * `snippet.host `_, minimal text and code snippet hosting
+* `sourcehut `_, the hacker's forge
 
 If you have a project or web site using Pygments, `open an issue or PR
 `_ and we'll add a line here.
diff --git a/doc/languages.rst b/doc/languages.rst
index f9adb90..86fde61 100644
--- a/doc/languages.rst
+++ b/doc/languages.rst
@@ -51,7 +51,7 @@ Programming languages
 * `Dart `_
 * DCPU-16
 * `Delphi `_
-* `DOT / Graphviz ` _
+* `DOT / Graphviz `_
 * `Devicetree `_
 * `Dylan `_ (incl. console)
 * `Eiffel `_
@@ -219,7 +219,7 @@ Other markup
 * Apache Pig
 * BBCode
 * CapDL
-* `Cap'n Proto `_
+* `Cap'n Proto `_
 * `CDDL `_
 * CMake
 * `Csound `_ scores
@@ -255,10 +255,12 @@ Other markup
 * MQL
 * MySQL
 * NCAR command language
+* `NestedText `_
 * Nginx config files
 * `Nix language `_
 * NSIS scripts
 * Notmuch
+* `OMG IDL `_
 * `PEG `_
 * POV-Ray scenes
 * `PromQL `_
diff --git a/external/autopygmentize b/external/autopygmentize
index 8a2e7a6..369287d 100755
--- a/external/autopygmentize
+++ b/external/autopygmentize
@@ -1,6 +1,6 @@
 #!/bin/bash
 # Best effort auto-pygmentization with transparent decompression
-# by Reuben Thomas 2008-2019
+# by Reuben Thomas 2008-2021
 # This program is in the public domain.
 
 # Strategy: first see if pygmentize can find a lexer; if not, ask file; if that finds nothing, fail
@@ -13,58 +13,58 @@ options=${@:1:$(($#-1))}  # handle others args as options to pass to pygmentize
 
 file_common_opts="--brief --dereference"
 
-lexer=$(pygmentize -N "$file")
-if [[ "$lexer" == text ]]; then
-    # Try to do better than just "text"
-    case $(file --mime-type --uncompress $file_common_opts "$file") in
-        application/xml|image/svg+xml) lexer=xml;;
-        application/javascript) lexer=javascript;;
-        text/html) lexer=html;;
-        text/troff) lexer=nroff;;
-        text/x-asm) lexer=nasm;;
-        text/x-awk) lexer=awk;;
-        text/x-c) lexer=c;;
-        text/x-c++) lexer=cpp;;
-        text/x-crystal) lexer=crystal;;
-        text/x-diff) lexer=diff;;
-        text/x-fortran) lexer=fortran;;
-        text/x-gawk) lexer=gawk;;
-        text/x-java) lexer=java;;
-        text/x-lisp) lexer=common-lisp;;
-        text/x-lua) lexer=lua;;
-        text/x-makefile) lexer=make;;
-        text/x-msdos-batch) lexer=bat;;
-        text/x-nawk) lexer=nawk;;
-        text/x-pascal) lexer=pascal;;
-        text/x-perl) lexer=perl;;
-        text/x-php) lexer=php;;
-        text/x-po) lexer=po;;
-        text/x-python) lexer=python;;
-        text/x-ruby) lexer=ruby;;
-        text/x-shellscript) lexer=sh;;
-        text/x-tcl) lexer=tcl;;
-        text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer
-        
-        # Types that file outputs which pygmentize didn't support as of file 5.20, pygments 2.0
-        # text/calendar
-        # text/inf
-        # text/PGP
-        # text/rtf
-        # text/texmacs
-        # text/vnd.graphviz
-        # text/x-bcpl
-        # text/x-info
-        # text/x-m4
-        # text/x-vcard
-        # text/x-xmcd
-        
-        text/plain)  # special filenames. TODO: insert more
-            case $(basename "$file") in
-                .zshrc) lexer=sh;;
-            esac
-            ;;
-    esac
-fi
+case $(file --mime-type --uncompress $file_common_opts "$file") in
+    application/xml|image/svg+xml) lexer=xml;;
+    application/javascript) lexer=javascript;;
+    application/json) lexer=json;;
+    text/html) lexer=html;;
+    text/troff) lexer=nroff;;
+    text/x-asm) lexer=nasm;;
+    text/x-awk) lexer=awk;;
+    text/x-c) lexer=c;;
+    text/x-c++) lexer=cpp;;
+    text/x-crystal) lexer=crystal;;
+    text/x-diff) lexer=diff;;
+    text/x-fortran) lexer=fortran;;
+    text/x-gawk) lexer=gawk;;
+    text/x-java) lexer=java;;
+    text/x-lisp) lexer=common-lisp;;
+    text/x-lua) lexer=lua;;
+    text/x-makefile) lexer=make;;
+    text/x-msdos-batch) lexer=bat;;
+    text/x-nawk) lexer=nawk;;
+    text/x-pascal) lexer=pascal;;
+    text/x-perl) lexer=perl;;
+    text/x-php) lexer=php;;
+    text/x-po) lexer=po;;
+    text/x-python) lexer=python;;
+    text/x-ruby) lexer=ruby;;
+    text/x-shellscript) lexer=sh;;
+    text/x-tcl) lexer=tcl;;
+    text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer
+
+    # Types that file outputs which pygmentize didn't support as of file 5.20, pygments 2.0
+    # text/calendar
+    # text/inf
+    # text/PGP
+    # text/rtf
+    # text/texmacs
+    # text/vnd.graphviz
+    # text/x-bcpl
+    # text/x-info
+    # text/x-m4
+    # text/x-vcard
+    # text/x-xmcd
+
+    text/plain)  # special filenames. TODO: insert more
+        case $(basename "$file") in
+            .zshrc) lexer=sh;;
+        esac
+        # pygmentize -N is much cheaper than file, but makes some bad guesses (e.g.
+        # it guesses ".pl" is Prolog, not Perl)
+        lexer=$(pygmentize -N "$file")
+        ;;
+esac
 
 # Find a concatenator for compressed files
 concat=cat
diff --git a/pygments/__init__.py b/pygments/__init__.py
index 97efc00..d7e892c 100644
--- a/pygments/__init__.py
+++ b/pygments/__init__.py
@@ -27,7 +27,7 @@
 import sys
 from io import StringIO, BytesIO
 
-__version__ = '2.8.1'
+__version__ = '2.9.0'
 __docformat__ = 'restructuredtext'
 
 __all__ = ['lex', 'format', 'highlight']
diff --git a/pygments/formatters/_mapping.py b/pygments/formatters/_mapping.py
index 2592ef8..9a8ab84 100755
--- a/pygments/formatters/_mapping.py
+++ b/pygments/formatters/_mapping.py
@@ -22,6 +22,7 @@ FORMATTERS = {
     'JpgImageFormatter': ('pygments.formatters.img', 'img_jpg', ('jpg', 'jpeg'), ('*.jpg',), 'Create a JPEG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'),
     'LatexFormatter': ('pygments.formatters.latex', 'LaTeX', ('latex', 'tex'), ('*.tex',), 'Format tokens as LaTeX code. This needs the `fancyvrb` and `color` standard packages.'),
     'NullFormatter': ('pygments.formatters.other', 'Text only', ('text', 'null'), ('*.txt',), 'Output the text unchanged without any formatting.'),
+    'PangoMarkupFormatter': ('pygments.formatters.pangomarkup', 'Pango Markup', ('pango', 'pangomarkup'), (), 'Format tokens as Pango Markup code. It can then be rendered to an SVG.'),
     'RawTokenFormatter': ('pygments.formatters.other', 'Raw tokens', ('raw', 'tokens'), ('*.raw',), 'Format tokens as a raw representation for storing token streams.'),
     'RtfFormatter': ('pygments.formatters.rtf', 'RTF', ('rtf',), ('*.rtf',), 'Format tokens as RTF markup. This formatter automatically outputs full RTF documents with color information and other useful stuff. Perfect for Copy and Paste into Microsoft(R) Word(R) documents.'),
     'SvgFormatter': ('pygments.formatters.svg', 'SVG', ('svg',), ('*.svg',), 'Format tokens as an SVG graphics file.  This formatter is still experimental. Each line of code is a ```` element with explicit ``x`` and ``y`` coordinates containing ```` elements with the individual token styles.'),
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py
index 3ba104f..3029c1c 100644
--- a/pygments/formatters/html.py
+++ b/pygments/formatters/html.py
@@ -272,7 +272,9 @@ class HtmlFormatter(Formatter):
         125%``).
 
     `hl_lines`
-        Specify a list of lines to be highlighted.
+        Specify a list of lines to be highlighted. The line numbers are always
+        relative to the input (i.e. the first line is line 1) and are
+        independent of `linenostart`.
 
         .. versionadded:: 0.11
 
@@ -303,7 +305,7 @@ class HtmlFormatter(Formatter):
 
     `lineanchors`
         If set to a nonempty string, e.g. ``foo``, the formatter will wrap each
-        output line in an anchor tag with a ``name`` of ``foo-linenumber``.
+        output line in an anchor tag with an ``id`` (and `name`) of ``foo-linenumber``.
         This allows easy linking to certain lines.
 
         .. versionadded:: 0.9
@@ -335,7 +337,9 @@ class HtmlFormatter(Formatter):
 
     `filename`
         A string used to generate a filename when rendering ``
`` blocks,
-        for example if displaying source code.
+        for example if displaying source code. If `linenos` is set to
+        ``'table'`` then the filename will be rendered in an initial row
+        containing a single `` which spans both columns.
 
         .. versionadded:: 2.1
 
@@ -691,11 +695,20 @@ class HtmlFormatter(Formatter):
 
         ls = '\n'.join(lines)
 
+        # If a filename was specified, we can't put it into the code table as it
+        # would misalign the line numbers. Hence we emit a separate row for it.
+        filename_tr = ""
+        if self.filename:
+            filename_tr = (
+                '
' + '' + self.filename + '
' + '') + # in case you wonder about the seemingly redundant
here: since the # content in the other cell also is wrapped in a div, some browsers in # some configurations seem to mess up the formatting... yield 0, ( - '' % self.cssclass + + '
' % self.cssclass + filename_tr + '
' +
             ls + '
' ) @@ -752,7 +765,7 @@ class HtmlFormatter(Formatter): for t, line in inner: if t: i += 1 - yield 1, '' % (s, i) + line + yield 1, '' % (s, i, s, i) + line else: yield 0, line @@ -788,7 +801,7 @@ class HtmlFormatter(Formatter): style.append(self._pre_style) style = '; '.join(style) - if self.filename: + if self.filename and self.linenos != 1: yield 0, ('' + self.filename + '') # the empty span here is to keep leading empty lines from being @@ -877,7 +890,7 @@ class HtmlFormatter(Formatter): def _lookup_ctag(self, token): entry = ctags.TagEntry() - if self._ctags.find(entry, token, 0): + if self._ctags.find(entry, token.encode(), 0): return entry['file'], entry['lineNumber'] else: return None, None diff --git a/pygments/formatters/pangomarkup.py b/pygments/formatters/pangomarkup.py new file mode 100644 index 0000000..9225775 --- /dev/null +++ b/pygments/formatters/pangomarkup.py @@ -0,0 +1,83 @@ +""" + pygments.formatters.pango + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for Pango markup output. + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.formatter import Formatter + + +__all__ = ['PangoMarkupFormatter'] + + +_escape_table = { + ord('&'): '&', + ord('<'): '<', +} + + +def escape_special_chars(text, table=_escape_table): + """Escape & and < for Pango Markup.""" + return text.translate(table) + + +class PangoMarkupFormatter(Formatter): + """ + Format tokens as Pango Markup code. It can then be rendered to an SVG. + + .. versionadded:: 2.9 + """ + + name = 'Pango Markup' + aliases = ['pango', 'pangomarkup'] + filenames = [] + + def __init__(self, **options): + Formatter.__init__(self, **options) + + self.styles = {} + + for token, style in self.style: + start = '' + end = '' + if style['color']: + start += '' % style['color'] + end = '' + end + if style['bold']: + start += '' + end = '' + end + if style['italic']: + start += '' + end = '' + end + if style['underline']: + start += '' + end = '' + end + self.styles[token] = (start, end) + + def format_unencoded(self, tokensource, outfile): + lastval = '' + lasttype = None + + outfile.write('') + + for ttype, value in tokensource: + while ttype not in self.styles: + ttype = ttype.parent + if ttype == lasttype: + lastval += escape_special_chars(value) + else: + if lastval: + stylebegin, styleend = self.styles[lasttype] + outfile.write(stylebegin + lastval + styleend) + lastval = escape_special_chars(value) + lasttype = ttype + + if lastval: + stylebegin, styleend = self.styles[lasttype] + outfile.write(stylebegin + lastval + styleend) + + outfile.write('') diff --git a/pygments/lexers/_julia_builtins.py b/pygments/lexers/_julia_builtins.py new file mode 100644 index 0000000..c1dcca0 --- /dev/null +++ b/pygments/lexers/_julia_builtins.py @@ -0,0 +1,401 @@ +# operators +# see https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm +# Julia v1.6.0-rc1 +OPERATORS_LIST = [ + # other + '->', + # prec-assignment + ':=', '$=', + # prec-conditional, prec-lazy-or, prec-lazy-and + '?', '||', '&&', + # prec-colon + ':', + # prec-plus + '$', + # prec-decl + '::', +] +DOTTED_OPERATORS_LIST = [ + # prec-assignment + r'=', r'+=', r'-=', r'*=', r'/=', r'//=', r'\=', r'^=', r'÷=', r'%=', r'<<=', + r'>>=', r'>>>=', r'|=', r'&=', r'⊻=', r'≔', r'⩴', r"≕'", r'~', + # prec-pair + '=>', + # prec-arrow + r'→', r'↔', r'↚', r'↛', r'↞', r'↠', r'↢', r'↣', r'↦', r'↤', r'↮', r'⇎', r'⇍', r'⇏', + r'⇐', r'⇒', r'⇔', r'⇴', r'⇶', r'⇷', r'⇸', r'⇹', r'⇺', r'⇻', r'⇼', r'⇽', r'⇾', r'⇿', + r'⟵', r'⟶', r'⟷', r'⟹', r'⟺', r'⟻', r'⟼', r'⟽', r'⟾', r'⟿', r'⤀', r'⤁', r'⤂', r'⤃', + r'⤄', r'⤅', r'⤆', r'⤇', r'⤌', r'⤍', r'⤎', r'⤏', r'⤐', r'⤑', r'⤔', r'⤕', r'⤖', r'⤗', + r'⤘', r'⤝', r'⤞', r'⤟', r'⤠', r'⥄', r'⥅', r'⥆', r'⥇', r'⥈', r'⥊', r'⥋', r'⥎', r'⥐', + r'⥒', r'⥓', r'⥖', r'⥗', r'⥚', r'⥛', r'⥞', r'⥟', r'⥢', r'⥤', r'⥦', r'⥧', r'⥨', r'⥩', + r'⥪', r'⥫', r'⥬', r'⥭', r'⥰', r'⧴', r'⬱', r'⬰', r'⬲', r'⬳', r'⬴', r'⬵', r'⬶', r'⬷', + r'⬸', r'⬹', r'⬺', r'⬻', r'⬼', r'⬽', r'⬾', r'⬿', r'⭀', r'⭁', r'⭂', r'⭃', r'⭄', r'⭇', + r'⭈', r'⭉', r'⭊', r'⭋', r'⭌', r'←', r'→', r'⇜', r'⇝', r'↜', r'↝', r'↩', r'↪', r'↫', + r'↬', r'↼', r'↽', r'⇀', r'⇁', r'⇄', r'⇆', r'⇇', r'⇉', r'⇋', r'⇌', r'⇚', r'⇛', r'⇠', + r'⇢', r'↷', r'↶', r'↺', r'↻', r'-->', r'<--', r'<-->', + # prec-comparison + r'>', r'<', r'>=', r'≥', r'<=', r'≤', r'==', r'===', r'≡', r'!=', r'≠', r'!==', + r'≢', r'∈', r'∉', r'∋', r'∌', r'⊆', r'⊈', r'⊂', r'⊄', r'⊊', r'∝', r'∊', r'∍', r'∥', + r'∦', r'∷', r'∺', r'∻', r'∽', r'∾', r'≁', r'≃', r'≂', r'≄', r'≅', r'≆', r'≇', r'≈', + r'≉', r'≊', r'≋', r'≌', r'≍', r'≎', r'≐', r'≑', r'≒', r'≓', r'≖', r'≗', r'≘', r'≙', + r'≚', r'≛', r'≜', r'≝', r'≞', r'≟', r'≣', r'≦', r'≧', r'≨', r'≩', r'≪', r'≫', r'≬', + r'≭', r'≮', r'≯', r'≰', r'≱', r'≲', r'≳', r'≴', r'≵', r'≶', r'≷', r'≸', r'≹', r'≺', + r'≻', r'≼', r'≽', r'≾', r'≿', r'⊀', r'⊁', r'⊃', r'⊅', r'⊇', r'⊉', r'⊋', r'⊏', r'⊐', + r'⊑', r'⊒', r'⊜', r'⊩', r'⊬', r'⊮', r'⊰', r'⊱', r'⊲', r'⊳', r'⊴', r'⊵', r'⊶', r'⊷', + r'⋍', r'⋐', r'⋑', r'⋕', r'⋖', r'⋗', r'⋘', r'⋙', r'⋚', r'⋛', r'⋜', r'⋝', r'⋞', r'⋟', + r'⋠', r'⋡', r'⋢', r'⋣', r'⋤', r'⋥', r'⋦', r'⋧', r'⋨', r'⋩', r'⋪', r'⋫', r'⋬', r'⋭', + r'⋲', r'⋳', r'⋴', r'⋵', r'⋶', r'⋷', r'⋸', r'⋹', r'⋺', r'⋻', r'⋼', r'⋽', r'⋾', r'⋿', + r'⟈', r'⟉', r'⟒', r'⦷', r'⧀', r'⧁', r'⧡', r'⧣', r'⧤', r'⧥', r'⩦', r'⩧', r'⩪', r'⩫', + r'⩬', r'⩭', r'⩮', r'⩯', r'⩰', r'⩱', r'⩲', r'⩳', r'⩵', r'⩶', r'⩷', r'⩸', r'⩹', r'⩺', + r'⩻', r'⩼', r'⩽', r'⩾', r'⩿', r'⪀', r'⪁', r'⪂', r'⪃', r'⪄', r'⪅', r'⪆', r'⪇', r'⪈', + r'⪉', r'⪊', r'⪋', r'⪌', r'⪍', r'⪎', r'⪏', r'⪐', r'⪑', r'⪒', r'⪓', r'⪔', r'⪕', r'⪖', + r'⪗', r'⪘', r'⪙', r'⪚', r'⪛', r'⪜', r'⪝', r'⪞', r'⪟', r'⪠', r'⪡', r'⪢', r'⪣', r'⪤', + r'⪥', r'⪦', r'⪧', r'⪨', r'⪩', r'⪪', r'⪫', r'⪬', r'⪭', r'⪮', r'⪯', r'⪰', r'⪱', r'⪲', + r'⪳', r'⪴', r'⪵', r'⪶', r'⪷', r'⪸', r'⪹', r'⪺', r'⪻', r'⪼', r'⪽', r'⪾', r'⪿', r'⫀', + r'⫁', r'⫂', r'⫃', r'⫄', r'⫅', r'⫆', r'⫇', r'⫈', r'⫉', r'⫊', r'⫋', r'⫌', r'⫍', r'⫎', + r'⫏', r'⫐', r'⫑', r'⫒', r'⫓', r'⫔', r'⫕', r'⫖', r'⫗', r'⫘', r'⫙', r'⫷', r'⫸', r'⫹', + r'⫺', r'⊢', r'⊣', r'⟂', r'<:', r'>:', + # prec-pipe + '<|', '|>', + # prec-colon + r'…', r'⁝', r'⋮', r'⋱', r'⋰', r'⋯', + # prec-plus + r'+', r'-', r'¦', r'|', r'⊕', r'⊖', r'⊞', r'⊟', r'++', r'∪', r'∨', r'⊔', r'±', r'∓', + r'∔', r'∸', r'≏', r'⊎', r'⊻', r'⊽', r'⋎', r'⋓', r'⧺', r'⧻', r'⨈', r'⨢', r'⨣', r'⨤', + r'⨥', r'⨦', r'⨧', r'⨨', r'⨩', r'⨪', r'⨫', r'⨬', r'⨭', r'⨮', r'⨹', r'⨺', r'⩁', r'⩂', + r'⩅', r'⩊', r'⩌', r'⩏', r'⩐', r'⩒', r'⩔', r'⩖', r'⩗', r'⩛', r'⩝', r'⩡', r'⩢', r'⩣', + # prec-times + r'*', r'/', r'⌿', r'÷', r'%', r'&', r'⋅', r'∘', r'×', '\\', r'∩', r'∧', r'⊗', r'⊘', + r'⊙', r'⊚', r'⊛', r'⊠', r'⊡', r'⊓', r'∗', r'∙', r'∤', r'⅋', r'≀', r'⊼', r'⋄', r'⋆', + r'⋇', r'⋉', r'⋊', r'⋋', r'⋌', r'⋏', r'⋒', r'⟑', r'⦸', r'⦼', r'⦾', r'⦿', r'⧶', r'⧷', + r'⨇', r'⨰', r'⨱', r'⨲', r'⨳', r'⨴', r'⨵', r'⨶', r'⨷', r'⨸', r'⨻', r'⨼', r'⨽', r'⩀', + r'⩃', r'⩄', r'⩋', r'⩍', r'⩎', r'⩑', r'⩓', r'⩕', r'⩘', r'⩚', r'⩜', r'⩞', r'⩟', r'⩠', + r'⫛', r'⊍', r'▷', r'⨝', r'⟕', r'⟖', r'⟗', r'⨟', + # prec-rational, prec-bitshift + '//', '>>', '<<', '>>>', + # prec-power + r'^', r'↑', r'↓', r'⇵', r'⟰', r'⟱', r'⤈', r'⤉', r'⤊', r'⤋', r'⤒', r'⤓', r'⥉', r'⥌', + r'⥍', r'⥏', r'⥑', r'⥔', r'⥕', r'⥘', r'⥙', r'⥜', r'⥝', r'⥠', r'⥡', r'⥣', r'⥥', r'⥮', + r'⥯', r'↑', r'↓', + # unary-ops, excluding unary-and-binary-ops + '!', r'¬', r'√', r'∛', r'∜' +] + +# Generated with the following in Julia v1.6.0-rc1 +''' +#!/usr/bin/env julia + +import REPL.REPLCompletions +res = String["in", "isa", "where"] +for kw in collect(x.keyword for x in REPLCompletions.complete_keyword("")) + if !(contains(kw, " ") || kw == "struct") + push!(res, kw) + end +end +sort!(unique!(setdiff!(res, ["true", "false"]))) +foreach(x -> println("\'", x, "\',"), res) +''' +KEYWORD_LIST = ( + 'baremodule', + 'begin', + 'break', + 'catch', + 'ccall', + 'const', + 'continue', + 'do', + 'else', + 'elseif', + 'end', + 'export', + 'finally', + 'for', + 'function', + 'global', + 'if', + 'import', + 'in', + 'isa', + 'let', + 'local', + 'macro', + 'module', + 'quote', + 'return', + 'try', + 'using', + 'where', + 'while', +) + +# Generated with the following in Julia v1.6.0-rc1 +''' +#!/usr/bin/env julia + +import REPL.REPLCompletions +res = String[] +for compl in filter!(x -> isa(x, REPLCompletions.ModuleCompletion) && (x.parent === Base || x.parent === Core), + REPLCompletions.completions("", 0)[1]) + try + v = eval(Symbol(compl.mod)) + if (v isa Type || v isa TypeVar) && (compl.mod != "=>") + push!(res, compl.mod) + end + catch e + end +end +sort!(unique!(res)) +foreach(x -> println("\'", x, "\',"), res) +''' +BUILTIN_LIST = ( + 'AbstractArray', + 'AbstractChannel', + 'AbstractChar', + 'AbstractDict', + 'AbstractDisplay', + 'AbstractFloat', + 'AbstractIrrational', + 'AbstractMatch', + 'AbstractMatrix', + 'AbstractPattern', + 'AbstractRange', + 'AbstractSet', + 'AbstractString', + 'AbstractUnitRange', + 'AbstractVecOrMat', + 'AbstractVector', + 'Any', + 'ArgumentError', + 'Array', + 'AssertionError', + 'BigFloat', + 'BigInt', + 'BitArray', + 'BitMatrix', + 'BitSet', + 'BitVector', + 'Bool', + 'BoundsError', + 'CapturedException', + 'CartesianIndex', + 'CartesianIndices', + 'Cchar', + 'Cdouble', + 'Cfloat', + 'Channel', + 'Char', + 'Cint', + 'Cintmax_t', + 'Clong', + 'Clonglong', + 'Cmd', + 'Colon', + 'Complex', + 'ComplexF16', + 'ComplexF32', + 'ComplexF64', + 'ComposedFunction', + 'CompositeException', + 'Condition', + 'Cptrdiff_t', + 'Cshort', + 'Csize_t', + 'Cssize_t', + 'Cstring', + 'Cuchar', + 'Cuint', + 'Cuintmax_t', + 'Culong', + 'Culonglong', + 'Cushort', + 'Cvoid', + 'Cwchar_t', + 'Cwstring', + 'DataType', + 'DenseArray', + 'DenseMatrix', + 'DenseVecOrMat', + 'DenseVector', + 'Dict', + 'DimensionMismatch', + 'Dims', + 'DivideError', + 'DomainError', + 'EOFError', + 'Enum', + 'ErrorException', + 'Exception', + 'ExponentialBackOff', + 'Expr', + 'Float16', + 'Float32', + 'Float64', + 'Function', + 'GlobalRef', + 'HTML', + 'IO', + 'IOBuffer', + 'IOContext', + 'IOStream', + 'IdDict', + 'IndexCartesian', + 'IndexLinear', + 'IndexStyle', + 'InexactError', + 'InitError', + 'Int', + 'Int128', + 'Int16', + 'Int32', + 'Int64', + 'Int8', + 'Integer', + 'InterruptException', + 'InvalidStateException', + 'Irrational', + 'KeyError', + 'LinRange', + 'LineNumberNode', + 'LinearIndices', + 'LoadError', + 'MIME', + 'Matrix', + 'Method', + 'MethodError', + 'Missing', + 'MissingException', + 'Module', + 'NTuple', + 'NamedTuple', + 'Nothing', + 'Number', + 'OrdinalRange', + 'OutOfMemoryError', + 'OverflowError', + 'Pair', + 'PartialQuickSort', + 'PermutedDimsArray', + 'Pipe', + 'ProcessFailedException', + 'Ptr', + 'QuoteNode', + 'Rational', + 'RawFD', + 'ReadOnlyMemoryError', + 'Real', + 'ReentrantLock', + 'Ref', + 'Regex', + 'RegexMatch', + 'RoundingMode', + 'SegmentationFault', + 'Set', + 'Signed', + 'Some', + 'StackOverflowError', + 'StepRange', + 'StepRangeLen', + 'StridedArray', + 'StridedMatrix', + 'StridedVecOrMat', + 'StridedVector', + 'String', + 'StringIndexError', + 'SubArray', + 'SubString', + 'SubstitutionString', + 'Symbol', + 'SystemError', + 'Task', + 'TaskFailedException', + 'Text', + 'TextDisplay', + 'Timer', + 'Tuple', + 'Type', + 'TypeError', + 'TypeVar', + 'UInt', + 'UInt128', + 'UInt16', + 'UInt32', + 'UInt64', + 'UInt8', + 'UndefInitializer', + 'UndefKeywordError', + 'UndefRefError', + 'UndefVarError', + 'Union', + 'UnionAll', + 'UnitRange', + 'Unsigned', + 'Val', + 'Vararg', + 'VecElement', + 'VecOrMat', + 'Vector', + 'VersionNumber', + 'WeakKeyDict', + 'WeakRef', +) + +# Generated with the following in Julia v1.6.0-rc1 +''' +#!/usr/bin/env julia + +import REPL.REPLCompletions +res = String["true", "false"] +for compl in filter!(x -> isa(x, REPLCompletions.ModuleCompletion) && (x.parent === Base || x.parent === Core), + REPLCompletions.completions("", 0)[1]) + try + v = eval(Symbol(compl.mod)) + if !(v isa Function || v isa Type || v isa TypeVar || v isa Module || v isa Colon) + push!(res, compl.mod) + end + catch e + end +end +sort!(unique!(res)) +foreach(x -> println("\'", x, "\',"), res) +''' +LITERAL_LIST = ( + 'ARGS', + 'C_NULL', + 'DEPOT_PATH', + 'ENDIAN_BOM', + 'ENV', + 'Inf', + 'Inf16', + 'Inf32', + 'Inf64', + 'InsertionSort', + 'LOAD_PATH', + 'MergeSort', + 'NaN', + 'NaN16', + 'NaN32', + 'NaN64', + 'PROGRAM_FILE', + 'QuickSort', + 'RoundDown', + 'RoundFromZero', + 'RoundNearest', + 'RoundNearestTiesAway', + 'RoundNearestTiesUp', + 'RoundToZero', + 'RoundUp', + 'VERSION', + 'devnull', + 'false', + 'im', + 'missing', + 'nothing', + 'pi', + 'stderr', + 'stdin', + 'stdout', + 'true', + 'undef', + 'π', + 'ℯ', +) diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index 45bbde2..aab8bde 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -15,20 +15,20 @@ LEXERS = { 'ABAPLexer': ('pygments.lexers.business', 'ABAP', ('abap',), ('*.abap', '*.ABAP'), ('text/x-abap',)), 'AMDGPULexer': ('pygments.lexers.amdgpu', 'AMDGPU', ('amdgpu',), ('*.isa',), ()), - 'APLLexer': ('pygments.lexers.apl', 'APL', ('apl',), ('*.apl',), ()), + 'APLLexer': ('pygments.lexers.apl', 'APL', ('apl',), ('*.apl', '*.aplf', '*.aplo', '*.apln', '*.aplc', '*.apli', '*.dyalog'), ()), 'AbnfLexer': ('pygments.lexers.grammar_notation', 'ABNF', ('abnf',), ('*.abnf',), ('text/x-abnf',)), - 'ActionScript3Lexer': ('pygments.lexers.actionscript', 'ActionScript 3', ('as3', 'actionscript3'), ('*.as',), ('application/x-actionscript3', 'text/x-actionscript3', 'text/actionscript3')), - 'ActionScriptLexer': ('pygments.lexers.actionscript', 'ActionScript', ('as', 'actionscript'), ('*.as',), ('application/x-actionscript', 'text/x-actionscript', 'text/actionscript')), + 'ActionScript3Lexer': ('pygments.lexers.actionscript', 'ActionScript 3', ('actionscript3', 'as3'), ('*.as',), ('application/x-actionscript3', 'text/x-actionscript3', 'text/actionscript3')), + 'ActionScriptLexer': ('pygments.lexers.actionscript', 'ActionScript', ('actionscript', 'as'), ('*.as',), ('application/x-actionscript', 'text/x-actionscript', 'text/actionscript')), 'AdaLexer': ('pygments.lexers.pascal', 'Ada', ('ada', 'ada95', 'ada2005'), ('*.adb', '*.ads', '*.ada'), ('text/x-ada',)), 'AdlLexer': ('pygments.lexers.archetype', 'ADL', ('adl',), ('*.adl', '*.adls', '*.adlf', '*.adlx'), ()), 'AgdaLexer': ('pygments.lexers.haskell', 'Agda', ('agda',), ('*.agda',), ('text/x-agda',)), 'AheuiLexer': ('pygments.lexers.esoteric', 'Aheui', ('aheui',), ('*.aheui',), ()), 'AlloyLexer': ('pygments.lexers.dsls', 'Alloy', ('alloy',), ('*.als',), ('text/x-alloy',)), - 'AmbientTalkLexer': ('pygments.lexers.ambient', 'AmbientTalk', ('at', 'ambienttalk', 'ambienttalk/2'), ('*.at',), ('text/x-ambienttalk',)), + 'AmbientTalkLexer': ('pygments.lexers.ambient', 'AmbientTalk', ('ambienttalk', 'ambienttalk/2', 'at'), ('*.at',), ('text/x-ambienttalk',)), 'AmplLexer': ('pygments.lexers.ampl', 'Ampl', ('ampl',), ('*.run',), ()), 'Angular2HtmlLexer': ('pygments.lexers.templates', 'HTML + Angular2', ('html+ng2',), ('*.ng2',), ()), 'Angular2Lexer': ('pygments.lexers.templates', 'Angular2', ('ng2',), (), ()), - 'AntlrActionScriptLexer': ('pygments.lexers.parsers', 'ANTLR With ActionScript Target', ('antlr-as', 'antlr-actionscript'), ('*.G', '*.g'), ()), + 'AntlrActionScriptLexer': ('pygments.lexers.parsers', 'ANTLR With ActionScript Target', ('antlr-actionscript', 'antlr-as'), ('*.G', '*.g'), ()), 'AntlrCSharpLexer': ('pygments.lexers.parsers', 'ANTLR With C# Target', ('antlr-csharp', 'antlr-c#'), ('*.G', '*.g'), ()), 'AntlrCppLexer': ('pygments.lexers.parsers', 'ANTLR With CPP Target', ('antlr-cpp',), ('*.G', '*.g'), ()), 'AntlrJavaLexer': ('pygments.lexers.parsers', 'ANTLR With Java Target', ('antlr-java',), ('*.G', '*.g'), ()), @@ -42,10 +42,10 @@ LEXERS = { 'ArduinoLexer': ('pygments.lexers.c_like', 'Arduino', ('arduino',), ('*.ino',), ('text/x-arduino',)), 'ArrowLexer': ('pygments.lexers.arrow', 'Arrow', ('arrow',), ('*.arw',), ()), 'AspectJLexer': ('pygments.lexers.jvm', 'AspectJ', ('aspectj',), ('*.aj',), ('text/x-aspectj',)), - 'AsymptoteLexer': ('pygments.lexers.graphics', 'Asymptote', ('asy', 'asymptote'), ('*.asy',), ('text/x-asymptote',)), + 'AsymptoteLexer': ('pygments.lexers.graphics', 'Asymptote', ('asymptote', 'asy'), ('*.asy',), ('text/x-asymptote',)), 'AugeasLexer': ('pygments.lexers.configs', 'Augeas', ('augeas',), ('*.aug',), ()), 'AutoItLexer': ('pygments.lexers.automation', 'AutoIt', ('autoit',), ('*.au3',), ('text/x-autoit',)), - 'AutohotkeyLexer': ('pygments.lexers.automation', 'autohotkey', ('ahk', 'autohotkey'), ('*.ahk', '*.ahkl'), ('text/x-autohotkey',)), + 'AutohotkeyLexer': ('pygments.lexers.automation', 'autohotkey', ('autohotkey', 'ahk'), ('*.ahk', '*.ahkl'), ('text/x-autohotkey',)), 'AwkLexer': ('pygments.lexers.textedit', 'Awk', ('awk', 'gawk', 'mawk', 'nawk'), ('*.awk',), ('application/x-awk',)), 'BBCBasicLexer': ('pygments.lexers.basic', 'BBC Basic', ('bbcbasic',), ('*.bbc',), ()), 'BBCodeLexer': ('pygments.lexers.markup', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)), @@ -55,9 +55,9 @@ LEXERS = { 'BaseMakefileLexer': ('pygments.lexers.make', 'Base Makefile', ('basemake',), (), ()), 'BashLexer': ('pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh', 'zsh', 'shell'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '*.exheres-0', '*.exlib', '*.zsh', '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'zshrc', '.zshrc', 'PKGBUILD'), ('application/x-sh', 'application/x-shellscript', 'text/x-shellscript')), 'BashSessionLexer': ('pygments.lexers.shell', 'Bash Session', ('console', 'shell-session'), ('*.sh-session', '*.shell-session'), ('application/x-shell-session', 'application/x-sh-session')), - 'BatchLexer': ('pygments.lexers.shell', 'Batchfile', ('bat', 'batch', 'dosbatch', 'winbatch'), ('*.bat', '*.cmd'), ('application/x-dos-batch',)), + 'BatchLexer': ('pygments.lexers.shell', 'Batchfile', ('batch', 'bat', 'dosbatch', 'winbatch'), ('*.bat', '*.cmd'), ('application/x-dos-batch',)), 'BefungeLexer': ('pygments.lexers.esoteric', 'Befunge', ('befunge',), ('*.befunge',), ('application/x-befunge',)), - 'BibTeXLexer': ('pygments.lexers.bibtex', 'BibTeX', ('bib', 'bibtex'), ('*.bib',), ('text/x-bibtex',)), + 'BibTeXLexer': ('pygments.lexers.bibtex', 'BibTeX', ('bibtex', 'bib'), ('*.bib',), ('text/x-bibtex',)), 'BlitzBasicLexer': ('pygments.lexers.basic', 'BlitzBasic', ('blitzbasic', 'b3d', 'bplus'), ('*.bb', '*.decls'), ('text/x-bb',)), 'BlitzMaxLexer': ('pygments.lexers.basic', 'BlitzMax', ('blitzmax', 'bmax'), ('*.bmx',), ('text/x-bmx',)), 'BnfLexer': ('pygments.lexers.grammar_notation', 'BNF', ('bnf',), ('*.bnf',), ('text/x-bnf',)), @@ -81,11 +81,11 @@ LEXERS = { 'CddlLexer': ('pygments.lexers.cddl', 'CDDL', ('cddl',), ('*.cddl',), ('text/x-cddl',)), 'CeylonLexer': ('pygments.lexers.jvm', 'Ceylon', ('ceylon',), ('*.ceylon',), ('text/x-ceylon',)), 'Cfengine3Lexer': ('pygments.lexers.configs', 'CFEngine3', ('cfengine3', 'cf3'), ('*.cf',), ()), - 'ChaiscriptLexer': ('pygments.lexers.scripting', 'ChaiScript', ('chai', 'chaiscript'), ('*.chai',), ('text/x-chaiscript', 'application/x-chaiscript')), + 'ChaiscriptLexer': ('pygments.lexers.scripting', 'ChaiScript', ('chaiscript', 'chai'), ('*.chai',), ('text/x-chaiscript', 'application/x-chaiscript')), 'ChapelLexer': ('pygments.lexers.chapel', 'Chapel', ('chapel', 'chpl'), ('*.chpl',), ()), 'CharmciLexer': ('pygments.lexers.c_like', 'Charmci', ('charmci',), ('*.ci',), ()), 'CheetahHtmlLexer': ('pygments.lexers.templates', 'HTML+Cheetah', ('html+cheetah', 'html+spitfire', 'htmlcheetah'), (), ('text/html+cheetah', 'text/html+spitfire')), - 'CheetahJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Cheetah', ('js+cheetah', 'javascript+cheetah', 'js+spitfire', 'javascript+spitfire'), (), ('application/x-javascript+cheetah', 'text/x-javascript+cheetah', 'text/javascript+cheetah', 'application/x-javascript+spitfire', 'text/x-javascript+spitfire', 'text/javascript+spitfire')), + 'CheetahJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Cheetah', ('javascript+cheetah', 'js+cheetah', 'javascript+spitfire', 'js+spitfire'), (), ('application/x-javascript+cheetah', 'text/x-javascript+cheetah', 'text/javascript+cheetah', 'application/x-javascript+spitfire', 'text/x-javascript+spitfire', 'text/javascript+spitfire')), 'CheetahLexer': ('pygments.lexers.templates', 'Cheetah', ('cheetah', 'spitfire'), ('*.tmpl', '*.spt'), ('application/x-cheetah', 'application/x-spitfire')), 'CheetahXmlLexer': ('pygments.lexers.templates', 'XML+Cheetah', ('xml+cheetah', 'xml+spitfire'), (), ('application/xml+cheetah', 'application/xml+spitfire')), 'CirruLexer': ('pygments.lexers.webmisc', 'Cirru', ('cirru',), ('*.cirru',), ('text/x-cirru',)), @@ -95,7 +95,7 @@ LEXERS = { 'ClojureScriptLexer': ('pygments.lexers.jvm', 'ClojureScript', ('clojurescript', 'cljs'), ('*.cljs',), ('text/x-clojurescript', 'application/x-clojurescript')), 'CobolFreeformatLexer': ('pygments.lexers.business', 'COBOLFree', ('cobolfree',), ('*.cbl', '*.CBL'), ()), 'CobolLexer': ('pygments.lexers.business', 'COBOL', ('cobol',), ('*.cob', '*.COB', '*.cpy', '*.CPY'), ('text/x-cobol',)), - 'CoffeeScriptLexer': ('pygments.lexers.javascript', 'CoffeeScript', ('coffee-script', 'coffeescript', 'coffee'), ('*.coffee',), ('text/coffeescript',)), + 'CoffeeScriptLexer': ('pygments.lexers.javascript', 'CoffeeScript', ('coffeescript', 'coffee-script', 'coffee'), ('*.coffee',), ('text/coffeescript',)), 'ColdfusionCFCLexer': ('pygments.lexers.templates', 'Coldfusion CFC', ('cfc',), ('*.cfc',), ()), 'ColdfusionHtmlLexer': ('pygments.lexers.templates', 'Coldfusion HTML', ('cfm',), ('*.cfm', '*.cfml'), ('application/x-coldfusion',)), 'ColdfusionLexer': ('pygments.lexers.templates', 'cfstatement', ('cfs',), (), ()), @@ -112,7 +112,7 @@ LEXERS = { 'CsoundOrchestraLexer': ('pygments.lexers.csound', 'Csound Orchestra', ('csound', 'csound-orc'), ('*.orc', '*.udo'), ()), 'CsoundScoreLexer': ('pygments.lexers.csound', 'Csound Score', ('csound-score', 'csound-sco'), ('*.sco',), ()), 'CssDjangoLexer': ('pygments.lexers.templates', 'CSS+Django/Jinja', ('css+django', 'css+jinja'), (), ('text/css+django', 'text/css+jinja')), - 'CssErbLexer': ('pygments.lexers.templates', 'CSS+Ruby', ('css+erb', 'css+ruby'), (), ('text/css+ruby',)), + 'CssErbLexer': ('pygments.lexers.templates', 'CSS+Ruby', ('css+ruby', 'css+erb'), (), ('text/css+ruby',)), 'CssGenshiLexer': ('pygments.lexers.templates', 'CSS+Genshi Text', ('css+genshitext', 'css+genshi'), (), ('text/css+genshi',)), 'CssLexer': ('pygments.lexers.css', 'CSS', ('css',), ('*.css',), ('text/css',)), 'CssPhpLexer': ('pygments.lexers.templates', 'CSS+PHP', ('css+php',), (), ('text/css+php',)), @@ -125,7 +125,7 @@ LEXERS = { 'DarcsPatchLexer': ('pygments.lexers.diff', 'Darcs Patch', ('dpatch',), ('*.dpatch', '*.darcspatch'), ()), 'DartLexer': ('pygments.lexers.javascript', 'Dart', ('dart',), ('*.dart',), ('text/x-dart',)), 'Dasm16Lexer': ('pygments.lexers.asm', 'DASM16', ('dasm16',), ('*.dasm16', '*.dasm'), ('text/x-dasm16',)), - 'DebianControlLexer': ('pygments.lexers.installers', 'Debian Control file', ('control', 'debcontrol'), ('control',), ()), + 'DebianControlLexer': ('pygments.lexers.installers', 'Debian Control file', ('debcontrol', 'control'), ('control',), ()), 'DelphiLexer': ('pygments.lexers.pascal', 'Delphi', ('delphi', 'pas', 'pascal', 'objectpascal'), ('*.pas', '*.dpr'), ('text/x-pascal',)), 'DevicetreeLexer': ('pygments.lexers.devicetree', 'Devicetree', ('devicetree', 'dts'), ('*.dts', '*.dtsi'), ('text/x-c',)), 'DgLexer': ('pygments.lexers.python', 'dg', ('dg',), ('*.dg',), ('text/x-dg',)), @@ -144,9 +144,9 @@ LEXERS = { 'EbnfLexer': ('pygments.lexers.parsers', 'EBNF', ('ebnf',), ('*.ebnf',), ('text/x-ebnf',)), 'EiffelLexer': ('pygments.lexers.eiffel', 'Eiffel', ('eiffel',), ('*.e',), ('text/x-eiffel',)), 'ElixirConsoleLexer': ('pygments.lexers.erlang', 'Elixir iex session', ('iex',), (), ('text/x-elixir-shellsession',)), - 'ElixirLexer': ('pygments.lexers.erlang', 'Elixir', ('elixir', 'ex', 'exs'), ('*.ex', '*.eex', '*.exs'), ('text/x-elixir',)), + 'ElixirLexer': ('pygments.lexers.erlang', 'Elixir', ('elixir', 'ex', 'exs'), ('*.ex', '*.eex', '*.exs', '*.leex'), ('text/x-elixir',)), 'ElmLexer': ('pygments.lexers.elm', 'Elm', ('elm',), ('*.elm',), ('text/x-elm',)), - 'EmacsLispLexer': ('pygments.lexers.lisp', 'EmacsLisp', ('emacs', 'elisp', 'emacs-lisp'), ('*.el',), ('text/x-elisp', 'application/x-elisp')), + 'EmacsLispLexer': ('pygments.lexers.lisp', 'EmacsLisp', ('emacs-lisp', 'elisp', 'emacs'), ('*.el',), ('text/x-elisp', 'application/x-elisp')), 'EmailLexer': ('pygments.lexers.email', 'E-mail', ('email', 'eml'), ('*.eml',), ('message/rfc822',)), 'ErbLexer': ('pygments.lexers.templates', 'ERB', ('erb',), (), ('application/x-ruby-templating',)), 'ErlangLexer': ('pygments.lexers.erlang', 'Erlang', ('erlang',), ('*.erl', '*.hrl', '*.es', '*.escript'), ('text/x-erlang',)), @@ -176,10 +176,11 @@ LEXERS = { 'GDScriptLexer': ('pygments.lexers.gdscript', 'GDScript', ('gdscript', 'gd'), ('*.gd',), ('text/x-gdscript', 'application/x-gdscript')), 'GLShaderLexer': ('pygments.lexers.graphics', 'GLSL', ('glsl',), ('*.vert', '*.frag', '*.geo'), ('text/x-glslsrc',)), 'GasLexer': ('pygments.lexers.asm', 'GAS', ('gas', 'asm'), ('*.s', '*.S'), ('text/x-gas',)), + 'GcodeLexer': ('pygments.lexers.gcodelexer', 'g-code', ('gcode',), ('*.gcode',), ()), 'GenshiLexer': ('pygments.lexers.templates', 'Genshi', ('genshi', 'kid', 'xml+genshi', 'xml+kid'), ('*.kid',), ('application/x-genshi', 'application/x-kid')), 'GenshiTextLexer': ('pygments.lexers.templates', 'Genshi Text', ('genshitext',), (), ('application/x-genshi-text', 'text/x-genshi')), 'GettextLexer': ('pygments.lexers.textfmts', 'Gettext Catalog', ('pot', 'po'), ('*.pot', '*.po'), ('application/x-gettext', 'text/x-gettext', 'text/gettext')), - 'GherkinLexer': ('pygments.lexers.testing', 'Gherkin', ('cucumber', 'gherkin'), ('*.feature',), ('text/x-gherkin',)), + 'GherkinLexer': ('pygments.lexers.testing', 'Gherkin', ('gherkin', 'cucumber'), ('*.feature',), ('text/x-gherkin',)), 'GnuplotLexer': ('pygments.lexers.graphics', 'Gnuplot', ('gnuplot',), ('*.plot', '*.plt'), ('text/x-gnuplot',)), 'GoLexer': ('pygments.lexers.go', 'Go', ('go',), ('*.go',), ('text/x-gosrc',)), 'GoloLexer': ('pygments.lexers.jvm', 'Golo', ('golo',), ('*.golo',), ()), @@ -194,7 +195,7 @@ LEXERS = { 'HandlebarsHtmlLexer': ('pygments.lexers.templates', 'HTML+Handlebars', ('html+handlebars',), ('*.handlebars', '*.hbs'), ('text/html+handlebars', 'text/x-handlebars-template')), 'HandlebarsLexer': ('pygments.lexers.templates', 'Handlebars', ('handlebars',), (), ()), 'HaskellLexer': ('pygments.lexers.haskell', 'Haskell', ('haskell', 'hs'), ('*.hs',), ('text/x-haskell',)), - 'HaxeLexer': ('pygments.lexers.haxe', 'Haxe', ('hx', 'haxe', 'hxsl'), ('*.hx', '*.hxsl'), ('text/haxe', 'text/x-haxe', 'text/x-hx')), + 'HaxeLexer': ('pygments.lexers.haxe', 'Haxe', ('haxe', 'hxsl', 'hx'), ('*.hx', '*.hxsl'), ('text/haxe', 'text/x-haxe', 'text/x-hx')), 'HexdumpLexer': ('pygments.lexers.hexdump', 'Hexdump', ('hexdump',), (), ()), 'HsailLexer': ('pygments.lexers.asm', 'HSAIL', ('hsail', 'hsa'), ('*.hsail',), ('text/x-hsail',)), 'HspecLexer': ('pygments.lexers.haskell', 'Hspec', ('hspec',), (), ()), @@ -223,19 +224,19 @@ LEXERS = { 'JagsLexer': ('pygments.lexers.modeling', 'JAGS', ('jags',), ('*.jag', '*.bug'), ()), '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', ('js+django', 'javascript+django', 'js+jinja', 'javascript+jinja'), (), ('application/x-javascript+django', 'application/x-javascript+jinja', 'text/x-javascript+django', 'text/x-javascript+jinja', 'text/javascript+django', 'text/javascript+jinja')), - 'JavascriptErbLexer': ('pygments.lexers.templates', 'JavaScript+Ruby', ('js+erb', 'javascript+erb', 'js+ruby', 'javascript+ruby'), (), ('application/x-javascript+ruby', 'text/x-javascript+ruby', 'text/javascript+ruby')), + 'JavascriptDjangoLexer': ('pygments.lexers.templates', 'JavaScript+Django/Jinja', ('javascript+django', 'js+django', 'javascript+jinja', 'js+jinja'), (), ('application/x-javascript+django', 'application/x-javascript+jinja', 'text/x-javascript+django', 'text/x-javascript+jinja', 'text/javascript+django', 'text/javascript+jinja')), + 'JavascriptErbLexer': ('pygments.lexers.templates', 'JavaScript+Ruby', ('javascript+ruby', 'js+ruby', 'javascript+erb', 'js+erb'), (), ('application/x-javascript+ruby', 'text/x-javascript+ruby', 'text/javascript+ruby')), 'JavascriptGenshiLexer': ('pygments.lexers.templates', 'JavaScript+Genshi Text', ('js+genshitext', 'js+genshi', 'javascript+genshitext', 'javascript+genshi'), (), ('application/x-javascript+genshi', 'text/x-javascript+genshi', 'text/javascript+genshi')), - 'JavascriptLexer': ('pygments.lexers.javascript', 'JavaScript', ('js', 'javascript'), ('*.js', '*.jsm', '*.mjs'), ('application/javascript', 'application/x-javascript', 'text/x-javascript', 'text/javascript')), - 'JavascriptPhpLexer': ('pygments.lexers.templates', 'JavaScript+PHP', ('js+php', 'javascript+php'), (), ('application/x-javascript+php', 'text/x-javascript+php', 'text/javascript+php')), - 'JavascriptSmartyLexer': ('pygments.lexers.templates', 'JavaScript+Smarty', ('js+smarty', 'javascript+smarty'), (), ('application/x-javascript+smarty', 'text/x-javascript+smarty', 'text/javascript+smarty')), + 'JavascriptLexer': ('pygments.lexers.javascript', 'JavaScript', ('javascript', 'js'), ('*.js', '*.jsm', '*.mjs', '*.cjs'), ('application/javascript', 'application/x-javascript', 'text/x-javascript', 'text/javascript')), + 'JavascriptPhpLexer': ('pygments.lexers.templates', 'JavaScript+PHP', ('javascript+php', 'js+php'), (), ('application/x-javascript+php', 'text/x-javascript+php', 'text/javascript+php')), + 'JavascriptSmartyLexer': ('pygments.lexers.templates', 'JavaScript+Smarty', ('javascript+smarty', 'js+smarty'), (), ('application/x-javascript+smarty', 'text/x-javascript+smarty', 'text/javascript+smarty')), 'JclLexer': ('pygments.lexers.scripting', 'JCL', ('jcl',), ('*.jcl',), ('text/x-jcl',)), 'JsgfLexer': ('pygments.lexers.grammar_notation', 'JSGF', ('jsgf',), ('*.jsgf',), ('application/jsgf', 'application/x-jsgf', 'text/jsgf')), 'JsonBareObjectLexer': ('pygments.lexers.data', 'JSONBareObject', (), (), ()), 'JsonLdLexer': ('pygments.lexers.data', 'JSON-LD', ('jsonld', 'json-ld'), ('*.jsonld',), ('application/ld+json',)), 'JsonLexer': ('pygments.lexers.data', 'JSON', ('json', 'json-object'), ('*.json', 'Pipfile.lock'), ('application/json', 'application/json-object')), 'JspLexer': ('pygments.lexers.templates', 'Java Server Page', ('jsp',), ('*.jsp',), ('application/x-jsp',)), - 'JuliaConsoleLexer': ('pygments.lexers.julia', 'Julia console', ('jlcon',), (), ()), + 'JuliaConsoleLexer': ('pygments.lexers.julia', 'Julia console', ('jlcon', 'julia-repl'), (), ()), 'JuliaLexer': ('pygments.lexers.julia', 'Julia', ('julia', 'jl'), ('*.jl',), ('text/x-julia', 'application/x-julia')), 'JuttleLexer': ('pygments.lexers.javascript', 'Juttle', ('juttle',), ('*.juttle',), ('application/juttle', 'application/x-juttle', 'text/x-juttle', 'text/juttle')), 'KalLexer': ('pygments.lexers.javascript', 'Kal', ('kal',), ('*.kal',), ('text/kal', 'application/kal')), @@ -243,22 +244,23 @@ LEXERS = { 'KernelLogLexer': ('pygments.lexers.textfmts', 'Kernel log', ('kmsg', 'dmesg'), ('*.kmsg', '*.dmesg'), ()), 'KokaLexer': ('pygments.lexers.haskell', 'Koka', ('koka',), ('*.kk', '*.kki'), ('text/x-koka',)), 'KotlinLexer': ('pygments.lexers.jvm', 'Kotlin', ('kotlin',), ('*.kt', '*.kts'), ('text/x-kotlin',)), + 'KuinLexer': ('pygments.lexers.kuin', 'Kuin', ('kuin',), ('*.kn',), ()), 'LSLLexer': ('pygments.lexers.scripting', 'LSL', ('lsl',), ('*.lsl',), ('text/x-lsl',)), 'LassoCssLexer': ('pygments.lexers.templates', 'CSS+Lasso', ('css+lasso',), (), ('text/css+lasso',)), 'LassoHtmlLexer': ('pygments.lexers.templates', 'HTML+Lasso', ('html+lasso',), (), ('text/html+lasso', 'application/x-httpd-lasso', 'application/x-httpd-lasso[89]')), - 'LassoJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Lasso', ('js+lasso', 'javascript+lasso'), (), ('application/x-javascript+lasso', 'text/x-javascript+lasso', 'text/javascript+lasso')), + 'LassoJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Lasso', ('javascript+lasso', 'js+lasso'), (), ('application/x-javascript+lasso', 'text/x-javascript+lasso', 'text/javascript+lasso')), 'LassoLexer': ('pygments.lexers.javascript', 'Lasso', ('lasso', 'lassoscript'), ('*.lasso', '*.lasso[89]'), ('text/x-lasso',)), 'LassoXmlLexer': ('pygments.lexers.templates', 'XML+Lasso', ('xml+lasso',), (), ('application/xml+lasso',)), 'LeanLexer': ('pygments.lexers.theorem', 'Lean', ('lean',), ('*.lean',), ('text/x-lean',)), 'LessCssLexer': ('pygments.lexers.css', 'LessCss', ('less',), ('*.less',), ('text/x-less-css',)), - 'LighttpdConfLexer': ('pygments.lexers.configs', 'Lighttpd configuration file', ('lighty', 'lighttpd'), (), ('text/x-lighttpd-conf',)), + 'LighttpdConfLexer': ('pygments.lexers.configs', 'Lighttpd configuration file', ('lighttpd', 'lighty'), ('lighttpd.conf',), ('text/x-lighttpd-conf',)), 'LimboLexer': ('pygments.lexers.inferno', 'Limbo', ('limbo',), ('*.b',), ('text/limbo',)), 'LiquidLexer': ('pygments.lexers.templates', 'liquid', ('liquid',), ('*.liquid',), ()), - 'LiterateAgdaLexer': ('pygments.lexers.haskell', 'Literate Agda', ('lagda', 'literate-agda'), ('*.lagda',), ('text/x-literate-agda',)), - 'LiterateCryptolLexer': ('pygments.lexers.haskell', 'Literate Cryptol', ('lcry', 'literate-cryptol', 'lcryptol'), ('*.lcry',), ('text/x-literate-cryptol',)), - 'LiterateHaskellLexer': ('pygments.lexers.haskell', 'Literate Haskell', ('lhs', 'literate-haskell', 'lhaskell'), ('*.lhs',), ('text/x-literate-haskell',)), - 'LiterateIdrisLexer': ('pygments.lexers.haskell', 'Literate Idris', ('lidr', 'literate-idris', 'lidris'), ('*.lidr',), ('text/x-literate-idris',)), - 'LiveScriptLexer': ('pygments.lexers.javascript', 'LiveScript', ('live-script', 'livescript'), ('*.ls',), ('text/livescript',)), + 'LiterateAgdaLexer': ('pygments.lexers.haskell', 'Literate Agda', ('literate-agda', 'lagda'), ('*.lagda',), ('text/x-literate-agda',)), + 'LiterateCryptolLexer': ('pygments.lexers.haskell', 'Literate Cryptol', ('literate-cryptol', 'lcryptol', 'lcry'), ('*.lcry',), ('text/x-literate-cryptol',)), + 'LiterateHaskellLexer': ('pygments.lexers.haskell', 'Literate Haskell', ('literate-haskell', 'lhaskell', 'lhs'), ('*.lhs',), ('text/x-literate-haskell',)), + 'LiterateIdrisLexer': ('pygments.lexers.haskell', 'Literate Idris', ('literate-idris', 'lidris', 'lidr'), ('*.lidr',), ('text/x-literate-idris',)), + 'LiveScriptLexer': ('pygments.lexers.javascript', 'LiveScript', ('livescript', 'live-script'), ('*.ls',), ('text/livescript',)), 'LlvmLexer': ('pygments.lexers.asm', 'LLVM', ('llvm',), ('*.ll',), ('text/x-llvm',)), 'LlvmMirBodyLexer': ('pygments.lexers.asm', 'LLVM-MIR Body', ('llvm-mir-body',), (), ()), 'LlvmMirLexer': ('pygments.lexers.asm', 'LLVM-MIR', ('llvm-mir',), ('*.mir',), ()), @@ -271,24 +273,24 @@ LEXERS = { 'MakefileLexer': ('pygments.lexers.make', 'Makefile', ('make', 'makefile', 'mf', 'bsdmake'), ('*.mak', '*.mk', 'Makefile', 'makefile', 'Makefile.*', 'GNUmakefile'), ('text/x-makefile',)), 'MakoCssLexer': ('pygments.lexers.templates', 'CSS+Mako', ('css+mako',), (), ('text/css+mako',)), 'MakoHtmlLexer': ('pygments.lexers.templates', 'HTML+Mako', ('html+mako',), (), ('text/html+mako',)), - 'MakoJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Mako', ('js+mako', 'javascript+mako'), (), ('application/x-javascript+mako', 'text/x-javascript+mako', 'text/javascript+mako')), + 'MakoJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Mako', ('javascript+mako', 'js+mako'), (), ('application/x-javascript+mako', 'text/x-javascript+mako', 'text/javascript+mako')), 'MakoLexer': ('pygments.lexers.templates', 'Mako', ('mako',), ('*.mao',), ('application/x-mako',)), 'MakoXmlLexer': ('pygments.lexers.templates', 'XML+Mako', ('xml+mako',), (), ('application/xml+mako',)), 'MaqlLexer': ('pygments.lexers.business', 'MAQL', ('maql',), ('*.maql',), ('text/x-gooddata-maql', 'application/x-gooddata-maql')), - 'MarkdownLexer': ('pygments.lexers.markup', 'markdown', ('md', 'markdown'), ('*.md', '*.markdown'), ('text/x-markdown',)), + 'MarkdownLexer': ('pygments.lexers.markup', 'Markdown', ('markdown', 'md'), ('*.md', '*.markdown'), ('text/x-markdown',)), 'MaskLexer': ('pygments.lexers.javascript', 'Mask', ('mask',), ('*.mask',), ('text/x-mask',)), 'MasonLexer': ('pygments.lexers.templates', 'Mason', ('mason',), ('*.m', '*.mhtml', '*.mc', '*.mi', 'autohandler', 'dhandler'), ('application/x-mason',)), 'MathematicaLexer': ('pygments.lexers.algebra', 'Mathematica', ('mathematica', 'mma', 'nb'), ('*.nb', '*.cdf', '*.nbp', '*.ma'), ('application/mathematica', 'application/vnd.wolfram.mathematica', 'application/vnd.wolfram.mathematica.package', 'application/vnd.wolfram.cdf')), 'MatlabLexer': ('pygments.lexers.matlab', 'Matlab', ('matlab',), ('*.m',), ('text/matlab',)), 'MatlabSessionLexer': ('pygments.lexers.matlab', 'Matlab session', ('matlabsession',), (), ()), 'MiniDLexer': ('pygments.lexers.d', 'MiniD', ('minid',), (), ('text/x-minidsrc',)), - 'MiniScriptLexer': ('pygments.lexers.scripting', 'MiniScript', ('ms', 'miniscript'), ('*.ms',), ('text/x-minicript', 'application/x-miniscript')), + 'MiniScriptLexer': ('pygments.lexers.scripting', 'MiniScript', ('miniscript', 'ms'), ('*.ms',), ('text/x-minicript', 'application/x-miniscript')), 'ModelicaLexer': ('pygments.lexers.modeling', 'Modelica', ('modelica',), ('*.mo',), ('text/x-modelica',)), 'Modula2Lexer': ('pygments.lexers.modula2', 'Modula-2', ('modula2', 'm2'), ('*.def', '*.mod'), ('text/x-modula2',)), 'MoinWikiLexer': ('pygments.lexers.markup', 'MoinMoin/Trac Wiki markup', ('trac-wiki', 'moin'), (), ('text/x-trac-wiki',)), 'MonkeyLexer': ('pygments.lexers.basic', 'Monkey', ('monkey',), ('*.monkey',), ('text/x-monkey',)), 'MonteLexer': ('pygments.lexers.monte', 'Monte', ('monte',), ('*.mt',), ()), - 'MoonScriptLexer': ('pygments.lexers.scripting', 'MoonScript', ('moon', 'moonscript'), ('*.moon',), ('text/x-moonscript', 'application/x-moonscript')), + 'MoonScriptLexer': ('pygments.lexers.scripting', 'MoonScript', ('moonscript', 'moon'), ('*.moon',), ('text/x-moonscript', 'application/x-moonscript')), 'MoselLexer': ('pygments.lexers.mosel', 'Mosel', ('mosel',), ('*.mos',), ()), 'MozPreprocCssLexer': ('pygments.lexers.markup', 'CSS+mozpreproc', ('css+mozpreproc',), ('*.css.in',), ()), 'MozPreprocHashLexer': ('pygments.lexers.markup', 'mozhashpreproc', ('mozhashpreproc',), (), ()), @@ -302,7 +304,7 @@ LEXERS = { 'MySqlLexer': ('pygments.lexers.sql', 'MySQL', ('mysql',), (), ('text/x-mysql',)), 'MyghtyCssLexer': ('pygments.lexers.templates', 'CSS+Myghty', ('css+myghty',), (), ('text/css+myghty',)), 'MyghtyHtmlLexer': ('pygments.lexers.templates', 'HTML+Myghty', ('html+myghty',), (), ('text/html+myghty',)), - 'MyghtyJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Myghty', ('js+myghty', 'javascript+myghty'), (), ('application/x-javascript+myghty', 'text/x-javascript+myghty', 'text/javascript+mygthy')), + 'MyghtyJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Myghty', ('javascript+myghty', 'js+myghty'), (), ('application/x-javascript+myghty', 'text/x-javascript+myghty', 'text/javascript+mygthy')), 'MyghtyLexer': ('pygments.lexers.templates', 'Myghty', ('myghty',), ('*.myt', 'autodelegate'), ('application/x-myghty',)), 'MyghtyXmlLexer': ('pygments.lexers.templates', 'XML+Myghty', ('xml+myghty',), (), ('application/xml+myghty',)), 'NCLLexer': ('pygments.lexers.ncl', 'NCL', ('ncl',), ('*.ncl',), ('text/ncl',)), @@ -311,10 +313,11 @@ LEXERS = { 'NasmObjdumpLexer': ('pygments.lexers.asm', 'objdump-nasm', ('objdump-nasm',), ('*.objdump-intel',), ('text/x-nasm-objdump',)), 'NemerleLexer': ('pygments.lexers.dotnet', 'Nemerle', ('nemerle',), ('*.n',), ('text/x-nemerle',)), 'NesCLexer': ('pygments.lexers.c_like', 'nesC', ('nesc',), ('*.nc',), ('text/x-nescsrc',)), + 'NestedTextLexer': ('pygments.lexers.configs', 'NestedText', ('nestedtext', 'nt'), ('*.nt',), ()), 'NewLispLexer': ('pygments.lexers.lisp', 'NewLisp', ('newlisp',), ('*.lsp', '*.nl', '*.kif'), ('text/x-newlisp', 'application/x-newlisp')), 'NewspeakLexer': ('pygments.lexers.smalltalk', 'Newspeak', ('newspeak',), ('*.ns2',), ('text/x-newspeak',)), 'NginxConfLexer': ('pygments.lexers.configs', 'Nginx configuration file', ('nginx',), ('nginx.conf',), ('text/x-nginx-conf',)), - 'NimrodLexer': ('pygments.lexers.nimrod', 'Nimrod', ('nim', 'nimrod'), ('*.nim', '*.nimrod'), ('text/x-nim',)), + 'NimrodLexer': ('pygments.lexers.nimrod', 'Nimrod', ('nimrod', 'nim'), ('*.nim', '*.nimrod'), ('text/x-nim',)), 'NitLexer': ('pygments.lexers.nit', 'Nit', ('nit',), ('*.nit',), ()), 'NixLexer': ('pygments.lexers.nix', 'Nix', ('nixos', 'nix'), ('*.nix',), ('text/x-nix',)), 'NotmuchLexer': ('pygments.lexers.textfmts', 'Notmuch', ('notmuch',), (), ()), @@ -327,6 +330,7 @@ LEXERS = { 'OcamlLexer': ('pygments.lexers.ml', 'OCaml', ('ocaml',), ('*.ml', '*.mli', '*.mll', '*.mly'), ('text/x-ocaml',)), 'OctaveLexer': ('pygments.lexers.matlab', 'Octave', ('octave',), ('*.m',), ('text/octave',)), 'OdinLexer': ('pygments.lexers.archetype', 'ODIN', ('odin',), ('*.odin',), ('text/odin',)), + 'OmgIdlLexer': ('pygments.lexers.c_like', 'OMG Interface Definition Language', ('omg-idl',), ('*.idl', '*.pidl'), ()), 'OocLexer': ('pygments.lexers.ooc', 'Ooc', ('ooc',), ('*.ooc',), ('text/x-ooc',)), 'OpaLexer': ('pygments.lexers.ml', 'Opa', ('opa',), ('*.opa',), ('text/x-opa',)), 'OpenEdgeLexer': ('pygments.lexers.business', 'OpenEdge ABL', ('openedge', 'abl', 'progress'), ('*.p', '*.cls'), ('text/x-openedge', 'application/x-openedge')), @@ -368,7 +372,7 @@ LEXERS = { 'QVToLexer': ('pygments.lexers.qvt', 'QVTO', ('qvto', 'qvt'), ('*.qvto',), ()), 'QmlLexer': ('pygments.lexers.webmisc', 'QML', ('qml', 'qbs'), ('*.qml', '*.qbs'), ('application/x-qml', 'application/x-qt.qbs+qml')), 'RConsoleLexer': ('pygments.lexers.r', 'RConsole', ('rconsole', 'rout'), ('*.Rout',), ()), - 'RNCCompactLexer': ('pygments.lexers.rnc', 'Relax-NG Compact', ('rnc', 'rng-compact'), ('*.rnc',), ()), + 'RNCCompactLexer': ('pygments.lexers.rnc', 'Relax-NG Compact', ('rng-compact', 'rnc'), ('*.rnc',), ()), 'RPMSpecLexer': ('pygments.lexers.installers', 'RPMSpec', ('spec',), ('*.spec',), ('text/x-rpm-spec',)), 'RacketLexer': ('pygments.lexers.lisp', 'Racket', ('racket', 'rkt'), ('*.rkt', '*.rktd', '*.rktl'), ('text/x-racket', 'application/x-racket')), 'RagelCLexer': ('pygments.lexers.parsers', 'Ragel in C Host', ('ragel-c',), ('*.rl',), ()), @@ -381,12 +385,12 @@ LEXERS = { 'RagelRubyLexer': ('pygments.lexers.parsers', 'Ragel in Ruby Host', ('ragel-ruby', 'ragel-rb'), ('*.rl',), ()), 'RawTokenLexer': ('pygments.lexers.special', 'Raw token data', (), (), ('application/x-pygments-tokens',)), 'RdLexer': ('pygments.lexers.r', 'Rd', ('rd',), ('*.Rd',), ('text/x-r-doc',)), - 'ReasonLexer': ('pygments.lexers.ml', 'ReasonML', ('reason', 'reasonml'), ('*.re', '*.rei'), ('text/x-reasonml',)), + 'ReasonLexer': ('pygments.lexers.ml', 'ReasonML', ('reasonml', 'reason'), ('*.re', '*.rei'), ('text/x-reasonml',)), 'RebolLexer': ('pygments.lexers.rebol', 'REBOL', ('rebol',), ('*.r', '*.r3', '*.reb'), ('text/x-rebol',)), 'RedLexer': ('pygments.lexers.rebol', 'Red', ('red', 'red/system'), ('*.red', '*.reds'), ('text/x-red', 'text/x-red-system')), 'RedcodeLexer': ('pygments.lexers.esoteric', 'Redcode', ('redcode',), ('*.cw',), ()), 'RegeditLexer': ('pygments.lexers.configs', 'reg', ('registry',), ('*.reg',), ('text/x-windows-registry',)), - 'ResourceLexer': ('pygments.lexers.resource', 'ResourceBundle', ('resource', 'resourcebundle'), (), ()), + 'ResourceLexer': ('pygments.lexers.resource', 'ResourceBundle', ('resourcebundle', 'resource'), (), ()), 'RexxLexer': ('pygments.lexers.scripting', 'Rexx', ('rexx', 'arexx'), ('*.rexx', '*.rex', '*.rx', '*.arexx'), ('text/x-rexx',)), 'RhtmlLexer': ('pygments.lexers.templates', 'RHTML', ('rhtml', 'html+erb', 'html+ruby'), ('*.rhtml',), ('text/html+ruby',)), 'RideLexer': ('pygments.lexers.ride', 'Ride', ('ride',), ('*.ride',), ('text/x-ride',)), @@ -395,10 +399,10 @@ LEXERS = { 'RobotFrameworkLexer': ('pygments.lexers.robotframework', 'RobotFramework', ('robotframework',), ('*.robot',), ('text/x-robotframework',)), 'RqlLexer': ('pygments.lexers.sql', 'RQL', ('rql',), ('*.rql',), ('text/x-rql',)), 'RslLexer': ('pygments.lexers.dsls', 'RSL', ('rsl',), ('*.rsl',), ('text/rsl',)), - 'RstLexer': ('pygments.lexers.markup', 'reStructuredText', ('rst', 'rest', 'restructuredtext'), ('*.rst', '*.rest'), ('text/x-rst', 'text/prs.fallenstein.rst')), - 'RtsLexer': ('pygments.lexers.trafficscript', 'TrafficScript', ('rts', 'trafficscript'), ('*.rts',), ()), + 'RstLexer': ('pygments.lexers.markup', 'reStructuredText', ('restructuredtext', 'rst', 'rest'), ('*.rst', '*.rest'), ('text/x-rst', 'text/prs.fallenstein.rst')), + 'RtsLexer': ('pygments.lexers.trafficscript', 'TrafficScript', ('trafficscript', 'rts'), ('*.rts',), ()), 'RubyConsoleLexer': ('pygments.lexers.ruby', 'Ruby irb session', ('rbcon', 'irb'), (), ('text/x-ruby-shellsession',)), - 'RubyLexer': ('pygments.lexers.ruby', 'Ruby', ('rb', 'ruby', 'duby'), ('*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx', '*.duby', 'Gemfile'), ('text/x-ruby', 'application/x-ruby')), + 'RubyLexer': ('pygments.lexers.ruby', 'Ruby', ('ruby', 'rb', 'duby'), ('*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx', '*.duby', 'Gemfile'), ('text/x-ruby', 'application/x-ruby')), 'RustLexer': ('pygments.lexers.rust', 'Rust', ('rust', 'rs'), ('*.rs', '*.rs.in'), ('text/rust', 'text/x-rust')), 'SASLexer': ('pygments.lexers.sas', 'SAS', ('sas',), ('*.SAS', '*.sas'), ('text/x-sas', 'text/sas', 'application/x-sas')), 'SLexer': ('pygments.lexers.r', 'S', ('splus', 's', 'r'), ('*.S', '*.R', '.Rhistory', '.Rprofile', '.Renviron'), ('text/S-plus', 'text/S', 'text/x-r-source', 'text/x-r', 'text/x-R', 'text/x-r-history', 'text/x-r-profile')), @@ -427,7 +431,7 @@ LEXERS = { 'SnowballLexer': ('pygments.lexers.dsls', 'Snowball', ('snowball',), ('*.sbl',), ()), 'SolidityLexer': ('pygments.lexers.solidity', 'Solidity', ('solidity',), ('*.sol',), ()), 'SourcePawnLexer': ('pygments.lexers.pawn', 'SourcePawn', ('sp',), ('*.sp',), ('text/x-sourcepawn',)), - 'SourcesListLexer': ('pygments.lexers.installers', 'Debian Sourcelist', ('sourceslist', 'sources.list', 'debsources'), ('sources.list',), ()), + 'SourcesListLexer': ('pygments.lexers.installers', 'Debian Sourcelist', ('debsources', 'sourceslist', 'sources.list'), ('sources.list',), ()), 'SparqlLexer': ('pygments.lexers.rdf', 'SPARQL', ('sparql',), ('*.rq', '*.sparql'), ('application/sparql-query',)), 'SqlLexer': ('pygments.lexers.sql', 'SQL', ('sql',), ('*.sql',), ('text/x-sql',)), 'SqliteConsoleLexer': ('pygments.lexers.sql', 'sqlite3con', ('sqlite3',), ('*.sqlite3-console',), ('text/x-sqlite3-console',)), @@ -435,7 +439,7 @@ LEXERS = { 'SspLexer': ('pygments.lexers.templates', 'Scalate Server Page', ('ssp',), ('*.ssp',), ('application/x-ssp',)), 'StanLexer': ('pygments.lexers.modeling', 'Stan', ('stan',), ('*.stan',), ()), 'StataLexer': ('pygments.lexers.stata', 'Stata', ('stata', 'do'), ('*.do', '*.ado'), ('text/x-stata', 'text/stata', 'application/x-stata')), - 'SuperColliderLexer': ('pygments.lexers.supercollider', 'SuperCollider', ('sc', 'supercollider'), ('*.sc', '*.scd'), ('application/supercollider', 'text/supercollider')), + 'SuperColliderLexer': ('pygments.lexers.supercollider', 'SuperCollider', ('supercollider', 'sc'), ('*.sc', '*.scd'), ('application/supercollider', 'text/supercollider')), 'SwiftLexer': ('pygments.lexers.objective', 'Swift', ('swift',), ('*.swift',), ('text/x-swift',)), 'SwigLexer': ('pygments.lexers.c_like', 'SWIG', ('swig',), ('*.swg', '*.i'), ('text/swig',)), 'SystemVerilogLexer': ('pygments.lexers.hdl', 'systemverilog', ('systemverilog', 'sv'), ('*.sv', '*.svh'), ('text/x-systemverilog',)), @@ -448,12 +452,14 @@ LEXERS = { 'TcshLexer': ('pygments.lexers.shell', 'Tcsh', ('tcsh', 'csh'), ('*.tcsh', '*.csh'), ('application/x-csh',)), 'TcshSessionLexer': ('pygments.lexers.shell', 'Tcsh Session', ('tcshcon',), (), ()), 'TeaTemplateLexer': ('pygments.lexers.templates', 'Tea', ('tea',), ('*.tea',), ('text/x-tea',)), - 'TeraTermLexer': ('pygments.lexers.teraterm', 'Tera Term macro', ('ttl', 'teraterm', 'teratermmacro'), ('*.ttl',), ('text/x-teratermmacro',)), + 'TealLexer': ('pygments.lexers.teal', 'teal', ('teal',), ('*.teal',), ()), + 'TeraTermLexer': ('pygments.lexers.teraterm', 'Tera Term macro', ('teratermmacro', 'teraterm', 'ttl'), ('*.ttl',), ('text/x-teratermmacro',)), 'TermcapLexer': ('pygments.lexers.configs', 'Termcap', ('termcap',), ('termcap', 'termcap.src'), ()), 'TerminfoLexer': ('pygments.lexers.configs', 'Terminfo', ('terminfo',), ('terminfo', 'terminfo.src'), ()), 'TerraformLexer': ('pygments.lexers.configs', 'Terraform', ('terraform', 'tf'), ('*.tf',), ('application/x-tf', 'application/x-terraform')), 'TexLexer': ('pygments.lexers.markup', 'TeX', ('tex', 'latex'), ('*.tex', '*.aux', '*.toc'), ('text/x-tex', 'text/x-latex')), 'TextLexer': ('pygments.lexers.special', 'Text only', ('text',), ('*.txt',), ('text/plain',)), + 'ThingsDBLexer': ('pygments.lexers.thingsdb', 'ThingsDB', ('ti', 'thingsdb'), ('*.ti',), ()), 'ThriftLexer': ('pygments.lexers.dsls', 'Thrift', ('thrift',), ('*.thrift',), ('application/x-thrift',)), 'TiddlyWiki5Lexer': ('pygments.lexers.markup', 'tiddler', ('tid',), ('*.tid',), ('text/vnd.tiddlywiki',)), 'TodotxtLexer': ('pygments.lexers.textfmts', 'Todotxt', ('todotxt',), ('todo.txt', '*.todotxt'), ('text/x-todo',)), @@ -462,7 +468,7 @@ LEXERS = { 'TurtleLexer': ('pygments.lexers.rdf', 'Turtle', ('turtle',), ('*.ttl',), ('text/turtle', 'application/x-turtle')), 'TwigHtmlLexer': ('pygments.lexers.templates', 'HTML+Twig', ('html+twig',), ('*.twig',), ('text/html+twig',)), 'TwigLexer': ('pygments.lexers.templates', 'Twig', ('twig',), (), ('application/x-twig',)), - 'TypeScriptLexer': ('pygments.lexers.javascript', 'TypeScript', ('ts', 'typescript'), ('*.ts', '*.tsx'), ('text/x-typescript',)), + 'TypeScriptLexer': ('pygments.lexers.javascript', 'TypeScript', ('typescript', 'ts'), ('*.ts', '*.tsx'), ('text/x-typescript',)), 'TypoScriptCssDataLexer': ('pygments.lexers.typoscript', 'TypoScriptCssData', ('typoscriptcssdata',), (), ()), 'TypoScriptHtmlDataLexer': ('pygments.lexers.typoscript', 'TypoScriptHtmlData', ('typoscripthtmldata',), (), ()), 'TypoScriptLexer': ('pygments.lexers.typoscript', 'TypoScript', ('typoscript',), ('*.typoscript',), ('text/x-typoscript',)), @@ -485,12 +491,13 @@ LEXERS = { 'VhdlLexer': ('pygments.lexers.hdl', 'vhdl', ('vhdl',), ('*.vhdl', '*.vhd'), ('text/x-vhdl',)), 'VimLexer': ('pygments.lexers.textedit', 'VimL', ('vim',), ('*.vim', '.vimrc', '.exrc', '.gvimrc', '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc'), ('text/x-vim',)), 'WDiffLexer': ('pygments.lexers.diff', 'WDiff', ('wdiff',), ('*.wdiff',), ()), + 'WatLexer': ('pygments.lexers.webassembly', 'WebAssembly', ('wast', 'wat'), ('*.wat', '*.wast'), ()), 'WebIDLLexer': ('pygments.lexers.webidl', 'Web IDL', ('webidl',), ('*.webidl',), ()), 'WhileyLexer': ('pygments.lexers.whiley', 'Whiley', ('whiley',), ('*.whiley',), ('text/x-whiley',)), 'X10Lexer': ('pygments.lexers.x10', 'X10', ('x10', 'xten'), ('*.x10',), ('text/x-x10',)), 'XQueryLexer': ('pygments.lexers.webmisc', 'XQuery', ('xquery', 'xqy', 'xq', 'xql', 'xqm'), ('*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm'), ('text/xquery', 'application/xquery')), 'XmlDjangoLexer': ('pygments.lexers.templates', 'XML+Django/Jinja', ('xml+django', 'xml+jinja'), (), ('application/xml+django', 'application/xml+jinja')), - 'XmlErbLexer': ('pygments.lexers.templates', 'XML+Ruby', ('xml+erb', 'xml+ruby'), (), ('application/xml+ruby',)), + 'XmlErbLexer': ('pygments.lexers.templates', 'XML+Ruby', ('xml+ruby', 'xml+erb'), (), ('application/xml+ruby',)), 'XmlLexer': ('pygments.lexers.html', 'XML', ('xml',), ('*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd', '*.wsdl', '*.wsf'), ('text/xml', 'application/xml', 'image/svg+xml', 'application/rss+xml', 'application/atom+xml')), 'XmlPhpLexer': ('pygments.lexers.templates', 'XML+PHP', ('xml+php',), (), ('application/xml+php',)), 'XmlSmartyLexer': ('pygments.lexers.templates', 'XML+Smarty', ('xml+smarty',), (), ('application/xml+smarty',)), @@ -504,6 +511,7 @@ LEXERS = { 'ZeekLexer': ('pygments.lexers.dsls', 'Zeek', ('zeek', 'bro'), ('*.zeek', '*.bro'), ()), 'ZephirLexer': ('pygments.lexers.php', 'Zephir', ('zephir',), ('*.zep',), ()), 'ZigLexer': ('pygments.lexers.zig', 'Zig', ('zig',), ('*.zig',), ('text/zig',)), + 'apdlexer': ('pygments.lexers.apdlexer', 'ANSYS parametric design language', ('ansys', 'apdl'), ('*.ans',), ()), } if __name__ == '__main__': # pragma: no cover diff --git a/pygments/lexers/actionscript.py b/pygments/lexers/actionscript.py index 3d6df13..f0ab652 100644 --- a/pygments/lexers/actionscript.py +++ b/pygments/lexers/actionscript.py @@ -25,7 +25,7 @@ class ActionScriptLexer(RegexLexer): """ name = 'ActionScript' - aliases = ['as', 'actionscript'] + aliases = ['actionscript', 'as'] filenames = ['*.as'] mimetypes = ['application/x-actionscript', 'text/x-actionscript', 'text/actionscript'] @@ -123,7 +123,7 @@ class ActionScript3Lexer(RegexLexer): """ name = 'ActionScript 3' - aliases = ['as3', 'actionscript3'] + aliases = ['actionscript3', 'as3'] filenames = ['*.as'] mimetypes = ['application/x-actionscript3', 'text/x-actionscript3', 'text/actionscript3'] diff --git a/pygments/lexers/ambient.py b/pygments/lexers/ambient.py index d27d126..f5d8bd2 100644 --- a/pygments/lexers/ambient.py +++ b/pygments/lexers/ambient.py @@ -25,7 +25,7 @@ class AmbientTalkLexer(RegexLexer): """ name = 'AmbientTalk' filenames = ['*.at'] - aliases = ['at', 'ambienttalk', 'ambienttalk/2'] + aliases = ['ambienttalk', 'ambienttalk/2', 'at'] mimetypes = ['text/x-ambienttalk'] flags = re.MULTILINE | re.DOTALL diff --git a/pygments/lexers/amdgpu.py b/pygments/lexers/amdgpu.py index 529a687..756b773 100644 --- a/pygments/lexers/amdgpu.py +++ b/pygments/lexers/amdgpu.py @@ -8,13 +8,14 @@ :license: BSD, see LICENSE for details. """ -from pygments.lexer import RegexLexer +from pygments.lexer import RegexLexer, words from pygments.token import Name, Text, Keyword, Whitespace, Number, Comment import re __all__ = ['AMDGPULexer'] + class AMDGPULexer(RegexLexer): """ For AMD GPU assembly. @@ -24,7 +25,7 @@ class AMDGPULexer(RegexLexer): name = 'AMDGPU' aliases = ['amdgpu'] filenames = ['*.isa'] - + flags = re.IGNORECASE tokens = { @@ -36,7 +37,11 @@ class AMDGPULexer(RegexLexer): (r'([;#]|//).*?\n', Comment.Single), (r'((s_)?(ds|buffer|flat|image)_[a-z0-9_]+)', Keyword.Reserved), (r'(_lo|_hi)', Name.Variable), - (r'(vmcnt|lgkmcnt|expcnt|vmcnt|lit|unorm|glc)', Name.Attribute), + (r'(vmcnt|lgkmcnt|expcnt)', Name.Attribute), + (words(( + 'op', 'vaddr', 'vdata', 'soffset', 'srsrc', 'format', + 'offset', 'offen', 'idxen', 'glc', 'dlc', 'slc', 'tfe', 'lds', + 'lit', 'unorm'), suffix=r'\b'), Name.Attribute), (r'(label_[a-z0-9]+)', Keyword), (r'(_L[0-9]*)', Name.Variable), (r'(s|v)_[a-z0-9_]+', Keyword), @@ -45,4 +50,4 @@ class AMDGPULexer(RegexLexer): (r'[0-9]+\.[^0-9]+', Number.Float), (r'(0[xX][a-z0-9]+)|([0-9]+)', Number.Integer) ] - } \ No newline at end of file + } diff --git a/pygments/lexers/apdlexer.py b/pygments/lexers/apdlexer.py new file mode 100644 index 0000000..f670198 --- /dev/null +++ b/pygments/lexers/apdlexer.py @@ -0,0 +1,448 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.apdlexer + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for ANSYS Parametric Design Language. + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, words +from pygments.token import Comment, Keyword, Name, Text, Number, Operator, \ + String, Generic, Punctuation + +__all__ = ['apdlexer'] + + +class apdlexer(RegexLexer): + """ + For APDL source code. + + .. versionadded:: 2.9 + """ + name = 'ANSYS parametric design language' + aliases = ['ansys', 'apdl'] + filenames = ['*.ans'] + flags = re.IGNORECASE + + # list of elements + elafunb = ("SURF152", "SURF153", "SURF154", "SURF156", "SHELL157", + "SURF159", "LINK160", "BEAM161", "PLANE162", + "SHELL163", "SOLID164", "COMBI165", "MASS166", + "LINK167", "SOLID168", "TARGE169", "TARGE170", + "CONTA171", "CONTA172", "CONTA173", "CONTA174", + "CONTA175", "CONTA176", "CONTA177", "CONTA178", + "PRETS179", "LINK180", "SHELL181", "PLANE182", + "PLANE183", "MPC184", "SOLID185", "SOLID186", + "SOLID187", "BEAM188", "BEAM189", "SOLSH190", + "INTER192", "INTER193", "INTER194", "INTER195", + "MESH200", "FOLLW201", "INTER202", "INTER203", + "INTER204", "INTER205", "SHELL208", "SHELL209", + "CPT212", "CPT213", "COMBI214", "CPT215", "CPT216", + "CPT217", "FLUID220", "FLUID221", "PLANE223", + "SOLID226", "SOLID227", "PLANE230", "SOLID231", + "SOLID232", "PLANE233", "SOLID236", "SOLID237", + "PLANE238", "SOLID239", "SOLID240", "HSFLD241", + "HSFLD242", "SURF251", "SURF252", "REINF263", + "REINF264", "REINF265", "SOLID272", "SOLID273", + "SOLID278", "SOLID279", "SHELL281", "SOLID285", + "PIPE288", "PIPE289", "ELBOW290", "USER300", "BEAM3", + "BEAM4", "BEAM23", "BEAM24", "BEAM44", "BEAM54", + "COMBIN7", "FLUID79", "FLUID80", "FLUID81", "FLUID141", + "FLUID142", "INFIN9", "INFIN47", "PLANE13", "PLANE25", + "PLANE42", "PLANE53", "PLANE67", "PLANE82", "PLANE83", + "PLANE145", "PLANE146", "CONTAC12", "CONTAC52", + "LINK1", "LINK8", "LINK10", "LINK32", "PIPE16", + "PIPE17", "PIPE18", "PIPE20", "PIPE59", "PIPE60", + "SHELL41", "SHELL43", "SHELL57", "SHELL63", "SHELL91", + "SHELL93", "SHELL99", "SHELL150", "SOLID5", "SOLID45", + "SOLID46", "SOLID65", "SOLID69", "SOLID92", "SOLID95", + "SOLID117", "SOLID127", "SOLID128", "SOLID147", + "SOLID148", "SOLID191", "VISCO88", "VISCO89", + "VISCO106", "VISCO107", "VISCO108", "TRANS109") + + elafunc = ("PGRAPH", "/VT", "VTIN", "VTRFIL", "VTTEMP", "PGRSET", + "VTCLR", "VTMETH", "VTRSLT", "VTVMOD", "PGSELE", + "VTDISC", "VTMP", "VTSEC", "PGWRITE", "VTEVAL", "VTOP", + "VTSFE", "POUTRES", "VTFREQ", "VTPOST", "VTSL", + "FLDATA1-40", "HFPCSWP", "MSDATA", "MSVARY", "QFACT", + "FLOCHECK", "HFPOWER", "MSMASS", "PERI", "SPADP", + "FLREAD", "HFPORT", "MSMETH", "PLFSS", "SPARM", + "FLOTRAN", "HFSCAT", "MSMIR", "PLSCH", "SPFSS", + "HFADP", "ICE", "MSNOMF", "PLSYZ", "SPICE", "HFARRAY", + "ICEDELE", "MSPROP", "PLTD", "SPSCAN", "HFDEEM", + "ICELIST", "MSQUAD", "PLTLINE", "SPSWP", "HFEIGOPT", + "ICVFRC", "MSRELAX", "PLVFRC", "HFEREFINE", "LPRT", + "MSSOLU", "/PICE", "HFMODPRT", "MSADV", "MSSPEC", + "PLWAVE", "HFPA", "MSCAP", "MSTERM", "PRSYZ") + + elafund = ("*VOPER", "VOVLAP", "*VPLOT", "VPLOT", "VPTN", "*VPUT", + "VPUT", "*VREAD", "VROTAT", "VSBA", "VSBV", "VSBW", + "/VSCALE", "*VSCFUN", "VSEL", "VSLA", "*VSTAT", "VSUM", + "VSWEEP", "VSYMM", "VTRAN", "VTYPE", "/VUP", "*VWRITE", + "/WAIT", "WAVES", "WERASE", "WFRONT", "/WINDOW", + "WMID", "WMORE", "WPAVE", "WPCSYS", "WPLANE", "WPOFFS", + "WPROTA", "WPSTYL", "WRFULL", "WRITE", "WRITEMAP", + "*WRK", "WSORT", "WSPRINGS", "WSTART", "WTBCREATE", + "XFDATA", "XFENRICH", "XFLIST", "/XFRM", "/XRANGE", + "XVAR", "/YRANGE", "/ZOOM", "/WB", "XMLO", "/XML", + "CNTR", "EBLOCK", "CMBLOCK", "NBLOCK", "/TRACK", + "CWZPLOT", "~EUI", "NELE", "EALL", "NALL", "FLITEM", + "LSLN", "PSOLVE", "ASLN", "/VERIFY", "/SSS", "~CFIN", + "*EVAL", "*MOONEY", "/RUNSTAT", "ALPFILL", + "ARCOLLAPSE", "ARDETACH", "ARFILL", "ARMERGE", + "ARSPLIT", "FIPLOT", "GAPFINISH", "GAPLIST", + "GAPMERGE", "GAPOPT", "GAPPLOT", "LNCOLLAPSE", + "LNDETACH", "LNFILL", "LNMERGE", "LNSPLIT", "PCONV", + "PLCONV", "PEMOPTS", "PEXCLUDE", "PINCLUDE", "PMETH", + "/PMETH", "PMOPTS", "PPLOT", "PPRANGE", "PRCONV", + "PRECISION", "RALL", "RFILSZ", "RITER", "RMEMRY", + "RSPEED", "RSTAT", "RTIMST", "/RUNST", "RWFRNT", + "SARPLOT", "SHSD", "SLPPLOT", "SLSPLOT", "VCVFILL", + "/OPT", "OPEQN", "OPFACT", "OPFRST", "OPGRAD", + "OPKEEP", "OPLOOP", "OPPRNT", "OPRAND", "OPSUBP", + "OPSWEEP", "OPTYPE", "OPUSER", "OPVAR", "OPADD", + "OPCLR", "OPDEL", "OPMAKE", "OPSEL", "OPANL", "OPDATA", + "OPRESU", "OPSAVE", "OPEXE", "OPLFA", "OPLGR", + "OPLIST", "OPLSW", "OPRFA", "OPRGR", "OPRSW", + "PILECALC", "PILEDISPSET", "PILEGEN", "PILELOAD", + "PILEMASS", "PILERUN", "PILESEL", "PILESTIF", + "PLVAROPT", "PRVAROPT", "TOCOMP", "TODEF", "TOFREQ", + "TOTYPE", "TOVAR", "TOEXE", "TOLOOP", "TOGRAPH", + "TOLIST", "TOPLOT", "TOPRINT", "TOSTAT", "TZAMESH", + "TZDELE", "TZEGEN", "XVAROPT", "PGSAVE", "SOLCONTROL", + "TOTAL", "VTGEOM", "VTREAL", "VTSTAT") + + elafune = ("/ANUM", "AOFFST", "AOVLAP", "APLOT", "APPEND", "APTN", + "ARCLEN", "ARCTRM", "AREAS", "AREFINE", "AREMESH", + "AREVERSE", "AROTAT", "ARSCALE", "ARSYM", "ASBA", + "ASBL", "ASBV", "ASBW", "ASCRES", "ASEL", "ASIFILE", + "*ASK", "ASKIN", "ASLL", "ASLV", "ASOL", "/ASSIGN", + "ASUB", "ASUM", "ATAN", "ATRAN", "ATYPE", "/AUTO", + "AUTOTS", "/AUX2", "/AUX3", "/AUX12", "/AUX15", + "AVPRIN", "AVRES", "AWAVE", "/AXLAB", "*AXPY", + "/BATCH", "BCSOPTION", "BETAD", "BF", "BFA", "BFADELE", + "BFALIST", "BFCUM", "BFDELE", "BFE", "BFECUM", + "BFEDELE", "BFELIST", "BFESCAL", "BFINT", "BFK", + "BFKDELE", "BFKLIST", "BFL", "BFLDELE", "BFLIST", + "BFLLIST", "BFSCALE", "BFTRAN", "BFUNIF", "BFV", + "BFVDELE", "BFVLIST", "BIOOPT", "BIOT", "BLC4", "BLC5", + "BLOCK", "BOOL", "BOPTN", "BSAX", "BSMD", "BSM1", + "BSM2", "BSPLIN", "BSS1", "BSS2", "BSTE", "BSTQ", + "BTOL", "BUCOPT", "C", "CALC", "CAMPBELL", "CBDOF", + "CBMD", "CBMX", "CBTE", "CBTMP", "CDOPT", "CDREAD", + "CDWRITE", "CE", "CECHECK", "CECMOD", "CECYC", + "CEDELE", "CEINTF", "CELIST", "CENTER", "CEQN", + "CERIG", "CESGEN", "CFACT", "*CFCLOS", "*CFOPEN", + "*CFWRITE", "/CFORMAT", "CGLOC", "CGOMGA", "CGROW", + "CHECK", "CHKMSH", "CINT", "CIRCLE", "CISOL", + "/CLABEL", "/CLEAR", "CLOCAL", "CLOG", "/CLOG", + "CLRMSHLN", "CM", "CMACEL", "/CMAP", "CMATRIX", + "CMDELE", "CMDOMEGA", "CMEDIT", "CMGRP", "CMLIST", + "CMMOD", "CMOMEGA", "CMPLOT", "CMROTATE", "CMSEL", + "CMSFILE", "CMSOPT", "CMWRITE", "CNCHECK", "CNKMOD", + "CNTR", "CNVTOL", "/COLOR", "/COM", "*COMP", "COMBINE", + "COMPRESS", "CON4", "CONE", "/CONFIG", "CONJUG", + "/CONTOUR", "/COPY", "CORIOLIS", "COUPLE", "COVAL", + "CP", "CPCYC", "CPDELE", "CPINTF", "/CPLANE", "CPLGEN", + "CPLIST", "CPMERGE", "CPNGEN", "CPSGEN", "CQC", + "*CREATE", "CRPLIM", "CS", "CSCIR", "CSDELE", "CSKP", + "CSLIST", "CSWPLA", "CSYS", "/CTYPE", "CURR2D", + "CUTCONTROL", "/CVAL", "CVAR", "/CWD", "CYCCALC", + "/CYCEXPAND", "CYCFILES", "CYCFREQ", "*CYCLE", + "CYCLIC", "CYCOPT", "CYCPHASE", "CYCSPEC", "CYL4", + "CYL5", "CYLIND", "CZDEL", "CZMESH", "D", "DA", + "DADELE", "DALIST", "DAMORPH", "DATA", "DATADEF", + "DCGOMG", "DCUM", "DCVSWP", "DDASPEC", "DDELE", + "DDOPTION", "DEACT", "DEFINE", "*DEL", "DELETE", + "/DELETE", "DELTIM", "DEMORPH", "DERIV", "DESIZE", + "DESOL", "DETAB", "/DEVDISP", "/DEVICE", "/DFLAB", + "DFLX", "DFSWAVE", "DIG", "DIGIT", "*DIM", + "/DIRECTORY", "DISPLAY", "/DIST", "DJ", "DJDELE", + "DJLIST", "DK", "DKDELE", "DKLIST", "DL", "DLDELE", + "DLIST", "DLLIST", "*DMAT", "DMOVE", "DMPEXT", + "DMPOPTION", "DMPRAT", "DMPSTR", "DNSOL", "*DO", "DOF", + "DOFSEL", "DOMEGA", "*DOT", "*DOWHILE", "DSCALE", + "/DSCALE", "DSET", "DSPOPTION", "DSUM", "DSURF", + "DSYM", "DSYS", "DTRAN", "DUMP", "/DV3D", "DVAL", + "DVMORPH", "DYNOPT", "E", "EALIVE", "EDADAPT", "EDALE", + "EDASMP", "EDBOUND", "EDBX", "EDBVIS", "EDCADAPT", + "EDCGEN", "EDCLIST", "EDCMORE", "EDCNSTR", "EDCONTACT", + "EDCPU", "EDCRB", "EDCSC", "EDCTS", "EDCURVE", + "EDDAMP", "EDDBL", "EDDC", "EDDRELAX", "EDDUMP", + "EDELE", "EDENERGY", "EDFPLOT", "EDGCALE", "/EDGE", + "EDHGLS", "EDHIST", "EDHTIME", "EDINT", "EDIPART", + "EDIS", "EDLCS", "EDLOAD", "EDMP", "EDNB", "EDNDTSD", + "EDNROT", "EDOPT", "EDOUT", "EDPART", "EDPC", "EDPL", + "EDPVEL", "EDRC", "EDRD", "EDREAD", "EDRI", "EDRST", + "EDRUN", "EDSHELL", "EDSOLV", "EDSP", "EDSTART", + "EDTERM", "EDTP", "EDVEL", "EDWELD", "EDWRITE", + "EEXTRUDE", "/EFACET", "EGEN", "*EIGEN", "EINFIN", + "EINTF", "EKILL", "ELBOW", "ELEM", "ELIST", "*ELSE", + "*ELSEIF", "EMAGERR", "EMATWRITE", "EMF", "EMFT", + "EMID", "EMIS", "EMODIF", "EMORE", "EMSYM", "EMTGEN", + "EMUNIT", "EN", "*END", "*ENDDO", "*ENDIF", + "ENDRELEASE", "ENERSOL", "ENGEN", "ENORM", "ENSYM", + "EORIENT", "EPLOT", "EQSLV", "ERASE", "/ERASE", + "EREAD", "EREFINE", "EREINF", "ERESX", "ERNORM", + "ERRANG", "ESCHECK", "ESEL", "/ESHAPE", "ESIZE", + "ESLA", "ESLL", "ESLN", "ESLV", "ESOL", "ESORT", + "ESSOLV", "ESTIF", "ESURF", "ESYM", "ESYS", "ET", + "ETABLE", "ETCHG", "ETCONTROL", "ETDELE", "ETLIST", + "ETYPE", "EUSORT", "EWRITE", "*EXIT", "/EXIT", "EXP", + "EXPAND", "/EXPAND", "EXPASS", "*EXPORT", "EXPROFILE", + "EXPSOL", "EXTOPT", "EXTREM", "EXUNIT", "F", "/FACET", + "FATIGUE", "FC", "FCCHECK", "FCDELE", "FCLIST", "FCUM", + "FCTYP", "FDELE", "/FDELE", "FE", "FEBODY", "FECONS", + "FEFOR", "FELIST", "FESURF", "*FFT", "FILE", + "FILEAUX2", "FILEAUX3", "FILEDISP", "FILL", "FILLDATA", + "/FILNAME", "FINISH", "FITEM", "FJ", "FJDELE", + "FJLIST", "FK", "FKDELE", "FKLIST", "FL", "FLIST", + "FLLIST", "FLST", "FLUXV", "FLUREAD", "FMAGBC", + "FMAGSUM", "/FOCUS", "FOR2D", "FORCE", "FORM", + "/FORMAT", "FP", "FPLIST", "*FREE", "FREQ", "FRQSCL", + "FS", "FSCALE", "FSDELE", "FSLIST", "FSNODE", "FSPLOT", + "FSSECT", "FSSPARM", "FSUM", "FTCALC", "FTRAN", + "FTSIZE", "FTWRITE", "FTYPE", "FVMESH", "GAP", "GAPF", + "GAUGE", "GCDEF", "GCGEN", "/GCMD", "/GCOLUMN", + "GENOPT", "GEOM", "GEOMETRY", "*GET", "/GFILE", + "/GFORMAT", "/GLINE", "/GMARKER", "GMATRIX", "GMFACE", + "*GO", "/GO", "/GOLIST", "/GOPR", "GP", "GPDELE", + "GPLIST", "GPLOT", "/GRAPHICS", "/GRESUME", "/GRID", + "/GROPT", "GRP", "/GRTYP", "/GSAVE", "GSBDATA", + "GSGDATA", "GSLIST", "GSSOL", "/GST", "GSUM", "/GTHK", + "/GTYPE", "HARFRQ", "/HBC", "HBMAT", "/HEADER", "HELP", + "HELPDISP", "HEMIOPT", "HFANG", "HFSYM", "HMAGSOLV", + "HPGL", "HPTCREATE", "HPTDELETE", "HRCPLX", "HREXP", + "HROPT", "HROCEAN", "HROUT", "IC", "ICDELE", "ICLIST", + "/ICLWID", "/ICSCALE", "*IF", "IGESIN", "IGESOUT", + "/IMAGE", "IMAGIN", "IMESH", "IMMED", "IMPD", + "INISTATE", "*INIT", "/INPUT", "/INQUIRE", "INRES", + "INRTIA", "INT1", "INTSRF", "IOPTN", "IRLF", "IRLIST", + "*ITENGINE", "JPEG", "JSOL", "K", "KATT", "KBC", + "KBETW", "KCALC", "KCENTER", "KCLEAR", "KDELE", + "KDIST", "KEEP", "KESIZE", "KEYOPT", "KEYPTS", "KEYW", + "KFILL", "KGEN", "KL", "KLIST", "KMESH", "KMODIF", + "KMOVE", "KNODE", "KPLOT", "KPSCALE", "KREFINE", + "KSCALE", "KSCON", "KSEL", "KSLL", "KSLN", "KSUM", + "KSYMM", "KTRAN", "KUSE", "KWPAVE", "KWPLAN", "L", + "L2ANG", "L2TAN", "LANG", "LARC", "/LARC", "LAREA", + "LARGE", "LATT", "LAYER", "LAYERP26", "LAYLIST", + "LAYPLOT", "LCABS", "LCASE", "LCCALC", "LCCAT", + "LCDEF", "LCFACT", "LCFILE", "LCLEAR", "LCOMB", + "LCOPER", "LCSEL", "LCSL", "LCSUM", "LCWRITE", + "LCZERO", "LDELE", "LDIV", "LDRAG", "LDREAD", "LESIZE", + "LEXTND", "LFILLT", "LFSURF", "LGEN", "LGLUE", + "LGWRITE", "/LIGHT", "LINA", "LINE", "/LINE", "LINES", + "LINL", "LINP", "LINV", "LIST", "*LIST", "LLIST", + "LMATRIX", "LMESH", "LNSRCH", "LOCAL", "LOVLAP", + "LPLOT", "LPTN", "LREFINE", "LREVERSE", "LROTAT", + "LSBA", "*LSBAC", "LSBL", "LSBV", "LSBW", "LSCLEAR", + "LSDELE", "*LSDUMP", "LSEL", "*LSENGINE", "*LSFACTOR", + "LSLA", "LSLK", "LSOPER", "/LSPEC", "LSREAD", + "*LSRESTORE", "LSSCALE", "LSSOLVE", "LSTR", "LSUM", + "LSWRITE", "/LSYMBOL", "LSYMM", "LTAN", "LTRAN", + "LUMPM", "LVSCALE", "LWPLAN", "M", "MADAPT", "MAGOPT", + "MAGSOLV", "/MAIL", "MAP", "/MAP", "MAP2DTO3D", + "MAPSOLVE", "MAPVAR", "MASTER", "MAT", "MATER", + "MCHECK", "MDAMP", "MDELE", "MDPLOT", "MEMM", "/MENU", + "MESHING", "MFANALYSIS", "MFBUCKET", "MFCALC", "MFCI", + "MFCLEAR", "MFCMMAND", "MFCONV", "MFDTIME", "MFELEM", + "MFEM", "MFEXTER", "MFFNAME", "MFFR", "MFIMPORT", + "MFINTER", "MFITER", "MFLCOMM", "MFLIST", "MFMAP", + "MFORDER", "MFOUTPUT", "*MFOURI", "MFPSIMUL", "MFRC", + "MFRELAX", "MFRSTART", "MFSORDER", "MFSURFACE", + "MFTIME", "MFTOL", "*MFUN", "MFVOLUME", "MFWRITE", + "MGEN", "MIDTOL", "/MKDIR", "MLIST", "MMASS", "MMF", + "MODCONT", "MODE", "MODIFY", "MODMSH", "MODSELOPTION", + "MODOPT", "MONITOR", "*MOPER", "MOPT", "MORPH", "MOVE", + "MP", "MPAMOD", "MPCHG", "MPCOPY", "MPDATA", "MPDELE", + "MPDRES", "/MPLIB", "MPLIST", "MPPLOT", "MPREAD", + "MPRINT", "MPTEMP", "MPTGEN", "MPTRES", "MPWRITE", + "/MREP", "MSAVE", "*MSG", "MSHAPE", "MSHCOPY", + "MSHKEY", "MSHMID", "MSHPATTERN", "MSOLVE", "/MSTART", + "MSTOLE", "*MULT", "*MWRITE", "MXPAND", "N", "NANG", + "NAXIS", "NCNV", "NDELE", "NDIST", "NDSURF", "NEQIT", + "/NERR", "NFORCE", "NGEN", "NKPT", "NLADAPTIVE", + "NLDIAG", "NLDPOST", "NLGEOM", "NLHIST", "NLIST", + "NLMESH", "NLOG", "NLOPT", "NMODIF", "NOCOLOR", + "NODES", "/NOERASE", "/NOLIST", "NOOFFSET", "NOORDER", + "/NOPR", "NORA", "NORL", "/NORMAL", "NPLOT", "NPRINT", + "NREAD", "NREFINE", "NRLSUM", "*NRM", "NROPT", + "NROTAT", "NRRANG", "NSCALE", "NSEL", "NSLA", "NSLE", + "NSLK", "NSLL", "NSLV", "NSMOOTH", "NSOL", "NSORT", + "NSTORE", "NSUBST", "NSVR", "NSYM", "/NUMBER", + "NUMCMP", "NUMEXP", "NUMMRG", "NUMOFF", "NUMSTR", + "NUMVAR", "NUSORT", "NWPAVE", "NWPLAN", "NWRITE", + "OCDATA", "OCDELETE", "OCLIST", "OCREAD", "OCTABLE", + "OCTYPE", "OCZONE", "OMEGA", "OPERATE", "OPNCONTROL", + "OUTAERO", "OUTOPT", "OUTPR", "/OUTPUT", "OUTRES", + "OVCHECK", "PADELE", "/PAGE", "PAGET", "PAPUT", + "PARESU", "PARTSEL", "PARRES", "PARSAV", "PASAVE", + "PATH", "PAUSE", "/PBC", "/PBF", "PCALC", "PCGOPT", + "PCIRC", "/PCIRCLE", "/PCOPY", "PCROSS", "PDANL", + "PDCDF", "PDCFLD", "PDCLR", "PDCMAT", "PDCORR", + "PDDMCS", "PDDOEL", "PDEF", "PDEXE", "PDHIST", + "PDINQR", "PDLHS", "PDMETH", "PDOT", "PDPINV", + "PDPLOT", "PDPROB", "PDRESU", "PDROPT", "/PDS", + "PDSAVE", "PDSCAT", "PDSENS", "PDSHIS", "PDUSER", + "PDVAR", "PDWRITE", "PERBC2D", "PERTURB", "PFACT", + "PHYSICS", "PIVCHECK", "PLCAMP", "PLCFREQ", "PLCHIST", + "PLCINT", "PLCPLX", "PLCRACK", "PLDISP", "PLESOL", + "PLETAB", "PLFAR", "PLF2D", "PLGEOM", "PLLS", "PLMAP", + "PLMC", "PLNEAR", "PLNSOL", "/PLOPTS", "PLORB", "PLOT", + "PLOTTING", "PLPAGM", "PLPATH", "PLSECT", "PLST", + "PLTIME", "PLTRAC", "PLVAR", "PLVECT", "PLZZ", + "/PMACRO", "PMAP", "PMGTRAN", "PMLOPT", "PMLSIZE", + "/PMORE", "PNGR", "/PNUM", "POINT", "POLY", "/POLYGON", + "/POST1", "/POST26", "POWERH", "PPATH", "PRANGE", + "PRAS", "PRCAMP", "PRCINT", "PRCPLX", "PRED", + "PRENERGY", "/PREP7", "PRERR", "PRESOL", "PRETAB", + "PRFAR", "PRI2", "PRIM", "PRINT", "*PRINT", "PRISM", + "PRITER", "PRJSOL", "PRNEAR", "PRNLD", "PRNSOL", + "PROD", "PRORB", "PRPATH", "PRRFOR", "PRRSOL", + "PRSCONTROL", "PRSECT", "PRTIME", "PRVAR", "PRVECT", + "PSCONTROL", "PSCR", "PSDCOM", "PSDFRQ", "PSDGRAPH", + "PSDRES", "PSDSPL", "PSDUNIT", "PSDVAL", "PSDWAV", + "/PSEARCH", "PSEL", "/PSF", "PSMAT", "PSMESH", + "/PSPEC", "/PSTATUS", "PSTRES", "/PSYMB", "PTR", + "PTXY", "PVECT", "/PWEDGE", "QDVAL", "QRDOPT", "QSOPT", + "QUAD", "/QUIT", "QUOT", "R", "RACE", "RADOPT", + "RAPPND", "RATE", "/RATIO", "RBE3", "RCON", "RCYC", + "RDEC", "RDELE", "READ", "REAL", "REALVAR", "RECTNG", + "REMESH", "/RENAME", "REORDER", "*REPEAT", "/REPLOT", + "RESCOMBINE", "RESCONTROL", "RESET", "/RESET", "RESP", + "RESUME", "RESVEC", "RESWRITE", "*RETURN", "REXPORT", + "REZONE", "RFORCE", "/RGB", "RIGID", "RIGRESP", + "RIMPORT", "RLIST", "RMALIST", "RMANL", "RMASTER", + "RMCAP", "RMCLIST", "/RMDIR", "RMFLVEC", "RMLVSCALE", + "RMMLIST", "RMMRANGE", "RMMSELECT", "RMNDISP", + "RMNEVEC", "RMODIF", "RMORE", "RMPORDER", "RMRESUME", + "RMRGENERATE", "RMROPTIONS", "RMRPLOT", "RMRSTATUS", + "RMSAVE", "RMSMPLE", "RMUSE", "RMXPORT", "ROCK", + "ROSE", "RPOLY", "RPR4", "RPRISM", "RPSD", "RSFIT", + "RSOPT", "RSPLIT", "RSPLOT", "RSPRNT", "RSSIMS", + "RSTMAC", "RSTOFF", "RSURF", "RSYMM", "RSYS", "RTHICK", + "SABS", "SADD", "SALLOW", "SAVE", "SBCLIST", "SBCTRAN", + "SDELETE", "SE", "SECCONTROL", "SECDATA", + "SECFUNCTION", "SECJOINT", "/SECLIB", "SECLOCK", + "SECMODIF", "SECNUM", "SECOFFSET", "SECPLOT", + "SECREAD", "SECSTOP", "SECTYPE", "SECWRITE", "SED", + "SEDLIST", "SEEXP", "/SEG", "SEGEN", "SELIST", "SELM", + "SELTOL", "SENERGY", "SEOPT", "SESYMM", "*SET", "SET", + "SETFGAP", "SETRAN", "SEXP", "SF", "SFA", "SFACT", + "SFADELE", "SFALIST", "SFBEAM", "SFCALC", "SFCUM", + "SFDELE", "SFE", "SFEDELE", "SFELIST", "SFFUN", + "SFGRAD", "SFL", "SFLDELE", "SFLEX", "SFLIST", + "SFLLIST", "SFSCALE", "SFTRAN", "/SHADE", "SHELL", + "/SHOW", "/SHOWDISP", "SHPP", "/SHRINK", "SLIST", + "SLOAD", "SMALL", "*SMAT", "SMAX", "/SMBC", "SMBODY", + "SMCONS", "SMFOR", "SMIN", "SMOOTH", "SMRTSIZE", + "SMSURF", "SMULT", "SNOPTION", "SOLU", "/SOLU", + "SOLUOPT", "SOLVE", "SORT", "SOURCE", "SPACE", + "SPCNOD", "SPCTEMP", "SPDAMP", "SPEC", "SPFREQ", + "SPGRAPH", "SPH4", "SPH5", "SPHERE", "SPLINE", "SPLOT", + "SPMWRITE", "SPOINT", "SPOPT", "SPREAD", "SPTOPT", + "SPOWER", "SPUNIT", "SPVAL", "SQRT", "*SREAD", "SRSS", + "SSBT", "/SSCALE", "SSLN", "SSMT", "SSPA", "SSPB", + "SSPD", "SSPE", "SSPM", "SSUM", "SSTATE", "STABILIZE", + "STAOPT", "STAT", "*STATUS", "/STATUS", "STEF", + "/STITLE", "STORE", "SUBOPT", "SUBSET", "SUCALC", + "SUCR", "SUDEL", "SUEVAL", "SUGET", "SUMAP", "SUMTYPE", + "SUPL", "SUPR", "SURESU", "SUSAVE", "SUSEL", "SUVECT", + "SV", "SVPLOT", "SVTYP", "SWADD", "SWDEL", "SWGEN", + "SWLIST", "SYNCHRO", "/SYP", "/SYS", "TALLOW", + "TARGET", "*TAXIS", "TB", "TBCOPY", "TBDATA", "TBDELE", + "TBEO", "TBIN", "TBFIELD", "TBFT", "TBLE", "TBLIST", + "TBMODIF", "TBPLOT", "TBPT", "TBTEMP", "TCHG", "/TEE", + "TERM", "THEXPAND", "THOPT", "TIFF", "TIME", + "TIMERANGE", "TIMINT", "TIMP", "TINTP", "/TITLE", + "/TLABEL", "TOFFST", "*TOPER", "TORQ2D", "TORQC2D", + "TORQSUM", "TORUS", "TRANS", "TRANSFER", "*TREAD", + "TREF", "/TRIAD", "/TRLCY", "TRNOPT", "TRPDEL", + "TRPLIS", "TRPOIN", "TRTIME", "TSHAP", "/TSPEC", + "TSRES", "TUNIF", "TVAR", "/TXTRE", "/TYPE", "TYPE", + "/UCMD", "/UDOC", "/UI", "UIMP", "/UIS", "*ULIB", + "UNDELETE", "UNDO", "/UNITS", "UNPAUSE", "UPCOORD", + "UPGEOM", "*USE", "/USER", "USRCAL", "USRDOF", + "USRELEM", "V", "V2DOPT", "VA", "*VABS", "VADD", + "VARDEL", "VARNAM", "VATT", "VCLEAR", "*VCOL", + "/VCONE", "VCROSS", "*VCUM", "VDDAM", "VDELE", "VDGL", + "VDOT", "VDRAG", "*VEC", "*VEDIT", "VEORIENT", "VEXT", + "*VFACT", "*VFILL", "VFOPT", "VFQUERY", "VFSM", + "*VFUN", "VGEN", "*VGET", "VGET", "VGLUE", "/VIEW", + "VIMP", "VINP", "VINV", "*VITRP", "*VLEN", "VLIST", + "VLSCALE", "*VMASK", "VMESH", "VOFFST", "VOLUMES") + + # list of in-built () functions + elafunf = ("NX()", "NY()", "NZ()", "KX()", "KY()", "KZ()", "LX()", + "LY()", "LZ()", "LSX()", "LSY()", "LSZ()", "NODE()", + "KP()", "DISTND()", "DISTKP()", "DISTEN()", "ANGLEN()", + "ANGLEK()", "NNEAR()", "KNEAR()", "ENEARN()", + "AREAND()", "AREAKP()", "ARNODE()", "NORMNX()", + "NORMNY()", "NORMNZ()", "NORMKX()", "NORMKY()", + "NORMKZ()", "ENEXTN()", "NELEM()", "NODEDOF()", + "ELADJ()", "NDFACE()", "NMFACE()", "ARFACE()", "UX()", + "UY()", "UZ()", "ROTX()", "ROTY()", "ROTZ()", "TEMP()", + "PRES()", "VX()", "VY()", "VZ()", "ENKE()", "ENDS()", + "VOLT()", "MAG()", "AX()", "AY()", "AZ()", + "VIRTINQR()", "KWGET()", "VALCHR()", "VALHEX()", + "CHRHEX()", "STRFILL()", "STRCOMP()", "STRPOS()", + "STRLENG()", "UPCASE()", "LWCASE()", "JOIN()", + "SPLIT()", "ABS()", "SIGN()", "CXABS()", "EXP()", + "LOG()", "LOG10()", "SQRT()", "NINT()", "MOD()", + "RAND()", "GDIS()", "SIN()", "COS()", "TAN()", + "SINH()", "COSH()", "TANH()", "ASIN()", "ACOS()", + "ATAN()", "ATAN2()") + + elafung = ("NSEL()", "ESEL()", "KSEL()", "LSEL()", "ASEL()", + "VSEL()", "NDNEXT()", "ELNEXT()", "KPNEXT()", + "LSNEXT()", "ARNEXT()", "VLNEXT()", "CENTRX()", + "CENTRY()", "CENTRZ()") + + elafunh = ("~CAT5IN", "~CATIAIN", "~PARAIN", "~PROEIN", "~SATIN", + "~UGIN", "A", "AADD", "AATT", "ABEXTRACT", "*ABBR", + "ABBRES", "ABBSAV", "ABS", "ACCAT", "ACCOPTION", + "ACEL", "ACLEAR", "ADAMS", "ADAPT", "ADD", "ADDAM", + "ADELE", "ADGL", "ADRAG", "AESIZE", "AFILLT", "AFLIST", + "AFSURF", "*AFUN", "AGEN", "AGLUE", "AINA", "AINP", + "AINV", "AL", "ALIST", "ALLSEL", "ALPHAD", "AMAP", + "AMESH", "/AN3D", "ANCNTR", "ANCUT", "ANCYC", "ANDATA", + "ANDSCL", "ANDYNA", "/ANFILE", "ANFLOW", "/ANGLE", + "ANHARM", "ANIM", "ANISOS", "ANMODE", "ANMRES", + "/ANNOT", "ANORM", "ANPRES", "ANSOL", "ANSTOAQWA", + "ANSTOASAS", "ANTIME", "ANTYPE") + + tokens = { + 'root': [ + (r'!.*\n', Comment), + include('strings'), + include('core'), + include('nums'), + (words((elafunb+elafunc+elafund+elafune+elafunh), suffix=r'\b'), Keyword), + (words((elafunf+elafung), suffix=r'\b'), Name.Builtin), + (r'AR[0-9]+', Name.Variable.Instance), + (r'[a-z][a-z0-9_]*', Name.Variable), + (r'[\s]+', Text), + ], + 'core': [ + # Operators + (r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)', Operator), + (r'/EOF', Generic.Emph), + (r'[(),:&;]', Punctuation), + ], + 'strings': [ + (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double), + (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), + (r'[$%]', String.Symbol), + ], + 'nums': [ + (r'\d+(?![.ef])', Number.Integer), + (r'[+-]?\d*\.?\d+([ef][-+]?\d+)?', Number.Float), + (r'[+-]?\d+\.?\d*([ef][-+]?\d+)?', Number.Float), + ] + } diff --git a/pygments/lexers/apl.py b/pygments/lexers/apl.py index b681116..8c5eee7 100644 --- a/pygments/lexers/apl.py +++ b/pygments/lexers/apl.py @@ -23,7 +23,10 @@ class APLLexer(RegexLexer): """ name = 'APL' aliases = ['apl'] - filenames = ['*.apl'] + filenames = [ + '*.apl', '*.aplf', '*.aplo', '*.apln', + '*.aplc', '*.apli', '*.dyalog', + ] tokens = { 'root': [ @@ -65,8 +68,8 @@ class APLLexer(RegexLexer): # # Variables # ========= - # following IBM APL2 standard - (r'[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*', Name.Variable), + # following IBM APL2 standard (with a leading _ ok for GNU APL and Dyalog) + (r'[A-Za-zΔ∆⍙_][A-Za-zΔ∆⍙_¯0-9]*', Name.Variable), # # Numbers # ======= diff --git a/pygments/lexers/automation.py b/pygments/lexers/automation.py index e3b2ad8..7b03e39 100644 --- a/pygments/lexers/automation.py +++ b/pygments/lexers/automation.py @@ -22,7 +22,7 @@ class AutohotkeyLexer(RegexLexer): .. versionadded:: 1.4 """ name = 'autohotkey' - aliases = ['ahk', 'autohotkey'] + aliases = ['autohotkey', 'ahk'] filenames = ['*.ahk', '*.ahkl'] mimetypes = ['text/x-autohotkey'] diff --git a/pygments/lexers/bibtex.py b/pygments/lexers/bibtex.py index 56b5218..0210082 100644 --- a/pygments/lexers/bibtex.py +++ b/pygments/lexers/bibtex.py @@ -26,7 +26,7 @@ class BibTeXLexer(ExtendedRegexLexer): """ name = 'BibTeX' - aliases = ['bib', 'bibtex'] + aliases = ['bibtex', 'bib'] filenames = ['*.bib'] mimetypes = ["text/x-bibtex"] flags = re.IGNORECASE diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py index 1bdebd2..059b9be 100644 --- a/pygments/lexers/c_cpp.py +++ b/pygments/lexers/c_cpp.py @@ -43,6 +43,7 @@ class CFamilyLexer(RegexLexer): # Identifier regex with C and C++ Universal Character Name (UCN) support. _ident = r'(?:[a-zA-Z_$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})*' + _namespaced_ident = r'(?:[a-zA-Z_$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|::)*' tokens = { 'whitespace': [ @@ -63,6 +64,8 @@ class CFamilyLexer(RegexLexer): (r'/(\\\n)?[*][\w\W]*', Comment.Multiline), ], 'statements': [ + include('keywords'), + include('types'), (r'([LuU]|u8)?(")', bygroups(String.Affix, String), 'string'), (r"([LuU]|u8)?(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')", bygroups(String.Affix, String.Char, String.Char, String.Char)), @@ -78,6 +81,17 @@ class CFamilyLexer(RegexLexer): (r'(-)?' + _decpart + _intsuffix, Number.Integer), (r'[~!%^&*+=|?:<>/-]', Operator), (r'[()\[\],.]', Punctuation), + (r'(true|false|NULL)\b', Name.Builtin), + (r'(' + _ident + r')(\s*)(:)(?!:)', bygroups(Name.Label, Text, Punctuation)), + (_ident, Name) + ], + 'types': [ + (words(('int8', 'int16', 'int32', 'int64', 'wchar_t'), prefix=r'__', + suffix=r'\b'), Keyword.Reserved), + (words(('bool', 'int', 'long', 'float', 'short', 'double', 'char', + 'unsigned', 'signed', 'void'), suffix=r'\b'), Keyword.Type) + ], + 'keywords': [ (r'(struct|union)(\s+)', bygroups(Keyword, Text), 'classname'), (words(('asm', 'auto', 'break', 'case', 'const', 'continue', 'default', 'do', 'else', 'enum', 'extern', 'for', 'goto', @@ -85,36 +99,32 @@ class CFamilyLexer(RegexLexer): 'static', 'switch', 'typedef', 'volatile', 'while', 'union', 'thread_local', 'alignas', 'alignof', 'static_assert', '_Pragma'), suffix=r'\b'), Keyword), - (r'(bool|int|long|float|short|double|char|unsigned|signed|void)\b', - Keyword.Type), (words(('inline', '_inline', '__inline', 'naked', 'restrict', 'thread'), suffix=r'\b'), Keyword.Reserved), # Vector intrinsics (r'(__m(128i|128d|128|64))\b', Keyword.Reserved), # Microsoft-isms (words(( - 'asm', 'int8', 'based', 'except', 'int16', 'stdcall', 'cdecl', - 'fastcall', 'int32', 'declspec', 'finally', 'int64', 'try', - 'leave', 'wchar_t', 'w64', 'unaligned', 'raise', 'noop', + 'asm', 'based', 'except', 'stdcall', 'cdecl', + 'fastcall', 'declspec', 'finally', 'try', + 'leave', 'w64', 'unaligned', 'raise', 'noop', 'identifier', 'forceinline', 'assume'), - prefix=r'__', suffix=r'\b'), Keyword.Reserved), - (r'(true|false|NULL)\b', Name.Builtin), - (r'(' + _ident + r')(\s*)(:)(?!:)', bygroups(Name.Label, Text, Punctuation)), - (_ident, Name) + prefix=r'__', suffix=r'\b'), Keyword.Reserved) ], 'root': [ include('whitespace'), + include('keywords'), # functions - (r'((?:' + _ident + r'(?:[&*\s])+))' # return arguments - r'(' + _ident + r')' # method name + (r'(' + _namespaced_ident + r'(?:[&*\s])+)' # return arguments + r'(' + _namespaced_ident + r')' # method name r'(\s*\([^;]*?\))' # signature r'([^;{]*)(\{)', bygroups(using(this), Name.Function, using(this), using(this), Punctuation), 'function'), # function declarations - (r'((?:' + _ident + r'(?:[&*\s])+))' # return arguments - r'(' + _ident + r')' # method name + (r'(' + _namespaced_ident + r'(?:[&*\s])+)' # return arguments + r'(' + _namespaced_ident + r')' # method name r'(\s*\([^;]*?\))' # signature r'([^;]*)(;)', bygroups(using(this), Name.Function, using(this), using(this), @@ -143,8 +153,10 @@ class CFamilyLexer(RegexLexer): (r'\\', String), # stray backslash ], 'macro': [ - (r'(include)('+_ws1+r')("[^"]+")([^\n]*)', bygroups(Comment.Preproc, using(this), Comment.PreprocFile, Comment.Single)), - (r'(include)('+_ws1+r')(<[^>]+>)([^\n]*)', bygroups(Comment.Preproc, using(this), Comment.PreprocFile, Comment.Single)), + (r'('+_ws1+r')(include)('+_ws1+r')("[^"]+")([^\n]*)', + bygroups(using(this), Comment.Preproc, using(this), Comment.PreprocFile, Comment.Single)), + (r'('+_ws1+r')(include)('+_ws1+r')(<[^>]+>)([^\n]*)', + bygroups(using(this), Comment.Preproc, using(this), Comment.PreprocFile, Comment.Single)), (r'[^/\n]+', Comment.Preproc), (r'/[*](.|\n)*?[*]/', Comment.Multiline), (r'//.*?\n', Comment.Single, '#pop'), @@ -245,11 +257,14 @@ class CLexer(CFamilyLexer): priority = 0.1 tokens = { - 'statements': [ + 'keywords': [ (words(( '_Alignas', '_Alignof', '_Noreturn', '_Generic', '_Thread_local', '_Static_assert', '_Imaginary', 'noreturn', 'imaginary', 'complex'), suffix=r'\b'), Keyword), + inherit + ], + 'types': [ (words(('_Bool', '_Complex', '_Atomic'), suffix=r'\b'), Keyword.Type), inherit ] @@ -295,20 +310,6 @@ class CppLexer(CFamilyLexer): tokens = { 'statements': [ - (r'(class|concept|typename)(\s+)', bygroups(Keyword, Text), 'classname'), - (words(( - 'catch', 'const_cast', 'delete', 'dynamic_cast', 'explicit', - 'export', 'friend', 'mutable', 'namespace', 'new', 'operator', - 'private', 'protected', 'public', 'reinterpret_cast', 'class', - 'restrict', 'static_cast', 'template', 'this', 'throw', 'throws', - 'try', 'typeid', 'using', 'virtual', 'constexpr', 'nullptr', 'concept', - 'decltype', 'noexcept', 'override', 'final', 'constinit', 'consteval', - 'co_await', 'co_return', 'co_yield', 'requires', 'import', 'module', - 'typename'), - suffix=r'\b'), Keyword), - (r'char(16_t|32_t|8_t)\b', Keyword.Type), - (r'(enum)(\s+)', bygroups(Keyword, Text), 'enumname'), - # C++11 raw strings (r'((?:[LuU]|u8)?R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(")', bygroups(String.Affix, String, String.Delimiter, String.Delimiter, @@ -332,6 +333,32 @@ class CppLexer(CFamilyLexer): # template specification (r'\s*(?=>)', Text, '#pop'), default('#pop') + ], + 'keywords': [ + (r'(class|concept|typename)(\s+)', bygroups(Keyword, Text), 'classname'), + (words(( + 'catch', 'const_cast', 'delete', 'dynamic_cast', 'explicit', + 'export', 'friend', 'mutable', 'new', 'operator', + 'private', 'protected', 'public', 'reinterpret_cast', 'class', + 'restrict', 'static_cast', 'template', 'this', 'throw', 'throws', + 'try', 'typeid', 'using', 'virtual', 'constexpr', 'nullptr', 'concept', + 'decltype', 'noexcept', 'override', 'final', 'constinit', 'consteval', + 'co_await', 'co_return', 'co_yield', 'requires', 'import', 'module', + 'typename'), + suffix=r'\b'), Keyword), + (r'namespace\b', Keyword, 'namespace'), + (r'(enum)(\s+)', bygroups(Keyword, Text), 'enumname'), + inherit + ], + 'types': [ + (r'char(16_t|32_t|8_t)\b', Keyword.Type), + inherit + ], + 'namespace': [ + (r'[;{]', Punctuation, ('#pop', 'root')), + (r'inline\b', Keyword.Reserved), + (CFamilyLexer._ident, Name.Namespace), + include('statement') ] } diff --git a/pygments/lexers/c_like.py b/pygments/lexers/c_like.py index 41af035..3996783 100644 --- a/pygments/lexers/c_like.py +++ b/pygments/lexers/c_like.py @@ -13,13 +13,14 @@ import re from pygments.lexer import RegexLexer, include, bygroups, inherit, words, \ default from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ - Number, Punctuation + Number, Punctuation, Whitespace from pygments.lexers.c_cpp import CLexer, CppLexer from pygments.lexers import _mql_builtins __all__ = ['PikeLexer', 'NesCLexer', 'ClayLexer', 'ECLexer', 'ValaLexer', - 'CudaLexer', 'SwigLexer', 'MqlLexer', 'ArduinoLexer', 'CharmciLexer'] + 'CudaLexer', 'SwigLexer', 'MqlLexer', 'ArduinoLexer', 'CharmciLexer', + 'OmgIdlLexer'] class PikeLexer(CppLexer): @@ -334,6 +335,11 @@ class SwigLexer(CppLexer): priority = 0.04 # Lower than C/C++ and Objective C/C++ tokens = { + 'root': [ + # Match it here so it won't be matched as a function in the rest of root + (r'\$\**\&?\w+', Name), + inherit + ], 'statements': [ # SWIG directives (r'(%[a-z_][a-z0-9_]*)', Name.Function), @@ -549,7 +555,7 @@ class CharmciLexer(CppLexer): mimetypes = [] tokens = { - 'statements': [ + 'keywords': [ (r'(module)(\s+)', bygroups(Keyword, Text), 'classname'), (words(('mainmodule', 'mainchare', 'chare', 'array', 'group', 'nodegroup', 'message', 'conditional')), Keyword), @@ -563,3 +569,96 @@ class CharmciLexer(CppLexer): inherit, ], } + + +class OmgIdlLexer(CLexer): + """ + Lexer for `Object Management Group Interface Definition Language `_. + + .. versionadded:: 2.9 + """ + + name = 'OMG Interface Definition Language' + aliases = ['omg-idl'] + filenames = ['*.idl', '*.pidl'] + mimetypes = [] + + scoped_name = r'((::)?\w+)+' + + tokens = { + 'values': [ + (words(('true', 'false'), prefix=r'(?i)', suffix=r'\b'), Number), + (r'([Ll]?)(")', bygroups(String.Affix, String.Double), 'string'), + (r'([Ll]?)(\')(\\[^\']+)(\')', + bygroups(String.Affix, String.Char, String.Escape, String.Char)), + (r'([Ll]?)(\')(\\\')(\')', + bygroups(String.Affix, String.Char, String.Escape, String.Char)), + (r'([Ll]?)(\'.\')', bygroups(String.Affix, String.Char)), + (r'[+-]?\d+(\.\d*)?[Ee][+-]?\d+', Number.Float), + (r'[+-]?(\d+\.\d*)|(\d*\.\d+)([Ee][+-]?\d+)?', Number.Float), + (r'(?i)[+-]?0x[0-9a-f]+', Number.Hex), + (r'[+-]?[1-9]\d*', Number.Integer), + (r'[+-]?0[0-7]*', Number.Oct), + (r'[\+\-\*\/%^&\|~]', Operator), + (words(('<<', '>>')), Operator), + (scoped_name, Name), + (r'[{};:,<>\[\]]', Punctuation), + ], + 'annotation_params': [ + include('whitespace'), + (r'\(', Punctuation, '#push'), + include('values'), + (r'=', Punctuation), + (r'\)', Punctuation, '#pop'), + ], + 'annotation_params_maybe': [ + (r'\(', Punctuation, 'annotation_params'), + include('whitespace'), + default('#pop'), + ], + 'annotation_appl': [ + (r'@' + scoped_name, Name.Decorator, 'annotation_params_maybe'), + ], + 'enum': [ + include('whitespace'), + (r'[{,]', Punctuation), + (r'\w+', Name.Constant), + include('annotation_appl'), + (r'\}', Punctuation, '#pop'), + ], + 'root': [ + include('whitespace'), + (words(( + 'typedef', 'const', + 'in', 'out', 'inout', 'local', + ), prefix=r'(?i)', suffix=r'\b'), Keyword.Declaration), + (words(( + 'void', 'any', 'native', 'bitfield', + 'unsigned', 'boolean', 'char', 'wchar', 'octet', 'short', 'long', + 'int8', 'uint8', 'int16', 'int32', 'int64', 'uint16', 'uint32', 'uint64', + 'float', 'double', 'fixed', + 'sequence', 'string', 'wstring', 'map', + ), prefix=r'(?i)', suffix=r'\b'), Keyword.Type), + (words(( + '@annotation', 'struct', 'union', 'bitset', 'interface', + 'exception', 'valuetype', 'eventtype', 'component', + ), prefix=r'(?i)', suffix=r'(\s+)(\w+)'), bygroups(Keyword, Whitespace, Name.Class)), + (words(( + 'abstract', 'alias', 'attribute', 'case', 'connector', + 'consumes', 'context', 'custom', 'default', 'emits', 'factory', + 'finder', 'getraises', 'home', 'import', 'manages', 'mirrorport', + 'multiple', 'Object', 'oneway', 'primarykey', 'private', 'port', + 'porttype', 'provides', 'public', 'publishes', 'raises', + 'readonly', 'setraises', 'supports', 'switch', 'truncatable', + 'typeid', 'typename', 'typeprefix', 'uses', 'ValueBase', + ), prefix=r'(?i)', suffix=r'\b'), Keyword), + (r'(?i)(enum|bitmask)(\s+)(\w+)', + bygroups(Keyword, Whitespace, Name.Class), 'enum'), + (r'(?i)(module)(\s+)(\w+)', + bygroups(Keyword.Namespace, Whitespace, Name.Namespace)), + (r'(\w+)(\s*)(=)', bygroups(Name.Constant, Whitespace, Operator)), + (r'[\(\)]', Punctuation), + include('values'), + include('annotation_appl'), + ], + } diff --git a/pygments/lexers/cddl.py b/pygments/lexers/cddl.py index 09bb583..72b3464 100644 --- a/pygments/lexers/cddl.py +++ b/pygments/lexers/cddl.py @@ -119,7 +119,7 @@ class CddlLexer(RegexLexer): "root": [ include("commentsandwhitespace"), # tag types - (r"#(\d\.{uint})?".format(uint=_re_uint), Keyword.Type), # type or any + (r"#(\d\.{uint})?".format(uint=_re_uint), Keyword.Type), # type or any # occurence ( r"({uint})?(\*)({uint})?".format(uint=_re_uint), diff --git a/pygments/lexers/chapel.py b/pygments/lexers/chapel.py index a3f8ff7..7306862 100644 --- a/pygments/lexers/chapel.py +++ b/pygments/lexers/chapel.py @@ -26,6 +26,38 @@ class ChapelLexer(RegexLexer): aliases = ['chapel', 'chpl'] # mimetypes = ['text/x-chapel'] + known_types = ('bool', 'bytes', 'complex', 'imag', 'int', 'locale', + 'nothing', 'opaque', 'range', 'real', 'string', 'uint', + 'void') + + type_modifiers_par = ('atomic', 'single', 'sync') + type_modifiers_mem = ('borrowed', 'owned', 'shared', 'unmanaged') + type_modifiers = (*type_modifiers_par, *type_modifiers_mem) + + declarations = ('config', 'const', 'in', 'inout', 'out', 'param', 'ref', + 'type', 'var') + + constants = ('false', 'nil', 'none', 'true') + + other_keywords = ('align', 'as', + 'begin', 'break', 'by', + 'catch', 'cobegin', 'coforall', 'continue', + 'defer', 'delete', 'dmapped', 'do', 'domain', + 'else', 'enum', 'except', 'export', 'extern', + 'for', 'forall', 'foreach', 'forwarding', + 'if', 'implements', 'import', 'index', 'init', 'inline', + 'label', 'lambda', 'let', 'lifetime', 'local', + 'new', 'noinit', + 'on', 'only', 'otherwise', 'override', + 'pragma', 'primitive', 'private', 'prototype', 'public', + 'reduce', 'require', 'return', + 'scan', 'select', 'serial', 'sparse', 'subdomain', + 'then', 'this', 'throw', 'throws', 'try', + 'use', + 'when', 'where', 'while', 'with', + 'yield', + 'zip') + tokens = { 'root': [ (r'\n', Text), @@ -35,34 +67,15 @@ class ChapelLexer(RegexLexer): (r'//(.*?)\n', Comment.Single), (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), - (r'(config|const|in|inout|out|param|ref|type|var)\b', - Keyword.Declaration), - (r'(false|nil|none|true)\b', Keyword.Constant), - (r'(bool|bytes|complex|imag|int|nothing|opaque|range|real|string|uint|void)\b', - Keyword.Type), - (words(( - 'align', 'as', 'atomic', - 'begin', 'borrowed', 'break', 'by', - 'catch', 'cobegin', 'coforall', 'continue', - 'defer', 'delete', 'dmapped', 'do', 'domain', - 'else', 'enum', 'except', 'export', 'extern', - 'for', 'forall', 'forwarding', - 'if', 'import', 'index', 'init', 'inline', - 'label', 'lambda', 'let', 'lifetime', 'local', 'locale' - 'new', 'noinit', - 'on', 'only', 'otherwise', 'override', 'owned', - 'pragma', 'private', 'prototype', 'public', - 'reduce', 'require', 'return', - 'scan', 'select', 'serial', 'shared', 'single', 'sparse', 'subdomain', 'sync', - 'then', 'this', 'throw', 'throws', 'try', - 'unmanaged', 'use', - 'when', 'where', 'while', 'with', - 'yield', - 'zip'), suffix=r'\b'), - Keyword), + (words(declarations, suffix=r'\b'), Keyword.Declaration), + (words(constants, suffix=r'\b'), Keyword.Constant), + (words(known_types, suffix=r'\b'), Keyword.Type), + (words((*type_modifiers, *other_keywords), suffix=r'\b'), Keyword), + (r'(iter)((?:\s)+)', bygroups(Keyword, Text), 'procname'), (r'(proc)((?:\s)+)', bygroups(Keyword, Text), 'procname'), - (r'(class|module|record|union)(\s+)', bygroups(Keyword, Text), + (r'(operator)((?:\s)+)', bygroups(Keyword, Text), 'procname'), + (r'(class|interface|module|record|union)(\s+)', bygroups(Keyword, Text), 'classname'), # imaginary integers @@ -87,8 +100,8 @@ class ChapelLexer(RegexLexer): (r'[0-9]+', Number.Integer), # strings - (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double), - (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single), + (r'"(\\\\|\\"|[^"])*"', String), + (r"'(\\\\|\\'|[^'])*'", String), # tokens (r'(=|\+=|-=|\*=|/=|\*\*=|%=|&=|\|=|\^=|&&=|\|\|=|<<=|>>=|' @@ -105,7 +118,18 @@ class ChapelLexer(RegexLexer): (r'[a-zA-Z_][\w$]*', Name.Class, '#pop'), ], 'procname': [ - (r'([a-zA-Z_][.\w$]*|\~[a-zA-Z_][.\w$]*|[+*/!~%<>=&^|\-]{1,2})', + (r'([a-zA-Z_][.\w$]*|' # regular function name, including secondary + r'\~[a-zA-Z_][.\w$]*|' # support for legacy destructors + r'[+*/!~%<>=&^|\-:]{1,2})', # operators Name.Function, '#pop'), + + # allow `proc (atomic T).foo` + (r'\(', Punctuation, "receivertype"), + (r'\)+\.', Punctuation), + ], + 'receivertype': [ + (words(type_modifiers, suffix=r'\b'), Keyword), + (words(known_types, suffix=r'\b'), Keyword.Type), + (r'[^()]*', Name.Other, '#pop'), ], } diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py index 1648428..927896f 100644 --- a/pygments/lexers/configs.py +++ b/pygments/lexers/configs.py @@ -21,7 +21,7 @@ __all__ = ['IniLexer', 'RegeditLexer', 'PropertiesLexer', 'KconfigLexer', 'NginxConfLexer', 'LighttpdConfLexer', 'DockerLexer', 'TerraformLexer', 'TermcapLexer', 'TerminfoLexer', 'PkgConfigLexer', 'PacmanConfLexer', 'AugeasLexer', 'TOMLLexer', - 'SingularityLexer'] + 'NestedTextLexer', 'SingularityLexer'] class IniLexer(RegexLexer): @@ -349,7 +349,7 @@ class SquidConfLexer(RegexLexer): "cache_effective_user", "cache_host", "cache_host_acl", "cache_host_domain", "cache_log", "cache_mem", "cache_mem_high", "cache_mem_low", "cache_mgr", "cachemgr_passwd", "cache_peer", - "cache_peer_access", "cahce_replacement_policy", "cache_stoplist", + "cache_peer_access", "cache_replacement_policy", "cache_stoplist", "cache_stoplist_pattern", "cache_store_log", "cache_swap", "cache_swap_high", "cache_swap_log", "cache_swap_low", "client_db", "client_lifetime", "client_netmask", "connect_timeout", "coredump_dir", @@ -509,8 +509,8 @@ class LighttpdConfLexer(RegexLexer): .. versionadded:: 0.11 """ name = 'Lighttpd configuration file' - aliases = ['lighty', 'lighttpd'] - filenames = [] + aliases = ['lighttpd', 'lighty'] + filenames = ['lighttpd.conf'] mimetypes = ['text/x-lighttpd-conf'] tokens = { @@ -577,56 +577,113 @@ class TerraformLexer(RegexLexer): filenames = ['*.tf'] mimetypes = ['application/x-tf', 'application/x-terraform'] - embedded_keywords = ('ingress', 'egress', 'listener', 'default', - 'connection', 'alias', 'terraform', 'tags', 'vars', - 'config', 'lifecycle', 'timeouts') + classes = ('backend', 'data', 'module', 'output', 'provider', + 'provisioner', 'resource', 'variable') + classes_re = "({})".format(('|').join(classes)) + + types = ('string', 'number', 'bool', 'list', 'tuple', 'map', 'object', 'null') + + numeric_functions = ('abs', 'ceil', 'floor', 'log', 'max', + 'mix', 'parseint', 'pow', 'signum') + + string_functions = ('chomp', 'format', 'formatlist', 'indent', + 'join', 'lower', 'regex', 'regexall', 'replace', + 'split', 'strrev', 'substr', 'title', 'trim', + 'trimprefix', 'trimsuffix', 'trimspace', 'upper' + ) + + collection_functions = ('alltrue', 'anytrue', 'chunklist', 'coalesce', + 'coalescelist', 'compact', 'concat', 'contains', + 'distinct', 'element', 'flatten', 'index', 'keys', + 'length', 'list', 'lookup', 'map', 'matchkeys', + 'merge', 'range', 'reverse', 'setintersection', + 'setproduct', 'setsubtract', 'setunion', 'slice', + 'sort', 'sum', 'transpose', 'values', 'zipmap' + ) + + encoding_functions = ('base64decode', 'base64encode', 'base64gzip', + 'csvdecode', 'jsondecode', 'jsonencode', 'textdecodebase64', + 'textencodebase64', 'urlencode', 'yamldecode', 'yamlencode') + + + filesystem_functions = ('abspath', 'dirname', 'pathexpand', 'basename', + 'file', 'fileexists', 'fileset', 'filebase64', 'templatefile') + + date_time_functions = ('formatdate', 'timeadd', 'timestamp') + + hash_crypto_functions = ('base64sha256', 'base64sha512', 'bcrypt', 'filebase64sha256', + 'filebase64sha512', 'filemd5', 'filesha1', 'filesha256', 'filesha512', + 'md5', 'rsadecrypt', 'sha1', 'sha256', 'sha512', 'uuid', 'uuidv5') + + ip_network_functions = ('cidrhost', 'cidrnetmask', 'cidrsubnet', 'cidrsubnets') + + type_conversion_functions = ('can', 'defaults', 'tobool', 'tolist', 'tomap', + 'tonumber', 'toset', 'tostring', 'try') + + builtins = numeric_functions + string_functions + collection_functions + encoding_functions +\ + filesystem_functions + date_time_functions + hash_crypto_functions + ip_network_functions +\ + type_conversion_functions + builtins_re = "({})".format(('|').join(builtins)) tokens = { 'root': [ - include('string'), - include('punctuation'), - include('curly'), include('basic'), include('whitespace'), + + # Strings + (r'(".*")', bygroups(String.Double)), + + # Constants + (words(('true', 'false'), prefix=r'\b', suffix=r'\b'), Name.Constant), + + # Types + (words(types, prefix=r'\b', suffix=r'\b'), Keyword.Type), + + include('identifier'), + include('punctuation'), (r'[0-9]+', Number), ], 'basic': [ - (words(('true', 'false'), prefix=r'\b', suffix=r'\b'), Keyword.Type), (r'\s*/\*', Comment.Multiline, 'comment'), (r'\s*#.*\n', Comment.Single), - (r'(.*?)(\s*)(=)', bygroups(Name.Attribute, Text, Operator)), - (words(('variable', 'resource', 'provider', 'provisioner', 'module', - 'backend', 'data', 'output'), prefix=r'\b', suffix=r'\b'), - Keyword.Reserved, 'function'), - (words(embedded_keywords, prefix=r'\b', suffix=r'\b'), - Keyword.Declaration), - (r'\$\{', String.Interpol, 'var_builtin'), - ], - 'function': [ - (r'(\s+)(".*")(\s+)', bygroups(Text, String, Text)), - include('punctuation'), - include('curly'), + include('whitespace'), + + # e.g. terraform { + # e.g. egress { + (r'(\s*)([0-9a-zA-Z-_]+)(\s*)(=?)(\s*)(\{)', + bygroups(Text, Name.Builtin, Text, Operator, Text, Punctuation)), + + # Assignment with attributes, e.g. something = ... + (r'(\s*)([0-9a-zA-Z-_]+)(\s*)(=)(\s*)', + bygroups(Text, Name.Attribute, Text, Operator, Text)), + + # Assignment with environment variables and similar, e.g. "something" = ... + # or key value assignment, e.g. "SlotName" : ... + (r'(\s*)("\S+")(\s*)([=:])(\s*)', + bygroups(Text, Literal.String.Double, Text, Operator, Text)), + + # Functions, e.g. jsonencode(element("value")) + (builtins_re + r'(\()', bygroups(Name.Function, Punctuation)), + + # List of attributes, e.g. ignore_changes = [last_modified, filename] + (r'(\[)([a-z_,\s]+)(\])', bygroups(Punctuation, Name.Builtin, Punctuation)), + + # e.g. resource "aws_security_group" "allow_tls" { + # e.g. backend "consul" { + (classes_re + r'(\s+)', bygroups(Keyword.Reserved, Text), 'blockname'), ], - 'var_builtin': [ - (r'\$\{', String.Interpol, '#push'), - (words(('concat', 'file', 'join', 'lookup', 'element'), - prefix=r'\b', suffix=r'\b'), Name.Builtin), - include('string'), - include('punctuation'), - (r'\s+', Text), - (r'\}', String.Interpol, '#pop'), + 'blockname': [ + # e.g. resource "aws_security_group" "allow_tls" { + # e.g. backend "consul" { + (r'(\s*)("[0-9a-zA-Z-_]+")?(\s*)("[0-9a-zA-Z-_]+")(\s+)(\{)', + bygroups(Text, Name.Class, Text, Name.Variable, Text, Punctuation)), ], - 'string': [ - (r'(".*")', bygroups(String.Double)), + 'identifier': [ + (r'\b(var\.[0-9a-zA-Z-_\.\[\]]+)\b', bygroups(Name.Variable)), + (r'\b([0-9a-zA-Z-_\[\]]+\.[0-9a-zA-Z-_\.\[\]]+)\b', bygroups(Name.Variable)), ], 'punctuation': [ - (r'[\[\](),.]', Punctuation), - ], - # Keep this seperate from punctuation - we sometimes want to use different - # Tokens for { } - 'curly': [ - (r'\{', Text.Punctuation), - (r'\}', Text.Punctuation), + (r'[\[\]()\{\},.?:!=]', Punctuation), ], 'comment': [ (r'[^*/]', Comment.Multiline), @@ -940,6 +997,31 @@ class TOMLLexer(RegexLexer): ] } +class NestedTextLexer(RegexLexer): + """ + Lexer for `NextedText `_, a human-friendly data + format. + + .. versionadded:: 2.9 + """ + + name = 'NestedText' + aliases = ['nestedtext', 'nt'] + filenames = ['*.nt'] + + _quoted_dict_item = r'^(\s*)({0})(.*?)({0}: ?)(.*?)(\s*)$' + + tokens = { + 'root': [ + (r'^(\s*)(#.*?)$', bygroups(Text, Comment)), + (r'^(\s*)(> ?)(.*?)(\s*)$', bygroups(Text, Punctuation, String, Whitespace)), + (r'^(\s*)(- ?)(.*?)(\s*)$', bygroups(Text, Punctuation, String, Whitespace)), + (_quoted_dict_item.format("'"), bygroups(Text, Punctuation, Name, Punctuation, String, Whitespace)), + (_quoted_dict_item.format('"'), bygroups(Text, Punctuation, Name, Punctuation, String, Whitespace)), + (r'^(\s*)(.*?)(: ?)(.*?)(\s*)$', bygroups(Text, Name, Punctuation, String, Whitespace)), + ], + } + class SingularityLexer(RegexLexer): """ diff --git a/pygments/lexers/devicetree.py b/pygments/lexers/devicetree.py index 9eca82a..240a451 100644 --- a/pygments/lexers/devicetree.py +++ b/pygments/lexers/devicetree.py @@ -58,7 +58,7 @@ class DevicetreeLexer(RegexLexer): (r'(L?)(")', bygroups(String.Affix, String), 'string'), (r'0x[0-9a-fA-F]+', Number.Hex), (r'\d+', Number.Integer), - (r'([^\s{}/*]*)(\s*)(:)', bygroups(Name.Label, Text, Punctuation)), + (r'([^\s{}/*]*)(\s*)(:)', bygroups(Name.Label, Text, Punctuation), '#pop'), (words(('compatible', 'model', 'phandle', 'status', '#address-cells', '#size-cells', 'reg', 'virtual-reg', 'ranges', 'dma-ranges', 'device_type', 'name'), suffix=r'\b'), Keyword.Reserved), diff --git a/pygments/lexers/erlang.py b/pygments/lexers/erlang.py index 74b52c8..35ea718 100644 --- a/pygments/lexers/erlang.py +++ b/pygments/lexers/erlang.py @@ -230,7 +230,7 @@ class ElixirLexer(RegexLexer): name = 'Elixir' aliases = ['elixir', 'ex', 'exs'] - filenames = ['*.ex', '*.eex', '*.exs'] + filenames = ['*.ex', '*.eex', '*.exs', '*.leex'] mimetypes = ['text/x-elixir'] KEYWORD = ('fn', 'do', 'end', 'after', 'else', 'rescue', 'catch') diff --git a/pygments/lexers/futhark.py b/pygments/lexers/futhark.py index 8892bb7..f580ea7 100644 --- a/pygments/lexers/futhark.py +++ b/pygments/lexers/futhark.py @@ -10,9 +10,9 @@ import re -from pygments.lexer import RegexLexer, include, bygroups, default, words +from pygments.lexer import RegexLexer from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ - Number, Punctuation, Error + Number, Punctuation from pygments import unistring as uni __all__ = ['FutharkLexer'] @@ -25,7 +25,7 @@ class FutharkLexer(RegexLexer): """ A Futhark lexer - .. versionadded:: 2.8.0 + .. versionadded:: 2.8 """ name = 'Futhark' aliases = ['futhark'] @@ -70,7 +70,8 @@ class FutharkLexer(RegexLexer): (r'[][(),:;`{}]', Punctuation), # Numbers - (r'0[xX]_*[\da-fA-F](_*[\da-fA-F])*_*[pP][+-]?\d(_*\d)*' + num_postfix, Number.Float), + (r'0[xX]_*[\da-fA-F](_*[\da-fA-F])*_*[pP][+-]?\d(_*\d)*' + num_postfix, + Number.Float), (r'0[xX]_*[\da-fA-F](_*[\da-fA-F])*\.[\da-fA-F](_*[\da-fA-F])*' r'(_*[pP][+-]?\d(_*\d)*)?' + num_postfix, Number.Float), (r'\d(_*\d)*_*[eE][+-]?\d(_*\d)*' + num_postfix, Number.Float), diff --git a/pygments/lexers/gcodelexer.py b/pygments/lexers/gcodelexer.py new file mode 100644 index 0000000..1a76df7 --- /dev/null +++ b/pygments/lexers/gcodelexer.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.gcodelexer + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the G Code Language. + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, bygroups +from pygments.token import Comment, Name, Text, Keyword, Number + +__all__ = ['GcodeLexer'] + + +class GcodeLexer(RegexLexer): + """ + For gcode source code. + + .. versionadded:: 2.9 + """ + name = 'g-code' + aliases = ['gcode'] + filenames = ['*.gcode'] + + tokens = { + 'root': [ + (r';.*\n', Comment), + (r'^[gmGM]\d{1,4}\s', Name.Builtin), # M or G commands + (r'([^gGmM])([+-]?\d*[.]?\d+)', bygroups(Keyword, Number)), + (r'\s', Text.Whitespace), + (r'.*\n', Text), + ] + } diff --git a/pygments/lexers/graphics.py b/pygments/lexers/graphics.py index 7e944ba..f0b36b0 100644 --- a/pygments/lexers/graphics.py +++ b/pygments/lexers/graphics.py @@ -407,7 +407,7 @@ class AsymptoteLexer(RegexLexer): .. versionadded:: 1.2 """ name = 'Asymptote' - aliases = ['asy', 'asymptote'] + aliases = ['asymptote', 'asy'] filenames = ['*.asy'] mimetypes = ['text/x-asymptote'] diff --git a/pygments/lexers/graphviz.py b/pygments/lexers/graphviz.py index 55cf2e4..a685933 100644 --- a/pygments/lexers/graphviz.py +++ b/pygments/lexers/graphviz.py @@ -9,7 +9,8 @@ """ from pygments.lexer import RegexLexer, bygroups -from pygments.token import Comment, Keyword, Operator, Name, String, Number, Punctuation, Whitespace +from pygments.token import Comment, Keyword, Operator, Name, String, Number, \ + Punctuation, Whitespace __all__ = ['GraphvizLexer'] @@ -37,9 +38,9 @@ class GraphvizLexer(RegexLexer): bygroups(Name.Attribute, Whitespace, Punctuation, Whitespace), 'attr_id'), (r'\b(n|ne|e|se|s|sw|w|nw|c|_)\b', Name.Builtin), - (r'\b\D\w*', Name.Tag), # node + (r'\b\D\w*', Name.Tag), # node (r'[-]?((\.[0-9]+)|([0-9]+(\.[0-9]*)?))', Number), - (r'"(\\"|[^"])*?"', Name.Tag), # quoted node + (r'"(\\"|[^"])*?"', Name.Tag), # quoted node (r'<', Punctuation, 'xml'), ], 'attr_id': [ @@ -54,4 +55,4 @@ class GraphvizLexer(RegexLexer): (r'\s+', Whitespace), (r'[^<>\s]', Name.Tag), ] - } \ No newline at end of file + } diff --git a/pygments/lexers/haskell.py b/pygments/lexers/haskell.py index bc4b201..74cd8dc 100644 --- a/pygments/lexers/haskell.py +++ b/pygments/lexers/haskell.py @@ -575,7 +575,7 @@ class LiterateHaskellLexer(LiterateLexer): .. versionadded:: 0.9 """ name = 'Literate Haskell' - aliases = ['lhs', 'literate-haskell', 'lhaskell'] + aliases = ['literate-haskell', 'lhaskell', 'lhs'] filenames = ['*.lhs'] mimetypes = ['text/x-literate-haskell'] @@ -598,7 +598,7 @@ class LiterateIdrisLexer(LiterateLexer): .. versionadded:: 2.0 """ name = 'Literate Idris' - aliases = ['lidr', 'literate-idris', 'lidris'] + aliases = ['literate-idris', 'lidris', 'lidr'] filenames = ['*.lidr'] mimetypes = ['text/x-literate-idris'] @@ -621,7 +621,7 @@ class LiterateAgdaLexer(LiterateLexer): .. versionadded:: 2.0 """ name = 'Literate Agda' - aliases = ['lagda', 'literate-agda'] + aliases = ['literate-agda', 'lagda'] filenames = ['*.lagda'] mimetypes = ['text/x-literate-agda'] @@ -644,7 +644,7 @@ class LiterateCryptolLexer(LiterateLexer): .. versionadded:: 2.0 """ name = 'Literate Cryptol' - aliases = ['lcry', 'literate-cryptol', 'lcryptol'] + aliases = ['literate-cryptol', 'lcryptol', 'lcry'] filenames = ['*.lcry'] mimetypes = ['text/x-literate-cryptol'] diff --git a/pygments/lexers/haxe.py b/pygments/lexers/haxe.py index d970eac..69e3569 100644 --- a/pygments/lexers/haxe.py +++ b/pygments/lexers/haxe.py @@ -26,7 +26,7 @@ class HaxeLexer(ExtendedRegexLexer): """ name = 'Haxe' - aliases = ['hx', 'haxe', 'hxsl'] + aliases = ['haxe', 'hxsl', 'hx'] filenames = ['*.hx', '*.hxsl'] mimetypes = ['text/haxe', 'text/x-haxe', 'text/x-hx'] diff --git a/pygments/lexers/installers.py b/pygments/lexers/installers.py index a4bc077..ab33320 100644 --- a/pygments/lexers/installers.py +++ b/pygments/lexers/installers.py @@ -223,7 +223,7 @@ class SourcesListLexer(RegexLexer): """ name = 'Debian Sourcelist' - aliases = ['sourceslist', 'sources.list', 'debsources'] + aliases = ['debsources', 'sourceslist', 'sources.list'] filenames = ['sources.list'] mimetype = ['application/x-debian-sourceslist'] @@ -270,7 +270,7 @@ class DebianControlLexer(RegexLexer): .. versionadded:: 0.9 """ name = 'Debian Control file' - aliases = ['control', 'debcontrol'] + aliases = ['debcontrol', 'control'] filenames = ['control'] tokens = { diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py index a06272b..f04d42d 100644 --- a/pygments/lexers/javascript.py +++ b/pygments/lexers/javascript.py @@ -35,8 +35,8 @@ class JavascriptLexer(RegexLexer): """ name = 'JavaScript' - aliases = ['js', 'javascript'] - filenames = ['*.js', '*.jsm', '*.mjs'] + aliases = ['javascript', 'js'] + filenames = ['*.js', '*.jsm', '*.mjs', '*.cjs'] mimetypes = ['application/javascript', 'application/x-javascript', 'text/x-javascript', 'text/javascript'] @@ -81,7 +81,7 @@ class JavascriptLexer(RegexLexer): (r'[})\].]', Punctuation), (r'(for|in|while|do|break|return|continue|switch|case|default|if|else|' r'throw|try|catch|finally|new|delete|typeof|instanceof|void|yield|await|async|' - r'this|of|static|export|import|debugger|extends|super)\b', Keyword, 'slashstartsregex'), + r'this|of|static|export|import|from|as|debugger|extends|super)\b', Keyword, 'slashstartsregex'), (r'(var|let|const|with|function|class)\b', Keyword.Declaration, 'slashstartsregex'), (r'(abstract|boolean|byte|char|double|enum|final|float|goto' r'implements|int|interface|long|native|package|private|protected' @@ -231,13 +231,13 @@ class LiveScriptLexer(RegexLexer): """ For `LiveScript`_ source code. - .. _LiveScript: http://gkz.github.com/LiveScript/ + .. _LiveScript: https://livescript.net/ .. versionadded:: 1.6 """ name = 'LiveScript' - aliases = ['live-script', 'livescript'] + aliases = ['livescript', 'live-script'] filenames = ['*.ls'] mimetypes = ['text/livescript'] @@ -449,7 +449,7 @@ class TypeScriptLexer(RegexLexer): """ name = 'TypeScript' - aliases = ['ts', 'typescript'] + aliases = ['typescript', 'ts'] filenames = ['*.ts', '*.tsx'] mimetypes = ['text/x-typescript'] @@ -486,7 +486,7 @@ class TypeScriptLexer(RegexLexer): (r'(for|in|while|do|break|return|continue|switch|case|default|if|else|' r'throw|try|catch|finally|new|delete|typeof|instanceof|void|of|' r'this|async|await|debugger|yield|abstract|static|import|export|' - r'implements|super|extends|private|protected|public|readonly)\b', + r'from|implements|super|extends|private|protected|public|readonly)\b', Keyword, 'slashstartsregex'), (r'(var|let|const|with|function|class|type|enum|interface)\b', Keyword.Declaration, 'slashstartsregex'), @@ -504,7 +504,7 @@ class TypeScriptLexer(RegexLexer): # Match variable type keywords (r'\b(string|bool|number)\b', Keyword.Type), # Match stuff like: constructor - (r'\b(constructor|declare|interface|as|AS)\b', Keyword.Reserved), + (r'\b(constructor|declare|interface|as)\b', Keyword.Reserved), # Match stuff like: super(argument, list) (r'(super)(\s*)(\([\w,?.$\s]+\s*\))', bygroups(Keyword.Reserved, Text), 'slashstartsregex'), @@ -1033,7 +1033,7 @@ class CoffeeScriptLexer(RegexLexer): """ name = 'CoffeeScript' - aliases = ['coffee-script', 'coffeescript', 'coffee'] + aliases = ['coffeescript', 'coffee-script', 'coffee'] filenames = ['*.coffee'] mimetypes = ['text/coffeescript'] diff --git a/pygments/lexers/julia.py b/pygments/lexers/julia.py index be8c133..390d5d7 100644 --- a/pygments/lexers/julia.py +++ b/pygments/lexers/julia.py @@ -15,12 +15,16 @@ from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, \ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation, Generic from pygments.util import shebang_matches +from pygments.lexers._julia_builtins import OPERATORS_LIST, DOTTED_OPERATORS_LIST, \ + KEYWORD_LIST, BUILTIN_LIST, LITERAL_LIST __all__ = ['JuliaLexer', 'JuliaConsoleLexer'] +# see https://docs.julialang.org/en/v1/manual/variables/#Allowed-Variable-Names allowed_variable = \ - '(?:[a-zA-Z_\u00A1-\U0010ffff]|%s)(?:[a-zA-Z_0-9\u00A1-\U0010ffff])*!*' - + '(?:[a-zA-Z_\u00A1-\U0010ffff][a-zA-Z_0-9!\u00A1-\U0010ffff]*)' +# see https://github.com/JuliaLang/julia/blob/master/src/flisp/julia_opsuffs.h +operator_suffixes = r'[²³¹ʰʲʳʷʸˡˢˣᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁᵂᵃᵇᵈᵉᵍᵏᵐᵒᵖᵗᵘᵛᵝᵞᵟᵠᵡᵢᵣᵤᵥᵦᵧᵨᵩᵪᶜᶠᶥᶦᶫᶰᶸᶻᶿ′″‴‵‶‷⁗⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₐₑₒₓₕₖₗₘₙₚₛₜⱼⱽ]*' class JuliaLexer(RegexLexer): """ @@ -42,21 +46,35 @@ class JuliaLexer(RegexLexer): (r'[^\S\n]+', Text), (r'#=', Comment.Multiline, "blockcomment"), (r'#.*$', Comment), - (r'[\[\]{}(),;]', Punctuation), + (r'[\[\](),;]', Punctuation), + + # symbols + # intercept range expressions first + (r'(' + allowed_variable + r')(\s*)(:)(' + allowed_variable + ')', + bygroups(Name, Text, Operator, Name)), + # then match :name which does not follow closing brackets, digits, or the + # ::, <:, and :> operators + (r'(?\d.])(:' + allowed_variable + ')', String.Symbol), + + # type assertions - excludes expressions like ::typeof(sin) and ::avec[1] + (r'(?<=::)(\s*)(' + allowed_variable + r')\b(?![(\[])', bygroups(Text, Keyword.Type)), + # type comparisons + # - MyType <: A or MyType >: A + ('(' + allowed_variable + r')(\s*)([<>]:)(\s*)(' + allowed_variable + r')\b(?![(\[])', + bygroups(Keyword.Type, Text, Operator, Text, Keyword.Type)), + # - <: B or >: B + (r'([<>]:)(\s*)(' + allowed_variable + r')\b(?![(\[])', + bygroups(Operator, Text, Keyword.Type)), + # - A <: or A >: + (r'\b(' + allowed_variable + r')(\s*)([<>]:)', + bygroups(Keyword.Type, Text, Operator)), - # keywords - (r'in\b', Keyword.Pseudo), - (r'isa\b', Keyword.Pseudo), - (r'(true|false)\b', Keyword.Constant), - (r'(local|global|const)\b', Keyword.Declaration), - (words([ - 'function', 'type', 'typealias', 'abstract', 'immutable', - 'baremodule', 'begin', 'bitstype', 'break', 'catch', 'ccall', - 'continue', 'do', 'else', 'elseif', 'end', 'export', 'finally', - 'for', 'if', 'import', 'importall', 'let', 'macro', 'module', - 'mutable', 'primitive', 'quote', 'return', 'struct', 'try', - 'using', 'while'], - suffix=r'\b'), Keyword), + # operators + # Suffixes aren't actually allowed on all operators, but we'll ignore that + # since those cases are invalid Julia code. + (words([*OPERATORS_LIST, *DOTTED_OPERATORS_LIST], suffix=operator_suffixes), Operator), + (words(['.' + o for o in DOTTED_OPERATORS_LIST], suffix=operator_suffixes), Operator), + (words(['...', '..']), Operator), # NOTE # Patterns below work only for definition sites and thus hardly reliable. @@ -64,160 +82,67 @@ class JuliaLexer(RegexLexer): # functions # (r'(function)(\s+)(' + allowed_variable + ')', # bygroups(Keyword, Text, Name.Function)), - # - # types - # (r'(type|typealias|abstract|immutable)(\s+)(' + allowed_variable + ')', - # bygroups(Keyword, Text, Name.Class)), - - # type names - (words([ - 'ANY', 'ASCIIString', 'AbstractArray', 'AbstractChannel', - 'AbstractFloat', 'AbstractMatrix', 'AbstractRNG', - 'AbstractSparseArray', 'AbstractSparseMatrix', - 'AbstractSparseVector', 'AbstractString', 'AbstractVecOrMat', - 'AbstractVector', 'Any', 'ArgumentError', 'Array', - 'AssertionError', 'Associative', 'Base64DecodePipe', - 'Base64EncodePipe', 'Bidiagonal', 'BigFloat', 'BigInt', - 'BitArray', 'BitMatrix', 'BitVector', 'Bool', 'BoundsError', - 'Box', 'BufferStream', 'CapturedException', 'CartesianIndex', - 'CartesianRange', 'Cchar', 'Cdouble', 'Cfloat', 'Channel', - 'Char', 'Cint', 'Cintmax_t', 'Clong', 'Clonglong', - 'ClusterManager', 'Cmd', 'Coff_t', 'Colon', 'Complex', - 'Complex128', 'Complex32', 'Complex64', 'CompositeException', - 'Condition', 'Cptrdiff_t', 'Cshort', 'Csize_t', 'Cssize_t', - 'Cstring', 'Cuchar', 'Cuint', 'Cuintmax_t', 'Culong', - 'Culonglong', 'Cushort', 'Cwchar_t', 'Cwstring', 'DataType', - 'Date', 'DateTime', 'DenseArray', 'DenseMatrix', - 'DenseVecOrMat', 'DenseVector', 'Diagonal', 'Dict', - 'DimensionMismatch', 'Dims', 'DirectIndexString', 'Display', - 'DivideError', 'DomainError', 'EOFError', 'EachLine', 'Enum', - 'Enumerate', 'ErrorException', 'Exception', 'Expr', - 'Factorization', 'FileMonitor', 'FileOffset', 'Filter', - 'Float16', 'Float32', 'Float64', 'FloatRange', 'Function', - 'GenSym', 'GlobalRef', 'GotoNode', 'HTML', 'Hermitian', 'IO', - 'IOBuffer', 'IOStream', 'IPv4', 'IPv6', 'InexactError', - 'InitError', 'Int', 'Int128', 'Int16', 'Int32', 'Int64', 'Int8', - 'IntSet', 'Integer', 'InterruptException', 'IntrinsicFunction', - 'InvalidStateException', 'Irrational', 'KeyError', 'LabelNode', - 'LambdaStaticData', 'LinSpace', 'LineNumberNode', 'LoadError', - 'LocalProcess', 'LowerTriangular', 'MIME', 'Matrix', - 'MersenneTwister', 'Method', 'MethodError', 'MethodTable', - 'Module', 'NTuple', 'NewvarNode', 'NullException', 'Nullable', - 'Number', 'ObjectIdDict', 'OrdinalRange', 'OutOfMemoryError', - 'OverflowError', 'Pair', 'ParseError', 'PartialQuickSort', - 'Pipe', 'PollingFileWatcher', 'ProcessExitedException', - 'ProcessGroup', 'Ptr', 'QuoteNode', 'RandomDevice', 'Range', - 'Rational', 'RawFD', 'ReadOnlyMemoryError', 'Real', - 'ReentrantLock', 'Ref', 'Regex', 'RegexMatch', - 'RemoteException', 'RemoteRef', 'RepString', 'RevString', - 'RopeString', 'RoundingMode', 'SegmentationFault', - 'SerializationState', 'Set', 'SharedArray', 'SharedMatrix', - 'SharedVector', 'Signed', 'SimpleVector', 'SparseMatrixCSC', - 'StackOverflowError', 'StatStruct', 'StepRange', 'StridedArray', - 'StridedMatrix', 'StridedVecOrMat', 'StridedVector', 'SubArray', - 'SubString', 'SymTridiagonal', 'Symbol', 'SymbolNode', - 'Symmetric', 'SystemError', 'TCPSocket', 'Task', 'Text', - 'TextDisplay', 'Timer', 'TopNode', 'Tridiagonal', 'Tuple', - 'Type', 'TypeConstructor', 'TypeError', 'TypeName', 'TypeVar', - 'UDPSocket', 'UInt', 'UInt128', 'UInt16', 'UInt32', 'UInt64', - 'UInt8', 'UTF16String', 'UTF32String', 'UTF8String', - 'UndefRefError', 'UndefVarError', 'UnicodeError', 'UniformScaling', - 'Union', 'UnitRange', 'Unsigned', 'UpperTriangular', 'Val', - 'Vararg', 'VecOrMat', 'Vector', 'VersionNumber', 'Void', 'WString', - 'WeakKeyDict', 'WeakRef', 'WorkerConfig', 'Zip'], suffix=r'\b'), - Keyword.Type), - - # builtins - (words([ - 'ARGS', 'CPU_CORES', 'C_NULL', 'DevNull', 'ENDIAN_BOM', - 'ENV', 'I', 'Inf', 'Inf16', 'Inf32', 'Inf64', - 'InsertionSort', 'JULIA_HOME', 'LOAD_PATH', 'MergeSort', - 'NaN', 'NaN16', 'NaN32', 'NaN64', 'OS_NAME', - 'QuickSort', 'RoundDown', 'RoundFromZero', 'RoundNearest', - 'RoundNearestTiesAway', 'RoundNearestTiesUp', - 'RoundToZero', 'RoundUp', 'STDERR', 'STDIN', 'STDOUT', - 'VERSION', 'WORD_SIZE', 'catalan', 'e', 'eu', - 'eulergamma', 'golden', 'im', 'nothing', 'pi', 'γ', 'π', 'φ'], - suffix=r'\b'), Name.Builtin), - - # operators - # see: https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm - (words(( - # prec-assignment - '=', ':=', '+=', '-=', '*=', '/=', '//=', './/=', '.*=', './=', - '\\=', '.\\=', '^=', '.^=', '÷=', '.÷=', '%=', '.%=', '|=', '&=', - '$=', '=>', '<<=', '>>=', '>>>=', '~', '.+=', '.-=', - # prec-conditional - '?', - # prec-arrow - '--', '-->', - # prec-lazy-or - '||', - # prec-lazy-and - '&&', - # prec-comparison - '>', '<', '>=', '≥', '<=', '≤', '==', '===', '≡', '!=', '≠', - '!==', '≢', '.>', '.<', '.>=', '.≥', '.<=', '.≤', '.==', '.!=', - '.≠', '.=', '.!', '<:', '>:', '∈', '∉', '∋', '∌', '⊆', - '⊈', '⊂', - '⊄', '⊊', - # prec-pipe - '|>', '<|', - # prec-colon - ':', - # prec-plus - '.+', '.-', '|', '∪', '$', - # prec-bitshift - '<<', '>>', '>>>', '.<<', '.>>', '.>>>', - # prec-times - '*', '/', './', '÷', '.÷', '%', '⋅', '.%', '.*', '\\', '.\\', '&', '∩', - # prec-rational - '//', './/', - # prec-power - '^', '.^', - # prec-decl - '::', - # prec-dot - '.', - # unary op - '+', '-', '!', '√', '∛', '∜', - )), Operator), # chars (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|" r"\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'", String.Char), # try to match trailing transpose - (r'(?<=[.\w)\]])\'+', Operator), - - # strings - (r'"""', String, 'tqstring'), - (r'"', String, 'string'), + (r'(?<=[.\w)\]])(\'' + operator_suffixes + ')+', Operator), + # raw strings + (r'(raw)(""")', bygroups(String.Affix, String), 'tqrawstring'), + (r'(raw)(")', bygroups(String.Affix, String), 'rawstring'), # regular expressions - (r'r"""', String.Regex, 'tqregex'), - (r'r"', String.Regex, 'regex'), + (r'(r)(""")', bygroups(String.Affix, String.Regex), 'tqregex'), + (r'(r)(")', bygroups(String.Affix, String.Regex), 'regex'), + # other strings + (r'(' + allowed_variable + ')?(""")', bygroups(String.Affix, String), 'tqstring'), + (r'(' + allowed_variable + ')?(")', bygroups(String.Affix, String), 'string'), # backticks - (r'`', String.Backtick, 'command'), + (r'(' + allowed_variable + ')?(```)', bygroups(String.Affix, String.Backtick), 'tqcommand'), + (r'(' + allowed_variable + ')?(`)', bygroups(String.Affix, String.Backtick), 'command'), + + # type names + # - names that begin a curly expression + ('(' + allowed_variable + r')(\{)', + bygroups(Keyword.Type, Punctuation), 'curly'), + # - names as part of bare 'where' + (r'(where)(\s+)(' + allowed_variable + ')', + bygroups(Keyword, Text, Keyword.Type)), + # - curly expressions in general + (r'(\{)', Punctuation, 'curly'), + # - names as part of type declaration + (r'(abstract[ \t]+type|primitive[ \t]+type|mutable[ \t]+struct|struct)([\s()]+)(' + + allowed_variable + r')', bygroups(Keyword, Text, Keyword.Type)), + + # macros + (r'@' + allowed_variable, Name.Decorator), + (words([*OPERATORS_LIST, '..', '.', *DOTTED_OPERATORS_LIST], + prefix='@', suffix=operator_suffixes), Name.Decorator), + + # keywords + (words(KEYWORD_LIST, suffix=r'\b'), Keyword), + # builtin types + (words(BUILTIN_LIST, suffix=r'\b'), Keyword.Type), + # builtin literals + (words(LITERAL_LIST, suffix=r'\b'), Name.Builtin), # names (allowed_variable, Name), - (r'@' + allowed_variable, Name.Decorator), # numbers - (r'(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?', Number.Float), - (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float), - (r'\d+(_\d+)+[eEf][+-]?[0-9]+', Number.Float), - (r'\d+[eEf][+-]?[0-9]+', Number.Float), - (r'0b[01]+(_[01]+)+', Number.Bin), - (r'0b[01]+', Number.Bin), - (r'0o[0-7]+(_[0-7]+)+', Number.Oct), - (r'0o[0-7]+', Number.Oct), - (r'0x[a-fA-F0-9]+(_[a-fA-F0-9]+)+', Number.Hex), - (r'0x[a-fA-F0-9]+', Number.Hex), - (r'\d+(_\d+)+', Number.Integer), - (r'\d+', Number.Integer) + (r'(\d+((_\d+)+)?\.(?!\.)(\d+((_\d+)+)?)?|\.\d+((_\d+)+)?)([eEf][+-]?[0-9]+)?', Number.Float), + (r'\d+((_\d+)+)?[eEf][+-]?[0-9]+', Number.Float), + (r'0x[a-fA-F0-9]+((_[a-fA-F0-9]+)+)?(\.([a-fA-F0-9]+((_[a-fA-F0-9]+)+)?)?)?p[+-]?\d+', Number.Float), + (r'0b[01]+((_[01]+)+)?', Number.Bin), + (r'0o[0-7]+((_[0-7]+)+)?', Number.Oct), + (r'0x[a-fA-F0-9]+((_[a-fA-F0-9]+)+)?', Number.Hex), + (r'\d+((_\d+)+)?', Number.Integer), + + # single dot operator matched last to permit e.g. ".1" as a float + (words(['.']), Operator), ], "blockcomment": [ @@ -227,53 +152,80 @@ class JuliaLexer(RegexLexer): (r'[=#]', Comment.Multiline), ], - 'string': [ + 'curly': [ + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), + (allowed_variable, Keyword.Type), + include('root'), + ], + + 'tqrawstring': [ + (r'"""', String, '#pop'), + (r'([^"]|"[^"][^"])+', String), + ], + 'rawstring': [ (r'"', String, '#pop'), - # FIXME: This escape pattern is not perfect. - (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape), - # Interpolation is defined as "$" followed by the shortest full - # expression, which is something we can't parse. - # Include the most common cases here: $word, and $(paren'd expr). + (r'\\"', String.Escape), + (r'([^"\\]|\\[^"])+', String), + ], + + # Interpolation is defined as "$" followed by the shortest full expression, which is + # something we can't parse. + # Include the most common cases here: $word, and $(paren'd expr). + 'interp': [ (r'\$' + allowed_variable, String.Interpol), - # (r'\$[a-zA-Z_]+', String.Interpol), (r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'), + ], + 'in-intp': [ + (r'\(', Punctuation, '#push'), + (r'\)', Punctuation, '#pop'), + include('root'), + ], + + 'string': [ + (r'(")(' + allowed_variable + r'|\d+)?', bygroups(String, String.Affix), '#pop'), + # FIXME: This escape pattern is not perfect. + (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape), + include('interp'), # @printf and @sprintf formats (r'%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]', String.Interpol), - (r'.|\s', String), + (r'[^"$%\\]+', String), + (r'.', String), ], - 'tqstring': [ - (r'"""', String, '#pop'), + (r'(""")(' + allowed_variable + r'|\d+)?', bygroups(String, String.Affix), '#pop'), (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape), - (r'\$' + allowed_variable, String.Interpol), - (r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'), - (r'.|\s', String), + include('interp'), + (r'[^"$%\\]+', String), + (r'.', String), ], 'regex': [ - (r'"', String.Regex, '#pop'), + (r'(")([imsxa]*)?', bygroups(String.Regex, String.Affix), '#pop'), (r'\\"', String.Regex), - (r'.|\s', String.Regex), + (r'[^\\"]+', String.Regex), ], 'tqregex': [ - (r'"""', String.Regex, '#pop'), - (r'.|\s', String.Regex), + (r'(""")([imsxa]*)?', bygroups(String.Regex, String.Affix), '#pop'), + (r'[^"]+', String.Regex), ], 'command': [ - (r'`', String.Backtick, '#pop'), - (r'\$' + allowed_variable, String.Interpol), - (r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'), - (r'.|\s', String.Backtick) + (r'(`)(' + allowed_variable + r'|\d+)?', bygroups(String.Backtick, String.Affix), '#pop'), + (r'\\[`$]', String.Escape), + include('interp'), + (r'[^\\`$]+', String.Backtick), + (r'.', String.Backtick), + ], + 'tqcommand': [ + (r'(```)(' + allowed_variable + r'|\d+)?', bygroups(String.Backtick, String.Affix), '#pop'), + (r'\\\$', String.Escape), + include('interp'), + (r'[^\\`$]+', String.Backtick), + (r'.', String.Backtick), ], - - 'in-intp': [ - (r'\(', Punctuation, '#push'), - (r'\)', Punctuation, '#pop'), - include('root'), - ] } def analyse_text(text): @@ -287,7 +239,7 @@ class JuliaConsoleLexer(Lexer): .. versionadded:: 1.6 """ name = 'Julia console' - aliases = ['jlcon'] + aliases = ['jlcon', 'julia-repl'] def get_tokens_unprocessed(self, text): jllexer = JuliaLexer(**self.options) diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py index f6e1203..2fa2ea4 100644 --- a/pygments/lexers/jvm.py +++ b/pygments/lexers/jvm.py @@ -156,226 +156,278 @@ class ScalaLexer(RegexLexer): flags = re.MULTILINE | re.DOTALL - # don't use raw unicode strings! - op = ('[-~\\^\\*!%&\\\\<>\\|+=:/?@\u00a6-\u00a7\u00a9\u00ac\u00ae\u00b0-\u00b1' - '\u00b6\u00d7\u00f7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9' - '\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2' - '\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38' - '\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940' - '\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c' - '\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118' - '\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144' - '\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767' - '\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb' - '\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020' - '\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3' - '\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff' - '\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66' - '\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+') - - letter = ('[a-zA-Z\\$_\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6' - '\u00f8-\u02af\u0370-\u0373\u0376-\u0377\u037b-\u037d\u0386' - '\u0388-\u03f5\u03f7-\u0481\u048a-\u0556\u0561-\u0587\u05d0-\u05f2' - '\u0621-\u063f\u0641-\u064a\u066e-\u066f\u0671-\u06d3\u06d5' - '\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5' - '\u07b1\u07ca-\u07ea\u0904-\u0939\u093d\u0950\u0958-\u0961' - '\u0972-\u097f\u0985-\u09b9\u09bd\u09ce\u09dc-\u09e1\u09f0-\u09f1' - '\u0a05-\u0a39\u0a59-\u0a5e\u0a72-\u0a74\u0a85-\u0ab9\u0abd' - '\u0ad0-\u0ae1\u0b05-\u0b39\u0b3d\u0b5c-\u0b61\u0b71\u0b83-\u0bb9' - '\u0bd0\u0c05-\u0c3d\u0c58-\u0c61\u0c85-\u0cb9\u0cbd\u0cde-\u0ce1' - '\u0d05-\u0d3d\u0d60-\u0d61\u0d7a-\u0d7f\u0d85-\u0dc6\u0e01-\u0e30' - '\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0eb0\u0eb2-\u0eb3\u0ebd-\u0ec4' - '\u0edc-\u0f00\u0f40-\u0f6c\u0f88-\u0f8b\u1000-\u102a\u103f' - '\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070' - '\u1075-\u1081\u108e\u10a0-\u10fa\u1100-\u135a\u1380-\u138f' - '\u13a0-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u16ee-\u1711' - '\u1720-\u1731\u1740-\u1751\u1760-\u1770\u1780-\u17b3\u17dc' - '\u1820-\u1842\u1844-\u18a8\u18aa-\u191c\u1950-\u19a9\u19c1-\u19c7' - '\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf' - '\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c77\u1d00-\u1d2b\u1d62-\u1d77' - '\u1d79-\u1d9a\u1e00-\u1fbc\u1fbe\u1fc2-\u1fcc\u1fd0-\u1fdb' - '\u1fe0-\u1fec\u1ff2-\u1ffc\u2071\u207f\u2102\u2107\u210a-\u2113' - '\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139' - '\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c7c' - '\u2c80-\u2ce4\u2d00-\u2d65\u2d80-\u2dde\u3006-\u3007\u3021-\u3029' - '\u3038-\u303a\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff-\u318e' - '\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\ua014\ua016-\ua48c' - '\ua500-\ua60b\ua610-\ua61f\ua62a-\ua66e\ua680-\ua697\ua722-\ua76f' - '\ua771-\ua787\ua78b-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822' - '\ua840-\ua873\ua882-\ua8b3\ua90a-\ua925\ua930-\ua946\uaa00-\uaa28' - '\uaa40-\uaa42\uaa44-\uaa4b\uac00-\ud7a3\uf900-\ufb1d\ufb1f-\ufb28' - '\ufb2a-\ufd3d\ufd50-\ufdfb\ufe70-\ufefc\uff21-\uff3a\uff41-\uff5a' - '\uff66-\uff6f\uff71-\uff9d\uffa0-\uffdc]') - - upper = ('[A-Z\\$_\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108' - '\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c' - '\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130' - '\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145' - '\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a' - '\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e' - '\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182' - '\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194' - '\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7' - '\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc' - '\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9' - '\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee' - '\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204' - '\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218' - '\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c' - '\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246' - '\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f' - '\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0' - '\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7' - '\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a' - '\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e' - '\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a' - '\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae' - '\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1' - '\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6' - '\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea' - '\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe' - '\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512' - '\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556' - '\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e' - '\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22' - '\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36' - '\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a' - '\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e' - '\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72' - '\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86' - '\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2' - '\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6' - '\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca' - '\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede' - '\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2' - '\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d' - '\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f' - '\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb' - '\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112' - '\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133' - '\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67' - '\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86' - '\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a' - '\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae' - '\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2' - '\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6' - '\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646' - '\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a' - '\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682' - '\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696' - '\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736' - '\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a' - '\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e' - '\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b' - '\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]') - - idrest = '%s(?:%s|[0-9])*(?:(?<=_)%s)?' % (letter, letter, op) - letter_letter_digit = '%s(?:%s|\\d)*' % (letter, letter) + opchar = '[!#%&*\\-\\/:?@^' + uni.combine('Sm', 'So') + ']' + letter = '[_\\$' + uni.combine('Ll', 'Lu', 'Lo', 'Nl', 'Lt') + ']' + upperLetter = '[' + uni.combine('Lu', 'Lt') + ']' + letterOrDigit = '(?:%s|[0-9])' % letter + letterOrDigitNoDollarSign = '(?:%s|[0-9])' % letter.replace('\\$', '') + alphaId = '%s+' % letter + simpleInterpolatedVariable = '%s%s*' % (letter, letterOrDigitNoDollarSign) + idrest = '%s%s*(?:(?<=_)%s+)?' % (letter, letterOrDigit, opchar) + idUpper = '%s%s*(?:(?<=_)%s+)?' % (upperLetter, letterOrDigit, opchar) + plainid = '(?:%s|%s+)' % (idrest, opchar) + backQuotedId = r'`[^`]+`' + anyId = r'(?:%s|%s)' % (plainid, backQuotedId) + notStartOfComment = r'(?!//|/\*)' + endOfLineMaybeWithComment = r'(?=\s*(//|$))' + + keywords = ( + 'new', 'return', 'throw', 'classOf', 'isInstanceOf', 'asInstanceOf', + 'else', 'if', 'then', 'do', 'while', 'for', 'yield', 'match', 'case', + 'catch', 'finally', 'try' + ) + + operators = ( + '<%', '=:=', '<:<', '<%<', '>:', '<:', '=', '==', '!=', '<=', '>=', + '<>', '<', '>', '<-', '←', '->', '→', '=>', '⇒', '?', '@', '|', '-', + '+', '*', '%', '~' + ) + + storage_modifiers = ( + 'private', 'protected', 'synchronized', '@volatile', 'abstract', + 'final', 'lazy', 'sealed', 'implicit', 'override', '@transient', + '@native' + ) tokens = { 'root': [ - # method names - (r'(class|trait|object)(\s+)', bygroups(Keyword, Text), 'class'), - (r'[^\S\n]+', Text), - include('comments'), - (r'@%s' % idrest, Name.Decorator), - (r'(abstract|ca(?:se|tch)|d(?:ef|o)|e(?:lse|xtends)|' - r'f(?:inal(?:ly)?|or(?:Some)?)|i(?:f|mplicit)|' - r'lazy|match|new|override|pr(?:ivate|otected)' - r'|re(?:quires|turn)|s(?:ealed|uper)|' - r't(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\b|' - r'(<[%:-]|=>|>:|[#=@_\u21D2\u2190])\b', Keyword), - (r':(?!%s)' % op, Keyword, 'type'), - (r'%s%s\b' % (upper, idrest), Name.Class), - (r'(true|false|null)\b', Keyword.Constant), - (r'(import|package)(\s+)', bygroups(Keyword, Text), 'import'), - (r'(type)(\s+)', bygroups(Keyword, Text), 'type'), - (r'""".*?"""(?!")', String), - (r'"(\\\\|\\[^\\]|[^"\\])*"', String), - (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char), - (r"'%s" % idrest, Text.Symbol), - (r'[fs]"""', String, 'interptriplestring'), # interpolated strings - (r'[fs]"', String, 'interpstring'), # interpolated strings - (r'raw"(\\\\|\\[^\\]|[^"\\])*"', String), # raw strings - # (r'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator, - # Name.Attribute)), - (idrest, Name), - (r'`[^`]+`', Name), - (r'\[', Operator, 'typeparam'), - (r'[(){};,.#]', Operator), - (op, Operator), - (r'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?', - Number.Float), - (r'0x[0-9a-fA-F]+', Number.Hex), - (r'[0-9]+L?', Number.Integer), - (r'\n', Text) - ], - 'class': [ - (r'(%s|%s|`[^`]+`)(\s*)(\[)' % (idrest, op), - bygroups(Name.Class, Text, Operator), ('#pop', 'typeparam')), - (r'\s+', Text), + include('whitespace'), include('comments'), - (r'\{', Operator, '#pop'), - (r'\(', Operator, '#pop'), - (r'%s|%s|`[^`]+`' % (idrest, op), Name.Class, '#pop'), + include('script-header'), + include('imports'), + include('exports'), + include('storage-modifiers'), + include('annotations'), + include('using'), + include('declarations'), + include('inheritance'), + include('extension'), + include('end'), + include('constants'), + include('strings'), + include('symbols'), + include('singleton-type'), + include('inline'), + include('quoted'), + include('keywords'), + include('operators'), + include('punctuation'), + include('names'), ], - 'type': [ - (r'\s+', Text), - include('comments'), - (r'<[%:]|>:|[#_]|\bforSome\b|\btype\b', Keyword), - (r'([,);}]|=>|=|\u21d2)(\s*)', bygroups(Operator, Text), '#pop'), - (r'[({]', Operator, '#push'), - (r'((?:%s|%s|`[^`]+`)(?:\.(?:%s|%s|`[^`]+`))*)(\s*)(\[)' % - (idrest, op, idrest, op), - bygroups(Keyword.Type, Text, Operator), ('#pop', 'typeparam')), - (r'((?:%s|%s|`[^`]+`)(?:\.(?:%s|%s|`[^`]+`))*)(\s*)$' % - (idrest, op, idrest, op), - bygroups(Keyword.Type, Text), '#pop'), - (r'\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type) - ], - 'typeparam': [ + + # Includes: + 'whitespace': [ (r'\s+', Text), - include('comments'), - (r',+', Punctuation), - (r'<[%:]|=>|>:|[#_\u21D2]|\bforSome\b|\btype\b', Keyword), - (r'([\])}])', Operator, '#pop'), - (r'[(\[{]', Operator, '#push'), - (r'\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type) ], 'comments': [ (r'//.*?\n', Comment.Single), (r'/\*', Comment.Multiline, 'comment'), ], + 'script-header': [ + (r'^#!([^\n]*)$', Comment.Hashbang), + ], + 'imports': [ + (r'\b(import)(\s+)', bygroups(Keyword, Text), 'import-path'), + ], + 'exports': [ + (r'\b(export)(\s+)(given)(\s+)', + bygroups(Keyword, Text, Keyword, Text), 'export-path'), + (r'\b(export)(\s+)', bygroups(Keyword, Text), 'export-path'), + ], + 'storage-modifiers': [ + (words(storage_modifiers, prefix=r'\b', suffix=r'\b'), Keyword), + # Only highlight soft modifiers if they are eventually followed by + # the correct keyword. Note that soft modifiers can be followed by a + # sequence of regular modifiers; [a-z\s]* skips those, and we just + # check that the soft modifier is applied to a supported statement. + (r'\b(transparent|opaque|infix|open|inline)\b(?=[a-z\s]*\b' + r'(def|val|var|given|type|class|trait|object|enum)\b)', Keyword), + ], + 'annotations': [ + (r'@%s' % idrest, Name.Decorator), + ], + 'using': [ + # using is a soft keyword, can only be used in the first position of + # a parameter or argument list. + (r'(\()(\s*)(using)(\s)', bygroups(Punctuation, Text, Keyword, Text)), + ], + 'declarations': [ + (r'\b(def)\b(\s*)%s(%s)?' % (notStartOfComment, anyId), + bygroups(Keyword, Text, Name.Function)), + (r'\b(trait)\b(\s*)%s(%s)?' % (notStartOfComment, anyId), + bygroups(Keyword, Text, Name.Class)), + (r'\b(?:(case)(\s+))?(class|object|enum)\b(\s*)%s(%s)?' % + (notStartOfComment, anyId), + bygroups(Keyword, Text, Keyword, Text, Name.Class)), + (r'(?)|(?=%s)|(?="))?' % + (idUpper, backQuotedId, plainid), + bygroups(Keyword, Text, Name.Class)), + ], + 'extension': [ + (r'\b(extension)(\s+)(?=[\[\(])', bygroups(Keyword, Text)), + ], + 'end': [ + # end is a soft keyword, should only be highlighted in certain cases + (r'\b(end)(\s+)(if|while|for|match|new|extension|val|var)\b', + bygroups(Keyword, Text, Keyword)), + (r'\b(end)(\s+)(%s)%s' % (idUpper, endOfLineMaybeWithComment), + bygroups(Keyword, Text, Name.Class)), + (r'\b(end)(\s+)(%s|%s)?%s' % + (backQuotedId, plainid, endOfLineMaybeWithComment), + bygroups(Keyword, Text, Name.Namespace)), + ], + 'punctuation': [ + (r'[{}()\[\];,.]', Punctuation), + (r'(?', Operator), + (r'\}', Punctuation, '#pop'), + (r',', Punctuation), + (r'[\[\]]', Punctuation), + include('qualified-name'), + ], + 'export-path': [ + (r'(?<=[\n;:])', Text, '#pop'), + include('comments'), + include('qualified-name'), + (r'\{', Punctuation, 'export-path-curly-brace'), ], - 'interptriplestring': [ + 'export-path-curly-brace': [ + include('whitespace'), + include('comments'), + (r'=>', Operator), + (r'\}', Punctuation, '#pop'), + (r',', Punctuation), + include('qualified-name'), + ], + 'package': [ + (r'(?<=[\n;])', Text, '#pop'), + (r':', Punctuation, '#pop'), + include('comments'), + include('qualified-name'), + ], + 'interpolated-string-triple': [ (r'"""(?!")', String, '#pop'), (r'"', String), - include('interpstringcommon'), + include('interpolated-string-common'), ], - 'interpstring': [ + 'interpolated-string': [ (r'"', String, '#pop'), - include('interpstringcommon'), + include('interpolated-string-common'), ], - 'interpbrace': [ + 'interpolated-string-brace': [ (r'\}', String.Interpol, '#pop'), - (r'\{', String.Interpol, '#push'), + (r'\{', Punctuation, 'interpolated-string-nested-brace'), include('root'), ], + 'interpolated-string-nested-brace': [ + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), + include('root'), + ], + + # Helpers + 'qualified-name': [ + (idUpper, Name.Class), + (r'(%s)(\.)' % anyId, bygroups(Name.Namespace, Punctuation)), + (r'\.', Punctuation), + (anyId, Name), + (r'[^\S\n]+', Text), + ], + 'interpolated-string-common': [ + (r'[^"$\\]+', String), + (r'\$\$', String.Escape), + (r'(\$)(%s)' % simpleInterpolatedVariable, + bygroups(String.Interpol, Name)), + (r'\$\{', String.Interpol, 'interpolated-string-brace'), + (r'\\.', String), + ], } @@ -497,18 +549,24 @@ class GroovyLexer(RegexLexer): default('base'), ], 'base': [ - # method names - (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments - r'([a-zA-Z_]\w*)' # method name - r'(\s*)(\()', # signature start - bygroups(using(this), Name.Function, Text, Operator)), (r'[^\S\n]+', Text), (r'//.*?\n', Comment.Single), (r'/\*.*?\*/', Comment.Multiline), - (r'@[a-zA-Z_][\w.]*', Name.Decorator), + # keywords: go before method names to avoid lexing "throw new XYZ" + # as a method signature (r'(assert|break|case|catch|continue|default|do|else|finally|for|' r'if|goto|instanceof|new|return|switch|this|throw|try|while|in|as)\b', Keyword), + # method names + (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments + r'(' + r'[a-zA-Z_]\w*' # method name + r'|"(?:\\\\|\\[^\\]|[^"\\])*"' # or double-quoted method name + r"|'(?:\\\\|\\[^\\]|[^'\\])*'" # or single-quoted method name + r')' + r'(\s*)(\()', # signature start + bygroups(using(this), Name.Function, Text, Operator)), + (r'@[a-zA-Z_][\w.]*', Name.Decorator), (r'(abstract|const|enum|extends|final|implements|native|private|' r'protected|public|static|strictfp|super|synchronized|throws|' r'transient|volatile)\b', Keyword.Declaration), diff --git a/pygments/lexers/kuin.py b/pygments/lexers/kuin.py new file mode 100644 index 0000000..5800db9 --- /dev/null +++ b/pygments/lexers/kuin.py @@ -0,0 +1,299 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.kuin + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for the Kuin language. +""" + +from pygments.lexer import RegexLexer, include, using, inherit, this, bygroups, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, Number, Punctuation + +__all__ = ['KuinLexer'] + +class KuinLexer(RegexLexer): + """ + For `Kuin `_ source code + + .. versionadded:: 2.9 + """ + name = 'Kuin' + aliases = ['kuin'] + filenames = ['*.kn'] + + tokens = { + 'root': [ + include('statement'), + ], + 'statement': [ + # Whitespace / Comment + include('whitespace'), + + # Block-statement + (r'(\+?[ \t]*\*?[ \t]*\bfunc)([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*)', bygroups(Keyword, using(this), Name.Function), 'func_'), + (r'\b(class)([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*)', bygroups(Keyword, using(this), Name.Class), 'class_'), + (r'\b(enum)([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*)', bygroups(Keyword, using(this), Name.Constant), 'enum_'), + (r'\b(block)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?', bygroups(Keyword, using(this), Name.Other), 'block_'), + (r'\b(ifdef)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?', bygroups(Keyword, using(this), Name.Other), 'ifdef_'), + (r'\b(if)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?', bygroups(Keyword, using(this), Name.Other), 'if_'), + (r'\b(switch)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?', bygroups(Keyword, using(this), Name.Other), 'switch_'), + (r'\b(while)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?', bygroups(Keyword, using(this), Name.Other), 'while_'), + (r'\b(for)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?', bygroups(Keyword, using(this), Name.Other), 'for_'), + (r'\b(foreach)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?', bygroups(Keyword, using(this), Name.Other), 'foreach_'), + (r'\b(try)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?', bygroups(Keyword, using(this), Name.Other), 'try_'), + + # Line-statement + (r'\b(do)\b', Keyword, 'do'), + (r'(\+?[ \t]*\bvar)\b', Keyword, 'var'), + (r'\b(const)\b', Keyword, 'const'), + (r'\b(ret)\b', Keyword, 'ret'), + (r'\b(throw)\b', Keyword, 'throw'), + (r'\b(alias)\b', Keyword, 'alias'), + (r'\b(assert)\b', Keyword, 'assert'), + (r'\|', Text, 'continued_line'), + (r'[ \t]*\n', Text), + ], + + # Whitespace / Comment + 'whitespace': [ + (r'^[ \t]*;.*', Comment.Single), + (r'[ \t]+(?![; \t])', Text), + (r'\{', Comment.Multiline, 'multiline_comment'), + ], + 'multiline_comment': [ + (r'\{', Comment.Multiline, 'multiline_comment'), + (r'(?:\s*;.*|[^{}\n]+)', Comment.Multiline), + (r'\n', Comment.Multiline), + (r'\}', Comment.Multiline, '#pop'), + ], + + # Block-statement + 'func_': [ + include('expr'), + (r'\n', Text, 'func'), + ], + 'func': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(func)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + include('statement'), + ], + 'class_': [ + include('expr'), + (r'\n', Text, 'class'), + ], + 'class': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(class)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + include('statement'), + ], + 'enum_': [ + include('expr'), + (r'\n', Text, 'enum'), + ], + 'enum': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(enum)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + include('expr'), + (r'\n', Text), + ], + 'block_': [ + include('expr'), + (r'\n', Text, 'block'), + ], + 'block': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(block)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + include('statement'), + include('break'), + include('skip'), + ], + 'ifdef_': [ + include('expr'), + (r'\n', Text, 'ifdef'), + ], + 'ifdef': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(ifdef)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + (words(('rls', 'dbg'), prefix=r'\b', suffix=r'\b'), Keyword.Constant, 'ifdef_sp'), + include('statement'), + include('break'), + include('skip'), + ], + 'ifdef_sp': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + 'if_': [ + include('expr'), + (r'\n', Text, 'if'), + ], + 'if': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(if)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + (words(('elif', 'else'), prefix=r'\b', suffix=r'\b'), Keyword, 'if_sp'), + include('statement'), + include('break'), + include('skip'), + ], + 'if_sp': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + 'switch_': [ + include('expr'), + (r'\n', Text, 'switch'), + ], + 'switch': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(switch)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + (words(('case', 'default', 'to'), prefix=r'\b', suffix=r'\b'), Keyword, 'switch_sp'), + include('statement'), + include('break'), + include('skip'), + ], + 'switch_sp': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + 'while_': [ + include('expr'), + (r'\n', Text, 'while'), + ], + 'while': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(while)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + include('statement'), + include('break'), + include('skip'), + ], + 'for_': [ + include('expr'), + (r'\n', Text, 'for'), + ], + 'for': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(for)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + include('statement'), + include('break'), + include('skip'), + ], + 'foreach_': [ + include('expr'), + (r'\n', Text, 'foreach'), + ], + 'foreach': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(foreach)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + include('statement'), + include('break'), + include('skip'), + ], + 'try_': [ + include('expr'), + (r'\n', Text, 'try'), + ], + 'try': [ + (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(try)\b', bygroups(Keyword, using(this), Keyword), '#pop:2'), + (words(('catch', 'finally', 'to'), prefix=r'\b', suffix=r'\b'), Keyword, 'try_sp'), + include('statement'), + include('break'), + include('skip'), + ], + 'try_sp': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + + # Line-statement + 'break': [ + (r'\b(break)\b([ \t]+)([a-zA-Z_][0-9a-zA-Z_]*)', bygroups(Keyword, using(this), Name.Other)), + ], + 'skip': [ + (r'\b(skip)\b([ \t]+)([a-zA-Z_][0-9a-zA-Z_]*)', bygroups(Keyword, using(this), Name.Other)), + ], + 'alias': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + 'assert': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + 'const': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + 'do': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + 'ret': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + 'throw': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + 'var': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + 'continued_line': [ + include('expr'), + (r'\n', Text, '#pop'), + ], + + 'expr': [ + # Whitespace / Comment + include('whitespace'), + + # Punctuation + (r'\(', Punctuation,), + (r'\)', Punctuation,), + (r'\[', Punctuation,), + (r'\]', Punctuation,), + (r',', Punctuation), + + # Keyword + (words(( + 'true', 'false', 'null', 'inf' + ), prefix=r'\b', suffix=r'\b'), Keyword.Constant), + (words(( + 'me' + ), prefix=r'\b', suffix=r'\b'), Keyword), + (words(( + 'bit16', 'bit32', 'bit64', 'bit8', 'bool', + 'char', 'class', 'dict', 'enum', 'float', 'func', + 'int', 'list', 'queue', 'stack' + ), prefix=r'\b', suffix=r'\b'), Keyword.Type), + + # Number + (r'\b[0-9]\.[0-9]+(?!\.)(:?e[\+-][0-9]+)?\b', Number.Float), + (r'\b2#[01]+(?:b(?:8|16|32|64))?\b', Number.Bin), + (r'\b8#[0-7]+(?:b(?:8|16|32|64))?\b', Number.Oct), + (r'\b16#[0-9A-F]+(?:b(?:8|16|32|64))?\b', Number.Hex), + (r'\b[0-9]+(?:b(?:8|16|32|64))?\b', Number.Decimal), + + # String / Char + (r'"', String.Double, 'string'), + (r"'(?:\\.|.)+?'", String.Char), + + # Operator + (r'(?:\.|\$(?:>|<)?)', Operator), + (r'(?:\^)', Operator), + (r'(?:\+|-|!|##?)', Operator), + (r'(?:\*|/|%)', Operator), + (r'(?:~)', Operator), + (r'(?:(?:=|<>)(?:&|\$)?|<=?|>=?)', Operator), + (r'(?:&)', Operator), + (r'(?:\|)', Operator), + (r'(?:\?)', Operator), + (r'(?::(?::|\+|-|\*|/|%|\^|~)?)', Operator), + + # Identifier + (r"\b([a-zA-Z_][0-9a-zA-Z_]*)(?=@)\b", Name), + (r"(@)?\b([a-zA-Z_][0-9a-zA-Z_]*)\b", bygroups(Name.Other, Name.Variable)), + ], + + # String + 'string': [ + (r'(?:\\[^{\n]|[^"\\])+', String.Double), + (r'\\\{', String.Double, 'toStrInString'), + (r'"', String.Double, '#pop'), + ], + 'toStrInString': [ + include('expr'), + (r'\}', String.Double, '#pop'), + ], + } diff --git a/pygments/lexers/lisp.py b/pygments/lexers/lisp.py index 531c66a..14f52b8 100644 --- a/pygments/lexers/lisp.py +++ b/pygments/lexers/lisp.py @@ -1536,7 +1536,7 @@ class EmacsLispLexer(RegexLexer): .. versionadded:: 2.1 """ name = 'EmacsLisp' - aliases = ['emacs', 'elisp', 'emacs-lisp'] + aliases = ['emacs-lisp', 'elisp', 'emacs'] filenames = ['*.el'] mimetypes = ['text/x-elisp', 'application/x-elisp'] diff --git a/pygments/lexers/markup.py b/pygments/lexers/markup.py index e3cc817..3317d1b 100644 --- a/pygments/lexers/markup.py +++ b/pygments/lexers/markup.py @@ -121,7 +121,7 @@ class RstLexer(RegexLexer): .. versionadded:: 0.8 """ name = 'reStructuredText' - aliases = ['rst', 'rest', 'restructuredtext'] + aliases = ['restructuredtext', 'rst', 'rest'] filenames = ['*.rst', '*.rest'] mimetypes = ["text/x-rst", "text/prs.fallenstein.rst"] flags = re.MULTILINE @@ -501,8 +501,8 @@ class MarkdownLexer(RegexLexer): .. versionadded:: 2.2 """ - name = 'markdown' - aliases = ['md', 'markdown'] + name = 'Markdown' + aliases = ['markdown', 'md'] filenames = ['*.md', '*.markdown'] mimetypes = ["text/x-markdown"] flags = re.MULTILINE diff --git a/pygments/lexers/matlab.py b/pygments/lexers/matlab.py index 7a72eed..e12303d 100644 --- a/pygments/lexers/matlab.py +++ b/pygments/lexers/matlab.py @@ -20,7 +20,6 @@ from pygments.lexers import _scilab_builtins __all__ = ['MatlabLexer', 'MatlabSessionLexer', 'OctaveLexer', 'ScilabLexer'] - class MatlabLexer(RegexLexer): """ For Matlab source code. @@ -2783,8 +2782,8 @@ class MatlabSessionLexer(Lexer): # Set leading spaces with the length of the prompt to be a generic prompt # This keeps code aligned when prompts are removed, say with some Javascript if line.startswith(' '*line_start): - insertions.append((len(curcode), - [(0, Generic.Prompt, line[:line_start])])) + insertions.append( + (len(curcode), [(0, Generic.Prompt, line[:line_start])])) curcode += line[line_start:] else: curcode += line @@ -3146,18 +3145,21 @@ class OctaveLexer(RegexLexer): tokens = { 'root': [ - # We should look into multiline comments + (r'%\{\s*\n', Comment.Multiline, 'percentblockcomment'), + (r'#\{\s*\n', Comment.Multiline, 'hashblockcomment'), (r'[%#].*$', Comment), (r'^\s*function\b', Keyword, 'deffunc'), # from 'iskeyword' on hg changeset 8cc154f45e37 (words(( - '__FILE__', '__LINE__', 'break', 'case', 'catch', 'classdef', 'continue', 'do', 'else', - 'elseif', 'end', 'end_try_catch', 'end_unwind_protect', 'endclassdef', - 'endevents', 'endfor', 'endfunction', 'endif', 'endmethods', 'endproperties', - 'endswitch', 'endwhile', 'events', 'for', 'function', 'get', 'global', 'if', 'methods', - 'otherwise', 'persistent', 'properties', 'return', 'set', 'static', 'switch', 'try', - 'until', 'unwind_protect', 'unwind_protect_cleanup', 'while'), suffix=r'\b'), + '__FILE__', '__LINE__', 'break', 'case', 'catch', 'classdef', + 'continue', 'do', 'else', 'elseif', 'end', 'end_try_catch', + 'end_unwind_protect', 'endclassdef', 'endevents', 'endfor', + 'endfunction', 'endif', 'endmethods', 'endproperties', 'endswitch', + 'endwhile', 'events', 'for', 'function', 'get', 'global', 'if', + 'methods', 'otherwise', 'persistent', 'properties', 'return', + 'set', 'static', 'switch', 'try', 'until', 'unwind_protect', + 'unwind_protect_cleanup', 'while'), suffix=r'\b'), Keyword), (words(builtin_kw + command_kw + function_kw + loadable_kw + mapping_kw, @@ -3191,8 +3193,19 @@ class OctaveLexer(RegexLexer): (r'(?>|:=|[-~+/*%=<>&^|.]', Operator), (r'[]{}:(),;[]', Punctuation), (r'(in|is|and|or|not)\b', Operator.Word), @@ -168,7 +169,6 @@ class PythonLexer(RegexLexer): include('magicfuncs'), include('magicvars'), include('name'), - include('numbers'), ], 'expr-inside-fstring': [ (r'[{([]', Punctuation, 'expr-inside-fstring-inner'), @@ -845,14 +845,14 @@ class CythonLexer(RegexLexer): ], 'builtins': [ (words(( - '__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', + '__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', 'bint', 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals', 'long', 'map', 'max', - 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'property', + 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'Py_ssize_t', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'unsigned', diff --git a/pygments/lexers/resource.py b/pygments/lexers/resource.py index 2cbacbc..3ed176a 100644 --- a/pygments/lexers/resource.py +++ b/pygments/lexers/resource.py @@ -24,7 +24,7 @@ class ResourceLexer(RegexLexer): .. versionadded:: 2.0 """ name = 'ResourceBundle' - aliases = ['resource', 'resourcebundle'] + aliases = ['resourcebundle', 'resource'] filenames = [] _types = (':table', ':array', ':string', ':bin', ':import', ':intvector', diff --git a/pygments/lexers/rnc.py b/pygments/lexers/rnc.py index ffb95f3..cc8950a 100644 --- a/pygments/lexers/rnc.py +++ b/pygments/lexers/rnc.py @@ -23,7 +23,7 @@ class RNCCompactLexer(RegexLexer): """ name = 'Relax-NG Compact' - aliases = ['rnc', 'rng-compact'] + aliases = ['rng-compact', 'rnc'] filenames = ['*.rnc'] tokens = { diff --git a/pygments/lexers/ruby.py b/pygments/lexers/ruby.py index 71b5a89..2c3e7bd 100644 --- a/pygments/lexers/ruby.py +++ b/pygments/lexers/ruby.py @@ -33,7 +33,7 @@ class RubyLexer(ExtendedRegexLexer): """ name = 'Ruby' - aliases = ['rb', 'ruby', 'duby'] + aliases = ['ruby', 'rb', 'duby'] filenames = ['*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx', '*.duby', 'Gemfile'] mimetypes = ['text/x-ruby', 'application/x-ruby'] diff --git a/pygments/lexers/rust.py b/pygments/lexers/rust.py index 3a162b0..6cb8291 100644 --- a/pygments/lexers/rust.py +++ b/pygments/lexers/rust.py @@ -135,7 +135,7 @@ class RustLexer(RegexLexer): # String literals (r'b"', String, 'bytestring'), (r'"', String, 'string'), - (r'b?r(#*)".*?"\1', String), + (r'(?s)b?r(#*)".*?"\1', String), # Lifetime names (r"'", Operator, 'lifetime'), @@ -152,6 +152,11 @@ class RustLexer(RegexLexer): # Attributes (r'#!?\[', Comment.Preproc, 'attribute['), + + # Misc + # Lone hashes: not used in Rust syntax, but allowed in macro + # arguments, most famously for quote::quote!() + (r'#', Text), ], 'comment': [ (r'[^*/]+', Comment.Multiline), diff --git a/pygments/lexers/scripting.py b/pygments/lexers/scripting.py index 7f92eb1..47d066f 100644 --- a/pygments/lexers/scripting.py +++ b/pygments/lexers/scripting.py @@ -168,9 +168,9 @@ class MoonScriptLexer(LuaLexer): .. versionadded:: 1.5 """ - name = "MoonScript" - aliases = ["moon", "moonscript"] - filenames = ["*.moon"] + name = 'MoonScript' + aliases = ['moonscript', 'moon'] + filenames = ['*.moon'] mimetypes = ['text/x-moonscript', 'application/x-moonscript'] tokens = { @@ -237,7 +237,7 @@ class ChaiscriptLexer(RegexLexer): """ name = 'ChaiScript' - aliases = ['chai', 'chaiscript'] + aliases = ['chaiscript', 'chai'] filenames = ['*.chai'] mimetypes = ['text/x-chaiscript', 'application/x-chaiscript'] @@ -1236,9 +1236,9 @@ class MiniScriptLexer(RegexLexer): .. versionadded:: 2.6 """ - name = "MiniScript" - aliases = ["ms", "miniscript"] - filenames = ["*.ms"] + name = 'MiniScript' + aliases = ['miniscript', 'ms'] + filenames = ['*.ms'] mimetypes = ['text/x-minicript', 'application/x-miniscript'] tokens = { diff --git a/pygments/lexers/shell.py b/pygments/lexers/shell.py index 6283a11..5539e81 100644 --- a/pygments/lexers/shell.py +++ b/pygments/lexers/shell.py @@ -238,7 +238,7 @@ class BatchLexer(RegexLexer): .. versionadded:: 0.7 """ name = 'Batchfile' - aliases = ['bat', 'batch', 'dosbatch', 'winbatch'] + aliases = ['batch', 'bat', 'dosbatch', 'winbatch'] filenames = ['*.bat', '*.cmd'] mimetypes = ['application/x-dos-batch'] @@ -730,7 +730,7 @@ class PowerShellLexer(RegexLexer): (r'\[[a-z_\[][\w. `,\[\]]*\]', Name.Constant), # .net [type]s (r'-[a-z_]\w*', Name), (r'\w+', Name), - (r'[.,;@{}\[\]$()=+*/\\&%!~?^`|<>-]|::', Punctuation), + (r'[.,;:@{}\[\]$()=+*/\\&%!~?^`|<>-]', Punctuation), ], 'child': [ (r'\)', Punctuation, '#pop'), diff --git a/pygments/lexers/supercollider.py b/pygments/lexers/supercollider.py index 5129e9b..724674f 100644 --- a/pygments/lexers/supercollider.py +++ b/pygments/lexers/supercollider.py @@ -25,7 +25,7 @@ class SuperColliderLexer(RegexLexer): """ name = 'SuperCollider' - aliases = ['sc', 'supercollider'] + aliases = ['supercollider', 'sc'] filenames = ['*.sc', '*.scd'] mimetypes = ['application/supercollider', 'text/supercollider', ] diff --git a/pygments/lexers/teal.py b/pygments/lexers/teal.py new file mode 100644 index 0000000..393000a --- /dev/null +++ b/pygments/lexers/teal.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.teal + ~~~~~~~~~~~~~~~~~~~~ + + Lexer for TEAL. + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, bygroups, include, words +from pygments.token import Comment, Name, Number, String, Text, Keyword + +__all__ = ['TealLexer'] + +class TealLexer(RegexLexer): + """ + For the `Transaction Execution Approval Language (TEAL) + ` + + For more information about the grammar, see: + https://github.com/algorand/go-algorand/blob/master/data/transactions/logic/assembler.go + + .. versionadded:: 2.9 + """ + name = 'teal' + aliases = ['teal'] + filenames = ['*.teal'] + + keywords = words({ + 'Sender', 'Fee', 'FirstValid', 'FirstValidTime', 'LastValid', 'Note', + 'Lease', 'Receiver', 'Amount', 'CloseRemainderTo', 'VotePK', + 'SelectionPK', 'VoteFirst', 'VoteLast', 'VoteKeyDilution', 'Type', + 'TypeEnum', 'XferAsset', 'AssetAmount', 'AssetSender', 'AssetReceiver', + 'AssetCloseTo', 'GroupIndex', 'TxID', 'ApplicationID', 'OnCompletion', + 'ApplicationArgs', 'NumAppArgs', 'Accounts', 'NumAccounts', + 'ApprovalProgram', 'ClearStateProgram', 'RekeyTo', 'ConfigAsset', + 'ConfigAssetTotal', 'ConfigAssetDecimals', 'ConfigAssetDefaultFrozen', + 'ConfigAssetUnitName', 'ConfigAssetName', 'ConfigAssetURL', + 'ConfigAssetMetadataHash', 'ConfigAssetManager', 'ConfigAssetReserve', + 'ConfigAssetFreeze', 'ConfigAssetClawback', 'FreezeAsset', + 'FreezeAssetAccount', 'FreezeAssetFrozen', + 'NoOp', 'OptIn', 'CloseOut', 'ClearState', 'UpdateApplication', + 'DeleteApplication', + 'MinTxnFee', 'MinBalance', 'MaxTxnLife', 'ZeroAddress', 'GroupSize', + 'LogicSigVersion', 'Round', 'LatestTimestamp', 'CurrentApplicationID', + 'AssetBalance', 'AssetFrozen', + 'AssetTotal', 'AssetDecimals', 'AssetDefaultFrozen', 'AssetUnitName', + 'AssetName', 'AssetURL', 'AssetMetadataHash', 'AssetManager', + 'AssetReserve', 'AssetFreeze', 'AssetClawback', + }, suffix = r'\b') + + identifier = r'[^ \t\n]+(?=\/\/)|[^ \t\n]+' + newline = r'\r?\n' + tokens = { + 'root': [ + include('whitespace'), + # pragmas match specifically on the space character + (r'^#pragma .*' + newline, Comment.Directive), + # labels must be followed by a space, + # but anything after that is ignored + ('(' + identifier + ':' + ')' + '([ \t].*)', + bygroups(Name.Label, Comment.Single)), + (identifier, Name.Function, 'function-args'), + ], + 'function-args': [ + include('whitespace'), + (r'"', String, 'string'), + (r'(b(?:ase)?(?:32|64) ?)(\(?[a-zA-Z0-9+/=]+\)?)', + bygroups(String.Affix, String.Other)), + (r'[A-Z2-7]{58}', Number), # address + (r'0x[\da-fA-F]+', Number.Hex), + (r'\d+', Number.Integer), + (keywords, Keyword), + (identifier, Name.Attributes), # branch targets + (newline, Text, '#pop'), + ], + 'string': [ + (r'\\(?:["nrt\\]|x\d\d)', String.Escape), + (r'[^\\\"\n]+', String), + (r'"', String, '#pop'), + ], + 'whitespace': [ + (r'[ \t]+', Text), + (r'//[^\n]+', Comment.Single), + ], + } diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py index 15ea0ec..3ac190f 100644 --- a/pygments/lexers/templates.py +++ b/pygments/lexers/templates.py @@ -267,11 +267,11 @@ class VelocityLexer(RegexLexer): def analyse_text(text): rv = 0.0 - if re.search(r'#\{?macro\}?\(.*?\).*?#\{?end\}?', text): + if re.search(r'#\{?macro\}?\(.*?\).*?#\{?end\}?', text, re.DOTALL): rv += 0.25 - if re.search(r'#\{?if\}?\(.+?\).*?#\{?end\}?', text): + if re.search(r'#\{?if\}?\(.+?\).*?#\{?end\}?', text, re.DOTALL): rv += 0.15 - if re.search(r'#\{?foreach\}?\(.+?\).*?#\{?end\}?', text): + if re.search(r'#\{?foreach\}?\(.+?\).*?#\{?end\}?', text, re.DOTALL): rv += 0.15 if re.search(r'\$!?\{?[a-zA-Z_]\w*(\([^)]*\))?' r'(\.\w+(\([^)]*\))?)*\}?', text): @@ -489,7 +489,7 @@ class MyghtyJavascriptLexer(DelegatingLexer): """ name = 'JavaScript+Myghty' - aliases = ['js+myghty', 'javascript+myghty'] + aliases = ['javascript+myghty', 'js+myghty'] mimetypes = ['application/x-javascript+myghty', 'text/x-javascript+myghty', 'text/javascript+mygthy'] @@ -679,7 +679,7 @@ class MakoJavascriptLexer(DelegatingLexer): """ name = 'JavaScript+Mako' - aliases = ['js+mako', 'javascript+mako'] + aliases = ['javascript+mako', 'js+mako'] mimetypes = ['application/x-javascript+mako', 'text/x-javascript+mako', 'text/javascript+mako'] @@ -798,8 +798,8 @@ class CheetahJavascriptLexer(DelegatingLexer): """ name = 'JavaScript+Cheetah' - aliases = ['js+cheetah', 'javascript+cheetah', - 'js+spitfire', 'javascript+spitfire'] + aliases = ['javascript+cheetah', 'js+cheetah', + 'javascript+spitfire', 'js+spitfire'] mimetypes = ['application/x-javascript+cheetah', 'text/x-javascript+cheetah', 'text/javascript+cheetah', @@ -1026,7 +1026,7 @@ class XmlErbLexer(DelegatingLexer): """ name = 'XML+Ruby' - aliases = ['xml+erb', 'xml+ruby'] + aliases = ['xml+ruby', 'xml+erb'] alias_filenames = ['*.xml'] mimetypes = ['application/xml+ruby'] @@ -1046,7 +1046,7 @@ class CssErbLexer(DelegatingLexer): """ name = 'CSS+Ruby' - aliases = ['css+erb', 'css+ruby'] + aliases = ['css+ruby', 'css+erb'] alias_filenames = ['*.css'] mimetypes = ['text/css+ruby'] @@ -1064,7 +1064,7 @@ class JavascriptErbLexer(DelegatingLexer): """ name = 'JavaScript+Ruby' - aliases = ['js+erb', 'javascript+erb', 'js+ruby', 'javascript+ruby'] + aliases = ['javascript+ruby', 'js+ruby', 'javascript+erb', 'js+erb'] alias_filenames = ['*.js'] mimetypes = ['application/x-javascript+ruby', 'text/x-javascript+ruby', @@ -1147,7 +1147,7 @@ class JavascriptPhpLexer(DelegatingLexer): """ name = 'JavaScript+PHP' - aliases = ['js+php', 'javascript+php'] + aliases = ['javascript+php', 'js+php'] alias_filenames = ['*.js'] mimetypes = ['application/x-javascript+php', 'text/x-javascript+php', @@ -1229,7 +1229,7 @@ class JavascriptSmartyLexer(DelegatingLexer): """ name = 'JavaScript+Smarty' - aliases = ['js+smarty', 'javascript+smarty'] + aliases = ['javascript+smarty', 'js+smarty'] alias_filenames = ['*.js', '*.tpl'] mimetypes = ['application/x-javascript+smarty', 'text/x-javascript+smarty', @@ -1311,8 +1311,8 @@ class JavascriptDjangoLexer(DelegatingLexer): """ name = 'JavaScript+Django/Jinja' - aliases = ['js+django', 'javascript+django', - 'js+jinja', 'javascript+jinja'] + aliases = ['javascript+django', 'js+django', + 'javascript+jinja', 'js+jinja'] alias_filenames = ['*.js'] mimetypes = ['application/x-javascript+django', 'application/x-javascript+jinja', @@ -1750,7 +1750,7 @@ class LassoJavascriptLexer(DelegatingLexer): """ name = 'JavaScript+Lasso' - aliases = ['js+lasso', 'javascript+lasso'] + aliases = ['javascript+lasso', 'js+lasso'] alias_filenames = ['*.js'] mimetypes = ['application/x-javascript+lasso', 'text/x-javascript+lasso', diff --git a/pygments/lexers/teraterm.py b/pygments/lexers/teraterm.py index d09c66f..feb552d 100644 --- a/pygments/lexers/teraterm.py +++ b/pygments/lexers/teraterm.py @@ -24,7 +24,7 @@ class TeraTermLexer(RegexLexer): .. versionadded:: 2.4 """ name = 'Tera Term macro' - aliases = ['ttl', 'teraterm', 'teratermmacro'] + aliases = ['teratermmacro', 'teraterm', 'ttl'] filenames = ['*.ttl'] mimetypes = ['text/x-teratermmacro'] diff --git a/pygments/lexers/testing.py b/pygments/lexers/testing.py index 81c4297..9111a1c 100644 --- a/pygments/lexers/testing.py +++ b/pygments/lexers/testing.py @@ -21,7 +21,7 @@ class GherkinLexer(RegexLexer): .. versionadded:: 1.2 """ name = 'Gherkin' - aliases = ['cucumber', 'gherkin'] + aliases = ['gherkin', 'cucumber'] filenames = ['*.feature'] mimetypes = ['text/x-gherkin'] diff --git a/pygments/lexers/theorem.py b/pygments/lexers/theorem.py index eee1126..ec55a32 100644 --- a/pygments/lexers/theorem.py +++ b/pygments/lexers/theorem.py @@ -43,6 +43,7 @@ class CoqLexer(RegexLexer): 'Canonical', 'Coercion', 'Theorem', 'Lemma', 'Corollary', 'Proposition', 'Fact', 'Remark', 'Example', 'Proof', 'Goal', 'Save', 'Qed', 'Defined', 'Hint', 'Resolve', 'Rewrite', 'View', 'Search', + 'Abort', 'Admitted', 'Show', 'Print', 'Printing', 'All', 'Graph', 'Projections', 'inside', 'outside', 'Check', 'Global', 'Instance', 'Class', 'Existing', 'Universe', 'Polymorphic', 'Monomorphic', 'Context' @@ -55,7 +56,7 @@ class CoqLexer(RegexLexer): ) keywords3 = ( # Sorts - 'Type', 'Prop', + 'Type', 'Prop', 'SProp', ) keywords4 = ( # Tactics @@ -94,7 +95,8 @@ class CoqLexer(RegexLexer): '<->', '=', '>', '>]', r'>\}', r'\?', r'\?\?', r'\[', r'\[<', r'\[>', r'\[\|', ']', '_', '`', r'\{', r'\{<', r'\|', r'\|]', r'\}', '~', '=>', r'/\\', r'\\/', r'\{\|', r'\|\}', - 'Π', 'λ', + # 'Π', 'Σ', # Not defined in the standard library + 'λ', '¬', '∧', '∨', '∀', '∃', '→', '↔', '≠', '≤', '≥', ) operators = r'[!$%&*+\./:<=>?@^|~-]' prefix_syms = r'[!?~]' diff --git a/pygments/lexers/thingsdb.py b/pygments/lexers/thingsdb.py new file mode 100644 index 0000000..37f64e5 --- /dev/null +++ b/pygments/lexers/thingsdb.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.thingsdb + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the ThingsDB language. + + :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +from pygments.lexer import RegexLexer, include, bygroups +from pygments.token import Comment, Keyword, Name, Number, String, Text, \ + Operator, Punctuation, Whitespace + +__all__ = ['ThingsDBLexer'] + + +class ThingsDBLexer(RegexLexer): + """ + Lexer for the ThingsDB programming language. + + .. versionadded:: 2.9 + """ + name = 'ThingsDB' + aliases = ['ti', 'thingsdb'] + filenames = ['*.ti'] + + tokens = { + 'root': [ + include('expression'), + ], + 'expression': [ + include('comments'), + include('whitespace'), + + # numbers + (r'[-+]?0b[01]+', Number.Bin), + (r'[-+]?0o[0-8]+', Number.Octal), + (r'([-+]?0x[0-9a-fA-F]+)', Number.Hex), + (r'[-+]?[0-9]+', Number.Integer), + (r'[-+]?((inf|nan)([^0-9A-Za-z_]|$)|[0-9]*\.[0-9]+(e[+-][0-9]+)?)', + Number.Float), + + # strings + (r'(?:"(?:[^"]*)")+', String.Double), + (r"(?:'(?:[^']*)')+", String.Single), + + # literals + (r'(true|false|nil)\b', Keyword.Constant), + + # regular expressions + (r'(/[^/\\]*(?:\\.[^/\\]*)*/i?)', String.Regex), + + # thing id's + (r'#[0-9]+', Comment.Preproc), + + # name, assignments and functions + include('names'), + + (r'[(){}\[\],;]', Punctuation), + (r'[+\-*/%&|<>^!~@=:?]', Operator), + ], + 'names': [ + (r'(\.)' + r'(add|call|contains|del|endswith|extend|filter|find|findindex|' + r'get|has|id|indexof|keys|len|lower|map|pop|push|remove|set|sort|' + r'splice|startswith|test|unwrap|upper|values|wrap)' + r'(\()', + bygroups(Name.Function, Name.Function, Punctuation), 'arguments'), + (r'(array|assert|assert_err|auth_err|backup_info|backups_info|' + r'bad_data_err|bool|closure|collection_info|collections_info|' + r'counters|deep|del_backup|del_collection|del_expired|del_node|' + r'del_procedure|del_token|del_type|del_user|err|float|' + r'forbidden_err|grant|int|isarray|isascii|isbool|isbytes|iserr|' + r'isfloat|isinf|isint|islist|isnan|isnil|israw|isset|isstr|' + r'isthing|istuple|isutf8|lookup_err|max_quota_err|mod_type|new|' + r'new_backup|new_collection|new_node|new_procedure|new_token|' + r'new_type|new_user|node_err|node_info|nodes_info|now|' + r'num_arguments_err|operation_err|overflow_err|procedure_doc|' + r'procedure_info|procedures_info|raise|refs|rename_collection|' + r'rename_user|reset_counters|return|revoke|run|set_log_level|set|' + r'set_quota|set_type|shutdown|str|syntax_err|thing|try|type|' + r'type_err|type_count|type_info|types_info|user_info|users_info|' + r'value_err|wse|zero_div_err)' + r'(\()', + bygroups(Name.Function, Punctuation), + 'arguments'), + (r'(\.[A-Za-z_][0-9A-Za-z_]*)' + r'(\s*)(=)', + bygroups(Name.Attribute, Text, Operator)), + (r'\.[A-Za-z_][0-9A-Za-z_]*', Name.Attribute), + (r'([A-Za-z_][0-9A-Za-z_]*)(\s*)(=)', + bygroups(Name.Variable, Text, Operator)), + (r'[A-Za-z_][0-9A-Za-z_]*', Name.Variable), + ], + 'whitespace': [ + (r'\n', Whitespace), + (r'\s+', Whitespace), + ], + 'comments': [ + (r'//(.*?)\n', Comment.Single), + (r'/\*', Comment.Multiline, 'comment'), + ], + 'comment': [ + (r'[^*/]+', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline), + ], + 'arguments': [ + include('expression'), + (',', Punctuation), + (r'\(', Punctuation, '#push'), + (r'\)', Punctuation, '#pop'), + ], + } diff --git a/pygments/lexers/trafficscript.py b/pygments/lexers/trafficscript.py index 088258a..e796a27 100644 --- a/pygments/lexers/trafficscript.py +++ b/pygments/lexers/trafficscript.py @@ -23,7 +23,7 @@ class RtsLexer(RegexLexer): .. versionadded:: 2.1 """ name = 'TrafficScript' - aliases = ['rts','trafficscript'] + aliases = ['trafficscript', 'rts'] filenames = ['*.rts'] tokens = { diff --git a/pygments/lexers/webassembly.py b/pygments/lexers/webassembly.py new file mode 100644 index 0000000..d162a46 --- /dev/null +++ b/pygments/lexers/webassembly.py @@ -0,0 +1,120 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.webassembly + ~~~~~~~~~~~~~~~~~~~ + + Lexers for the WebAssembly text format. + + The grammar can be found at https://github.com/WebAssembly/spec/blob/master/interpreter/README.md + and https://webassembly.github.io/spec/core/text/. + + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, words, bygroups, default +from pygments.token import Text, Comment, Operator, Keyword, String, Number, Punctuation, Literal, Error, Name + +__all__ = ['WatLexer'] + +keywords = ( + 'module', 'import', 'func', 'funcref', 'start', 'param', 'local', 'type', + 'result', 'export', 'memory', 'global', 'mut', 'data', 'table', 'elem', + 'if', 'then', 'else', 'end', 'block', 'loop' +) + +builtins = ( + 'unreachable', 'nop', 'block', 'loop', 'if', 'else', 'end', 'br', 'br_if', + 'br_table', 'return', 'call', 'call_indirect', 'drop', 'select', + 'local.get', 'local.set', 'local.tee', 'global.get', 'global.set', + 'i32.load', 'i64.load', 'f32.load', 'f64.load', 'i32.load8_s', + 'i32.load8_u', 'i32.load16_s', 'i32.load16_u', 'i64.load8_s', + 'i64.load8_u', 'i64.load16_s', 'i64.load16_u', 'i64.load32_s', + 'i64.load32_u', 'i32.store', 'i64.store', 'f32.store', 'f64.store', + 'i32.store8', 'i32.store16', 'i64.store8', 'i64.store16', 'i64.store32', + 'memory.size', 'memory.grow', 'i32.const', 'i64.const', 'f32.const', + 'f64.const', 'i32.eqz', 'i32.eq', 'i32.ne', 'i32.lt_s', 'i32.lt_u', + 'i32.gt_s', 'i32.gt_u', 'i32.le_s', 'i32.le_u', 'i32.ge_s', 'i32.ge_u', + 'i64.eqz', 'i64.eq', 'i64.ne', 'i64.lt_s', 'i64.lt_u', 'i64.gt_s', + 'i64.gt_u', 'i64.le_s', 'i64.le_u', 'i64.ge_s', 'i64.ge_u', 'f32.eq', + 'f32.ne', 'f32.lt', 'f32.gt', 'f32.le', 'f32.ge', 'f64.eq', 'f64.ne', + 'f64.lt', 'f64.gt', 'f64.le', 'f64.ge', 'i32.clz', 'i32.ctz', 'i32.popcnt', + 'i32.add', 'i32.sub', 'i32.mul', 'i32.div_s', 'i32.div_u', 'i32.rem_s', + 'i32.rem_u', 'i32.and', 'i32.or', 'i32.xor', 'i32.shl', 'i32.shr_s', + 'i32.shr_u', 'i32.rotl', 'i32.rotr', 'i64.clz', 'i64.ctz', 'i64.popcnt', + 'i64.add', 'i64.sub', 'i64.mul', 'i64.div_s', 'i64.div_u', 'i64.rem_s', + 'i64.rem_u', 'i64.and', 'i64.or', 'i64.xor', 'i64.shl', 'i64.shr_s', + 'i64.shr_u', 'i64.rotl', 'i64.rotr', 'f32.abs', 'f32.neg', 'f32.ceil', + 'f32.floor', 'f32.trunc', 'f32.nearest', 'f32.sqrt', 'f32.add', 'f32.sub', + 'f32.mul', 'f32.div', 'f32.min', 'f32.max', 'f32.copysign', 'f64.abs', + 'f64.neg', 'f64.ceil', 'f64.floor', 'f64.trunc', 'f64.nearest', 'f64.sqrt', + 'f64.add', 'f64.sub', 'f64.mul', 'f64.div', 'f64.min', 'f64.max', + 'f64.copysign', 'i32.wrap_i64', 'i32.trunc_f32_s', 'i32.trunc_f32_u', + 'i32.trunc_f64_s', 'i32.trunc_f64_u', 'i64.extend_i32_s', + 'i64.extend_i32_u', 'i64.trunc_f32_s', 'i64.trunc_f32_u', + 'i64.trunc_f64_s', 'i64.trunc_f64_u', 'f32.convert_i32_s', + 'f32.convert_i32_u', 'f32.convert_i64_s', 'f32.convert_i64_u', + 'f32.demote_f64', 'f64.convert_i32_s', 'f64.convert_i32_u', + 'f64.convert_i64_s', 'f64.convert_i64_u', 'f64.promote_f32', + 'i32.reinterpret_f32', 'i64.reinterpret_f64', 'f32.reinterpret_i32', + 'f64.reinterpret_i64', +) + + +class WatLexer(RegexLexer): + """Lexer for the `WebAssembly text format `_. + + .. versionadded:: 2.9 + """ + + name = 'WebAssembly' + aliases = ['wast', 'wat'] + filenames = ['*.wat', '*.wast'] + + tokens = { + 'root': [ + (words(keywords, suffix=r'(?=[^a-z_\.])'), Keyword), + (words(builtins), Name.Builtin, 'arguments'), + (words(['i32', 'i64', 'f32', 'f64']), Keyword.Type), + (r'\$[A-Za-z0-9!#$%&\'*+./:<=>?@\\^_`|~-]+', Name.Variable), # yes, all of the are valid in identifiers + (r';;.*?$', Comment.Single), + (r'\(;', Comment.Multiline, 'nesting_comment'), + (r'[+-]?0x[\dA-Fa-f](_?[\dA-Fa-f])*(.([\dA-Fa-f](_?[\dA-Fa-f])*)?)?([pP][+-]?[\dA-Fa-f](_?[\dA-Fa-f])*)?', Number.Float), + (r'[+-]?\d.\d(_?\d)*[eE][+-]?\d(_?\d)*', Number.Float), + (r'[+-]?\d.\d(_?\d)*', Number.Float), + (r'[+-]?\d.[eE][+-]?\d(_?\d)*', Number.Float), + (r'[+-]?(inf|nan:0x[\dA-Fa-f](_?[\dA-Fa-f])*|nan)', Number.Float), + (r'[+-]?0x[\dA-Fa-f](_?[\dA-Fa-f])*', Number.Hex), + (r'[+-]?\d(_?\d)*', Number.Integer), + (r'[\(\)]', Punctuation), + (r'"', String.Double, 'string'), + (r'\s+', Text), + ], + 'nesting_comment': [ + (r'\(;', Comment.Multiline, '#push'), + (r';\)', Comment.Multiline, '#pop'), + (r'[^;(]+', Comment.Multiline), + (r'[;(]', Comment.Multiline), + ], + 'string': [ + (r'\\[\dA-Fa-f][\dA-Fa-f]', String.Escape), # must have exactly two hex digits + (r'\\t', String.Escape), + (r'\\n', String.Escape), + (r'\\r', String.Escape), + (r'\\"', String.Escape), + (r"\\'", String.Escape), + (r'\\u\{[\dA-Fa-f](_?[\dA-Fa-f])*\}', String.Escape), + (r'\\\\', String.Escape), + (r'"', String.Double, '#pop'), + (r'[^"\\]+', String.Double), + ], + 'arguments': [ + (r'\s+', Text), + (r'(offset)(=)(0x[\dA-Fa-f](_?[\dA-Fa-f])*)', bygroups(Keyword, Operator, Number.Hex)), + (r'(offset)(=)(\d(_?\d)*)', bygroups(Keyword, Operator, Number.Integer)), + (r'(align)(=)(0x[\dA-Fa-f](_?[\dA-Fa-f])*)', bygroups(Keyword, Operator, Number.Hex)), + (r'(align)(=)(\d(_?\d)*)', bygroups(Keyword, Operator, Number.Integer)), + default('#pop'), + ] + } diff --git a/pygments/style.py b/pygments/style.py index 3bf2b15..8ed0594 100644 --- a/pygments/style.py +++ b/pygments/style.py @@ -134,7 +134,7 @@ class StyleMeta(type): color = _ansimap[color] bgcolor = t[4] if bgcolor in _deprecated_ansicolors: - bgcolor = _deprecated_ansicolors[color] + bgcolor = _deprecated_ansicolors[bgcolor] if bgcolor in ansicolors: bgansicolor = bgcolor bgcolor = _ansimap[bgcolor] diff --git a/pygments/styles/__init__.py b/pygments/styles/__init__.py index e0cd196..50f6cb6 100644 --- a/pygments/styles/__init__.py +++ b/pygments/styles/__init__.py @@ -52,6 +52,8 @@ STYLE_MAP = { 'stata-dark': 'stata_dark::StataDarkStyle', 'inkpot': 'inkpot::InkPotStyle', 'zenburn': 'zenburn::ZenburnStyle', + 'gruvbox-dark': 'gruvbox::GruvboxDarkStyle', + 'gruvbox-light': 'gruvbox::GruvboxLightStyle', } diff --git a/pygments/styles/friendly.py b/pygments/styles/friendly.py index 86dd514..82f2479 100644 --- a/pygments/styles/friendly.py +++ b/pygments/styles/friendly.py @@ -20,6 +20,7 @@ class FriendlyStyle(Style): background_color = "#f0f0f0" default_style = "" + line_number_color = "#666666" styles = { Whitespace: "#bbbbbb", diff --git a/pygments/styles/gruvbox.py b/pygments/styles/gruvbox.py new file mode 100644 index 0000000..ddf05ea --- /dev/null +++ b/pygments/styles/gruvbox.py @@ -0,0 +1,107 @@ +""" + pygments.styles.gruvbox + ~~~~~~~~~~~~~~~~~~~~~~~ + + pygments version of the "gruvbox" vim theme. + https://github.com/morhetz/gruvbox + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.style import Style +from pygments.token import Keyword, Name, Comment, String, Error, \ + Number, Operator, Generic + + +class GruvboxDarkStyle(Style): + """ + Pygments version of the "gruvbox" dark vim theme. + """ + + background_color = '#282828' + highlight_color = '#ebdbb2' + + styles = { + Comment: 'italic #928374', + Comment.PreProc: '#8ec07c', + Comment.Special: 'bold italic #ebdbb2', + + Keyword: '#fb4934', + Operator.Word: '#fb4934', + + String: '#b8bb26', + String.Escape: '#fe8019', + + Number: '#d3869b', + + Name.Builtin: '#fe8019', + Name.Variable: '#83a598', + Name.Constant: '#d3869b', + Name.Class: '#8ec07c', + Name.Function: '#8ec07c', + Name.Namespace: '#8ec07c', + Name.Exception: '#fb4934', + Name.Tag: '#8ec07c', + Name.Attribute: '#fabd2f', + Name.Decorator: '#fb4934', + + Generic.Heading: 'bold #ebdbb2', + Generic.Subheading: 'underline #ebdbb2', + Generic.Deleted: 'bg:#fb4934 #282828', + Generic.Inserted: 'bg:#b8bb26 #282828', + Generic.Error: '#fb4934', + Generic.Emph: 'italic', + Generic.Strong: 'bold', + Generic.Prompt: '#a89984', + Generic.Output: '#f2e5bc', + Generic.Traceback: '#fb4934', + + Error: 'bg:#fb4934 #282828' + } + +class GruvboxLightStyle(Style): + """ + Pygments version of the "gruvbox" Light vim theme. + """ + + background_color = '#fbf1c7' + highlight_color = '#3c3836' + + styles = { + Comment: 'italic #928374', + Comment.PreProc: '#427b58', + Comment.Special: 'bold italic #3c3836', + + Keyword: '#9d0006', + Operator.Word: '#9d0006', + + String: '#79740e', + String.Escape: '#af3a03', + + Number: '#8f3f71', + + Name.Builtin: '#af3a03', + Name.Variable: '#076678', + Name.Constant: '#8f3f71', + Name.Class: '#427b58', + Name.Function: '#427b58', + Name.Namespace: '#427b58', + Name.Exception: '#9d0006', + Name.Tag: '#427b58', + Name.Attribute: '#b57614', + Name.Decorator: '#9d0006', + + Generic.Heading: 'bold #3c3836', + Generic.Subheading: 'underline #3c3836', + Generic.Deleted: 'bg:#9d0006 #fbf1c7', + Generic.Inserted: 'bg:#79740e #fbf1c7', + Generic.Error: '#9d0006', + Generic.Emph: 'italic', + Generic.Strong: 'bold', + Generic.Prompt: '#7c6f64', + Generic.Output: '#32302f', + Generic.Traceback: '#9d0006', + + Error: 'bg:#9d0006 #fbf1c7' + } diff --git a/pygments/styles/native.py b/pygments/styles/native.py index d990389..9c2f2c1 100644 --- a/pygments/styles/native.py +++ b/pygments/styles/native.py @@ -20,6 +20,7 @@ class NativeStyle(Style): background_color = '#202020' highlight_color = '#404040' + line_number_color = '#aaaaaa' styles = { Token: '#d0d0d0', diff --git a/tests/examplefiles/amdgpu/amdgpu.isa b/tests/examplefiles/amdgpu/amdgpu.isa index fdab33c..672fdcc 100644 --- a/tests/examplefiles/amdgpu/amdgpu.isa +++ b/tests/examplefiles/amdgpu/amdgpu.isa @@ -7,4 +7,5 @@ v_mov_b32 v2, s3 v_addc_u32 v2, vcc, v2, 0, vcc v_add_u32 v3, vcc, s0, v0 v_mov_b32 v4, s1 -v_addc_u32 v4, vcc, v4, 0, vcc \ No newline at end of file +v_addc_u32 v4, vcc, v4, 0, vcc +buffer_load_dword v4, v2, s[8:11], 0 offen \ No newline at end of file diff --git a/tests/examplefiles/amdgpu/amdgpu.isa.output b/tests/examplefiles/amdgpu/amdgpu.isa.output index d8f1c0f..6b9e052 100644 --- a/tests/examplefiles/amdgpu/amdgpu.isa.output +++ b/tests/examplefiles/amdgpu/amdgpu.isa.output @@ -128,3 +128,22 @@ ' ' Text.Whitespace 'vcc' Name.Variable '\n' Text.Whitespace + +'buffer_load_dword' Keyword.Reserved +' ' Text.Whitespace +'v4' Name.Variable +',' Text +' ' Text.Whitespace +'v2' Name.Variable +',' Text +' ' Text.Whitespace +'s' Name.Variable +'[' Text +'8:11' Name.Attribute +']' Text +',' Text +' ' Text.Whitespace +'0' Literal.Number.Integer +' ' Text.Whitespace +'offen' Name.Attribute +'\n' Text.Whitespace diff --git a/tests/examplefiles/apdl/example1apdl.ans b/tests/examplefiles/apdl/example1apdl.ans new file mode 100644 index 0000000..232dbd7 --- /dev/null +++ b/tests/examplefiles/apdl/example1apdl.ans @@ -0,0 +1,53 @@ +finish +/clear + +/title, Thermal Stress Example +/prep7 ! Enter preprocessor +*VOPER,test + +k,1,0,0 ! Keypoints +k,2,1,0 + +l,1,2 ! Line connecting keypoints + +et,1,link33 ! Element type +r,1,4e-4, ! Area +mp,kxx,1,60.5 ! Thermal conductivity + +esize,0.1 ! Element size +lmesh,all ! Mesh line +physics,write,thermal ! Write physics environment as thermal +physics,clear ! Clear the environment + + +etchg,tts ! Element type +mp,ex,1,200e9 ! Young's modulus +mp,prxy,1,0.3 ! Poisson's ratio +mp,alpx,1,12e-6 ! Expansion coefficient +physics,write,struct ! Write physics environment as struct +physics,clear +finish + +/solu ! Enter the solution phase +antype,0 ! Static analysis +physics,read,thermal ! Read in the thermal environment +dk,1,temp,348 ! Apply a temp of 75 to keypoint 1 + +solve +finish + +/solu ! Re-enter the solution phase +physics,read,struct ! Read in the struct environment + +ldread,temp,,,,,,rth ! Apply loads derived from thermal environment +tref,273 + +dk,1,all,0 ! Apply structural constraints +dk,2,UX,0 + +solve +finish + +/post1 ! Enter postprocessor +etable,CompStress,LS,1 ! Create an element table for link stress +PRETAB,CompStress ! Print the element table diff --git a/tests/examplefiles/apdl/example1apdl.ans.output b/tests/examplefiles/apdl/example1apdl.ans.output new file mode 100644 index 0000000..2c3e925 --- /dev/null +++ b/tests/examplefiles/apdl/example1apdl.ans.output @@ -0,0 +1,285 @@ +'finish' Keyword +'\n' Text + +'/' Operator +'clear' Name.Variable +'\n\n' Text + +'/' Operator +'title' Name.Variable +',' Punctuation +' ' Text +'Thermal' Name.Variable +' ' Text +'Stress' Name.Variable +' ' Text +'Example' Name.Variable +'\n' Text + +'/' Operator +'prep7' Name.Variable +'\t\t\t\t\t' Text +'! Enter preprocessor\n' Comment + +'*' Operator +'VOPER' Name.Variable +',' Punctuation +'test' Name.Variable +'\n\n' Text + +'k' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'0' Literal.Number.Integer +',' Punctuation +'0' Literal.Number.Integer +'\t\t\t\t\t' Text +'! Keypoints\n' Comment + +'k' Keyword +',' Punctuation +'2' Literal.Number.Integer +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'0' Literal.Number.Integer +'\n\n' Text + +'l' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'2' Literal.Number.Integer +'\t\t\t\t\t' Text +'! Line connecting keypoints\n' Comment + +'\n' Text + +'et' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'link33' Name.Variable +'\t\t\t\t' Text +'! Element type\n' Comment + +'r' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'4e-4' Literal.Number.Float +',' Punctuation +'\t\t\t\t' Text +'! Area\n' Comment + +'mp' Keyword +',' Punctuation +'kxx' Name.Variable +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'6' Literal.Number.Integer +'0.5' Literal.Number.Float +'\t\t\t\t' Text +'! Thermal conductivity\n' Comment + +'\n' Text + +'esize' Keyword +',' Punctuation +'0.1' Literal.Number.Float +'\t\t\t\t' Text +'! Element size\n' Comment + +'lmesh' Keyword +',' Punctuation +'all' Name.Variable +'\t\t\t\t' Text +'! Mesh line\n' Comment + +'physics' Keyword +',' Punctuation +'write' Keyword +',' Punctuation +'thermal' Name.Variable +'\t\t\t' Text +'! Write physics environment as thermal\n' Comment + +'physics' Keyword +',' Punctuation +'clear' Name.Variable +'\t\t\t\t' Text +'! Clear the environment\n' Comment + +'\n\n' Text + +'etchg' Keyword +',' Punctuation +'tts' Name.Variable +'\t\t\t\t' Text +'! Element type\t\t\t\t\n' Comment + +'mp' Keyword +',' Punctuation +'ex' Name.Variable +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'20' Literal.Number.Integer +'0e9' Literal.Number.Float +'\t\t\t\t' Text +"! Young's modulus\n" Comment + +'mp' Keyword +',' Punctuation +'prxy' Name.Variable +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'0.3' Literal.Number.Float +'\t\t\t\t' Text +"! Poisson's ratio\n" Comment + +'mp' Keyword +',' Punctuation +'alpx' Name.Variable +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'1' Literal.Number.Integer +'2e-6' Literal.Number.Float +'\t\t\t\t' Text +'! Expansion coefficient\n' Comment + +'physics' Keyword +',' Punctuation +'write' Keyword +',' Punctuation +'struct' Name.Variable +'\t\t\t' Text +'! Write physics environment as struct\n' Comment + +'physics' Keyword +',' Punctuation +'clear' Name.Variable +'\n' Text + +'finish' Keyword +'\n\n' Text + +'/' Operator +'solu' Keyword +'\t\t\t\t\t' Text +'! Enter the solution phase\n' Comment + +'antype' Keyword +',' Punctuation +'0' Literal.Number.Integer +'\t\t\t\t' Text +'! Static analysis\n' Comment + +'physics' Keyword +',' Punctuation +'read' Keyword +',' Punctuation +'thermal' Name.Variable +'\t\t\t' Text +'! Read in the thermal environment\n' Comment + +'dk' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'temp' Name.Variable +',' Punctuation +'348' Literal.Number.Integer +'\t\t\t\t' Text +'! Apply a temp of 75 to keypoint 1\n' Comment + +'\n' Text + +'solve' Keyword +'\n' Text + +'finish' Keyword +'\n\n' Text + +'/' Operator +'solu' Keyword +'\t\t\t\t\t' Text +'! Re-enter the solution phase\n' Comment + +'physics' Keyword +',' Punctuation +'read' Keyword +',' Punctuation +'struct' Name.Variable +'\t\t\t' Text +'! Read in the struct environment\n' Comment + +'\n' Text + +'ldread' Keyword +',' Punctuation +'temp' Name.Variable +',' Punctuation +',' Punctuation +',' Punctuation +',' Punctuation +',' Punctuation +',' Punctuation +'rth' Name.Variable +'\t\t\t' Text +'! Apply loads derived from thermal environment\n' Comment + +'tref' Keyword +',' Punctuation +'273' Literal.Number.Integer +'\n\n' Text + +'dk' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'all' Name.Variable +',' Punctuation +'0' Literal.Number.Integer +'\t\t\t\t' Text +'! Apply structural constraints\n' Comment + +'dk' Keyword +',' Punctuation +'2' Literal.Number.Integer +',' Punctuation +'UX' Name.Variable +',' Punctuation +'0' Literal.Number.Integer +'\n\n' Text + +'solve' Keyword +'\n' Text + +'finish' Keyword +'\n\n' Text + +'/' Operator +'post1' Name.Variable +'\t\t\t\t\t' Text +'! Enter postprocessor\n' Comment + +'etable' Keyword +',' Punctuation +'CompStress' Name.Variable +',' Punctuation +'LS' Name.Variable +',' Punctuation +'1' Literal.Number.Integer +'\t\t\t' Text +'! Create an element table for link stress\n' Comment + +'PRETAB' Keyword +',' Punctuation +'CompStress' Name.Variable +'\t\t\t' Text +'! Print the element table\n' Comment diff --git a/tests/examplefiles/apdl/example2apdl.ans b/tests/examplefiles/apdl/example2apdl.ans new file mode 100644 index 0000000..238b62e --- /dev/null +++ b/tests/examplefiles/apdl/example2apdl.ans @@ -0,0 +1,69 @@ +! ANSYS command file to perform 2D Truss Tutorial (Chandrupatla p.123) +! +/title, Bridge Truss Tutorial +/PREP7 ! preprocessor phase +! +! define parameters (mm) +height = 3118 +width = 3600 +! +! define keypoints +! +K,1, 0, 0 ! keypoint, #, x, y +K,2, width/2,height +K,3, width, 0 +K,4, 3*width/2, height +K,5, 2*width, 0 +K,6, 5*width/2, height +K,7, 3*width, 0 +! +! define lines +! +L,1,2 ! line connecting kpoint 1 and 2 +L,1,3 +L,2,3 +L,2,4 +L,3,4 +L,3,5 +L,4,5 +L,4,6 +L,5,6 +L,5,7 +L,6,7 + +! +! element definition +! +ET,1,LINK1 ! element type #1; spring element +R,1,3250 ! real constant #1; Xsect area: 3200 mm^2 +MP,EX,1,200e3 ! material property #1; Young's modulus: 200 GPa + +LESIZE,ALL, , ,1,1,1 ! specify divisions on unmeshed lines +LMESH,all ! mesh all lines +! +FINISH ! finish pre-processor +! +/SOLU ! enter solution phase +! +! apply some constraints +DK,1,ALL,0 ! define a DOF constraint at a keypoint +DK,7,UY,0 +! +! apply loads +! +FK,1,FY,-280e3 ! define a force load to a keypoint +FK,3,FY,-210e3 +FK,5,FY,-280e3 +FK,7,FY,-360e3 +! +SOLVE ! solve the resulting system of equations +FINISH ! finish solution + +/POST1 +PRRSOL,F ! List Reaction Forces +PLDISP,2 ! Plot Deformed shape +PLNSOL,U,SUM,0,1 ! Contour Plot of deflection + +ETABLE,SAXL,LS, 1 ! Axial Stress +PRETAB,SAXL ! List Element Table +PLETAB,SAXL,NOAV ! Plot Axial Stress diff --git a/tests/examplefiles/apdl/example2apdl.ans.output b/tests/examplefiles/apdl/example2apdl.ans.output new file mode 100644 index 0000000..cefd4af --- /dev/null +++ b/tests/examplefiles/apdl/example2apdl.ans.output @@ -0,0 +1,429 @@ +'! ANSYS command file to perform 2D Truss Tutorial (Chandrupatla p.123)\n' Comment + +'!\n' Comment + +'/' Operator +'title' Name.Variable +',' Punctuation +' ' Text +'Bridge' Name.Variable +' ' Text +'Truss' Name.Variable +' ' Text +'Tutorial' Name.Variable +'\n' Text + +'/' Operator +'PREP7' Name.Variable +' ' Text +'! preprocessor phase\n' Comment + +'!\n' Comment + +'! define parameters (mm)\n' Comment + +'height' Name.Variable +' ' Text +'=' Operator +' ' Text +'3118' Literal.Number.Integer +'\n' Text + +'width' Name.Variable +' ' Text +'=' Operator +' ' Text +'3600' Literal.Number.Integer +'\n' Text + +'!\n' Comment + +'! define keypoints \n' Comment + +'!\n' Comment + +'K' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text +'0' Literal.Number.Integer +',' Punctuation +' ' Text +'0' Literal.Number.Integer +' ' Text +'! keypoint, #, x, y\n' Comment + +'K' Keyword +',' Punctuation +'2' Literal.Number.Integer +',' Punctuation +' ' Text +'width' Name.Variable +'/' Operator +'2' Literal.Number.Integer +',' Punctuation +'height' Name.Variable +' \n' Text + +'K' Keyword +',' Punctuation +'3' Literal.Number.Integer +',' Punctuation +' ' Text +'width' Name.Variable +',' Punctuation +' ' Text +'0' Literal.Number.Integer +'\n' Text + +'K' Keyword +',' Punctuation +'4' Literal.Number.Integer +',' Punctuation +' ' Text +'3' Literal.Number.Integer +'*' Operator +'width' Name.Variable +'/' Operator +'2' Literal.Number.Integer +',' Punctuation +' ' Text +'height' Name.Variable +'\n' Text + +'K' Keyword +',' Punctuation +'5' Literal.Number.Integer +',' Punctuation +' ' Text +'2' Literal.Number.Integer +'*' Operator +'width' Name.Variable +',' Punctuation +' ' Text +'0' Literal.Number.Integer +' \n' Text + +'K' Keyword +',' Punctuation +'6' Literal.Number.Integer +',' Punctuation +' ' Text +'5' Literal.Number.Integer +'*' Operator +'width' Name.Variable +'/' Operator +'2' Literal.Number.Integer +',' Punctuation +' ' Text +'height' Name.Variable +'\n' Text + +'K' Keyword +',' Punctuation +'7' Literal.Number.Integer +',' Punctuation +' ' Text +'3' Literal.Number.Integer +'*' Operator +'width' Name.Variable +',' Punctuation +' ' Text +'0' Literal.Number.Integer +'\n' Text + +'!\n' Comment + +'! define lines\n' Comment + +'!\n' Comment + +'L' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'2' Literal.Number.Integer +' ' Text +'! line connecting kpoint 1 and 2\n' Comment + +'L' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'3' Literal.Number.Integer +'\n' Text + +'L' Keyword +',' Punctuation +'2' Literal.Number.Integer +',' Punctuation +'3' Literal.Number.Integer +'\n' Text + +'L' Keyword +',' Punctuation +'2' Literal.Number.Integer +',' Punctuation +'4' Literal.Number.Integer +'\n' Text + +'L' Keyword +',' Punctuation +'3' Literal.Number.Integer +',' Punctuation +'4' Literal.Number.Integer +'\n' Text + +'L' Keyword +',' Punctuation +'3' Literal.Number.Integer +',' Punctuation +'5' Literal.Number.Integer +'\n' Text + +'L' Keyword +',' Punctuation +'4' Literal.Number.Integer +',' Punctuation +'5' Literal.Number.Integer +'\n' Text + +'L' Keyword +',' Punctuation +'4' Literal.Number.Integer +',' Punctuation +'6' Literal.Number.Integer +'\n' Text + +'L' Keyword +',' Punctuation +'5' Literal.Number.Integer +',' Punctuation +'6' Literal.Number.Integer +'\n' Text + +'L' Keyword +',' Punctuation +'5' Literal.Number.Integer +',' Punctuation +'7' Literal.Number.Integer +'\n' Text + +'L' Keyword +',' Punctuation +'6' Literal.Number.Integer +',' Punctuation +'7' Literal.Number.Integer +'\n \n' Text + +'!\n' Comment + +'! element definition\n' Comment + +'!\n' Comment + +'ET' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'LINK1' Keyword +' ' Text +'! element type #1; spring element\n' Comment + +'R' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'3250' Literal.Number.Integer +' ' Text +'! real constant #1; Xsect area: 3200 mm^2\n' Comment + +'MP' Keyword +',' Punctuation +'EX' Name.Variable +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'20' Literal.Number.Integer +'0e3' Literal.Number.Float +' ' Text +"! material property #1; Young's modulus: 200 GPa\n" Comment + +'\n' Text + +'LESIZE' Keyword +',' Punctuation +'ALL' Name.Variable +',' Punctuation +' ' Text +',' Punctuation +' ' Text +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'1' Literal.Number.Integer +' ' Text +'! specify divisions on unmeshed lines\n' Comment + +'LMESH' Keyword +',' Punctuation +'all' Name.Variable +' ' Text +'! mesh all lines\n' Comment + +'!\n' Comment + +'FINISH' Keyword +' ' Text +'! finish pre-processor\n' Comment + +'!\n' Comment + +'/' Operator +'SOLU' Keyword +' ' Text +'! enter solution phase\n' Comment + +'!\n' Comment + +'! apply some constraints\n' Comment + +'DK' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'ALL' Name.Variable +',' Punctuation +'0' Literal.Number.Integer +' ' Text +'! define a DOF constraint at a keypoint\n' Comment + +'DK' Keyword +',' Punctuation +'7' Literal.Number.Integer +',' Punctuation +'UY' Name.Variable +',' Punctuation +'0' Literal.Number.Integer +' \n' Text + +'!\n' Comment + +'! apply loads\n' Comment + +'!\n' Comment + +'FK' Keyword +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'FY' Name.Variable +',' Punctuation +'-' Operator +'28' Literal.Number.Integer +'0e3' Literal.Number.Float +' ' Text +'! define a force load to a keypoint\n' Comment + +'FK' Keyword +',' Punctuation +'3' Literal.Number.Integer +',' Punctuation +'FY' Name.Variable +',' Punctuation +'-' Operator +'21' Literal.Number.Integer +'0e3' Literal.Number.Float +' \n' Text + +'FK' Keyword +',' Punctuation +'5' Literal.Number.Integer +',' Punctuation +'FY' Name.Variable +',' Punctuation +'-' Operator +'28' Literal.Number.Integer +'0e3' Literal.Number.Float +' \n' Text + +'FK' Keyword +',' Punctuation +'7' Literal.Number.Integer +',' Punctuation +'FY' Name.Variable +',' Punctuation +'-' Operator +'36' Literal.Number.Integer +'0e3' Literal.Number.Float +' \n' Text + +'!\n' Comment + +'SOLVE' Keyword +' ' Text +'! solve the resulting system of equations\n' Comment + +'FINISH' Keyword +' ' Text +'! finish solution\n' Comment + +'\n' Text + +'/' Operator +'POST1' Name.Variable +'\n' Text + +'PRRSOL' Keyword +',' Punctuation +'F' Keyword +' ' Text +'! List Reaction Forces\n' Comment + +'PLDISP' Keyword +',' Punctuation +'2' Literal.Number.Integer +' ' Text +'! Plot Deformed shape\n' Comment + +'PLNSOL' Keyword +',' Punctuation +'U' Name.Variable +',' Punctuation +'SUM' Name.Variable +',' Punctuation +'0' Literal.Number.Integer +',' Punctuation +'1' Literal.Number.Integer +' ' Text +'! Contour Plot of deflection\n' Comment + +'\n' Text + +'ETABLE' Keyword +',' Punctuation +'SAXL' Name.Variable +',' Punctuation +'LS' Name.Variable +',' Punctuation +' ' Text +'1' Literal.Number.Integer +' ' Text +'! Axial Stress\n' Comment + +'PRETAB' Keyword +',' Punctuation +'SAXL' Name.Variable +' ' Text +'! List Element Table\n' Comment + +'PLETAB' Keyword +',' Punctuation +'SAXL' Name.Variable +',' Punctuation +'NOAV' Name.Variable +' ' Text +'! Plot Axial Stress\n' Comment diff --git a/tests/examplefiles/c/ceval.c.output b/tests/examplefiles/c/ceval.c.output index 333e66e..602c5d8 100644 --- a/tests/examplefiles/c/ceval.c.output +++ b/tests/examplefiles/c/ceval.c.output @@ -115,7 +115,7 @@ 'void' Keyword.Type '\n' Text -'ppc_getcounter' Name +'ppc_getcounter' Name.Function '(' Punctuation 'uint64' Name ' ' Text @@ -178,7 +178,7 @@ '\t' Text 'asm' Keyword ' ' Text -'volatile' Name.Function +'volatile' Keyword ' ' Text '(' Punctuation '"' Literal.String @@ -202,7 +202,7 @@ '\t' Text 'asm' Keyword ' ' Text -'volatile' Name.Function +'volatile' Keyword ' ' Text '(' Punctuation '"' Literal.String @@ -321,7 +321,7 @@ 'void' Keyword.Type ' ' Text -'dump_tsc' Name +'dump_tsc' Name.Function '(' Punctuation 'int' Keyword.Type ' ' Text @@ -575,7 +575,7 @@ ' ' Text '*' Operator ' ' Text -'call_function' Name +'call_function' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -607,7 +607,7 @@ ' ' Text '*' Operator ' ' Text -'call_function' Name +'call_function' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -631,7 +631,7 @@ ' ' Text '*' Operator ' ' Text -'fast_function' Name +'fast_function' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -662,7 +662,7 @@ ' ' Text '*' Operator ' ' Text -'do_call' Name +'do_call' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -690,7 +690,7 @@ ' ' Text '*' Operator ' ' Text -'ext_do_call' Name +'ext_do_call' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -721,7 +721,7 @@ ' ' Text '*' Operator ' ' Text -'update_keyword_args' Name +'update_keyword_args' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -750,7 +750,7 @@ ' ' Text '*' Operator ' ' Text -'update_star_args' Name +'update_star_args' Name.Function '(' Punctuation 'int' Keyword.Type ',' Punctuation @@ -778,7 +778,7 @@ ' ' Text '*' Operator ' ' Text -'load_args' Name +'load_args' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -818,7 +818,7 @@ ' ' Text 'int' Keyword.Type ' ' Text -'prtrace' Name +'prtrace' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -840,7 +840,7 @@ ' ' Text 'int' Keyword.Type ' ' Text -'call_trace' Name +'call_trace' Name.Function '(' Punctuation 'Py_tracefunc' Name ',' Punctuation @@ -871,7 +871,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'call_trace_protected' Name +'call_trace_protected' Name.Function '(' Punctuation 'Py_tracefunc' Name ',' Punctuation @@ -902,7 +902,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'call_exc_trace' Name +'call_exc_trace' Name.Function '(' Punctuation 'Py_tracefunc' Name ',' Punctuation @@ -923,7 +923,7 @@ ' ' Text 'int' Keyword.Type ' ' Text -'maybe_call_line_trace' Name +'maybe_call_line_trace' Name.Function '(' Punctuation 'Py_tracefunc' Name ',' Punctuation @@ -965,7 +965,7 @@ ' ' Text '*' Operator ' ' Text -'apply_slice' Name +'apply_slice' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -988,7 +988,7 @@ ' ' Text 'int' Keyword.Type ' ' Text -'assign_slice' Name +'assign_slice' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -1020,7 +1020,7 @@ ' ' Text '*' Operator ' ' Text -'cmp_outcome' Name +'cmp_outcome' Name.Function '(' Punctuation 'int' Keyword.Type ',' Punctuation @@ -1043,7 +1043,7 @@ ' ' Text '*' Operator ' ' Text -'import_from' Name +'import_from' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -1061,7 +1061,7 @@ ' ' Text 'int' Keyword.Type ' ' Text -'import_all_from' Name +'import_all_from' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -1081,7 +1081,7 @@ ' ' Text '*' Operator ' ' Text -'build_class' Name +'build_class' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -1104,7 +1104,7 @@ ' ' Text 'int' Keyword.Type ' ' Text -'exec_statement' Name +'exec_statement' Name.Function '(' Punctuation 'PyFrameObject' Name ' ' Text @@ -1134,7 +1134,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'set_exc_info' Name +'set_exc_info' Name.Function '(' Punctuation 'PyThreadState' Name ' ' Text @@ -1162,7 +1162,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'reset_exc_info' Name +'reset_exc_info' Name.Function '(' Punctuation 'PyThreadState' Name ' ' Text @@ -1175,7 +1175,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'format_exc_check_arg' Name +'format_exc_check_arg' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -1200,7 +1200,7 @@ ' ' Text '*' Operator ' ' Text -'string_concatenate' Name +'string_concatenate' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -3176,7 +3176,7 @@ ' ' Text 'why_code' Name ' ' Text -'do_raise' Name +'do_raise' Name.Function '(' Punctuation 'PyObject' Name ' ' Text @@ -3199,7 +3199,7 @@ ' ' Text 'int' Keyword.Type ' ' Text -'unpack_iterable' Name +'unpack_iterable' Name.Function '(' Punctuation 'PyObject' Name ' ' Text diff --git a/tests/examplefiles/c/example.c.output b/tests/examplefiles/c/example.c.output index ffe45d9..de43c8b 100644 --- a/tests/examplefiles/c/example.c.output +++ b/tests/examplefiles/c/example.c.output @@ -40,7 +40,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'yyerror' Name +'yyerror' Name.Function '(' Punctuation 'char' Keyword.Type '*' Operator @@ -216,7 +216,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'increaseStackby' Name +'increaseStackby' Name.Function '(' Punctuation 'int' Keyword.Type ' ' Text @@ -1809,7 +1809,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'increaseStackby' Name +'increaseStackby' Name.Function '(' Punctuation 'int' Keyword.Type ' ' Text @@ -1908,7 +1908,7 @@ 'char' Keyword.Type ' ' Text -'convertType' Name +'convertType' Name.Function '(' Punctuation 'int' Keyword.Type ' ' Text @@ -2026,7 +2026,7 @@ 'int' Keyword.Type ' ' Text -'main' Name +'main' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -2643,7 +2643,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_obj_freeze' Name.Function +'rb_obj_freeze' Name '(' Punctuation 'ary' Name ')' Punctuation @@ -2744,7 +2744,7 @@ 'VALUE' Name '\n' Text -'ary_alloc' Name +'ary_alloc' Name.Function '(' Punctuation 'klass' Name ')' Punctuation @@ -3067,7 +3067,7 @@ ' ' Text 'return' Keyword ' ' Text -'ary_new' Name.Function +'ary_new' Name '(' Punctuation 'rb_cArray' Name ',' Punctuation @@ -3098,7 +3098,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_ary_new2' Name.Function +'rb_ary_new2' Name '(' Punctuation 'ARY_DEFAULT_SIZE' Name ')' Punctuation @@ -3963,7 +3963,7 @@ '\t' Text 'return' Keyword ' ' Text -'RARRAY' Name.Function +'RARRAY' Name '(' Punctuation 'ary' Name ')' Punctuation @@ -4147,7 +4147,7 @@ ' ' Text 'return' Keyword ' ' Text -'ary_shared_array' Name.Function +'ary_shared_array' Name '(' Punctuation 'rb_cValues' Name ',' Punctuation @@ -4184,7 +4184,7 @@ ' ' Text 'return' Keyword ' ' Text -'ary_shared_array' Name.Function +'ary_shared_array' Name '(' Punctuation 'rb_cArray' Name ',' Punctuation @@ -4227,7 +4227,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_values_new' Name.Function +'rb_values_new' Name '(' Punctuation '2' Literal.Number.Integer ',' Punctuation @@ -4269,7 +4269,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_convert_type' Name.Function +'rb_convert_type' Name '(' Punctuation 'ary' Name ',' Punctuation @@ -4318,7 +4318,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_convert_type' Name.Function +'rb_convert_type' Name '(' Punctuation 'ary' Name ',' Punctuation @@ -4365,7 +4365,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_check_convert_type' Name.Function +'rb_check_convert_type' Name '(' Punctuation 'ary' Name ',' Punctuation @@ -4420,7 +4420,7 @@ 'VALUE' Name '\n' Text -'rb_ary_initialize' Name +'rb_ary_initialize' Name.Function '(' Punctuation 'argc' Name ',' Punctuation @@ -6332,7 +6332,7 @@ '\t' Text 'return' Keyword ' ' Text -'rb_ary_pop' Name.Function +'rb_ary_pop' Name '(' Punctuation 'ary' Name ')' Punctuation @@ -6616,7 +6616,7 @@ '\t' Text 'return' Keyword ' ' Text -'rb_ary_shift' Name.Function +'rb_ary_shift' Name '(' Punctuation 'ary' Name ')' Punctuation @@ -7929,7 +7929,7 @@ '\t' Text 'return' Keyword ' ' Text -'rb_ary_entry' Name.Function +'rb_ary_entry' Name '(' Punctuation 'ary' Name ',' Punctuation @@ -8090,7 +8090,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_ary_entry' Name.Function +'rb_ary_entry' Name '(' Punctuation 'ary' Name ',' Punctuation @@ -8197,7 +8197,7 @@ '\t' Text 'return' Keyword ' ' Text -'RARRAY' Name.Function +'RARRAY' Name '(' Punctuation 'ary' Name ')' Punctuation @@ -8223,7 +8223,7 @@ '\t' Text 'return' Keyword ' ' Text -'ary_shared_first' Name.Function +'ary_shared_first' Name '(' Punctuation 'argc' Name ',' Punctuation @@ -8334,7 +8334,7 @@ '\t' Text 'return' Keyword ' ' Text -'RARRAY' Name.Function +'RARRAY' Name '(' Punctuation 'ary' Name ')' Punctuation @@ -8367,7 +8367,7 @@ '\t' Text 'return' Keyword ' ' Text -'ary_shared_last' Name.Function +'ary_shared_last' Name '(' Punctuation 'argc' Name ',' Punctuation @@ -8841,7 +8841,7 @@ '\t\t' Text 'return' Keyword ' ' Text -'LONG2NUM' Name.Function +'LONG2NUM' Name '(' Punctuation 'i' Name ')' Punctuation @@ -9324,7 +9324,7 @@ '\t' Text 'return' Keyword ' ' Text -'to_ary' Name.Function +'to_ary' Name '(' Punctuation 'obj' Name ')' Punctuation @@ -11053,7 +11053,7 @@ ' ' Text 'return' Keyword ' ' Text -'LONG2NUM' Name.Function +'LONG2NUM' Name '(' Punctuation 'RARRAY' Name '(' Punctuation @@ -11270,7 +11270,7 @@ 'VALUE' Name '\n' Text -'recursive_join' Name +'recursive_join' Name.Function '(' Punctuation 'ary' Name ',' Punctuation @@ -11320,7 +11320,7 @@ '\t' Text 'return' Keyword ' ' Text -'rb_str_new2' Name.Function +'rb_str_new2' Name '(' Punctuation '"' Literal.String '[...]' Literal.String @@ -11986,7 +11986,7 @@ ' \n ' Text 'return' Keyword ' ' Text -'rb_ary_join' Name.Function +'rb_ary_join' Name '(' Punctuation 'ary' Name ',' Punctuation @@ -12058,7 +12058,7 @@ ' \n ' Text 'return' Keyword ' ' Text -'rb_ary_join' Name.Function +'rb_ary_join' Name '(' Punctuation 'ary' Name ',' Punctuation @@ -12381,7 +12381,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_exec_recursive' Name.Function +'rb_exec_recursive' Name '(' Punctuation 'inspect_ary' Name ',' Punctuation @@ -12743,7 +12743,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_ary_reverse' Name.Function +'rb_ary_reverse' Name '(' Punctuation 'ary' Name ')' Punctuation @@ -12784,7 +12784,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_ary_reverse' Name.Function +'rb_ary_reverse' Name '(' Punctuation 'rb_ary_dup' Name '(' Punctuation @@ -12839,7 +12839,7 @@ 'void' Keyword.Type '\n' Text -'ary_sort_check' Name +'ary_sort_check' Name.Function '(' Punctuation 'data' Name ')' Punctuation @@ -13232,7 +13232,7 @@ '\t' Text 'return' Keyword ' ' Text -'rb_str_cmp' Name.Function +'rb_str_cmp' Name '(' Punctuation 'a' Name ',' Punctuation @@ -13696,7 +13696,7 @@ '\t' Text 'return' Keyword ' ' Text -'rb_ary_new4' Name.Function +'rb_ary_new4' Name '(' Punctuation 'RARRAY' Name '(' Punctuation @@ -14319,7 +14319,7 @@ ' ' Text 'return' Keyword ' ' Text -'rb_get_values_at' Name.Function +'rb_get_values_at' Name '(' Punctuation 'ary' Name ',' Punctuation diff --git a/tests/examplefiles/chapel/99_bottles_of_beer.chpl.output b/tests/examplefiles/chapel/99_bottles_of_beer.chpl.output index 67c9278..59718e6 100644 --- a/tests/examplefiles/chapel/99_bottles_of_beer.chpl.output +++ b/tests/examplefiles/chapel/99_bottles_of_beer.chpl.output @@ -176,7 +176,7 @@ ' ' Text 'return' Keyword ' ' Text -'"\\n"' Literal.String.Double +'"\\n"' Literal.String ' ' Text '// disguise space used to separate elements in array I/O\n' Comment.Single @@ -195,7 +195,7 @@ ' ' Text '+' Operator ' ' Text -'" on the wall, "' Literal.String.Double +'" on the wall, "' Literal.String '\n' Text ' ' Text @@ -208,7 +208,7 @@ ' ' Text '+' Operator ' ' Text -'".\\n"' Literal.String.Double +'".\\n"' Literal.String '\n' Text ' ' Text @@ -230,7 +230,7 @@ ' ' Text '+' Operator ' ' Text -'" on the wall.\\n"' Literal.String.Double +'" on the wall.\\n"' Literal.String ';' Punctuation '\n' Text @@ -289,16 +289,16 @@ ' ' Text 'then' Keyword ' ' Text -'"N"' Literal.String.Double +'"N"' Literal.String ' \n ' Text 'else' Keyword ' ' Text -'"n"' Literal.String.Double +'"n"' Literal.String ')' Punctuation ' \n ' Text '+' Operator ' ' Text -'"o more"' Literal.String.Double +'"o more"' Literal.String ';' Punctuation '\n' Text @@ -309,7 +309,7 @@ ' \n ' Text '+' Operator ' ' Text -'" bottle"' Literal.String.Double +'" bottle"' Literal.String ' ' Text '+' Operator ' ' Text @@ -327,16 +327,16 @@ ' ' Text 'then' Keyword ' ' Text -'""' Literal.String.Double +'""' Literal.String ' ' Text 'else' Keyword ' ' Text -'"s"' Literal.String.Double +'"s"' Literal.String ')' Punctuation ' \n ' Text '+' Operator ' ' Text -'" of beer"' Literal.String.Double +'" of beer"' Literal.String ';' Punctuation '\n' Text @@ -371,13 +371,13 @@ ' ' Text 'then' Keyword ' ' Text -'"Go to the store and buy some more, "' Literal.String.Double +'"Go to the store and buy some more, "' Literal.String '\n' Text ' ' Text 'else' Keyword ' ' Text -'"Take one down and pass it around, "' Literal.String.Double +'"Take one down and pass it around, "' Literal.String ';' Punctuation '\n' Text @@ -468,7 +468,7 @@ ' ' Text 'writeln' Name.Other '(' Punctuation -'"M2 -> M1 -> x "' Literal.String.Double +'"M2 -> M1 -> x "' Literal.String ' ' Text '+' Operator ' ' Text @@ -539,7 +539,7 @@ 'writeln' Name.Other '(' Punctuation -'"Distance from origin: "' Literal.String.Double +'"Distance from origin: "' Literal.String ' ' Text '+' Operator ' ' Text @@ -573,7 +573,7 @@ ' ' Text '=' Operator ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'Point' Name.Other '(' Punctuation @@ -587,7 +587,7 @@ 'writeln' Name.Other '(' Punctuation -'"Distance from origin: "' Literal.String.Double +'"Distance from origin: "' Literal.String ' ' Text '+' Operator ' ' Text @@ -653,7 +653,7 @@ ' ' Text '=' Operator ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'Circle' Name.Other '(' Punctuation @@ -689,7 +689,7 @@ 'writeln' Name.Other '(' Punctuation -'"Area of circle: "' Literal.String.Double +'"Area of circle: "' Literal.String ' ' Text '+' Operator ' ' Text @@ -769,7 +769,7 @@ ' ' Text '=' Operator ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'Oval' Name.Other '(' Punctuation @@ -787,7 +787,7 @@ 'writeln' Name.Other '(' Punctuation -'"Area of oval: "' Literal.String.Double +'"Area of oval: "' Literal.String ' ' Text '+' Operator ' ' Text @@ -1116,11 +1116,11 @@ ' ' Text '<~>' Operator ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'ioLiteral' Name.Other '(' Punctuation -'","' Literal.String.Double +'","' Literal.String ')' Punctuation ' ' Text '<~>' Operator @@ -1129,7 +1129,7 @@ ' ' Text '<~>' Operator ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'ioNewline' Name.Other '(' Punctuation @@ -1150,7 +1150,7 @@ ' ' Text '=' Operator ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'IntPair' Name.Other '(' Punctuation @@ -1400,7 +1400,7 @@ ' ' Text 'throw' Keyword ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'Error' Name.Other '(' Punctuation @@ -1460,7 +1460,7 @@ ' ' Text 'writeln' Name.Other '(' Punctuation -'"Caught "' Literal.String.Double +'"Caught "' Literal.String ',' Punctuation ' ' Text 'e' Name.Other @@ -1522,7 +1522,7 @@ ' ' Text '=' Operator ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'borrowed' Keyword ' ' Text @@ -1539,7 +1539,7 @@ ' ' Text '=' Operator ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'owned' Keyword ' ' Text @@ -1556,7 +1556,7 @@ ' ' Text '=' Operator ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'shared' Keyword ' ' Text @@ -1569,7 +1569,7 @@ ' ' Text 'throw' Keyword ' ' Text -'new' Name.Other +'new' Keyword ' ' Text 'unmanaged' Keyword ' ' Text diff --git a/tests/examplefiles/charmci/Charmci.ci.output b/tests/examplefiles/charmci/Charmci.ci.output index e7e4d5e..586cb86 100644 --- a/tests/examplefiles/charmci/Charmci.ci.output +++ b/tests/examplefiles/charmci/Charmci.ci.output @@ -69,7 +69,7 @@ '\t\t' Text 'entry' Keyword ' ' Text -'ckcallback_main' Name.Function +'ckcallback_main' Name '(' Punctuation 'CkArgMsg' Name ' ' Text @@ -103,7 +103,7 @@ '\t\t' Text 'entry' Keyword ' ' Text -'ckcallback_group' Name.Function +'ckcallback_group' Name '(' Punctuation ')' Punctuation ';' Punctuation @@ -114,7 +114,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'registerCcsCallback' Name +'registerCcsCallback' Name.Function '(' Punctuation 'char' Keyword.Type ' ' Text @@ -143,7 +143,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'call' Name +'call' Name.Function '(' Punctuation 'CkCallback' Name ' ' Text @@ -161,7 +161,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'call' Name +'call' Name.Function '(' Punctuation 'CkCallback' Name ' ' Text diff --git a/tests/examplefiles/cpp/example.cpp.output b/tests/examplefiles/cpp/example.cpp.output index 2d6615f..aea47be 100644 --- a/tests/examplefiles/cpp/example.cpp.output +++ b/tests/examplefiles/cpp/example.cpp.output @@ -20,7 +20,7 @@ ' ' Text 'namespace' Keyword ' ' Text -'std' Name +'std' Name.Namespace ';' Punctuation '\n' Text @@ -28,7 +28,7 @@ 'namespace' Keyword ' ' Text -'highlight' Name +'highlight' Name.Namespace ' ' Text '{' Punctuation '\n' Text @@ -39,10 +39,7 @@ 'string' Name ' ' Text -'AnsiGenerator' Name -':' Operator -':' Operator -'getOpenTag' Name +'AnsiGenerator::getOpenTag' Name.Function '(' Punctuation 'const' Keyword ' ' Text @@ -519,7 +516,7 @@ ' ' Text 'return' Keyword ' ' Text -'string' Name.Function +'string' Name '(' Punctuation ')' Punctuation ';' Punctuation @@ -569,7 +566,7 @@ ' ' Text 'return' Keyword ' ' Text -'string' Name.Function +'string' Name '(' Punctuation ')' Punctuation ';' Punctuation @@ -786,7 +783,7 @@ 'namespace' Keyword ' ' Text -'highlight' Name +'highlight' Name.Namespace ' ' Text '{' Punctuation '\n' Text @@ -1096,7 +1093,7 @@ ' ' Text 'namespace' Keyword ' ' Text -'std' Name +'std' Name.Namespace ';' Punctuation '\n' Text @@ -1118,7 +1115,7 @@ 'namespace' Keyword ' ' Text -'astyle' Name +'astyle' Name.Namespace '\n' Text ' ' Text @@ -1236,10 +1233,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'ASBeautifier' Name -':' Operator -':' Operator -'initStatic' Name +'ASBeautifier::initStatic' Name.Function '(' Punctuation ')' Punctuation '\n' Text @@ -4875,7 +4869,7 @@ ' ' Text 'return' Keyword ' ' Text -'beautify' Name.Function +'beautify' Name '(' Punctuation 'sourceIterator' Name '-' Operator @@ -7038,7 +7032,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword ' ' Text '(' Punctuation '!' Operator @@ -8678,7 +8672,7 @@ '\n' Text ' ' Text -'registerInStatementIndent' Name.Function +'registerInStatementIndent' Name '(' Punctuation 'line' Name ',' Punctuation @@ -13779,7 +13773,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword ' ' Text '(' Punctuation '!' Operator @@ -13838,7 +13832,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword ' ' Text '(' Punctuation '!' Operator @@ -15080,7 +15074,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword ' ' Text '(' Punctuation 'ch' Name @@ -16225,7 +16219,7 @@ ' ' Text 'namespace' Keyword ' ' Text -'std' Name +'std' Name.Namespace ';' Punctuation '\n' Text @@ -16233,7 +16227,7 @@ 'namespace' Keyword ' ' Text -'astyle' Name +'astyle' Name.Namespace '\n' Text ' ' Text @@ -16363,7 +16357,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'init' Name +'init' Name.Function '(' Punctuation 'ASSourceIterator' Name '*' Operator @@ -16379,7 +16373,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'init' Name +'init' Name.Function '(' Punctuation ')' Punctuation ';' Punctuation @@ -16390,7 +16384,7 @@ ' ' Text 'bool' Keyword.Type ' ' Text -'hasMoreLines' Name +'hasMoreLines' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -16403,7 +16397,7 @@ ' ' Text 'string' Name ' ' Text -'nextLine' Name +'nextLine' Name.Function '(' Punctuation ')' Punctuation ';' Punctuation @@ -16414,7 +16408,7 @@ ' ' Text 'string' Name ' ' Text -'beautify' Name +'beautify' Name.Function '(' Punctuation 'const' Keyword ' ' Text @@ -16680,7 +16674,7 @@ 'string' Name ' ' Text '*' Operator -'findHeader' Name +'findHeader' Name.Function '(' Punctuation 'const' Keyword ' ' Text @@ -17566,6 +17560,6 @@ ' ' Text 'namespace' Keyword ' ' Text -'std' Name +'std' Name.Namespace ';' Punctuation '\n' Text diff --git a/tests/examplefiles/cpp/functions.cpp b/tests/examplefiles/cpp/functions.cpp new file mode 100644 index 0000000..662e0d2 --- /dev/null +++ b/tests/examplefiles/cpp/functions.cpp @@ -0,0 +1,87 @@ +using std::numerical; +string contains(const char str); +string contains(const char str) {} +string* contains(const char str); +string* contains(const char str) {} +string * contains(const char str); +string * contains(const char str) {} +string * contains(const char str); +string * contains(const char str) {} +string *contains(const char str); +string *contains(const char str) {} +string **contains(const char str); +string **contains(const char str) {} +string** contains(const char str); +string** contains(const char str) {} +string ** contains(const char str); +string ** contains(const char str) {} +string & contains(const char str); +string & contains(const char str) {} +string& contains(const char str); +string& contains(const char str) {} +string &contains(const char str); +string &contains(const char str) {} +string &&contains(const char str); +string &&contains(const char str) {} +string && contains(const char str); +string && contains(const char str) {} +string&& contains(const char str); +string&& contains(const char str) {} +const string contains(const char str); +const string contains(const char str) {} +explicit const string contains(const char str); +explicit const string contains(const char str) {} +explicit const string contains(const char str) noexcept; +explicit const string contains(const char str) noexcept {} +explicit const string contains(const char str) noexcept const; +explicit const string contains(const char str) noexcept const {} + + +explicit const string contains(const char&str); +explicit const string contains(const char&str) {} +explicit const string contains(const char& str); +explicit const string contains(const char& str) {} +explicit const string contains(const char str); +explicit const string contains(const char str) {} +explicit const string contains(const char&& str); +explicit const string contains(const char&& str) {} +explicit const string contains(const char&& str); +explicit const string contains(const char&& str) {} +explicit const string contains(const char &&str); +explicit const string contains(const char &&str) {} +explicit const string contains(const char ***** str); +explicit const string contains(const char ***** str) {} +explicit const string contains(const char *****str); +explicit const string contains(const char *****str) {} +explicit const string contains(const char***** str); +explicit const string contains(const char***** str) {} +explicit const string contains(const char *str); +explicit const string contains(const char *str) {} +explicit const string contains(const char* str); +explicit const string contains(const char* str) {} +explicit const string contains(const char * str); +explicit const string contains(const char * str) {} + +// Names with namespaces + +string Type::contains(char c) const noexcept; +string Type::contains(char c) const noexcept {} +std::string contains(char c) const noexcept; +std::string contains(char c) const noexcept {} +std::string contains(std::vector chars) const noexcept; +std::string contains(std::vector chars) const noexcept {} +std::string std::vector::contains(std::vector chars) const; +std::string std::vector::contains(std::vector chars) const {} +const inline explicit std::string std::vector::contains(std::vector chars) const {} +const inline explicit std::string std::vector::contains(std::vector chars) const; + +// inside classes + +class raz { + const virtual std::string contains(const std::string str); +} + +// Make sure these are not functions: +else if(flag && func_call()) {} +new T(); +const operator int() const {} // so int is lexed as type and not function.name \ No newline at end of file diff --git a/tests/examplefiles/cpp/functions.cpp.output b/tests/examplefiles/cpp/functions.cpp.output new file mode 100644 index 0000000..cec14f1 --- /dev/null +++ b/tests/examplefiles/cpp/functions.cpp.output @@ -0,0 +1,1405 @@ +'using' Keyword +' ' Text +'std' Name +':' Operator +':' Operator +'numerical' Name +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +'*' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +'*' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +' ' Text +'*' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'*' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +' ' Text +'*' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'*' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +' ' Text +'*' Operator +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'*' Operator +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +' ' Text +'*' Operator +'*' Operator +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'*' Operator +'*' Operator +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +'*' Operator +'*' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +'*' Operator +'*' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +' ' Text +'*' Operator +'*' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'*' Operator +'*' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +' ' Text +'&' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'&' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +'&' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +'&' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +' ' Text +'&' Operator +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'&' Operator +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +' ' Text +'&' Operator +'&' Operator +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'&' Operator +'&' Operator +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +' ' Text +'&' Operator +'&' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'&' Operator +'&' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'string' Name +'&' Operator +'&' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'string' Name +'&' Operator +'&' Operator +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'noexcept' Keyword +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'noexcept' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'noexcept' Keyword +' ' Text +'const' Keyword +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'noexcept' Keyword +' ' Text +'const' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'\n' Text + +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'&' Operator +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'&' Operator +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'&' Operator +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'&' Operator +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'&' Operator +'&' Operator +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'&' Operator +'&' Operator +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'&' Operator +'&' Operator +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'&' Operator +'&' Operator +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'&' Operator +'&' Operator +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'&' Operator +'&' Operator +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'*' Operator +'*' Operator +'*' Operator +'*' Operator +'*' Operator +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'*' Operator +'*' Operator +'*' Operator +'*' Operator +'*' Operator +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'*' Operator +'*' Operator +'*' Operator +'*' Operator +'*' Operator +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'*' Operator +'*' Operator +'*' Operator +'*' Operator +'*' Operator +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'*' Operator +'*' Operator +'*' Operator +'*' Operator +'*' Operator +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'*' Operator +'*' Operator +'*' Operator +'*' Operator +'*' Operator +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'*' Operator +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'*' Operator +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'*' Operator +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +'*' Operator +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'*' Operator +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'explicit' Keyword +' ' Text +'const' Keyword +' ' Text +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'char' Keyword.Type +' ' Text +'*' Operator +' ' Text +'str' Name +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'\n' Text + +'// Names with namespaces\n' Comment.Single + +'\n' Text + +'string' Name +' ' Text +'Type::contains' Name.Function +'(' Punctuation +'char' Keyword.Type +' ' Text +'c' Name +')' Punctuation +' ' Text +'const' Keyword +' ' Text +'noexcept' Keyword +';' Punctuation +'\n' Text + +'string' Name +' ' Text +'Type::contains' Name.Function +'(' Punctuation +'char' Keyword.Type +' ' Text +'c' Name +')' Punctuation +' ' Text +'const' Keyword +' ' Text +'noexcept' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'std' Name +':' Operator +':' Operator +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'char' Keyword.Type +' ' Text +'c' Name +')' Punctuation +' ' Text +'const' Keyword +' ' Text +'noexcept' Keyword +';' Punctuation +'\n' Text + +'std' Name +':' Operator +':' Operator +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'char' Keyword.Type +' ' Text +'c' Name +')' Punctuation +' ' Text +'const' Keyword +' ' Text +'noexcept' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'std' Name +':' Operator +':' Operator +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'std' Name +':' Operator +':' Operator +'vector' Name +'<' Operator +'char' Keyword.Type +'>' Operator +' ' Text +'chars' Name +')' Punctuation +' ' Text +'const' Keyword +' ' Text +'noexcept' Keyword +';' Punctuation +'\n' Text + +'std' Name +':' Operator +':' Operator +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'std' Name +':' Operator +':' Operator +'vector' Name +'<' Operator +'char' Keyword.Type +'>' Operator +' ' Text +'chars' Name +')' Punctuation +' ' Text +'const' Keyword +' ' Text +'noexcept' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'std' Name +':' Operator +':' Operator +'string' Name +' ' Text +'std::vector::contains' Name.Function +'(' Punctuation +'std' Name +':' Operator +':' Operator +'vector' Name +'<' Operator +'char' Keyword.Type +'>' Operator +' ' Text +'chars' Name +')' Punctuation +' ' Text +'const' Keyword +';' Punctuation +'\n' Text + +'std' Name +':' Operator +':' Operator +'string' Name +' ' Text +'std::vector::contains' Name.Function +'(' Punctuation +'std' Name +':' Operator +':' Operator +'vector' Name +'<' Operator +'char' Keyword.Type +'>' Operator +' ' Text +'chars' Name +')' Punctuation +' ' Text +'const' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'const' Keyword +' ' Text +'inline' Keyword.Reserved +' ' Text +'explicit' Keyword +' ' Text +'std' Name +':' Operator +':' Operator +'string' Name +' ' Text +'std::vector::contains' Name.Function +'(' Punctuation +'std' Name +':' Operator +':' Operator +'vector' Name +'<' Operator +'char' Keyword.Type +'>' Operator +' ' Text +'chars' Name +')' Punctuation +' ' Text +'const' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'const' Keyword +' ' Text +'inline' Keyword.Reserved +' ' Text +'explicit' Keyword +' ' Text +'std' Name +':' Operator +':' Operator +'string' Name +' ' Text +'std::vector::contains' Name.Function +'(' Punctuation +'std' Name +':' Operator +':' Operator +'vector' Name +'<' Operator +'char' Keyword.Type +'>' Operator +' ' Text +'chars' Name +')' Punctuation +' ' Text +'const' Keyword +';' Punctuation +'\n' Text + +'\n' Text + +'// inside classes\n' Comment.Single + +'\n' Text + +'class' Keyword +' ' Text +'raz' Name.Class +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'const' Keyword +' ' Text +'virtual' Keyword +' ' Text +'std' Name +':' Operator +':' Operator +'string' Name +' ' Text +'contains' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'std' Name +':' Operator +':' Operator +'string' Name +' ' Text +'str' Name +')' Punctuation +';' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text + +'\n' Text + +'// Make sure these are not functions:\n' Comment.Single + +'else' Keyword +' ' Text +'if' Keyword +'(' Punctuation +'flag' Name +' ' Text +'&' Operator +'&' Operator +' ' Text +'func_call' Name +'(' Punctuation +')' Punctuation +')' Punctuation +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'new' Keyword +' ' Text +'T' Name +'(' Punctuation +')' Punctuation +';' Punctuation +'\n' Text + +'const' Keyword +' ' Text +'operator' Keyword +' ' Text +'int' Keyword.Type +'(' Punctuation +')' Punctuation +' ' Text +'const' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +' ' Text +'// so int is lexed as type and not function.name\n' Comment.Single diff --git a/tests/examplefiles/cpp/namespace.cpp b/tests/examplefiles/cpp/namespace.cpp new file mode 100644 index 0000000..45d9540 --- /dev/null +++ b/tests/examplefiles/cpp/namespace.cpp @@ -0,0 +1,35 @@ +namespace std {} +namespace std::exprimental::inner {} +namespace {} +namespace std::exprimental::inline innner {} +namespace std::inline exprimental::innner {} +namespace other = std; +namespace other = std::exprimental; + +namespace std::exprimental::inner { +class QualifiedName { +public: + QualifiedName(const FlyString& local_name) + { + } + const FlyString& local_name() const { return m_local_name; } + +private: + FlyString m_local_name; +}; +} + +namespace ns::inner::inline pygments { + using namespace outer; + int has_value() { + namespace other = std; + } + namespace { + namespace user { + int has_value() { + using namespace inner; + return 4; + } + } + } +} \ No newline at end of file diff --git a/tests/examplefiles/cpp/namespace.cpp.output b/tests/examplefiles/cpp/namespace.cpp.output new file mode 100644 index 0000000..d929cb0 --- /dev/null +++ b/tests/examplefiles/cpp/namespace.cpp.output @@ -0,0 +1,276 @@ +'namespace' Keyword +' ' Text +'std' Name.Namespace +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'namespace' Keyword +' ' Text +'std' Name.Namespace +':' Operator +':' Operator +'exprimental' Name.Namespace +':' Operator +':' Operator +'inner' Name.Namespace +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'namespace' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'namespace' Keyword +' ' Text +'std' Name.Namespace +':' Operator +':' Operator +'exprimental' Name.Namespace +':' Operator +':' Operator +'inline' Keyword.Reserved +' ' Text +'innner' Name.Namespace +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'namespace' Keyword +' ' Text +'std' Name.Namespace +':' Operator +':' Operator +'inline' Keyword.Reserved +' ' Text +'exprimental' Name.Namespace +':' Operator +':' Operator +'innner' Name.Namespace +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'namespace' Keyword +' ' Text +'other' Name.Namespace +' ' Text +'=' Operator +' ' Text +'std' Name.Namespace +';' Punctuation +'\n' Text + +'namespace' Keyword +' ' Text +'other' Name.Namespace +' ' Text +'=' Operator +' ' Text +'std' Name.Namespace +':' Operator +':' Operator +'exprimental' Name.Namespace +';' Punctuation +'\n' Text + +'\n' Text + +'namespace' Keyword +' ' Text +'std' Name.Namespace +':' Operator +':' Operator +'exprimental' Name.Namespace +':' Operator +':' Operator +'inner' Name.Namespace +' ' Text +'{' Punctuation +'\n' Text + +'class' Keyword +' ' Text +'QualifiedName' Name.Class +' ' Text +'{' Punctuation +'\n' Text + +'public' Keyword +':' Operator +'\n' Text + +' ' Text +'QualifiedName' Name +'(' Punctuation +'const' Keyword +' ' Text +'FlyString' Name +'&' Operator +' ' Text +'local_name' Name +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'const' Keyword +' ' Text +'FlyString' Name +'&' Operator +' ' Text +'local_name' Name +'(' Punctuation +')' Punctuation +' ' Text +'const' Keyword +' ' Text +'{' Punctuation +' ' Text +'return' Keyword +' ' Text +'m_local_name' Name +';' Punctuation +' ' Text +'}' Punctuation +'\n' Text + +'\n' Text + +'private' Keyword +':' Operator +'\n' Text + +' ' Text +'FlyString' Name +' ' Text +'m_local_name' Name +';' Punctuation +'\n' Text + +'}' Punctuation +';' Punctuation +' \n' Text + +'}' Punctuation +'\n' Text + +'\n' Text + +'namespace' Keyword +' ' Text +'ns' Name.Namespace +':' Operator +':' Operator +'inner' Name.Namespace +':' Operator +':' Operator +'inline' Keyword.Reserved +' ' Text +'pygments' Name.Namespace +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'using' Keyword +' ' Text +'namespace' Keyword +' ' Text +'outer' Name.Namespace +';' Punctuation +'\n' Text + +' ' Text +'int' Keyword.Type +' ' Text +'has_value' Name.Function +'(' Punctuation +')' Punctuation +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'namespace' Keyword +' ' Text +'other' Name.Namespace +' ' Text +'=' Operator +' ' Text +'std' Name.Namespace +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'namespace' Keyword +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'namespace' Keyword +' ' Text +'user' Name.Namespace +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'int' Keyword.Type +' ' Text +'has_value' Name.Function +'(' Punctuation +')' Punctuation +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'using' Keyword +' ' Text +'namespace' Keyword +' ' Text +'inner' Name.Namespace +';' Punctuation +'\n' Text + +' ' Text +'return' Keyword +' ' Text +'4' Literal.Number.Integer +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/examplefiles/ec/test.ec.output b/tests/examplefiles/ec/test.ec.output index 2d8f5b0..7091bbf 100644 --- a/tests/examplefiles/ec/test.ec.output +++ b/tests/examplefiles/ec/test.ec.output @@ -2730,10 +2730,7 @@ ' ' Text 'bool' Keyword.Type ' ' Text -'AnchorEditor' Name -':' Operator -':' Operator -'NotifyClicked' Name +'AnchorEditor::NotifyClicked' Name.Function '(' Punctuation 'Button' Name ' ' Text @@ -3440,7 +3437,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword '(' Punctuation 'anchor' Name '.' Punctuation @@ -3503,7 +3500,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword '(' Punctuation 'anchor' Name '.' Punctuation @@ -3579,7 +3576,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword '(' Punctuation 'anchor' Name '.' Punctuation @@ -3668,7 +3665,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword '(' Punctuation 'anchor' Name '.' Punctuation @@ -4301,10 +4298,7 @@ ' ' Text 'bool' Keyword.Type ' ' Text -'AnchorEditor' Name -':' Operator -':' Operator -'NotifyClicked' Name +'AnchorEditor::NotifyClicked' Name.Function '(' Punctuation 'Button' Name ' ' Text @@ -5227,7 +5221,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword '(' Punctuation 'anchor' Name '.' Punctuation @@ -5290,7 +5284,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword '(' Punctuation 'anchor' Name '.' Punctuation @@ -5366,7 +5360,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword '(' Punctuation 'anchor' Name '.' Punctuation @@ -5455,7 +5449,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword '(' Punctuation 'anchor' Name '.' Punctuation @@ -6904,10 +6898,7 @@ ' ' Text 'bool' Keyword.Type ' ' Text -'DataBox' Name -':' Operator -':' Operator -'NotifyTextEntry' Name +'DataBox::NotifyTextEntry' Name.Function '(' Punctuation 'AnchorDropBox' Name ' ' Text diff --git a/tests/examplefiles/gcode/SupportLogo.gcode b/tests/examplefiles/gcode/SupportLogo.gcode new file mode 100644 index 0000000..6d27cda --- /dev/null +++ b/tests/examplefiles/gcode/SupportLogo.gcode @@ -0,0 +1,67 @@ +% +O0000 + N10 (MACH3 MILL - ) +N20 (AUTHOR - {SCOTT SHAFER}) G0 ( second comment ) +N30 (GROUP - TOOLPATH GROUP #1) +N40 (SYSTEM- ONECNC-XR2 MILL ADVANTAGE - VERSION 8.12) +N50 (NOTES - NONE) +N60 G0 G40 G49 G50 G80 G94 +N70 (.1875 INCH 3/16 HSS END MILL ) ( ) +N80 T4 M06 G43 H4 +N90 S3411.0 F25.0 M3 M07 +N100 G4 P3 +N110 G00 X14.9375 Y1.4106 Z0.1 +N120 Z0.05 +N130 G01 X14.9358 Y1.3786 Z0.0466 F25.0 +N140 X14.9376 Y1.3149 Z0.0399 +N150 X14.9445 Y1.2515 Z0.0332 +N220 X15.2348 Y0.8636 Z-0.0205 +N230 X15.309 Y0.8443 Z-0.0285 +N240 X15.3096 +N250 X15.3101 +N260 X15.3106 +N270 X15.3111 +N280 X15.3116 +N290 X15.3121 Y0.8437 +N300 X15.3812 Y0.8329 Z-0.0362 +N310 X15.4511 Y0.8279 Z-0.0436 +N320 X15.521 Y0.8289 Z-0.0509 +N330 X15.5907 Y0.8357 Z-0.0583 +N340 X15.6595 Y0.8485 Z-0.0656 +N350 X15.727 Y0.867 Z-0.073 +N360 X15.7772 Y0.8886 Z-0.0787 +N450 X16.0252 Y1.2813 Z-0.1299 +N460 X16.0288 Y1.3346 Z-0.1356 +N470 X16.0285 Y1.3881 Z-0.1412 +N480 Y1.3892 Z-0.1413 +N490 Y1.3904 Z-0.1414 +N500 Y1.3916 Z-0.1415 +N510 Y1.3927 Z-0.1417 +N520 Y1.3939 Z-0.1418 +N530 Y1.3951 Z-0.1419 +N540 Y1.4324 Z-0.1458 +N550 X16.0257 Y1.4697 Z-0.1498 +N600 X15.9644 Y1.6626 Z-0.1712 +N610 X15.9323 Y1.707 Z-0.177 +N620 X15.8944 Y1.7466 Z-0.1827 +N630 X15.8515 Y1.7806 Z-0.1885 +N640 X15.8044 Y1.8086 Z-0.1942 +N650 X15.7539 Y1.8298 Z-0.2 +N660 X15.7528 Y1.8321 +N670 X15.7032 Y1.6737 +N680 G02 X15.774 Y1.6404 I-0.2085 J-0.5347 +N690 X15.8954 Y1.5145 I-0.1426 J-0.259 +N700 X15.8975 Y1.51 I-0.082 J-0.0413 +N92490 G03 X0.964 Y1.615 I0.1291 J-0.3825 +N92500 X0.9254 Y1.4125 I0.5116 J-0.2025 +N92510 X0.9257 Y1.395 I0.5503 J0. +N92520 G02 X0.9257 Y1.3921 I-0.0918 J-0.0029 +N92530 X0.9256 Y1.3881 I-0.0918 J0. +N92540 G03 X0.925 Y1.357 I0.7199 J-0.0312 +N92550 X0.9827 Y1.0743 I0.7206 J0. +N92560 G00 Z0.1 +N92570 M05 M09 +N92580 (END TOOL) +N92590 M05 M09 +N92600 M30 +% diff --git a/tests/examplefiles/gcode/SupportLogo.gcode.output b/tests/examplefiles/gcode/SupportLogo.gcode.output new file mode 100644 index 0000000..fee1a84 --- /dev/null +++ b/tests/examplefiles/gcode/SupportLogo.gcode.output @@ -0,0 +1,639 @@ +'%\n' Text + +'O' Keyword +'0000' Literal.Number +'\n' Text.Whitespace + +' ' Text.Whitespace +' ' Text.Whitespace +' ' Text.Whitespace +' ' Text.Whitespace +'N' Keyword +'10' Literal.Number +' ' Text.Whitespace +'(MACH3 MILL - )\n' Text + +'N' Keyword +'20' Literal.Number +' ' Text.Whitespace +'(AUTHOR - {SCOTT SHAFER}) G0 ( second comment )\n' Text + +'N' Keyword +'30' Literal.Number +' ' Text.Whitespace +'(GROUP - TOOLPATH GROUP #1)\n' Text + +'N' Keyword +'40' Literal.Number +' ' Text.Whitespace +'(SYSTEM- ONECNC-XR2 MILL ADVANTAGE - VERSION 8.12)\n' Text + +'N' Keyword +'50' Literal.Number +' ' Text.Whitespace +'(NOTES - NONE)\n' Text + +'N' Keyword +'60' Literal.Number +' ' Text.Whitespace +'G0 G40 G49 G50 G80 G94\n' Text + +'N' Keyword +'70' Literal.Number +' ' Text.Whitespace +'(' Keyword +'.1875' Literal.Number +' ' Text.Whitespace +'INCH 3/16 HSS END MILL ) ( )\n' Text + +'N' Keyword +'80' Literal.Number +' ' Text.Whitespace +'T' Keyword +'4' Literal.Number +' ' Text.Whitespace +'M06 G43 H4\n' Text + +'N' Keyword +'90' Literal.Number +' ' Text.Whitespace +'S' Keyword +'3411.0' Literal.Number +' ' Text.Whitespace +'F' Keyword +'25.0' Literal.Number +' ' Text.Whitespace +'M3 M07\n' Text + +'N' Keyword +'100' Literal.Number +' ' Text.Whitespace +'G4 P3\n' Text + +'N' Keyword +'110' Literal.Number +' ' Text.Whitespace +'G00 X14.9375 Y1.4106 Z0.1\n' Text + +'N' Keyword +'120' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.05' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'130' Literal.Number +' ' Text.Whitespace +'G01 X14.9358 Y1.3786 Z0.0466 F25.0\n' Text + +'N' Keyword +'140' Literal.Number +' ' Text.Whitespace +'X' Keyword +'14.9376' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.3149' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0399' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'150' Literal.Number +' ' Text.Whitespace +'X' Keyword +'14.9445' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.2515' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0332' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'220' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.2348' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.8636' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0205' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'230' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.309' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.8443' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0285' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'240' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.3096' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'250' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.3101' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'260' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.3106' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'270' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.3111' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'280' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.3116' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'290' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.3121' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.8437' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'300' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.3812' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.8329' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0362' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'310' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.4511' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.8279' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0436' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'320' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.521' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.8289' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0509' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'330' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.5907' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.8357' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0583' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'340' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.6595' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.8485' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0656' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'350' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.727' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.867' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.073' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'360' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.7772' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.8886' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0787' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'450' Literal.Number +' ' Text.Whitespace +'X' Keyword +'16.0252' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.2813' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1299' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'460' Literal.Number +' ' Text.Whitespace +'X' Keyword +'16.0288' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.3346' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1356' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'470' Literal.Number +' ' Text.Whitespace +'X' Keyword +'16.0285' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.3881' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1412' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'480' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.3892' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1413' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'490' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.3904' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1414' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'500' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.3916' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1415' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'510' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.3927' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1417' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'520' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.3939' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1418' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'530' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.3951' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1419' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'540' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.4324' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1458' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'550' Literal.Number +' ' Text.Whitespace +'X' Keyword +'16.0257' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.4697' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1498' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'600' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.9644' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.6626' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1712' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'610' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.9323' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.707' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.177' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'620' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.8944' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.7466' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1827' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'630' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.8515' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.7806' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1885' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'640' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.8044' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.8086' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.1942' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'650' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.7539' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.8298' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.2' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'660' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.7528' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.8321' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'670' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.7032' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.6737' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'680' Literal.Number +' ' Text.Whitespace +'G02 X15.774 Y1.6404 I-0.2085 J-0.5347\n' Text + +'N' Keyword +'690' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.8954' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.5145' Literal.Number +' ' Text.Whitespace +'I' Keyword +'-0.1426' Literal.Number +' ' Text.Whitespace +'J' Keyword +'-0.259' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'700' Literal.Number +' ' Text.Whitespace +'X' Keyword +'15.8975' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.51' Literal.Number +' ' Text.Whitespace +'I' Keyword +'-0.082' Literal.Number +' ' Text.Whitespace +'J' Keyword +'-0.0413' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'92490' Literal.Number +' ' Text.Whitespace +'G03 X0.964 Y1.615 I0.1291 J-0.3825\n' Text + +'N' Keyword +'92500' Literal.Number +' ' Text.Whitespace +'X' Keyword +'0.9254' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.4125' Literal.Number +' ' Text.Whitespace +'I' Keyword +'0.5116' Literal.Number +' ' Text.Whitespace +'J' Keyword +'-0.2025' Literal.Number +'\n' Text.Whitespace + +'N' Keyword +'92510' Literal.Number +' ' Text.Whitespace +'X' Keyword +'0.9257' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.395' Literal.Number +' ' Text.Whitespace +'I' Keyword +'0.5503' Literal.Number +' ' Text.Whitespace +'J' Keyword +'0' Literal.Number +'.\n' Text + +'N' Keyword +'92520' Literal.Number +' ' Text.Whitespace +'G02 X0.9257 Y1.3921 I-0.0918 J-0.0029\n' Text + +'N' Keyword +'92530' Literal.Number +' ' Text.Whitespace +'X' Keyword +'0.9256' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.3881' Literal.Number +' ' Text.Whitespace +'I' Keyword +'-0.0918' Literal.Number +' ' Text.Whitespace +'J' Keyword +'0' Literal.Number +'.\n' Text + +'N' Keyword +'92540' Literal.Number +' ' Text.Whitespace +'G03 X0.925 Y1.357 I0.7199 J-0.0312\n' Text + +'N' Keyword +'92550' Literal.Number +' ' Text.Whitespace +'X' Keyword +'0.9827' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.0743' Literal.Number +' ' Text.Whitespace +'I' Keyword +'0.7206' Literal.Number +' ' Text.Whitespace +'J' Keyword +'0' Literal.Number +'.\n' Text + +'N' Keyword +'92560' Literal.Number +' ' Text.Whitespace +'G00 Z0.1\n' Text + +'N' Keyword +'92570' Literal.Number +' ' Text.Whitespace +'M05 M09\n' Text + +'N' Keyword +'92580' Literal.Number +' ' Text.Whitespace +'(END TOOL)\n' Text + +'N' Keyword +'92590' Literal.Number +' ' Text.Whitespace +'M05 M09\n' Text + +'N' Keyword +'92600' Literal.Number +' ' Text.Whitespace +'M30\n' Text + +'%\n' Text diff --git a/tests/examplefiles/gcode/boomerangv4.gcode b/tests/examplefiles/gcode/boomerangv4.gcode new file mode 100644 index 0000000..91d44da --- /dev/null +++ b/tests/examplefiles/gcode/boomerangv4.gcode @@ -0,0 +1,52 @@ +( Made using CamBam - http://www.cambam.co.uk ) +( boomerangv3 1/14/2010 9:29:11 PM ) +( T0 : 0.25 ) +G20 G90 G64 G40 +G0 Z1.0 +( T0 : 0.25 ) +T0 M6 +( Profile1 ) +G17 +M3 S0 +G0 X11.4158 Y0.5132 +G1 F30.0 Z0.0 +G3 F300.0 X12.9975 Y1.714 I0.4346 J1.0696 +G0 Z1.0 +G0 X0.4562 Y1.7439 +G1 F30.0 Z0.0 +G3 F300.0 X2.018 Y0.538 I1.0998 J-0.1898 +( 3DSurface1 ) +S0 +G0 Z1.0 +G0 X0.1101 Y1.2205 +G1 F30.0 Z-0.0025 +G1 F300.0 Y1.4452 +G1 F30.0 X0.1851 Y1.5275 +G1 F300.0 Y1.504 +G1 Y1.479 Z0.001 +G1 Y1.404 Z0.0333 +G1 Y1.204 +G1 Y1.179 Z-0.0025 +G1 Y1.1581 +G1 F30.0 X0.2601 Y1.0964 +G1 F300.0 Y1.104 +G1 Y1.129 Z0.0973 +G1 Y1.329 +G1 Y1.379 Z0.0791 +G1 Y1.404 Z0.0688 +G1 Y1.554 Z0.0041 +G1 Y1.579 Z-0.0025 +G1 Y1.6098 +G1 F30.0 X0.3351 Y1.6921 +G1 F300.0 Y1.654 +G1 Y1.629 Z0.0072 +G1 Y1.479 Z0.0719 +G1 Y1.454 Z0.0817 +G1 Y1.304 Z0.1363 +G1 Y1.279 Z0.1451 +G1 Y1.079 +G1 Y1.054 Z-0.0025 +G1 Y1.0352 +G1 F30.0 X0.4101 Y0.9747 +M5 +M30 diff --git a/tests/examplefiles/gcode/boomerangv4.gcode.output b/tests/examplefiles/gcode/boomerangv4.gcode.output new file mode 100644 index 0000000..cb337ef --- /dev/null +++ b/tests/examplefiles/gcode/boomerangv4.gcode.output @@ -0,0 +1,349 @@ +'( Made using CamBam - http://www.cambam.co.uk )\n' Text + +'( boomerangv3 1/14/2010 9:29:11 PM )\n' Text + +'( T0 : 0.25 )\n' Text + +'G20 ' Name.Builtin +'G90 G64 G40\n' Text + +'G0 ' Name.Builtin +'Z' Keyword +'1.0' Literal.Number +'\n' Text.Whitespace + +'( T0 : 0.25 )\n' Text + +'T' Keyword +'0' Literal.Number +' ' Text.Whitespace +'M6\n' Text + +'( Profile1 )\n' Text + +'G17\n' Name.Builtin + +'M3 ' Name.Builtin +'S' Keyword +'0' Literal.Number +'\n' Text.Whitespace + +'G0 ' Name.Builtin +'X' Keyword +'11.4158' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.5132' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'30.0' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0' Literal.Number +'\n' Text.Whitespace + +'G3 ' Name.Builtin +'F' Keyword +'300.0' Literal.Number +' ' Text.Whitespace +'X' Keyword +'12.9975' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.714' Literal.Number +' ' Text.Whitespace +'I' Keyword +'0.4346' Literal.Number +' ' Text.Whitespace +'J' Keyword +'1.0696' Literal.Number +'\n' Text.Whitespace + +'G0 ' Name.Builtin +'Z' Keyword +'1.0' Literal.Number +'\n' Text.Whitespace + +'G0 ' Name.Builtin +'X' Keyword +'0.4562' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.7439' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'30.0' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0' Literal.Number +'\n' Text.Whitespace + +'G3 ' Name.Builtin +'F' Keyword +'300.0' Literal.Number +' ' Text.Whitespace +'X' Keyword +'2.018' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.538' Literal.Number +' ' Text.Whitespace +'I' Keyword +'1.0998' Literal.Number +' ' Text.Whitespace +'J' Keyword +'-0.1898' Literal.Number +'\n' Text.Whitespace + +'( 3DSurface1 )\n' Text + +'S' Keyword +'0' Literal.Number +'\n' Text.Whitespace + +'G0 ' Name.Builtin +'Z' Keyword +'1.0' Literal.Number +'\n' Text.Whitespace + +'G0 ' Name.Builtin +'X' Keyword +'0.1101' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.2205' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'30.0' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0025' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'300.0' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.4452' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'30.0' Literal.Number +' ' Text.Whitespace +'X' Keyword +'0.1851' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.5275' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'300.0' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.504' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.479' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.001' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.404' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0333' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.204' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.179' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0025' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.1581' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'30.0' Literal.Number +' ' Text.Whitespace +'X' Keyword +'0.2601' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.0964' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'300.0' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.104' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.129' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0973' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.329' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.379' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0791' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.404' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0688' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.554' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0041' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.579' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0025' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.6098' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'30.0' Literal.Number +' ' Text.Whitespace +'X' Keyword +'0.3351' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.6921' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'300.0' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'1.654' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.629' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0072' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.479' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0719' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.454' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.0817' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.304' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.1363' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.279' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'0.1451' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.079' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.054' Literal.Number +' ' Text.Whitespace +'Z' Keyword +'-0.0025' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'Y' Keyword +'1.0352' Literal.Number +'\n' Text.Whitespace + +'G1 ' Name.Builtin +'F' Keyword +'30.0' Literal.Number +' ' Text.Whitespace +'X' Keyword +'0.4101' Literal.Number +' ' Text.Whitespace +'Y' Keyword +'0.9747' Literal.Number +'\n' Text.Whitespace + +'M5\n' Name.Builtin + +'M30\n' Name.Builtin diff --git a/tests/examplefiles/groovy/quoted.groovy b/tests/examplefiles/groovy/quoted.groovy new file mode 100644 index 0000000..a51aee6 --- /dev/null +++ b/tests/examplefiles/groovy/quoted.groovy @@ -0,0 +1,2 @@ +def "long function name"(i) { return i } +assert 'long function name'(1) == 1 diff --git a/tests/examplefiles/groovy/quoted.groovy.output b/tests/examplefiles/groovy/quoted.groovy.output new file mode 100644 index 0000000..ac9c4ce --- /dev/null +++ b/tests/examplefiles/groovy/quoted.groovy.output @@ -0,0 +1,28 @@ +'def' Keyword.Type +' ' Text +'"long function name"' Name.Function +'(' Operator +'i' Name +')' Operator +' ' Text +'{' Operator +' ' Text +'return' Keyword +' ' Text +'i' Name +' ' Text +'}' Operator +'\n' Text + +'assert' Keyword +' ' Text +"'long function name'" Literal.String.Single +'(' Operator +'1' Literal.Number.Integer +')' Operator +' ' Text +'=' Operator +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text diff --git a/tests/examplefiles/groovy/test.gradle.output b/tests/examplefiles/groovy/test.gradle.output index 7e8d73a..9504f44 100644 --- a/tests/examplefiles/groovy/test.gradle.output +++ b/tests/examplefiles/groovy/test.gradle.output @@ -88,7 +88,7 @@ ' ' Text 'String' Name ' ' Text -'getWorldString' Name.Function +'getWorldString' Name '(' Operator ')' Operator ' ' Text diff --git a/tests/examplefiles/groovy/test.groovy.output b/tests/examplefiles/groovy/test.groovy.output index d4fbeb5..bcb15b3 100644 --- a/tests/examplefiles/groovy/test.groovy.output +++ b/tests/examplefiles/groovy/test.groovy.output @@ -167,7 +167,7 @@ '\n' Text ' ' Text -'if' Name.Function +'if' Keyword ' ' Text '(' Operator '!' Operator @@ -183,7 +183,7 @@ ' ' Text 'new' Keyword ' ' Text -'RuntimeException' Name.Function +'RuntimeException' Name '(' Operator '"$activity activity doesn\'t exist"' Literal.String.Double ')' Operator @@ -273,7 +273,7 @@ '\n' Text ' ' Text -'switch' Name.Function +'switch' Keyword ' ' Text '(' Operator 'activityValue' Name diff --git a/tests/examplefiles/julia/string.jl b/tests/examplefiles/julia/string.jl index 67bf6c7..99b706f 100644 --- a/tests/examplefiles/julia/string.jl +++ b/tests/examplefiles/julia/string.jl @@ -1,1031 +1,364 @@ -## core string functions ## - -length(s::String) = error("you must implement length(",typeof(s),")") -next(s::String, i::Int) = error("you must implement next(",typeof(s),",Int)") -next(s::DirectIndexString, i::Int) = (s[i],i+1) -next(s::String, i::Integer) = next(s,int(i)) - -## generic supplied functions ## - -start(s::String) = 1 -done(s::String,i) = (i > length(s)) -isempty(s::String) = done(s,start(s)) -ref(s::String, i::Int) = next(s,i)[1] -ref(s::String, i::Integer) = s[int(i)] -ref(s::String, x::Real) = s[iround(x)] -ref{T<:Integer}(s::String, r::Range1{T}) = s[int(first(r)):int(last(r))] - -symbol(s::String) = symbol(cstring(s)) -string(s::String) = s - -print(s::String) = for c=s; print(c); end -print(x...) = for i=x; print(i); end -println(args...) = print(args..., '\n') - -show(s::String) = print_quoted(s) - -(*)(s::String...) = strcat(s...) -(^)(s::String, r::Integer) = repeat(s,r) - -size(s::String) = (length(s),) -size(s::String, d::Integer) = d==1 ? length(s) : - error("in size: dimension ",d," out of range") - -strlen(s::DirectIndexString) = length(s) -function strlen(s::String) - i = start(s) - if done(s,i) - return 0 - end - n = 1 - while true - c, j = next(s,i) - if done(s,j) - return n - end - n += 1 - i = j - end -end - -isvalid(s::DirectIndexString, i::Integer) = (start(s) <= i <= length(s)) -function isvalid(s::String, i::Integer) - try - next(s,i) - true - catch - false - end -end - -prevind(s::DirectIndexString, i::Integer) = i-1 -thisind(s::DirectIndexString, i::Integer) = i -nextind(s::DirectIndexString, i::Integer) = i+1 - -prevind(s::String, i::Integer) = thisind(s,thisind(s,i)-1) - -function thisind(s::String, i::Integer) - for j = i:-1:1 - if isvalid(s,j) - return j - end - end - return 0 # out of range -end - -function nextind(s::String, i::Integer) - for j = i+1:length(s) - if isvalid(s,j) - return j - end - end - length(s)+1 # out of range -end - -ind2chr(s::DirectIndexString, i::Integer) = i -chr2ind(s::DirectIndexString, i::Integer) = i - -function ind2chr(s::String, i::Integer) - s[i] # throws error if invalid - j = 1 - k = start(s) - while true - c, l = next(s,k) - if i <= k - return j - end - j += 1 - k = l - end -end - -function chr2ind(s::String, i::Integer) - if i < 1 - return i - end - j = 1 - k = start(s) - while true - c, l = next(s,k) - if i == j - return k - end - j += 1 - k = l - end -end - -function strchr(s::String, c::Char, i::Integer) - i = nextind(s,i) - while !done(s,i) - d, j = next(s,i) - if c == d - return i - end - i = j - end - return 0 -end -strchr(s::String, c::Char) = strchr(s, c, start(s)) -contains(s::String, c::Char) = (strchr(s,c)!=0) - -function chars(s::String) - cx = Array(Char,strlen(s)) - i = 0 - for c in s - cx[i += 1] = c - end - return cx -end - -function cmp(a::String, b::String) - i = start(a) - j = start(b) - while !done(a,i) && !done(b,i) - c, i = next(a,i) - d, j = next(b,j) - if c != d - return c < d ? -1 : +1 +# This file is a part of Julia. License is MIT: https://julialang.org/license + +""" + StringIndexError(str, i) + +An error occurred when trying to access `str` at index `i` that is not valid. +""" +struct StringIndexError <: Exception + string::AbstractString + index::Integer +end +@noinline string_index_err(s::AbstractString, i::Integer) = + throw(StringIndexError(s, Int(i))) +function Base.showerror(io::IO, exc::StringIndexError) + s = exc.string + print(io, "StringIndexError: ", "invalid index [$(exc.index)]") + if firstindex(s) <= exc.index <= ncodeunits(s) + iprev = thisind(s, exc.index) + inext = nextind(s, iprev) + if inext <= ncodeunits(s) + print(io, ", valid nearby indices [$iprev]=>'$(s[iprev])', [$inext]=>'$(s[inext])'") + else + print(io, ", valid nearby index [$iprev]=>'$(s[iprev])'") end end - done(a,i) && !done(b,j) ? -1 : - !done(a,i) && done(b,j) ? +1 : 0 -end - -isequal(a::String, b::String) = cmp(a,b) == 0 -isless(a::String, b::String) = cmp(a,b) < 0 - -# faster comparisons for byte strings - -cmp(a::ByteString, b::ByteString) = lexcmp(a.data, b.data) -isequal(a::ByteString, b::ByteString) = length(a)==length(b) && cmp(a,b)==0 - -## character column width function ## - -charwidth(c::Char) = max(0,int(ccall(:wcwidth, Int32, (Char,), c))) -strwidth(s::String) = (w=0; for c in s; w += charwidth(c); end; w) -strwidth(s::ByteString) = ccall(:u8_strwidth, Int, (Ptr{Uint8},), s.data) -# TODO: implement and use u8_strnwidth that takes a length argument - -## generic string uses only length and next ## - -type GenericString <: String - string::String -end - -length(s::GenericString) = length(s.string) -next(s::GenericString, i::Int) = next(s.string, i) - -## plain old character arrays ## - -type CharString <: String - chars::Array{Char,1} - - CharString(a::Array{Char,1}) = new(a) - CharString(c::Char...) = new([ c[i] | i=1:length(c) ]) -end -CharString(x...) = CharString(map(char,x)...) - -next(s::CharString, i::Int) = (s.chars[i], i+1) -length(s::CharString) = length(s.chars) -strlen(s::CharString) = length(s) - -string(c::Char) = CharString(c) -string(c::Char, x::Char...) = CharString(c, x...) - -## substrings reference original strings ## - -type SubString <: String - string::String - offset::Int - length::Int - - SubString(s::String, i::Int, j::Int) = new(s, i-1, j-i+1) - SubString(s::SubString, i::Int, j::Int) = - new(s.string, i-1+s.offset, j-i+1) -end -SubString(s::String, i::Integer, j::Integer) = SubString(s, int(i), int(j)) - -function next(s::SubString, i::Int) - if i < 1 || i > s.length - error("string index out of bounds") - end - c, i = next(s.string, i+s.offset) - c, i-s.offset -end - -length(s::SubString) = s.length -# TODO: strlen(s::SubString) = ?? -# default implementation will work but it's slow -# can this be delegated efficiently somehow? -# that may require additional string interfaces - -function ref(s::String, r::Range1{Int}) - if first(r) < 1 || length(s) < last(r) - error("in substring slice: index out of range") - end - SubString(s, first(r), last(r)) -end - -## efficient representation of repeated strings ## - -type RepString <: String - string::String - repeat::Integer -end - -length(s::RepString) = length(s.string)*s.repeat -strlen(s::RepString) = strlen(s.string)*s.repeat - -function next(s::RepString, i::Int) - if i < 1 || i > length(s) - error("string index out of bounds") - end - j = mod1(i,length(s.string)) - c, k = next(s.string, j) - c, k-j+i -end - -function repeat(s::String, r::Integer) - r < 0 ? error("can't repeat a string ",r," times") : - r == 0 ? "" : - r == 1 ? s : - RepString(s,r) -end - -## reversed strings without data movement ## - -type RevString <: String - string::String -end - -length(s::RevString) = length(s.string) -strlen(s::RevString) = strlen(s.string) - -start(s::RevString) = (n=length(s); n-thisind(s.string,n)+1) -function next(s::RevString, i::Int) - n = length(s); j = n-i+1 - (s.string[j], n-thisind(s.string,j-1)+1) -end - -reverse(s::String) = RevString(s) -reverse(s::RevString) = s.string - -## ropes for efficient concatenation, etc. ## - -# Idea: instead of this standard binary tree structure, -# how about we keep an array of substrings, with an -# offset array. We can do binary search on the offset -# array so we get O(log(n)) indexing time still, but we -# can compute the offsets lazily and avoid all the -# futzing around while the string is being constructed. - -type RopeString <: String - head::String - tail::String - depth::Int32 - length::Int - - RopeString(h::RopeString, t::RopeString) = - depth(h.tail) + depth(t) < depth(h.head) ? - RopeString(h.head, RopeString(h.tail, t)) : - new(h, t, max(h.depth,t.depth)+1, length(h)+length(t)) - - RopeString(h::RopeString, t::String) = - depth(h.tail) < depth(h.head) ? - RopeString(h.head, RopeString(h.tail, t)) : - new(h, t, h.depth+1, length(h)+length(t)) - - RopeString(h::String, t::RopeString) = - depth(t.head) < depth(t.tail) ? - RopeString(RopeString(h, t.head), t.tail) : - new(h, t, t.depth+1, length(h)+length(t)) - - RopeString(h::String, t::String) = - new(h, t, 1, length(h)+length(t)) -end - -depth(s::String) = 0 -depth(s::RopeString) = s.depth - -function next(s::RopeString, i::Int) - if i <= length(s.head) - return next(s.head, i) - else - c, j = next(s.tail, i-length(s.head)) - return c, j+length(s.head) - end -end - -length(s::RopeString) = s.length -strlen(s::RopeString) = strlen(s.head) + strlen(s.tail) - -strcat() = "" -strcat(s::String) = s -strcat(x...) = strcat(map(string,x)...) -strcat(s::String, t::String...) = - (t = strcat(t...); isempty(s) ? t : isempty(t) ? s : RopeString(s, t)) - -print(s::RopeString) = print(s.head, s.tail) - -## transformed strings ## - -type TransformedString <: String - transform::Function - string::String end -length(s::TransformedString) = length(s.string) -strlen(s::TransformedString) = strlen(s.string) +const ByteArray = Union{Vector{UInt8},Vector{Int8}} -function next(s::TransformedString, i::Int) - c, j = next(s.string,i) - c = s.transform(c, i) - return c, j -end +@inline between(b::T, lo::T, hi::T) where {T<:Integer} = (lo ≤ b) & (b ≤ hi) -## uppercase and lowercase transformations ## +## constructors and conversions ## -uppercase(c::Char) = ccall(:towupper, Char, (Char,), c) -lowercase(c::Char) = ccall(:towlower, Char, (Char,), c) +# String constructor docstring from boot.jl, workaround for #16730 +# and the unavailability of @doc in boot.jl context. +""" + String(v::AbstractVector{UInt8}) -uppercase(s::String) = TransformedString((c,i)->uppercase(c), s) -lowercase(s::String) = TransformedString((c,i)->lowercase(c), s) +Create a new `String` object from a byte vector `v` containing UTF-8 encoded +characters. If `v` is `Vector{UInt8}` it will be truncated to zero length and +future modification of `v` cannot affect the contents of the resulting string. +To avoid truncation of `Vector{UInt8}` data, use `String(copy(v))`; for other +`AbstractVector` types, `String(v)` already makes a copy. -ucfirst(s::String) = TransformedString((c,i)->i==1 ? uppercase(c) : c, s) -lcfirst(s::String) = TransformedString((c,i)->i==1 ? lowercase(c) : c, s) +When possible, the memory of `v` will be used without copying when the `String` +object is created. This is guaranteed to be the case for byte vectors returned +by [`take!`](@ref) on a writable [`IOBuffer`](@ref) and by calls to +[`read(io, nb)`](@ref). This allows zero-copy conversion of I/O data to strings. +In other cases, `Vector{UInt8}` data may be copied, but `v` is truncated anyway +to guarantee consistent behavior. +""" +String(v::AbstractVector{UInt8}) = String(copyto!(StringVector(length(v)), v)) +String(v::Vector{UInt8}) = ccall(:jl_array_to_string, Ref{String}, (Any,), v) -const uc = uppercase -const lc = lowercase +""" + unsafe_string(p::Ptr{UInt8}, [length::Integer]) -## string map ## +Copy a string from the address of a C-style (NUL-terminated) string encoded as UTF-8. +(The pointer can be safely freed afterwards.) If `length` is specified +(the length of the data in bytes), the string does not have to be NUL-terminated. -function map(f::Function, s::String) - out = memio(length(s)) - for c in s - write(out, f(c)::Char) - end - takebuf_string(out) +This function is labeled "unsafe" because it will crash if `p` is not +a valid memory address to data of the requested length. +""" +function unsafe_string(p::Union{Ptr{UInt8},Ptr{Int8}}, len::Integer) + p == C_NULL && throw(ArgumentError("cannot convert NULL to string")) + ccall(:jl_pchar_to_string, Ref{String}, (Ptr{UInt8}, Int), p, len) end - -## conversion of general objects to strings ## - -string(x) = print_to_string(show, x) -cstring(x...) = print_to_string(print, x...) - -function cstring(p::Ptr{Uint8}) - p == C_NULL ? error("cannot convert NULL to string") : - ccall(:jl_cstr_to_string, Any, (Ptr{Uint8},), p)::ByteString +function unsafe_string(p::Union{Ptr{UInt8},Ptr{Int8}}) + p == C_NULL && throw(ArgumentError("cannot convert NULL to string")) + ccall(:jl_cstr_to_string, Ref{String}, (Ptr{UInt8},), p) end -## string promotion rules ## - -promote_rule(::Type{UTF8String} , ::Type{ASCIIString}) = UTF8String -promote_rule(::Type{UTF8String} , ::Type{CharString} ) = UTF8String -promote_rule(::Type{ASCIIString}, ::Type{CharString} ) = UTF8String +_string_n(n::Integer) = ccall(:jl_alloc_string, Ref{String}, (Csize_t,), n) -## printing literal quoted string data ## +""" + String(s::AbstractString) -# TODO: this is really the inverse of print_unbackslashed +Convert a string to a contiguous byte array representation encoded as UTF-8 bytes. +This representation is often appropriate for passing strings to C. +""" +String(s::AbstractString) = print_to_string(s) +@pure String(s::Symbol) = unsafe_string(unsafe_convert(Ptr{UInt8}, s)) -function print_quoted_literal(s::String) - print('"') - for c = s; c == '"' ? print("\\\"") : print(c); end - print('"') -end - -## string escaping & unescaping ## +unsafe_wrap(::Type{Vector{UInt8}}, s::String) = ccall(:jl_string_to_array, Ref{Vector{UInt8}}, (Any,), s) -escape_nul(s::String, i::Int) = - !done(s,i) && '0' <= next(s,i)[1] <= '7' ? L"\x00" : L"\0" +Vector{UInt8}(s::CodeUnits{UInt8,String}) = copyto!(Vector{UInt8}(undef, length(s)), s) +Vector{UInt8}(s::String) = Vector{UInt8}(codeunits(s)) +Array{UInt8}(s::String) = Vector{UInt8}(codeunits(s)) -is_hex_digit(c::Char) = '0'<=c<='9' || 'a'<=c<='f' || 'A'<=c<='F' -need_full_hex(s::String, i::Int) = !done(s,i) && is_hex_digit(next(s,i)[1]) +String(s::CodeUnits{UInt8,String}) = s.s -function print_escaped(s::String, esc::String) - i = start(s) - while !done(s,i) - c, j = next(s,i) - c == '\0' ? print(escape_nul(s,j)) : - c == '\e' ? print(L"\e") : - c == '\\' ? print("\\\\") : - contains(esc,c) ? print('\\', c) : - iswprint(c) ? print(c) : - 7 <= c <= 13 ? print('\\', "abtnvfr"[c-6]) : - c <= '\x7f' ? print(L"\x", hex(c, 2)) : - c <= '\uffff' ? print(L"\u", hex(c, need_full_hex(s,j) ? 4 : 2)) : - print(L"\U", hex(c, need_full_hex(s,j) ? 8 : 4)) - i = j - end -end +## low-level functions ## -escape_string(s::String) = print_to_string(length(s), print_escaped, s, "\"") -print_quoted(s::String) = (print('"'); print_escaped(s, "\"\$"); print('"')) -#" # work around syntax highlighting problem -quote_string(s::String) = print_to_string(length(s)+2, print_quoted, s) +pointer(s::String) = unsafe_convert(Ptr{UInt8}, s) +pointer(s::String, i::Integer) = pointer(s) + Int(i)::Int - 1 -# bare minimum unescaping function unescapes only given characters +@pure ncodeunits(s::String) = Core.sizeof(s) +codeunit(s::String) = UInt8 -function print_unescaped_chars(s::String, esc::String) - if !contains(esc,'\\') - esc = strcat("\\", esc) - end - i = start(s) - while !done(s,i) - c, i = next(s,i) - if c == '\\' && !done(s,i) && contains(esc,s[i]) - c, i = next(s,i) - end - print(c) - end +@inline function codeunit(s::String, i::Integer) + @boundscheck checkbounds(s, i) + b = GC.@preserve s unsafe_load(pointer(s, i)) + return b end -unescape_chars(s::String, esc::String) = - print_to_string(length(s), print_unescaped_chars, s, esc) +## comparison ## -# general unescaping of traditional C and Unicode escape sequences +_memcmp(a::Union{Ptr{UInt8},AbstractString}, b::Union{Ptr{UInt8},AbstractString}, len) = + ccall(:memcmp, Cint, (Ptr{UInt8}, Ptr{UInt8}, Csize_t), a, b, len % Csize_t) % Int -function print_unescaped(s::String) - i = start(s) - while !done(s,i) - c, i = next(s,i) - if !done(s,i) && c == '\\' - c, i = next(s,i) - if c == 'x' || c == 'u' || c == 'U' - n = k = 0 - m = c == 'x' ? 2 : - c == 'u' ? 4 : 8 - while (k+=1) <= m && !done(s,i) - c, j = next(s,i) - n = '0' <= c <= '9' ? n<<4 + c-'0' : - 'a' <= c <= 'f' ? n<<4 + c-'a'+10 : - 'A' <= c <= 'F' ? n<<4 + c-'A'+10 : break - i = j - end - if k == 1 - error("\\x used with no following hex digits") - end - if m == 2 # \x escape sequence - write(uint8(n)) - else - print(char(n)) - end - elseif '0' <= c <= '7' - k = 1 - n = c-'0' - while (k+=1) <= 3 && !done(s,i) - c, j = next(s,i) - n = '0' <= c <= '7' ? n<<3 + c-'0' : break - i = j - end - if n > 255 - error("octal escape sequence out of range") - end - write(uint8(n)) - else - print(c == 'a' ? '\a' : - c == 'b' ? '\b' : - c == 't' ? '\t' : - c == 'n' ? '\n' : - c == 'v' ? '\v' : - c == 'f' ? '\f' : - c == 'r' ? '\r' : - c == 'e' ? '\e' : c) - end - else - print(c) - end - end +function cmp(a::String, b::String) + al, bl = sizeof(a), sizeof(b) + c = _memcmp(a, b, min(al,bl)) + return c < 0 ? -1 : c > 0 ? +1 : cmp(al,bl) +end + +function ==(a::String, b::String) + pointer_from_objref(a) == pointer_from_objref(b) && return true + al = sizeof(a) + return al == sizeof(b) && 0 == _memcmp(a, b, al) +end + +typemin(::Type{String}) = "" +typemin(::String) = typemin(String) + +## thisind, nextind ## + +@propagate_inbounds thisind(s::String, i::Int) = _thisind_str(s, i) + +# s should be String or SubString{String} +@inline function _thisind_str(s, i::Int) + i == 0 && return 0 + n = ncodeunits(s) + i == n + 1 && return i + @boundscheck between(i, 1, n) || throw(BoundsError(s, i)) + @inbounds b = codeunit(s, i) + (b & 0xc0 == 0x80) & (i-1 > 0) || return i + @inbounds b = codeunit(s, i-1) + between(b, 0b11000000, 0b11110111) && return i-1 + (b & 0xc0 == 0x80) & (i-2 > 0) || return i + @inbounds b = codeunit(s, i-2) + between(b, 0b11100000, 0b11110111) && return i-2 + (b & 0xc0 == 0x80) & (i-3 > 0) || return i + @inbounds b = codeunit(s, i-3) + between(b, 0b11110000, 0b11110111) && return i-3 + return i +end + +@propagate_inbounds nextind(s::String, i::Int) = _nextind_str(s, i) + +# s should be String or SubString{String} +@inline function _nextind_str(s, i::Int) + i == 0 && return 1 + n = ncodeunits(s) + @boundscheck between(i, 1, n) || throw(BoundsError(s, i)) + @inbounds l = codeunit(s, i) + (l < 0x80) | (0xf8 ≤ l) && return i+1 + if l < 0xc0 + i′ = @inbounds thisind(s, i) + return i′ < i ? @inbounds(nextind(s, i′)) : i+1 + end + # first continuation byte + (i += 1) > n && return i + @inbounds b = codeunit(s, i) + b & 0xc0 ≠ 0x80 && return i + ((i += 1) > n) | (l < 0xe0) && return i + # second continuation byte + @inbounds b = codeunit(s, i) + b & 0xc0 ≠ 0x80 && return i + ((i += 1) > n) | (l < 0xf0) && return i + # third continuation byte + @inbounds b = codeunit(s, i) + ifelse(b & 0xc0 ≠ 0x80, i, i+1) end -unescape_string(s::String) = print_to_string(length(s), print_unescaped, s) - ## checking UTF-8 & ACSII validity ## -byte_string_classify(s::ByteString) = - ccall(:u8_isvalid, Int32, (Ptr{Uint8}, Int), s.data, length(s)) +byte_string_classify(s::Union{String,Vector{UInt8},FastContiguousSubArray{UInt8,1,Vector{UInt8}}}) = + ccall(:u8_isvalid, Int32, (Ptr{UInt8}, Int), s, sizeof(s)) # 0: neither valid ASCII nor UTF-8 # 1: valid ASCII # 2: valid UTF-8 -is_valid_ascii(s::ByteString) = byte_string_classify(s) == 1 -is_valid_utf8 (s::ByteString) = byte_string_classify(s) != 0 - -check_ascii(s::ByteString) = is_valid_ascii(s) ? s : error("invalid ASCII sequence") -check_utf8 (s::ByteString) = is_valid_utf8(s) ? s : error("invalid UTF-8 sequence") - -## string interpolation parsing ## - -function _jl_interp_parse(s::String, unescape::Function, printer::Function) - sx = {} - i = j = start(s) - while !done(s,j) - c, k = next(s,j) - if c == '$' - if !isempty(s[i:j-1]) - push(sx, unescape(s[i:j-1])) - end - ex, j = parseatom(s,k) - push(sx, ex) - i = j - elseif c == '\\' && !done(s,k) - if s[k] == '$' - if !isempty(s[i:j-1]) - push(sx, unescape(s[i:j-1])) - end - i = k - end - c, j = next(s,k) - else - j = k +isvalid(::Type{String}, s::Union{Vector{UInt8},FastContiguousSubArray{UInt8,1,Vector{UInt8}},String}) = byte_string_classify(s) ≠ 0 +isvalid(s::String) = isvalid(String, s) + +is_valid_continuation(c) = c & 0xc0 == 0x80 + +## required core functionality ## + +@inline function iterate(s::String, i::Int=firstindex(s)) + (i % UInt) - 1 < ncodeunits(s) || return nothing + b = @inbounds codeunit(s, i) + u = UInt32(b) << 24 + between(b, 0x80, 0xf7) || return reinterpret(Char, u), i+1 + return iterate_continued(s, i, u) +end + +function iterate_continued(s::String, i::Int, u::UInt32) + u < 0xc0000000 && (i += 1; @goto ret) + n = ncodeunits(s) + # first continuation byte + (i += 1) > n && @goto ret + @inbounds b = codeunit(s, i) + b & 0xc0 == 0x80 || @goto ret + u |= UInt32(b) << 16 + # second continuation byte + ((i += 1) > n) | (u < 0xe0000000) && @goto ret + @inbounds b = codeunit(s, i) + b & 0xc0 == 0x80 || @goto ret + u |= UInt32(b) << 8 + # third continuation byte + ((i += 1) > n) | (u < 0xf0000000) && @goto ret + @inbounds b = codeunit(s, i) + b & 0xc0 == 0x80 || @goto ret + u |= UInt32(b); i += 1 +@label ret + return reinterpret(Char, u), i +end + +@propagate_inbounds function getindex(s::String, i::Int) + b = codeunit(s, i) + u = UInt32(b) << 24 + between(b, 0x80, 0xf7) || return reinterpret(Char, u) + return getindex_continued(s, i, u) +end + +function getindex_continued(s::String, i::Int, u::UInt32) + if u < 0xc0000000 + # called from `getindex` which checks bounds + @inbounds isvalid(s, i) && @goto ret + string_index_err(s, i) + end + n = ncodeunits(s) + + (i += 1) > n && @goto ret + @inbounds b = codeunit(s, i) # cont byte 1 + b & 0xc0 == 0x80 || @goto ret + u |= UInt32(b) << 16 + + ((i += 1) > n) | (u < 0xe0000000) && @goto ret + @inbounds b = codeunit(s, i) # cont byte 2 + b & 0xc0 == 0x80 || @goto ret + u |= UInt32(b) << 8 + + ((i += 1) > n) | (u < 0xf0000000) && @goto ret + @inbounds b = codeunit(s, i) # cont byte 3 + b & 0xc0 == 0x80 || @goto ret + u |= UInt32(b) +@label ret + return reinterpret(Char, u) +end + +getindex(s::String, r::UnitRange{<:Integer}) = s[Int(first(r)):Int(last(r))] + +@inline function getindex(s::String, r::UnitRange{Int}) + isempty(r) && return "" + i, j = first(r), last(r) + @boundscheck begin + checkbounds(s, r) + @inbounds isvalid(s, i) || string_index_err(s, i) + @inbounds isvalid(s, j) || string_index_err(s, j) + end + j = nextind(s, j) - 1 + n = j - i + 1 + ss = _string_n(n) + GC.@preserve s ss unsafe_copyto!(pointer(ss), pointer(s, i), n) + return ss +end + +length(s::String) = length_continued(s, 1, ncodeunits(s), ncodeunits(s)) + +@inline function length(s::String, i::Int, j::Int) + @boundscheck begin + 0 < i ≤ ncodeunits(s)+1 || throw(BoundsError(s, i)) + 0 ≤ j < ncodeunits(s)+1 || throw(BoundsError(s, j)) + end + j < i && return 0 + @inbounds i, k = thisind(s, i), i + c = j - i + (i == k) + length_continued(s, i, j, c) +end + +@inline function length_continued(s::String, i::Int, n::Int, c::Int) + i < n || return c + @inbounds b = codeunit(s, i) + @inbounds while true + while true + (i += 1) ≤ n || return c + 0xc0 ≤ b ≤ 0xf7 && break + b = codeunit(s, i) end - end - if !isempty(s[i:]) - push(sx, unescape(s[i:j-1])) - end - length(sx) == 1 && isa(sx[1],ByteString) ? sx[1] : - expr(:call, :print_to_string, printer, sx...) -end - -_jl_interp_parse(s::String, u::Function) = _jl_interp_parse(s, u, print) -_jl_interp_parse(s::String) = _jl_interp_parse(s, x->check_utf8(unescape_string(x))) - -function _jl_interp_parse_bytes(s::String) - writer(x...) = for w=x; write(w); end - _jl_interp_parse(s, unescape_string, writer) -end - -## core string macros ## - -macro str(s); _jl_interp_parse(s); end -macro S_str(s); _jl_interp_parse(s); end -macro I_str(s); _jl_interp_parse(s, x->unescape_chars(x,"\"")); end -macro E_str(s); check_utf8(unescape_string(s)); end -macro B_str(s); _jl_interp_parse_bytes(s); end -macro b_str(s); ex = _jl_interp_parse_bytes(s); :(($ex).data); end - -## shell-like command parsing ## - -function _jl_shell_parse(s::String, interp::Bool) - - in_single_quotes = false - in_double_quotes = false - - args = {} - arg = {} - i = start(s) - j = i - - function update_arg(x) - if !isa(x,String) || !isempty(x) - push(arg, x) - end - end - function append_arg() - if isempty(arg); arg = {"",}; end - push(args, arg) - arg = {} - end - - while !done(s,j) - c, k = next(s,j) - if !in_single_quotes && !in_double_quotes && iswspace(c) - update_arg(s[i:j-1]) - append_arg() - j = k - while !done(s,j) - c, k = next(s,j) - if !iswspace(c) - i = j - break - end - j = k - end - elseif interp && !in_single_quotes && c == '$' - update_arg(s[i:j-1]); i = k; j = k - if done(s,k) - error("\$ right before end of command") - end - if iswspace(s[k]) - error("space not allowed right after \$") - end - ex, j = parseatom(s,j) - update_arg(ex); i = j - else - if !in_double_quotes && c == '\'' - in_single_quotes = !in_single_quotes - update_arg(s[i:j-1]); i = k - elseif !in_single_quotes && c == '"' - in_double_quotes = !in_double_quotes - update_arg(s[i:j-1]); i = k - elseif c == '\\' - if in_double_quotes - if done(s,k) - error("unterminated double quote") - end - if s[k] == '"' || s[k] == '$' - update_arg(s[i:j-1]); i = k - c, k = next(s,k) - end - elseif !in_single_quotes - if done(s,k) - error("dangling backslash") - end - update_arg(s[i:j-1]); i = k - c, k = next(s,k) - end - end - j = k - end - end - - if in_single_quotes; error("unterminated single quote"); end - if in_double_quotes; error("unterminated double quote"); end - - update_arg(s[i:]) - append_arg() - - if !interp - return args - end - - # construct an expression - exprs = {} - for arg in args - push(exprs, expr(:tuple, arg)) - end - expr(:tuple,exprs) -end -_jl_shell_parse(s::String) = _jl_shell_parse(s,true) - -function shell_split(s::String) - parsed = _jl_shell_parse(s,false) - args = String[] - for arg in parsed - push(args, strcat(arg...)) - end - args -end - -function print_shell_word(word::String) - if isempty(word) - print("''") - end - has_single = false - has_special = false - for c in word - if iswspace(c) || c=='\\' || c=='\'' || c=='"' || c=='$' - has_special = true - if c == '\'' - has_single = true - end + l = b + b = codeunit(s, i) # cont byte 1 + c -= (x = b & 0xc0 == 0x80) + x & (l ≥ 0xe0) || continue + + (i += 1) ≤ n || return c + b = codeunit(s, i) # cont byte 2 + c -= (x = b & 0xc0 == 0x80) + x & (l ≥ 0xf0) || continue + + (i += 1) ≤ n || return c + b = codeunit(s, i) # cont byte 3 + c -= (b & 0xc0 == 0x80) + end +end + +## overload methods for efficiency ## + +isvalid(s::String, i::Int) = checkbounds(Bool, s, i) && thisind(s, i) == i + +function isascii(s::String) + @inbounds for i = 1:ncodeunits(s) + codeunit(s, i) >= 0x80 && return false + end + return true +end + +""" + repeat(c::AbstractChar, r::Integer) -> String + +Repeat a character `r` times. This can equivalently be accomplished by calling +[`c^r`](@ref :^(::Union{AbstractString, AbstractChar}, ::Integer)). + +# Examples +```jldoctest +julia> repeat('A', 3) +"AAA" +``` +""" +repeat(c::AbstractChar, r::Integer) = repeat(Char(c), r) # fallback +function repeat(c::Char, r::Integer) + r == 0 && return "" + r < 0 && throw(ArgumentError("can't repeat a character $r times")) + u = bswap(reinterpret(UInt32, c)) + n = 4 - (leading_zeros(u | 0xff) >> 3) + s = _string_n(n*r) + p = pointer(s) + GC.@preserve s if n == 1 + ccall(:memset, Ptr{Cvoid}, (Ptr{UInt8}, Cint, Csize_t), p, u % UInt8, r) + elseif n == 2 + p16 = reinterpret(Ptr{UInt16}, p) + for i = 1:r + unsafe_store!(p16, u % UInt16, i) end - end - if !has_special - print(word) - elseif !has_single - print('\'', word, '\'') - else - print('"') - for c in word - if c == '"' || c == '$' - print('\\') - end - print(c) - end - print('"') - end -end - -function print_shell_escaped(cmd::String, args::String...) - print_shell_word(cmd) - for arg in args - print(' ') - print_shell_word(arg) - end -end - -shell_escape(cmd::String, args::String...) = - print_to_string(print_shell_escaped, cmd, args...) - -## interface to parser ## - -function parse(s::String, pos, greedy) - # returns (expr, end_pos). expr is () in case of parse error. - ex, pos = ccall(:jl_parse_string, Any, - (Ptr{Uint8}, Int32, Int32), - cstring(s), pos-1, greedy ? 1:0) - if isa(ex,Expr) && is(ex.head,:error) - throw(ParseError(ex.args[1])) - end - if ex == (); throw(ParseError("end of input")); end - ex, pos+1 # C is zero-based, Julia is 1-based -end - -parse(s::String) = parse(s, 1, true) -parse(s::String, pos) = parse(s, pos, true) -parseatom(s::String) = parse(s, 1, false) -parseatom(s::String, pos) = parse(s, pos, false) - -## miscellaneous string functions ## - -function lpad(s::String, n::Integer, p::String) - m = n - strlen(s) - if m <= 0; return s; end - l = strlen(p) - if l==1 - return p^m * s - end - q = div(m,l) - r = m - q*l - cstring(p^q*p[1:chr2ind(p,r)]*s) -end - -function rpad(s::String, n::Integer, p::String) - m = n - strlen(s) - if m <= 0; return s; end - l = strlen(p) - if l==1 - return s * p^m - end - q = div(m,l) - r = m - q*l - cstring(s*p^q*p[1:chr2ind(p,r)]) -end - -lpad(s, n::Integer, p) = lpad(string(s), n, string(p)) -rpad(s, n::Integer, p) = rpad(string(s), n, string(p)) - -lpad(s, n::Integer) = lpad(string(s), n, " ") -rpad(s, n::Integer) = rpad(string(s), n, " ") - -function split(s::String, delims, include_empty::Bool) - i = 1 - strs = String[] - len = length(s) - while true - tokstart = tokend = i - while !done(s,i) - (c,i) = next(s,i) - if contains(delims, c) - break - end - tokend = i - end - tok = s[tokstart:(tokend-1)] - if include_empty || !isempty(tok) - push(strs, tok) + elseif n == 3 + b1 = (u >> 0) % UInt8 + b2 = (u >> 8) % UInt8 + b3 = (u >> 16) % UInt8 + for i = 0:r-1 + unsafe_store!(p, b1, 3i + 1) + unsafe_store!(p, b2, 3i + 2) + unsafe_store!(p, b3, 3i + 3) end - if !((i <= len) || (i==len+1 && tokend!=i)) - break + elseif n == 4 + p32 = reinterpret(Ptr{UInt32}, p) + for i = 1:r + unsafe_store!(p32, u, i) end end - strs + return s end - -split(s::String) = split(s, (' ','\t','\n','\v','\f','\r'), false) -split(s::String, x) = split(s, x, true) -split(s::String, x::Char, incl::Bool) = split(s, (x,), incl) - -function print_joined(strings, delim, last) - i = start(strings) - if done(strings,i) - return - end - str, i = next(strings,i) - print(str) - while !done(strings,i) - str, i = next(strings,i) - print(done(strings,i) ? last : delim) - print(str) - end -end - -function print_joined(strings, delim) - i = start(strings) - while !done(strings,i) - str, i = next(strings,i) - print(str) - if !done(strings,i) - print(delim) - end - end -end -print_joined(strings) = print_joined(strings, "") - -join(args...) = print_to_string(print_joined, args...) - -chop(s::String) = s[1:thisind(s,length(s))-1] -chomp(s::String) = (i=thisind(s,length(s)); s[i]=='\n' ? s[1:i-1] : s) -chomp(s::ByteString) = s.data[end]==0x0a ? s[1:end-1] : s - -function lstrip(s::String) - i = start(s) - while !done(s,i) - c, j = next(s,i) - if !iswspace(c) - return s[i:end] - end - i = j - end - "" -end - -function rstrip(s::String) - r = reverse(s) - i = start(r) - while !done(r,i) - c, j = next(r,i) - if !iswspace(c) - return s[1:end-i+1] - end - i = j - end - "" -end - -strip(s::String) = lstrip(rstrip(s)) - -## string to integer functions ## - -function parse_int{T<:Integer}(::Type{T}, s::String, base::Integer) - if !(2 <= base <= 36); error("invalid base: ",base); end - i = start(s) - if done(s,i) - error("premature end of integer (in ",show_to_string(s),")") - end - c,i = next(s,i) - sgn = one(T) - if T <: Signed && c == '-' - sgn = -sgn - if done(s,i) - error("premature end of integer (in ",show_to_string(s),")") - end - c,i = next(s,i) - end - base = convert(T,base) - n::T = 0 - while true - d = '0' <= c <= '9' ? c-'0' : - 'A' <= c <= 'Z' ? c-'A'+10 : - 'a' <= c <= 'z' ? c-'a'+10 : typemax(Int) - if d >= base - error(show_to_string(c)," is not a valid digit (in ",show_to_string(s),")") - end - # TODO: overflow detection? - n = n*base + d - if done(s,i) - break - end - c,i = next(s,i) - end - return flipsign(n,sgn) -end - -parse_int(s::String, base::Integer) = parse_int(Int,s,base) -parse_int(T::Type, s::String) = parse_int(T,s,10) -parse_int(s::String) = parse_int(Int,s,10) - -parse_bin(T::Type, s::String) = parse_int(T,s,2) -parse_oct(T::Type, s::String) = parse_int(T,s,8) -parse_hex(T::Type, s::String) = parse_int(T,s,16) - -parse_bin(s::String) = parse_int(Int,s,2) -parse_oct(s::String) = parse_int(Int,s,8) -parse_hex(s::String) = parse_int(Int,s,16) - -integer (s::String) = int(s) -unsigned(s::String) = uint(s) -int (s::String) = parse_int(Int,s) -uint (s::String) = parse_int(Uint,s) -int8 (s::String) = parse_int(Int8,s) -uint8 (s::String) = parse_int(Uint8,s) -int16 (s::String) = parse_int(Int16,s) -uint16 (s::String) = parse_int(Uint16,s) -int32 (s::String) = parse_int(Int32,s) -uint32 (s::String) = parse_int(Uint32,s) -int64 (s::String) = parse_int(Int64,s) -uint64 (s::String) = parse_int(Uint64,s) - -## integer to string functions ## - -const _jl_dig_syms = "0123456789abcdefghijklmnopqrstuvwxyz".data - -function int2str(n::Union(Int64,Uint64), b::Integer, l::Int) - if b < 2 || b > 36; error("int2str: invalid base ", b); end - neg = n < 0 - n = unsigned(abs(n)) - b = convert(typeof(n), b) - ndig = ndigits(n, b) - sz = max(convert(Int, ndig), l) + neg - data = Array(Uint8, sz) - i = sz - if ispow2(b) - digmask = b-1 - shift = trailing_zeros(b) - while i > neg - ch = n & digmask - data[i] = _jl_dig_syms[int(ch)+1] - n >>= shift - i -= 1 - end - else - while i > neg - ch = n % b - data[i] = _jl_dig_syms[int(ch)+1] - n = div(n,b) - i -= 1 - end - end - if neg - data[1] = '-' - end - ASCIIString(data) -end -int2str(n::Integer, b::Integer) = int2str(n, b, 0) -int2str(n::Integer, b::Integer, l::Int) = int2str(int64(n), b, l) - -string(x::Signed) = dec(int64(x)) -cstring(x::Signed) = dec(int64(x)) - -## string to float functions ## - -function float64_isvalid(s::String, out::Array{Float64,1}) - s = cstring(s) - return (ccall(:jl_strtod, Int32, (Ptr{Uint8},Ptr{Float64}), s, out)==0) -end - -function float32_isvalid(s::String, out::Array{Float32,1}) - s = cstring(s) - return (ccall(:jl_strtof, Int32, (Ptr{Uint8},Ptr{Float32}), s, out)==0) -end - -begin - local tmp::Array{Float64,1} = Array(Float64,1) - local tmpf::Array{Float32,1} = Array(Float32,1) - global float64, float32 - function float64(s::String) - if !float64_isvalid(s, tmp) - throw(ArgumentError("float64(String): invalid number format")) - end - return tmp[1] - end - - function float32(s::String) - if !float32_isvalid(s, tmpf) - throw(ArgumentError("float32(String): invalid number format")) - end - return tmpf[1] - end -end - -float(x::String) = float64(x) -parse_float(x::String) = float64(x) -parse_float(::Type{Float64}, x::String) = float64(x) -parse_float(::Type{Float32}, x::String) = float32(x) - -# copying a byte string (generally not needed due to "immutability") - -strcpy{T<:ByteString}(s::T) = T(copy(s.data)) - -# lexicographically compare byte arrays (used by Latin-1 and UTF-8) - -function lexcmp(a::Array{Uint8,1}, b::Array{Uint8,1}) - c = ccall(:memcmp, Int32, (Ptr{Uint8}, Ptr{Uint8}, Uint), - a, b, min(length(a),length(b))) - c < 0 ? -1 : c > 0 ? +1 : cmp(length(a),length(b)) -end - -# find the index of the first occurrence of a byte value in a byte array - -function memchr(a::Array{Uint8,1}, b::Integer) - p = pointer(a) - q = ccall(:memchr, Ptr{Uint8}, (Ptr{Uint8}, Int32, Uint), p, b, length(a)) - q == C_NULL ? 0 : q - p + 1 -end - -# concatenate byte arrays into a single array - -memcat() = Array(Uint8,0) -memcat(a::Array{Uint8,1}) = copy(a) - -function memcat(arrays::Array{Uint8,1}...) - n = 0 - for a in arrays - n += length(a) - end - arr = Array(Uint8, n) - ptr = pointer(arr) - offset = 0 - for a in arrays - ccall(:memcpy, Ptr{Uint8}, (Ptr{Uint8}, Ptr{Uint8}, Uint), - ptr+offset, a, length(a)) - offset += length(a) - end - return arr -end - -# concatenate the data fields of byte strings - -memcat(s::ByteString) = memcat(s.data) -memcat(sx::ByteString...) = memcat(map(s->s.data, sx)...) diff --git a/tests/examplefiles/julia/string.jl.output b/tests/examplefiles/julia/string.jl.output index 1175b3b..70010b5 100644 --- a/tests/examplefiles/julia/string.jl.output +++ b/tests/examplefiles/julia/string.jl.output @@ -1,784 +1,910 @@ -'## core string functions ##' Comment +'# This file is a part of Julia. License is MIT: https://julialang.org/license' Comment '\n' Text '\n' Text -'length' Name +'"""' Literal.String +'\n StringIndexError(str, i)\n\nAn error occurred when trying to access `str` at index `i` that is not valid.\n' Literal.String + +'"""' Literal.String +'\n' Text + +'struct' Keyword +' ' Text +'StringIndexError' Keyword.Type +' ' Text +'<:' Operator +' ' Text +'Exception' Keyword.Type +'\n' Text + +' ' Text +'string' Name +'::' Operator +'AbstractString' Keyword.Type +'\n' Text + +' ' Text +'index' Name +'::' Operator +'Integer' Keyword.Type +'\n' Text + +'end' Keyword +'\n' Text + +'@noinline' Name.Decorator +' ' Text +'string_index_err' Name '(' Punctuation 's' Name '::' Operator -'String' Name +'AbstractString' Keyword.Type +',' Punctuation +' ' Text +'i' Name +'::' Operator +'Integer' Keyword.Type ')' Punctuation ' ' Text '=' Operator -' ' Text -'error' Name +'\n' Text + +' ' Text +'throw' Name '(' Punctuation -'"' Literal.String -'y' Literal.String -'o' Literal.String -'u' Literal.String -' ' Literal.String -'m' Literal.String -'u' Literal.String -'s' Literal.String -'t' Literal.String -' ' Literal.String -'i' Literal.String -'m' Literal.String -'p' Literal.String -'l' Literal.String -'e' Literal.String -'m' Literal.String -'e' Literal.String -'n' Literal.String -'t' Literal.String -' ' Literal.String -'l' Literal.String -'e' Literal.String -'n' Literal.String -'g' Literal.String -'t' Literal.String -'h' Literal.String -'(' Literal.String -'"' Literal.String -',' Punctuation -'typeof' Name +'StringIndexError' Keyword.Type '(' Punctuation 's' Name -')' Punctuation ',' Punctuation -'"' Literal.String -')' Literal.String -'"' Literal.String +' ' Text +'Int' Keyword.Type +'(' Punctuation +'i' Name +')' Punctuation +')' Punctuation ')' Punctuation '\n' Text -'next' Name +'function' Keyword +' ' Text +'Base' Name +'.' Operator +'showerror' Name '(' Punctuation -'s' Name +'io' Name '::' Operator -'String' Name +'IO' Keyword.Type ',' Punctuation ' ' Text -'i' Name +'exc' Name '::' Operator -'Int' Keyword.Type +'StringIndexError' Keyword.Type ')' Punctuation +'\n' Text + +' ' Text +'s' Name ' ' Text '=' Operator ' ' Text -'error' Name +'exc' Name +'.' Operator +'string' Name +'\n' Text + +' ' Text +'print' Name '(' Punctuation +'io' Name +',' Punctuation +' ' Text '"' Literal.String -'y' Literal.String -'o' Literal.String -'u' Literal.String -' ' Literal.String -'m' Literal.String -'u' Literal.String -'s' Literal.String -'t' Literal.String -' ' Literal.String -'i' Literal.String -'m' Literal.String -'p' Literal.String -'l' Literal.String -'e' Literal.String -'m' Literal.String -'e' Literal.String -'n' Literal.String -'t' Literal.String -' ' Literal.String -'n' Literal.String -'e' Literal.String -'x' Literal.String -'t' Literal.String -'(' Literal.String +'StringIndexError: ' Literal.String '"' Literal.String ',' Punctuation -'typeof' Name +' ' Text +'"' Literal.String +'invalid index [' Literal.String +'$' Literal.String.Interpol '(' Punctuation -'s' Name +'exc' Name +'.' Operator +'index' Name ')' Punctuation -',' Punctuation -'"' Literal.String -',' Literal.String -'I' Literal.String -'n' Literal.String -'t' Literal.String -')' Literal.String +']' Literal.String '"' Literal.String ')' Punctuation '\n' Text -'next' Name +' ' Text +'if' Keyword +' ' Text +'firstindex' Name '(' Punctuation 's' Name -'::' Operator -'DirectIndexString' Keyword.Type -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type ')' Punctuation ' ' Text -'=' Operator +'<=' Operator +' ' Text +'exc' Name +'.' Operator +'index' Name +' ' Text +'<=' Operator ' ' Text +'ncodeunits' Name '(' Punctuation 's' Name -'[' Punctuation -'i' Name -']' Punctuation -',' Punctuation -'i' Name -'+' Operator -'1' Literal.Number.Integer ')' Punctuation '\n' Text -'next' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Integer' Keyword.Type -')' Punctuation +' ' Text +'iprev' Name ' ' Text '=' Operator ' ' Text -'next' Name +'thisind' Name '(' Punctuation 's' Name ',' Punctuation -'int' Name -'(' Punctuation -'i' Name -')' Punctuation +' ' Text +'exc' Name +'.' Operator +'index' Name ')' Punctuation '\n' Text -'\n' Text - -'## generic supplied functions ##' Comment -'\n' Text - -'\n' Text - -'start' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +' ' Text +'inext' Name ' ' Text '=' Operator ' ' Text -'1' Literal.Number.Integer -'\n' Text - -'done' Name +'nextind' Name '(' Punctuation 's' Name -'::' Operator -'String' Name ',' Punctuation -'i' Name -')' Punctuation ' ' Text -'=' Operator +'iprev' Name +')' Punctuation +'\n' Text + +' ' Text +'if' Keyword ' ' Text -'(' Punctuation -'i' Name +'inext' Name ' ' Text -'>' Operator +'<=' Operator ' ' Text -'length' Name +'ncodeunits' Name '(' Punctuation 's' Name ')' Punctuation -')' Punctuation '\n' Text -'isempty' Name +' ' Text +'print' Name '(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator +'io' Name +',' Punctuation ' ' Text -'done' Name +'"' Literal.String +', valid nearby indices [' Literal.String +'$iprev' Literal.String.Interpol +"]=>'" Literal.String +'$' Literal.String.Interpol '(' Punctuation 's' Name -',' Punctuation -'start' Name +'[' Punctuation +'iprev' Name +']' Punctuation +')' Punctuation +"', [" Literal.String +'$inext' Literal.String.Interpol +"]=>'" Literal.String +'$' Literal.String.Interpol '(' Punctuation 's' Name +'[' Punctuation +'inext' Name +']' Punctuation ')' Punctuation +"'" Literal.String +'"' Literal.String ')' Punctuation '\n' Text -'ref' Name +' ' Text +'else' Keyword +'\n' Text + +' ' Text +'print' Name '(' Punctuation -'s' Name -'::' Operator -'String' Name +'io' Name ',' Punctuation ' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'next' Name +'"' Literal.String +', valid nearby index [' Literal.String +'$iprev' Literal.String.Interpol +"]=>'" Literal.String +'$' Literal.String.Interpol '(' Punctuation 's' Name -',' Punctuation -'i' Name -')' Punctuation '[' Punctuation -'1' Literal.Number.Integer +'iprev' Name ']' Punctuation +')' Punctuation +"'" Literal.String +'"' Literal.String +')' Punctuation '\n' Text -'ref' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation +' ' Text +'end' Keyword +'\n' Text + +' ' Text +'end' Keyword +'\n' Text + +'end' Keyword +'\n' Text + +'\n' Text + +'const' Keyword ' ' Text -'i' Name -'::' Operator -'Integer' Keyword.Type -')' Punctuation +'ByteArray' Name ' ' Text '=' Operator ' ' Text -'s' Name -'[' Punctuation -'int' Name -'(' Punctuation -'i' Name -')' Punctuation -']' Punctuation +'Union' Keyword.Type +'{' Punctuation +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +'Vector' Keyword.Type +'{' Punctuation +'Int8' Keyword.Type +'}' Punctuation +'}' Punctuation '\n' Text -'ref' Name +'\n' Text + +'@inline' Name.Decorator +' ' Text +'between' Name '(' Punctuation -'s' Name +'b' Name '::' Operator -'String' Name +'T' Keyword.Type ',' Punctuation ' ' Text -'x' Name +'lo' Name +'::' Operator +'T' Keyword.Type +',' Punctuation +' ' Text +'hi' Name '::' Operator -'Real' Keyword.Type +'T' Keyword.Type ')' Punctuation ' ' Text -'=' Operator +'where' Keyword ' ' Text -'s' Name -'[' Punctuation -'iround' Name -'(' Punctuation -'x' Name -')' Punctuation -']' Punctuation -'\n' Text - -'ref' Name '{' Punctuation -'T' Name +'T' Keyword.Type '<:' Operator 'Integer' Keyword.Type '}' Punctuation +' ' Text +'=' Operator +' ' Text '(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation +'lo' Name ' ' Text -'r' Name -'::' Operator -'Range1' Name -'{' Punctuation -'T' Name -'}' Punctuation +'≤' Operator +' ' Text +'b' Name ')' Punctuation ' ' Text -'=' Operator +'&' Operator ' ' Text -'s' Name -'[' Punctuation -'int' Name -'(' Punctuation -'first' Name '(' Punctuation -'r' Name +'b' Name +' ' Text +'≤' Operator +' ' Text +'hi' Name ')' Punctuation -')' Punctuation -':' Operator -'int' Name -'(' Punctuation -'last' Name -'(' Punctuation -'r' Name -')' Punctuation -')' Punctuation -']' Punctuation '\n' Text '\n' Text -'symbol' Name +'## constructors and conversions ##' Comment +'\n' Text + +'\n' Text + +'# String constructor docstring from boot.jl, workaround for #16730' Comment +'\n' Text + +'# and the unavailability of @doc in boot.jl context.' Comment +'\n' Text + +'"""' Literal.String +'\n String(v::AbstractVector{UInt8})\n\nCreate a new `String` object from a byte vector `v` containing UTF-8 encoded\ncharacters. If `v` is `Vector{UInt8}` it will be truncated to zero length and\nfuture modification of `v` cannot affect the contents of the resulting string.\nTo avoid truncation of `Vector{UInt8}` data, use `String(copy(v))`; for other\n`AbstractVector` types, `String(v)` already makes a copy.\n\nWhen possible, the memory of `v` will be used without copying when the `String`\nobject is created. This is guaranteed to be the case for byte vectors returned\nby [`take!`](@ref) on a writable [`IOBuffer`](@ref) and by calls to\n[`read(io, nb)`](@ref). This allows zero-copy conversion of I/O data to strings.\nIn other cases, `Vector{UInt8}` data may be copied, but `v` is truncated anyway\nto guarantee consistent behavior.\n' Literal.String + +'"""' Literal.String +'\n' Text + +'String' Keyword.Type '(' Punctuation -'s' Name +'v' Name '::' Operator -'String' Name +'AbstractVector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation ')' Punctuation ' ' Text '=' Operator ' ' Text -'symbol' Name +'String' Keyword.Type '(' Punctuation -'cstring' Name +'copyto!' Name '(' Punctuation -'s' Name +'StringVector' Name +'(' Punctuation +'length' Name +'(' Punctuation +'v' Name +')' Punctuation +')' Punctuation +',' Punctuation +' ' Text +'v' Name ')' Punctuation ')' Punctuation '\n' Text -'string' Name +'String' Keyword.Type '(' Punctuation -'s' Name +'v' Name '::' Operator -'String' Name +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation ')' Punctuation ' ' Text '=' Operator ' ' Text -'s' Name +'ccall' Keyword +'(' Punctuation +':jl_array_to_string' Literal.String.Symbol +',' Punctuation +' ' Text +'Ref' Keyword.Type +'{' Punctuation +'String' Keyword.Type +'}' Punctuation +',' Punctuation +' ' Text +'(' Punctuation +'Any' Keyword.Type +',' Punctuation +')' Punctuation +',' Punctuation +' ' Text +'v' Name +')' Punctuation '\n' Text '\n' Text -'print' Name +'"""' Literal.String +'\n unsafe_string(p::Ptr{UInt8}, [length::Integer])\n\nCopy a string from the address of a C-style (NUL-terminated) string encoded as UTF-8.\n(The pointer can be safely freed afterwards.) If `length` is specified\n(the length of the data in bytes), the string does not have to be NUL-terminated.\n\nThis function is labeled ' Literal.String +'"' Literal.String +'unsafe' Literal.String +'"' Literal.String +' because it will crash if `p` is not\na valid memory address to data of the requested length.\n' Literal.String + +'"""' Literal.String +'\n' Text + +'function' Keyword +' ' Text +'unsafe_string' Name '(' Punctuation -'s' Name +'p' Name +'::' Operator +'Union' Keyword.Type +'{' Punctuation +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +'Ptr' Keyword.Type +'{' Punctuation +'Int8' Keyword.Type +'}' Punctuation +'}' Punctuation +',' Punctuation +' ' Text +'len' Name '::' Operator -'String' Name +'Integer' Keyword.Type ')' Punctuation +'\n' Text + +' ' Text +'p' Name ' ' Text -'=' Operator +'==' Operator ' ' Text -'for' Keyword +'C_NULL' Name.Builtin ' ' Text -'c' Name -'=' Operator -'s' Name -';' Punctuation +'&&' Operator ' ' Text -'print' Name +'throw' Name '(' Punctuation -'c' Name +'ArgumentError' Keyword.Type +'(' Punctuation +'"' Literal.String +'cannot convert NULL to string' Literal.String +'"' Literal.String ')' Punctuation -';' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'ccall' Keyword +'(' Punctuation +':jl_pchar_to_string' Literal.String.Symbol +',' Punctuation +' ' Text +'Ref' Keyword.Type +'{' Punctuation +'String' Keyword.Type +'}' Punctuation +',' Punctuation +' ' Text +'(' Punctuation +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +' ' Text +'Int' Keyword.Type +')' Punctuation +',' Punctuation +' ' Text +'p' Name +',' Punctuation ' ' Text +'len' Name +')' Punctuation +'\n' Text + 'end' Keyword '\n' Text -'print' Name +'function' Keyword +' ' Text +'unsafe_string' Name '(' Punctuation -'x' Name -'.' Operator -'.' Operator -'.' Operator +'p' Name +'::' Operator +'Union' Keyword.Type +'{' Punctuation +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +'Ptr' Keyword.Type +'{' Punctuation +'Int8' Keyword.Type +'}' Punctuation +'}' Punctuation ')' Punctuation +'\n' Text + +' ' Text +'p' Name ' ' Text -'=' Operator +'==' Operator ' ' Text -'for' Keyword +'C_NULL' Name.Builtin ' ' Text -'i' Name -'=' Operator -'x' Name -';' Punctuation +'&&' Operator ' ' Text -'print' Name +'throw' Name '(' Punctuation -'i' Name +'ArgumentError' Keyword.Type +'(' Punctuation +'"' Literal.String +'cannot convert NULL to string' Literal.String +'"' Literal.String +')' Punctuation ')' Punctuation -';' Punctuation -' ' Text -'end' Keyword '\n' Text -'println' Name +' ' Text +'ccall' Keyword '(' Punctuation -'args' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation +':jl_cstr_to_string' Literal.String.Symbol +',' Punctuation ' ' Text -'=' Operator +'Ref' Keyword.Type +'{' Punctuation +'String' Keyword.Type +'}' Punctuation +',' Punctuation ' ' Text -'print' Name '(' Punctuation -'args' Name -'.' Operator -'.' Operator -'.' Operator +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +')' Punctuation ',' Punctuation ' ' Text -"'\\n'" Literal.String.Char +'p' Name ')' Punctuation '\n' Text +'end' Keyword +'\n' Text + '\n' Text -'show' Name +'_string_n' Name '(' Punctuation -'s' Name +'n' Name '::' Operator -'String' Name +'Integer' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text -'print_quoted' Name +'ccall' Keyword '(' Punctuation -'s' Name +':jl_alloc_string' Literal.String.Symbol +',' Punctuation +' ' Text +'Ref' Keyword.Type +'{' Punctuation +'String' Keyword.Type +'}' Punctuation +',' Punctuation +' ' Text +'(' Punctuation +'Csize_t' Keyword.Type +',' Punctuation +')' Punctuation +',' Punctuation +' ' Text +'n' Name ')' Punctuation '\n' Text '\n' Text -'(' Punctuation -'*' Operator -')' Punctuation +'"""' Literal.String +'\n String(s::AbstractString)\n\nConvert a string to a contiguous byte array representation encoded as UTF-8 bytes.\nThis representation is often appropriate for passing strings to C.\n' Literal.String + +'"""' Literal.String +'\n' Text + +'String' Keyword.Type '(' Punctuation 's' Name '::' Operator -'String' Name -'.' Operator -'.' Operator -'.' Operator +'AbstractString' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text -'strcat' Name +'print_to_string' Name '(' Punctuation 's' Name -'.' Operator -'.' Operator -'.' Operator ')' Punctuation '\n' Text -'(' Punctuation -'^' Operator -')' Punctuation +'@pure' Name.Decorator +' ' Text +'String' Keyword.Type '(' Punctuation 's' Name '::' Operator -'String' Name -',' Punctuation -' ' Text -'r' Name -'::' Operator -'Integer' Keyword.Type +'Symbol' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text -'repeat' Name +'unsafe_string' Name '(' Punctuation -'s' Name +'unsafe_convert' Name +'(' Punctuation +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation ',' Punctuation -'r' Name +' ' Text +'s' Name +')' Punctuation ')' Punctuation '\n' Text '\n' Text -'size' Name +'unsafe_wrap' Name '(' Punctuation +'::' Operator +'Type' Keyword.Type +'{' Punctuation +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +'}' Punctuation +',' Punctuation +' ' Text 's' Name '::' Operator -'String' Name +'String' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text +'ccall' Keyword '(' Punctuation -'length' Name -'(' Punctuation -'s' Name -')' Punctuation +':jl_string_to_array' Literal.String.Symbol ',' Punctuation -')' Punctuation +' ' Text +'Ref' Keyword.Type +'{' Punctuation +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +'}' Punctuation +',' Punctuation +' ' Text +'(' Punctuation +'Any' Keyword.Type +',' Punctuation +')' Punctuation +',' Punctuation +' ' Text +'s' Name +')' Punctuation +'\n' Text + '\n' Text -'size' Name +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation '(' Punctuation 's' Name '::' Operator -'String' Name +'CodeUnits' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type ',' Punctuation -' ' Text -'d' Name -'::' Operator -'Integer' Keyword.Type +'String' Keyword.Type +'}' Punctuation ')' Punctuation ' ' Text '=' Operator ' ' Text -'d' Name -'==' Operator -'1' Literal.Number.Integer -' ' Text -'?' Operator +'copyto!' Name +'(' Punctuation +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +'(' Punctuation +'undef' Name.Builtin +',' Punctuation ' ' Text 'length' Name '(' Punctuation 's' Name ')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'i' Literal.String -'n' Literal.String -' ' Literal.String -'s' Literal.String -'i' Literal.String -'z' Literal.String -'e' Literal.String -':' Literal.String -' ' Literal.String -'d' Literal.String -'i' Literal.String -'m' Literal.String -'e' Literal.String -'n' Literal.String -'s' Literal.String -'i' Literal.String -'o' Literal.String -'n' Literal.String -' ' Literal.String -'"' Literal.String -',' Punctuation -'d' Name +')' Punctuation ',' Punctuation -'"' Literal.String -' ' Literal.String -'o' Literal.String -'u' Literal.String -'t' Literal.String -' ' Literal.String -'o' Literal.String -'f' Literal.String -' ' Literal.String -'r' Literal.String -'a' Literal.String -'n' Literal.String -'g' Literal.String -'e' Literal.String -'"' Literal.String +' ' Text +'s' Name ')' Punctuation '\n' Text -'\n' Text - -'strlen' Name +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation '(' Punctuation 's' Name '::' Operator -'DirectIndexString' Keyword.Type +'String' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text -'length' Name +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +'(' Punctuation +'codeunits' Name '(' Punctuation 's' Name ')' Punctuation +')' Punctuation '\n' Text -'function' Keyword -' ' Text -'strlen' Name +'Array' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation '(' Punctuation 's' Name '::' Operator -'String' Name +'String' Keyword.Type ')' Punctuation -'\n' Text - -' ' Text -'i' Name -' ' Text +' ' Text '=' Operator ' ' Text -'start' Name +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +'(' Punctuation +'codeunits' Name '(' Punctuation 's' Name ')' Punctuation +')' Punctuation '\n' Text -' ' Text -'if' Keyword -' ' Text -'done' Name +'\n' Text + +'String' Keyword.Type '(' Punctuation 's' Name +'::' Operator +'CodeUnits' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type ',' Punctuation -'i' Name +'String' Keyword.Type +'}' Punctuation ')' Punctuation -'\n' Text - -' ' Text -'return' Keyword ' ' Text -'0' Literal.Number.Integer +'=' Operator +' ' Text +'s' Name +'.' Operator +'s' Name '\n' Text -' ' Text -'end' Keyword '\n' Text -' ' Text -'n' Name -' ' Text -'=' Operator -' ' Text -'1' Literal.Number.Integer +'## low-level functions ##' Comment '\n' Text -' ' Text -'while' Keyword -' ' Text -'true' Keyword.Constant '\n' Text -' ' Text -'c' Name -',' Punctuation -' ' Text -'j' Name +'pointer' Name +'(' Punctuation +'s' Name +'::' Operator +'String' Keyword.Type +')' Punctuation ' ' Text '=' Operator ' ' Text -'next' Name +'unsafe_convert' Name '(' Punctuation -'s' Name +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation ',' Punctuation -'i' Name +' ' Text +'s' Name ')' Punctuation '\n' Text -' ' Text -'if' Keyword -' ' Text -'done' Name +'pointer' Name '(' Punctuation 's' Name +'::' Operator +'String' Keyword.Type ',' Punctuation -'j' Name +' ' Text +'i' Name +'::' Operator +'Integer' Keyword.Type ')' Punctuation -'\n' Text - -' ' Text -'return' Keyword ' ' Text -'n' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'n' Name +'=' Operator ' ' Text -'+=' Operator +'pointer' Name +'(' Punctuation +'s' Name +')' Punctuation ' ' Text -'1' Literal.Number.Integer -'\n' Text - -' ' Text +'+' Operator +' ' Text +'Int' Keyword.Type +'(' Punctuation 'i' Name +')' Punctuation +'::' Operator +'Int' Keyword.Type ' ' Text -'=' Operator +'-' Operator ' ' Text -'j' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'end' Keyword +'1' Literal.Number.Integer '\n' Text '\n' Text -'isvalid' Name +'@pure' Name.Decorator +' ' Text +'ncodeunits' Name '(' Punctuation 's' Name '::' Operator -'DirectIndexString' Keyword.Type -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Integer' Keyword.Type +'String' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text -'(' Punctuation -'start' Name +'Core' Name +'.' Operator +'sizeof' Name '(' Punctuation 's' Name ')' Punctuation -' ' Text -'<=' Operator -' ' Text -'i' Name -' ' Text -'<=' Operator -' ' Text -'length' Name +'\n' Text + +'codeunit' Name '(' Punctuation 's' Name +'::' Operator +'String' Keyword.Type ')' Punctuation -')' Punctuation +' ' Text +'=' Operator +' ' Text +'UInt8' Keyword.Type +'\n' Text + '\n' Text +'@inline' Name.Decorator +' ' Text 'function' Keyword ' ' Text -'isvalid' Name +'codeunit' Name '(' Punctuation 's' Name '::' Operator -'String' Name +'String' Keyword.Type ',' Punctuation ' ' Text 'i' Name @@ -788,188 +914,228 @@ '\n' Text ' ' Text -'try' Keyword -'\n' Text - -' ' Text -'next' Name +'@boundscheck' Name.Decorator +' ' Text +'checkbounds' Name '(' Punctuation 's' Name ',' Punctuation +' ' Text 'i' Name ')' Punctuation '\n' Text -' ' Text -'true' Keyword.Constant +' ' Text +'b' Name +' ' Text +'=' Operator +' ' Text +'GC' Name +'.' Operator +'@preserve' Name.Decorator +' ' Text +'s' Name +' ' Text +'unsafe_load' Name +'(' Punctuation +'pointer' Name +'(' Punctuation +'s' Name +',' Punctuation +' ' Text +'i' Name +')' Punctuation +')' Punctuation '\n' Text ' ' Text -'catch' Keyword +'return' Keyword +' ' Text +'b' Name '\n' Text -' ' Text -'false' Keyword.Constant +'end' Keyword '\n' Text -' ' Text -'end' Keyword '\n' Text -'end' Keyword +'## comparison ##' Comment '\n' Text '\n' Text -'prevind' Name +'_memcmp' Name '(' Punctuation -'s' Name +'a' Name '::' Operator -'DirectIndexString' Keyword.Type +'Union' Keyword.Type +'{' Punctuation +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +'AbstractString' Keyword.Type +'}' Punctuation ',' Punctuation ' ' Text -'i' Name +'b' Name '::' Operator -'Integer' Keyword.Type +'Union' Keyword.Type +'{' Punctuation +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +'AbstractString' Keyword.Type +'}' Punctuation +',' Punctuation +' ' Text +'len' Name ')' Punctuation ' ' Text '=' Operator -' ' Text -'i' Name -'-' Operator -'1' Literal.Number.Integer '\n' Text -'thisind' Name +' ' Text +'ccall' Keyword '(' Punctuation -'s' Name -'::' Operator -'DirectIndexString' Keyword.Type +':memcmp' Literal.String.Symbol ',' Punctuation ' ' Text -'i' Name -'::' Operator -'Integer' Keyword.Type +'Cint' Keyword.Type +',' Punctuation +' ' Text +'(' Punctuation +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +' ' Text +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +' ' Text +'Csize_t' Keyword.Type ')' Punctuation +',' Punctuation ' ' Text -'=' Operator +'a' Name +',' Punctuation ' ' Text -'i' Name -'\n' Text - -'nextind' Name -'(' Punctuation -'s' Name -'::' Operator -'DirectIndexString' Keyword.Type +'b' Name ',' Punctuation ' ' Text -'i' Name -'::' Operator -'Integer' Keyword.Type +'len' Name +' ' Text +'%' Operator +' ' Text +'Csize_t' Keyword.Type ')' Punctuation ' ' Text -'=' Operator +'%' Operator ' ' Text -'i' Name -'+' Operator -'1' Literal.Number.Integer +'Int' Keyword.Type '\n' Text '\n' Text -'prevind' Name +'function' Keyword +' ' Text +'cmp' Name '(' Punctuation -'s' Name +'a' Name '::' Operator -'String' Name +'String' Keyword.Type ',' Punctuation ' ' Text -'i' Name +'b' Name '::' Operator -'Integer' Keyword.Type +'String' Keyword.Type ')' Punctuation +'\n' Text + +' ' Text +'al' Name +',' Punctuation +' ' Text +'bl' Name ' ' Text '=' Operator ' ' Text -'thisind' Name +'sizeof' Name '(' Punctuation -'s' Name +'a' Name +')' Punctuation ',' Punctuation -'thisind' Name +' ' Text +'sizeof' Name '(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'-' Operator -'1' Literal.Number.Integer +'b' Name ')' Punctuation '\n' Text -'\n' Text - -'function' Keyword +' ' Text +'c' Name ' ' Text -'thisind' Name +'=' Operator +' ' Text +'_memcmp' Name '(' Punctuation -'s' Name -'::' Operator -'String' Name +'a' Name ',' Punctuation ' ' Text -'i' Name -'::' Operator -'Integer' Keyword.Type +'b' Name +',' Punctuation +' ' Text +'min' Name +'(' Punctuation +'al' Name +',' Punctuation +'bl' Name +')' Punctuation ')' Punctuation '\n' Text ' ' Text -'for' Keyword +'return' Keyword ' ' Text -'j' Name +'c' Name ' ' Text -'=' Operator +'<' Operator +' ' Text +'0' Literal.Number.Integer +' ' Text +'?' Operator ' ' Text -'i' Name -':' Operator '-' Operator '1' Literal.Number.Integer +' ' Text ':' Operator -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'if' Keyword ' ' Text -'isvalid' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -'\n' Text - -' ' Text -'return' Keyword +'c' Name ' ' Text -'j' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'return' Keyword +'>' Operator ' ' Text '0' Literal.Number.Integer ' ' Text -'# out of range' Comment +'?' Operator +' ' Text +'+' Operator +'1' Literal.Number.Integer +' ' Text +':' Operator +' ' Text +'cmp' Name +'(' Punctuation +'al' Name +',' Punctuation +'bl' Name +')' Punctuation '\n' Text 'end' Keyword @@ -979,9511 +1145,1504 @@ 'function' Keyword ' ' Text -'nextind' Name +'==' Operator '(' Punctuation -'s' Name +'a' Name '::' Operator -'String' Name +'String' Keyword.Type ',' Punctuation ' ' Text -'i' Name +'b' Name '::' Operator -'Integer' Keyword.Type +'String' Keyword.Type ')' Punctuation '\n' Text ' ' Text -'for' Keyword -' ' Text -'j' Name +'pointer_from_objref' Name +'(' Punctuation +'a' Name +')' Punctuation ' ' Text -'=' Operator +'==' Operator ' ' Text -'i' Name -'+' Operator -'1' Literal.Number.Integer -':' Operator -'length' Name +'pointer_from_objref' Name '(' Punctuation -'s' Name +'b' Name ')' Punctuation +' ' Text +'&&' Operator +' ' Text +'return' Keyword +' ' Text +'true' Name.Builtin '\n' Text -' ' Text -'if' Keyword +' ' Text +'al' Name ' ' Text -'isvalid' Name +'=' Operator +' ' Text +'sizeof' Name '(' Punctuation -'s' Name -',' Punctuation -'j' Name +'a' Name ')' Punctuation '\n' Text -' ' Text +' ' Text 'return' Keyword ' ' Text -'j' Name +'al' Name +' ' Text +'==' Operator +' ' Text +'sizeof' Name +'(' Punctuation +'b' Name +')' Punctuation +' ' Text +'&&' Operator +' ' Text +'0' Literal.Number.Integer +' ' Text +'==' Operator +' ' Text +'_memcmp' Name +'(' Punctuation +'a' Name +',' Punctuation +' ' Text +'b' Name +',' Punctuation +' ' Text +'al' Name +')' Punctuation '\n' Text -' ' Text 'end' Keyword '\n' Text -' ' Text -'end' Keyword '\n' Text -' ' Text -'length' Name +'typemin' Name '(' Punctuation -'s' Name +'::' Operator +'Type' Keyword.Type +'{' Punctuation +'String' Keyword.Type +'}' Punctuation ')' Punctuation -'+' Operator -'1' Literal.Number.Integer ' ' Text -'# out of range' Comment +'=' Operator +' ' Text +'"' Literal.String +'"' Literal.String '\n' Text -'end' Keyword +'typemin' Name +'(' Punctuation +'::' Operator +'String' Keyword.Type +')' Punctuation +' ' Text +'=' Operator +' ' Text +'typemin' Name +'(' Punctuation +'String' Keyword.Type +')' Punctuation '\n' Text '\n' Text -'ind2chr' Name +'## thisind, nextind ##' Comment +'\n' Text + +'\n' Text + +'@propagate_inbounds' Name.Decorator +' ' Text +'thisind' Name '(' Punctuation 's' Name '::' Operator -'DirectIndexString' Keyword.Type +'String' Keyword.Type ',' Punctuation ' ' Text 'i' Name '::' Operator -'Integer' Keyword.Type +'Int' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text -'i' Name -'\n' Text - -'chr2ind' Name +'_thisind_str' Name '(' Punctuation 's' Name -'::' Operator -'DirectIndexString' Keyword.Type ',' Punctuation ' ' Text 'i' Name -'::' Operator -'Integer' Keyword.Type ')' Punctuation -' ' Text -'=' Operator -' ' Text -'i' Name '\n' Text '\n' Text +'# s should be String or SubString{String}' Comment +'\n' Text + +'@inline' Name.Decorator +' ' Text 'function' Keyword ' ' Text -'ind2chr' Name +'_thisind_str' Name '(' Punctuation 's' Name -'::' Operator -'String' Name ',' Punctuation ' ' Text 'i' Name '::' Operator -'Integer' Keyword.Type +'Int' Keyword.Type ')' Punctuation '\n' Text ' ' Text -'s' Name -'[' Punctuation 'i' Name -']' Punctuation ' ' Text -'# throws error if invalid' Comment -'\n' Text - -' ' Text -'j' Name +'==' Operator ' ' Text -'=' Operator +'0' Literal.Number.Integer ' ' Text -'1' Literal.Number.Integer +'&&' Operator +' ' Text +'return' Keyword +' ' Text +'0' Literal.Number.Integer '\n' Text ' ' Text -'k' Name +'n' Name ' ' Text '=' Operator ' ' Text -'start' Name +'ncodeunits' Name '(' Punctuation 's' Name ')' Punctuation '\n' Text ' ' Text -'while' Keyword -' ' Text -'true' Keyword.Constant -'\n' Text - -' ' Text -'c' Name -',' Punctuation +'i' Name ' ' Text -'l' Name +'==' Operator ' ' Text -'=' Operator +'n' Name ' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'k' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword +'+' Operator ' ' Text -'i' Name +'1' Literal.Number.Integer ' ' Text -'<=' Operator +'&&' Operator ' ' Text -'k' Name -'\n' Text - -' ' Text 'return' Keyword ' ' Text -'j' Name -'\n' Text - -' ' Text -'end' Keyword +'i' Name '\n' Text -' ' Text -'j' Name +' ' Text +'@boundscheck' Name.Decorator ' ' Text -'+=' Operator +'between' Name +'(' Punctuation +'i' Name +',' Punctuation ' ' Text '1' Literal.Number.Integer -'\n' Text - -' ' Text -'k' Name +',' Punctuation ' ' Text -'=' Operator +'n' Name +')' Punctuation ' ' Text -'l' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'function' Keyword +'||' Operator ' ' Text -'chr2ind' Name +'throw' Name +'(' Punctuation +'BoundsError' Keyword.Type '(' Punctuation 's' Name -'::' Operator -'String' Name ',' Punctuation ' ' Text 'i' Name -'::' Operator -'Integer' Keyword.Type +')' Punctuation ')' Punctuation '\n' Text ' ' Text -'if' Keyword +'@inbounds' Name.Decorator ' ' Text -'i' Name +'b' Name ' ' Text -'<' Operator +'=' Operator ' ' Text -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'return' Keyword +'codeunit' Name +'(' Punctuation +'s' Name +',' Punctuation ' ' Text 'i' Name +')' Punctuation '\n' Text ' ' Text -'end' Keyword -'\n' Text - -' ' Text -'j' Name +'(' Punctuation +'b' Name ' ' Text -'=' Operator +'&' Operator ' ' Text -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'k' Name +'0xc0' Literal.Number.Hex ' ' Text -'=' Operator +'==' Operator +' ' Text +'0x80' Literal.Number.Hex +')' Punctuation +' ' Text +'&' Operator ' ' Text -'start' Name '(' Punctuation -'s' Name +'i' Name +'-' Operator +'1' Literal.Number.Integer +' ' Text +'>' Operator +' ' Text +'0' Literal.Number.Integer ')' Punctuation -'\n' Text - -' ' Text -'while' Keyword ' ' Text -'true' Keyword.Constant +'||' Operator +' ' Text +'return' Keyword +' ' Text +'i' Name '\n' Text -' ' Text -'c' Name -',' Punctuation +' ' Text +'@inbounds' Name.Decorator ' ' Text -'l' Name +'b' Name ' ' Text '=' Operator ' ' Text -'next' Name +'codeunit' Name '(' Punctuation 's' Name ',' Punctuation -'k' Name +' ' Text +'i' Name +'-' Operator +'1' Literal.Number.Integer ')' Punctuation '\n' Text -' ' Text -'if' Keyword +' ' Text +'between' Name +'(' Punctuation +'b' Name +',' Punctuation ' ' Text -'i' Name +'0b11000000' Literal.Number.Bin +',' Punctuation ' ' Text -'==' Operator +'0b11110111' Literal.Number.Bin +')' Punctuation +' ' Text +'&&' Operator ' ' Text -'j' Name -'\n' Text - -' ' Text 'return' Keyword ' ' Text -'k' Name -'\n' Text - -' ' Text -'end' Keyword +'i' Name +'-' Operator +'1' Literal.Number.Integer '\n' Text -' ' Text -'j' Name +' ' Text +'(' Punctuation +'b' Name ' ' Text -'+=' Operator +'&' Operator ' ' Text -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'k' Name +'0xc0' Literal.Number.Hex ' ' Text -'=' Operator +'==' Operator ' ' Text -'l' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'function' Keyword +'0x80' Literal.Number.Hex +')' Punctuation +' ' Text +'&' Operator ' ' Text -'strchr' Name '(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation +'i' Name +'-' Operator +'2' Literal.Number.Integer ' ' Text -'c' Name -'::' Operator -'Char' Keyword.Type -',' Punctuation +'>' Operator ' ' Text -'i' Name -'::' Operator -'Integer' Keyword.Type +'0' Literal.Number.Integer ')' Punctuation +' ' Text +'||' Operator +' ' Text +'return' Keyword +' ' Text +'i' Name '\n' Text ' ' Text -'i' Name +'@inbounds' Name.Decorator +' ' Text +'b' Name ' ' Text '=' Operator ' ' Text -'nextind' Name +'codeunit' Name '(' Punctuation 's' Name ',' Punctuation +' ' Text 'i' Name +'-' Operator +'2' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name +'between' Name '(' Punctuation -'s' Name +'b' Name ',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'d' Name +' ' Text +'0b11100000' Literal.Number.Bin ',' Punctuation ' ' Text -'j' Name +'0b11110111' Literal.Number.Bin +')' Punctuation ' ' Text -'=' Operator +'&&' Operator +' ' Text +'return' Keyword ' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation 'i' Name -')' Punctuation +'-' Operator +'2' Literal.Number.Integer '\n' Text -' ' Text -'if' Keyword +' ' Text +'(' Punctuation +'b' Name ' ' Text -'c' Name +'&' Operator +' ' Text +'0xc0' Literal.Number.Hex ' ' Text '==' Operator ' ' Text -'d' Name -'\n' Text - -' ' Text +'0x80' Literal.Number.Hex +')' Punctuation +' ' Text +'&' Operator +' ' Text +'(' Punctuation +'i' Name +'-' Operator +'3' Literal.Number.Integer +' ' Text +'>' Operator +' ' Text +'0' Literal.Number.Integer +')' Punctuation +' ' Text +'||' Operator +' ' Text 'return' Keyword ' ' Text 'i' Name '\n' Text -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'i' Name +' ' Text +'@inbounds' Name.Decorator +' ' Text +'b' Name ' ' Text '=' Operator ' ' Text -'j' Name +'codeunit' Name +'(' Punctuation +'s' Name +',' Punctuation +' ' Text +'i' Name +'-' Operator +'3' Literal.Number.Integer +')' Punctuation '\n' Text ' ' Text -'end' Keyword +'between' Name +'(' Punctuation +'b' Name +',' Punctuation +' ' Text +'0b11110000' Literal.Number.Bin +',' Punctuation +' ' Text +'0b11110111' Literal.Number.Bin +')' Punctuation +' ' Text +'&&' Operator +' ' Text +'return' Keyword +' ' Text +'i' Name +'-' Operator +'3' Literal.Number.Integer '\n' Text ' ' Text 'return' Keyword ' ' Text -'0' Literal.Number.Integer +'i' Name '\n' Text 'end' Keyword '\n' Text -'strchr' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'c' Name -'::' Operator -'Char' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'strchr' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'c' Name -',' Punctuation -' ' Text -'start' Name -'(' Punctuation -'s' Name -')' Punctuation -')' Punctuation '\n' Text -'contains' Name +'@propagate_inbounds' Name.Decorator +' ' Text +'nextind' Name '(' Punctuation 's' Name '::' Operator -'String' Name +'String' Keyword.Type ',' Punctuation ' ' Text -'c' Name +'i' Name '::' Operator -'Char' Keyword.Type +'Int' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text -'(' Punctuation -'strchr' Name +'_nextind_str' Name '(' Punctuation 's' Name ',' Punctuation -'c' Name -')' Punctuation -'!=' Operator -'0' Literal.Number.Integer +' ' Text +'i' Name ')' Punctuation '\n' Text '\n' Text -'function' Keyword -' ' Text -'chars' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +'# s should be String or SubString{String}' Comment '\n' Text -' ' Text -'cx' Name +'@inline' Name.Decorator ' ' Text -'=' Operator +'function' Keyword ' ' Text -'Array' Keyword.Type -'(' Punctuation -'Char' Keyword.Type -',' Punctuation -'strlen' Name +'_nextind_str' Name '(' Punctuation 's' Name -')' Punctuation +',' Punctuation +' ' Text +'i' Name +'::' Operator +'Int' Keyword.Type ')' Punctuation '\n' Text ' ' Text 'i' Name ' ' Text -'=' Operator +'==' Operator ' ' Text '0' Literal.Number.Integer +' ' Text +'&&' Operator +' ' Text +'return' Keyword +' ' Text +'1' Literal.Number.Integer '\n' Text ' ' Text -'for' Keyword -' ' Text -'c' Name +'n' Name ' ' Text -'in' Keyword.Pseudo +'=' Operator ' ' Text +'ncodeunits' Name +'(' Punctuation 's' Name +')' Punctuation '\n' Text -' ' Text -'cx' Name -'[' Punctuation -'i' Name +' ' Text +'@boundscheck' Name.Decorator ' ' Text -'+=' Operator +'between' Name +'(' Punctuation +'i' Name +',' Punctuation ' ' Text '1' Literal.Number.Integer -']' Punctuation -' ' Text -'=' Operator +',' Punctuation ' ' Text -'c' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'return' Keyword +'n' Name +')' Punctuation ' ' Text -'cx' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'function' Keyword +'||' Operator ' ' Text -'cmp' Name +'throw' Name '(' Punctuation -'a' Name -'::' Operator -'String' Name +'BoundsError' Keyword.Type +'(' Punctuation +'s' Name ',' Punctuation ' ' Text -'b' Name -'::' Operator -'String' Name +'i' Name +')' Punctuation ')' Punctuation '\n' Text ' ' Text -'i' Name +'@inbounds' Name.Decorator +' ' Text +'l' Name ' ' Text '=' Operator ' ' Text -'start' Name +'codeunit' Name '(' Punctuation -'a' Name +'s' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation '\n' Text ' ' Text -'j' Name +'(' Punctuation +'l' Name ' ' Text -'=' Operator +'<' Operator ' ' Text -'start' Name -'(' Punctuation -'b' Name +'0x80' Literal.Number.Hex ')' Punctuation -'\n' Text - -' ' Text -'while' Keyword ' ' Text -'!' Operator -'done' Name +'|' Operator +' ' Text '(' Punctuation -'a' Name -',' Punctuation -'i' Name +'0xf8' Literal.Number.Hex +' ' Text +'≤' Operator +' ' Text +'l' Name ')' Punctuation ' ' Text '&&' Operator ' ' Text -'!' Operator -'done' Name -'(' Punctuation -'b' Name -',' Punctuation +'return' Keyword +' ' Text 'i' Name -')' Punctuation +'+' Operator +'1' Literal.Number.Integer '\n' Text -' ' Text -'c' Name -',' Punctuation +' ' Text +'if' Keyword ' ' Text -'i' Name +'l' Name ' ' Text -'=' Operator +'<' Operator ' ' Text -'next' Name -'(' Punctuation -'a' Name -',' Punctuation -'i' Name -')' Punctuation +'0xc0' Literal.Number.Hex '\n' Text ' ' Text -'d' Name -',' Punctuation -' ' Text -'j' Name +'i′' Name ' ' Text '=' Operator ' ' Text -'next' Name +'@inbounds' Name.Decorator +' ' Text +'thisind' Name '(' Punctuation -'b' Name +'s' Name ',' Punctuation -'j' Name +' ' Text +'i' Name ')' Punctuation '\n' Text ' ' Text -'if' Keyword -' ' Text -'c' Name -' ' Text -'!=' Operator -' ' Text -'d' Name -'\n' Text - -' ' Text 'return' Keyword ' ' Text -'c' Name +'i′' Name ' ' Text '<' Operator ' ' Text -'d' Name +'i' Name ' ' Text '?' Operator ' ' Text -'-' Operator -'1' Literal.Number.Integer +'@inbounds' Name.Decorator +'(' Punctuation +'nextind' Name +'(' Punctuation +'s' Name +',' Punctuation +' ' Text +'i′' Name +')' Punctuation +')' Punctuation ' ' Text ':' Operator ' ' Text +'i' Name '+' Operator '1' Literal.Number.Integer '\n' Text -' ' Text +' ' Text 'end' Keyword '\n' Text ' ' Text -'end' Keyword +'# first continuation byte' Comment '\n' Text ' ' Text -'done' Name '(' Punctuation -'a' Name -',' Punctuation -'i' Name -')' Punctuation -' ' Text -'&&' Operator -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'b' Name -',' Punctuation -'j' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'-' Operator -'1' Literal.Number.Integer -' ' Text -':' Operator -'\n' Text - -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'a' Name -',' Punctuation -'i' Name -')' Punctuation -' ' Text -'&&' Operator -' ' Text -'done' Name -'(' Punctuation -'b' Name -',' Punctuation -'j' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'+' Operator -'1' Literal.Number.Integer -' ' Text -':' Operator -' ' Text -'0' Literal.Number.Integer -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'isequal' Name -'(' Punctuation -'a' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'b' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'cmp' Name -'(' Punctuation -'a' Name -',' Punctuation -'b' Name -')' Punctuation -' ' Text -'==' Operator -' ' Text -'0' Literal.Number.Integer -'\n' Text - -'isless' Name -'(' Punctuation -'a' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'b' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'cmp' Name -'(' Punctuation -'a' Name -',' Punctuation -'b' Name -')' Punctuation -' ' Text -'<' Operator -' ' Text -'0' Literal.Number.Integer -'\n' Text - -'\n' Text - -'# faster comparisons for byte strings' Comment -'\n' Text - -'\n' Text - -'cmp' Name -'(' Punctuation -'a' Name -'::' Operator -'ByteString' Name -',' Punctuation -' ' Text -'b' Name -'::' Operator -'ByteString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'lexcmp' Name -'(' Punctuation -'a' Name -'.' Operator -'data' Name -',' Punctuation -' ' Text -'b' Name -'.' Operator -'data' Name -')' Punctuation -'\n' Text - -'isequal' Name -'(' Punctuation -'a' Name -'::' Operator -'ByteString' Name -',' Punctuation -' ' Text -'b' Name -'::' Operator -'ByteString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'length' Name -'(' Punctuation -'a' Name -')' Punctuation -'==' Operator -'length' Name -'(' Punctuation -'b' Name -')' Punctuation -' ' Text -'&&' Operator -' ' Text -'cmp' Name -'(' Punctuation -'a' Name -',' Punctuation -'b' Name -')' Punctuation -'==' Operator -'0' Literal.Number.Integer -'\n' Text - -'\n' Text - -'## character column width function ##' Comment -'\n' Text - -'\n' Text - -'charwidth' Name -'(' Punctuation -'c' Name -'::' Operator -'Char' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'max' Name -'(' Punctuation -'0' Literal.Number.Integer -',' Punctuation -'int' Name -'(' Punctuation -'ccall' Keyword -'(' Punctuation -':' Operator -'wcwidth' Name -',' Punctuation -' ' Text -'Int32' Keyword.Type -',' Punctuation -' ' Text -'(' Punctuation -'Char' Keyword.Type -',' Punctuation -')' Punctuation -',' Punctuation -' ' Text -'c' Name -')' Punctuation -')' Punctuation -')' Punctuation -'\n' Text - -'strwidth' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'(' Punctuation -'w' Name -'=' Operator -'0' Literal.Number.Integer -';' Punctuation -' ' Text -'for' Keyword -' ' Text -'c' Name -' ' Text -'in' Keyword.Pseudo -' ' Text -'s' Name -';' Punctuation -' ' Text -'w' Name -' ' Text -'+=' Operator -' ' Text -'charwidth' Name -'(' Punctuation -'c' Name -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -';' Punctuation -' ' Text -'w' Name -')' Punctuation -'\n' Text - -'strwidth' Name -'(' Punctuation -'s' Name -'::' Operator -'ByteString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'ccall' Keyword -'(' Punctuation -':' Operator -'u8_strwidth' Name -',' Punctuation -' ' Text -'Int' Keyword.Type -',' Punctuation -' ' Text -'(' Punctuation -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -',' Punctuation -')' Punctuation -',' Punctuation -' ' Text -'s' Name -'.' Operator -'data' Name -')' Punctuation -'\n' Text - -'# TODO: implement and use u8_strnwidth that takes a length argument' Comment -'\n' Text - -'\n' Text - -'## generic string uses only length and next ##' Comment -'\n' Text - -'\n' Text - -'type' Keyword -' ' Text -'GenericString' Name -' ' Text -'<:' Operator -' ' Text -'String' Name -'\n' Text - -' ' Text -'string' Name -'::' Operator -'String' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'length' Name -'(' Punctuation -'s' Name -'::' Operator -'GenericString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -')' Punctuation -'\n' Text - -'next' Name -'(' Punctuation -'s' Name -'::' Operator -'GenericString' Name -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -',' Punctuation -' ' Text -'i' Name -')' Punctuation -'\n' Text - -'\n' Text - -'## plain old character arrays ##' Comment -'\n' Text - -'\n' Text - -'type' Keyword -' ' Text -'CharString' Name -' ' Text -'<:' Operator -' ' Text -'String' Name -'\n' Text - -' ' Text -'chars' Name -'::' Operator -'Array' Keyword.Type -'{' Punctuation -'Char' Keyword.Type -',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation -'\n' Text - -'\n' Text - -' ' Text -'CharString' Name -'(' Punctuation -'a' Name -'::' Operator -'Array' Keyword.Type -'{' Punctuation -'Char' Keyword.Type -',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation -')' Punctuation -' ' Text -'=' Operator -' ' Text -'new' Name -'(' Punctuation -'a' Name -')' Punctuation -'\n' Text - -' ' Text -'CharString' Name -'(' Punctuation -'c' Name -'::' Operator -'Char' Keyword.Type -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -' ' Text -'=' Operator -' ' Text -'new' Name -'(' Punctuation -'[' Punctuation -' ' Text -'c' Name -'[' Punctuation -'i' Name -']' Punctuation -' ' Text -'|' Operator -' ' Text -'i' Name -'=' Operator -'1' Literal.Number.Integer -':' Operator -'length' Name -'(' Punctuation -'c' Name -')' Punctuation -' ' Text -']' Punctuation -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'CharString' Name -'(' Punctuation -'x' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -' ' Text -'=' Operator -' ' Text -'CharString' Name -'(' Punctuation -'map' Name -'(' Punctuation -'char' Name -',' Punctuation -'x' Name -')' Punctuation -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -'\n' Text - -'\n' Text - -'next' Name -'(' Punctuation -'s' Name -'::' Operator -'CharString' Name -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'(' Punctuation -'s' Name -'.' Operator -'chars' Name -'[' Punctuation -'i' Name -']' Punctuation -',' Punctuation -' ' Text -'i' Name -'+' Operator -'1' Literal.Number.Integer -')' Punctuation -'\n' Text - -'length' Name -'(' Punctuation -'s' Name -'::' Operator -'CharString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -'.' Operator -'chars' Name -')' Punctuation -'\n' Text - -'strlen' Name -'(' Punctuation -'s' Name -'::' Operator -'CharString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -'\n' Text - -'string' Name -'(' Punctuation -'c' Name -'::' Operator -'Char' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'CharString' Name -'(' Punctuation -'c' Name -')' Punctuation -'\n' Text - -'string' Name -'(' Punctuation -'c' Name -'::' Operator -'Char' Keyword.Type -',' Punctuation -' ' Text -'x' Name -'::' Operator -'Char' Keyword.Type -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -' ' Text -'=' Operator -' ' Text -'CharString' Name -'(' Punctuation -'c' Name -',' Punctuation -' ' Text -'x' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -'\n' Text - -'\n' Text - -'## substrings reference original strings ##' Comment -'\n' Text - -'\n' Text - -'type' Keyword -' ' Text -'SubString' Keyword.Type -' ' Text -'<:' Operator -' ' Text -'String' Name -'\n' Text - -' ' Text -'string' Name -'::' Operator -'String' Name -'\n' Text - -' ' Text -'offset' Name -'::' Operator -'Int' Keyword.Type -'\n' Text - -' ' Text -'length' Name -'::' Operator -'Int' Keyword.Type -'\n' Text - -'\n' Text - -' ' Text -'SubString' Keyword.Type -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -',' Punctuation -' ' Text -'j' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'new' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'i' Name -'-' Operator -'1' Literal.Number.Integer -',' Punctuation -' ' Text -'j' Name -'-' Operator -'i' Name -'+' Operator -'1' Literal.Number.Integer -')' Punctuation -'\n' Text - -' ' Text -'SubString' Keyword.Type -'(' Punctuation -'s' Name -'::' Operator -'SubString' Keyword.Type -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -',' Punctuation -' ' Text -'j' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -'\n' Text - -' ' Text -'new' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -',' Punctuation -' ' Text -'i' Name -'-' Operator -'1' Literal.Number.Integer -'+' Operator -'s' Name -'.' Operator -'offset' Name -',' Punctuation -' ' Text -'j' Name -'-' Operator -'i' Name -'+' Operator -'1' Literal.Number.Integer -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'SubString' Keyword.Type -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Integer' Keyword.Type -',' Punctuation -' ' Text -'j' Name -'::' Operator -'Integer' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'SubString' Keyword.Type -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'int' Name -'(' Punctuation -'i' Name -')' Punctuation -',' Punctuation -' ' Text -'int' Name -'(' Punctuation -'j' Name -')' Punctuation -')' Punctuation -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'next' Name -'(' Punctuation -'s' Name -'::' Operator -'SubString' Keyword.Type -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'i' Name -' ' Text -'<' Operator -' ' Text -'1' Literal.Number.Integer -' ' Text -'||' Operator -' ' Text -'i' Name -' ' Text -'>' Operator -' ' Text -'s' Name -'.' Operator -'length' Name -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'s' Literal.String -'t' Literal.String -'r' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -' ' Literal.String -'i' Literal.String -'n' Literal.String -'d' Literal.String -'e' Literal.String -'x' Literal.String -' ' Literal.String -'o' Literal.String -'u' Literal.String -'t' Literal.String -' ' Literal.String -'o' Literal.String -'f' Literal.String -' ' Literal.String -'b' Literal.String -'o' Literal.String -'u' Literal.String -'n' Literal.String -'d' Literal.String -'s' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -',' Punctuation -' ' Text -'i' Name -'+' Operator -'s' Name -'.' Operator -'offset' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'i' Name -'-' Operator -'s' Name -'.' Operator -'offset' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'length' Name -'(' Punctuation -'s' Name -'::' Operator -'SubString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'s' Name -'.' Operator -'length' Name -'\n' Text - -'# TODO: strlen(s::SubString) = ??' Comment -'\n' Text - -"# default implementation will work but it's slow" Comment -'\n' Text - -'# can this be delegated efficiently somehow?' Comment -'\n' Text - -'# that may require additional string interfaces' Comment -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'ref' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'r' Name -'::' Operator -'Range1' Name -'{' Punctuation -'Int' Keyword.Type -'}' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'first' Name -'(' Punctuation -'r' Name -')' Punctuation -' ' Text -'<' Operator -' ' Text -'1' Literal.Number.Integer -' ' Text -'||' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -' ' Text -'<' Operator -' ' Text -'last' Name -'(' Punctuation -'r' Name -')' Punctuation -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'i' Literal.String -'n' Literal.String -' ' Literal.String -'s' Literal.String -'u' Literal.String -'b' Literal.String -'s' Literal.String -'t' Literal.String -'r' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -' ' Literal.String -'s' Literal.String -'l' Literal.String -'i' Literal.String -'c' Literal.String -'e' Literal.String -':' Literal.String -' ' Literal.String -'i' Literal.String -'n' Literal.String -'d' Literal.String -'e' Literal.String -'x' Literal.String -' ' Literal.String -'o' Literal.String -'u' Literal.String -'t' Literal.String -' ' Literal.String -'o' Literal.String -'f' Literal.String -' ' Literal.String -'r' Literal.String -'a' Literal.String -'n' Literal.String -'g' Literal.String -'e' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'SubString' Keyword.Type -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'first' Name -'(' Punctuation -'r' Name -')' Punctuation -',' Punctuation -' ' Text -'last' Name -'(' Punctuation -'r' Name -')' Punctuation -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'## efficient representation of repeated strings ##' Comment -'\n' Text - -'\n' Text - -'type' Keyword -' ' Text -'RepString' Keyword.Type -' ' Text -'<:' Operator -' ' Text -'String' Name -'\n' Text - -' ' Text -'string' Name -'::' Operator -'String' Name -'\n' Text - -' ' Text -'repeat' Name -'::' Operator -'Integer' Keyword.Type -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'length' Name -'(' Punctuation -'s' Name -'::' Operator -'RepString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -')' Punctuation -'*' Operator -'s' Name -'.' Operator -'repeat' Name -'\n' Text - -'strlen' Name -'(' Punctuation -'s' Name -'::' Operator -'RepString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'strlen' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -')' Punctuation -'*' Operator -'s' Name -'.' Operator -'repeat' Name -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'next' Name -'(' Punctuation -'s' Name -'::' Operator -'RepString' Keyword.Type -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'i' Name -' ' Text -'<' Operator -' ' Text -'1' Literal.Number.Integer -' ' Text -'||' Operator -' ' Text -'i' Name -' ' Text -'>' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'s' Literal.String -'t' Literal.String -'r' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -' ' Literal.String -'i' Literal.String -'n' Literal.String -'d' Literal.String -'e' Literal.String -'x' Literal.String -' ' Literal.String -'o' Literal.String -'u' Literal.String -'t' Literal.String -' ' Literal.String -'o' Literal.String -'f' Literal.String -' ' Literal.String -'b' Literal.String -'o' Literal.String -'u' Literal.String -'n' Literal.String -'d' Literal.String -'s' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'mod1' Name -'(' Punctuation -'i' Name -',' Punctuation -'length' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'k' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -',' Punctuation -' ' Text -'j' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'k' Name -'-' Operator -'j' Name -'+' Operator -'i' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'repeat' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'r' Name -'::' Operator -'Integer' Keyword.Type -')' Punctuation -'\n' Text - -' ' Text -'r' Name -' ' Text -'<' Operator -' ' Text -'0' Literal.Number.Integer -' ' Text -'?' Operator -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'c' Literal.String -'a' Literal.String -'n' Literal.String -"'" Literal.String -'t' Literal.String -' ' Literal.String -'r' Literal.String -'e' Literal.String -'p' Literal.String -'e' Literal.String -'a' Literal.String -'t' Literal.String -' ' Literal.String -'a' Literal.String -' ' Literal.String -'s' Literal.String -'t' Literal.String -'r' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -' ' Literal.String -'"' Literal.String -',' Punctuation -'r' Name -',' Punctuation -'"' Literal.String -' ' Literal.String -'t' Literal.String -'i' Literal.String -'m' Literal.String -'e' Literal.String -'s' Literal.String -'"' Literal.String -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'r' Name -' ' Text -'==' Operator -' ' Text -'0' Literal.Number.Integer -' ' Text -'?' Operator -' ' Text -'"' Literal.String -'"' Literal.String -' ' Text -':' Operator -'\n' Text - -' ' Text -'r' Name -' ' Text -'==' Operator -' ' Text -'1' Literal.Number.Integer -' ' Text -'?' Operator -' ' Text -'s' Name -' ' Text -':' Operator -'\n' Text - -' ' Text -'RepString' Keyword.Type -'(' Punctuation -'s' Name -',' Punctuation -'r' Name -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'## reversed strings without data movement ##' Comment -'\n' Text - -'\n' Text - -'type' Keyword -' ' Text -'RevString' Keyword.Type -' ' Text -'<:' Operator -' ' Text -'String' Name -'\n' Text - -' ' Text -'string' Name -'::' Operator -'String' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'length' Name -'(' Punctuation -'s' Name -'::' Operator -'RevString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -')' Punctuation -'\n' Text - -'strlen' Name -'(' Punctuation -'s' Name -'::' Operator -'RevString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'strlen' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -')' Punctuation -'\n' Text - -'\n' Text - -'start' Name -'(' Punctuation -'s' Name -'::' Operator -'RevString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'(' Punctuation -'n' Name -'=' Operator -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'n' Name -'-' Operator -'thisind' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -',' Punctuation -'n' Name -')' Punctuation -'+' Operator -'1' Literal.Number.Integer -')' Punctuation -'\n' Text - -'function' Keyword -' ' Text -'next' Name -'(' Punctuation -'s' Name -'::' Operator -'RevString' Keyword.Type -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -'\n' Text - -' ' Text -'n' Name -' ' Text -'=' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'n' Name -'-' Operator -'i' Name -'+' Operator -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'(' Punctuation -'s' Name -'.' Operator -'string' Name -'[' Punctuation -'j' Name -']' Punctuation -',' Punctuation -' ' Text -'n' Name -'-' Operator -'thisind' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -',' Punctuation -'j' Name -'-' Operator -'1' Literal.Number.Integer -')' Punctuation -'+' Operator -'1' Literal.Number.Integer -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'reverse' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'RevString' Keyword.Type -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -'reverse' Name -'(' Punctuation -'s' Name -'::' Operator -'RevString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'s' Name -'.' Operator -'string' Name -'\n' Text - -'\n' Text - -'## ropes for efficient concatenation, etc. ##' Comment -'\n' Text - -'\n' Text - -'# Idea: instead of this standard binary tree structure,' Comment -'\n' Text - -'# how about we keep an array of substrings, with an' Comment -'\n' Text - -'# offset array. We can do binary search on the offset' Comment -'\n' Text - -'# array so we get O(log(n)) indexing time still, but we' Comment -'\n' Text - -'# can compute the offsets lazily and avoid all the' Comment -'\n' Text - -'# futzing around while the string is being constructed.' Comment -'\n' Text - -'\n' Text - -'type' Keyword -' ' Text -'RopeString' Keyword.Type -' ' Text -'<:' Operator -' ' Text -'String' Name -'\n' Text - -' ' Text -'head' Name -'::' Operator -'String' Name -'\n' Text - -' ' Text -'tail' Name -'::' Operator -'String' Name -'\n' Text - -' ' Text -'depth' Name -'::' Operator -'Int32' Keyword.Type -'\n' Text - -' ' Text -'length' Name -'::' Operator -'Int' Keyword.Type -'\n' Text - -'\n' Text - -' ' Text -'RopeString' Keyword.Type -'(' Punctuation -'h' Name -'::' Operator -'RopeString' Keyword.Type -',' Punctuation -' ' Text -'t' Name -'::' Operator -'RopeString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -'\n' Text - -' ' Text -'depth' Name -'(' Punctuation -'h' Name -'.' Operator -'tail' Name -')' Punctuation -' ' Text -'+' Operator -' ' Text -'depth' Name -'(' Punctuation -'t' Name -')' Punctuation -' ' Text -'<' Operator -' ' Text -'depth' Name -'(' Punctuation -'h' Name -'.' Operator -'head' Name -')' Punctuation -' ' Text -'?' Operator -'\n' Text - -' ' Text -'RopeString' Keyword.Type -'(' Punctuation -'h' Name -'.' Operator -'head' Name -',' Punctuation -' ' Text -'RopeString' Keyword.Type -'(' Punctuation -'h' Name -'.' Operator -'tail' Name -',' Punctuation -' ' Text -'t' Name -')' Punctuation -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'new' Name -'(' Punctuation -'h' Name -',' Punctuation -' ' Text -'t' Name -',' Punctuation -' ' Text -'max' Name -'(' Punctuation -'h' Name -'.' Operator -'depth' Name -',' Punctuation -'t' Name -'.' Operator -'depth' Name -')' Punctuation -'+' Operator -'1' Literal.Number.Integer -',' Punctuation -' ' Text -'length' Name -'(' Punctuation -'h' Name -')' Punctuation -'+' Operator -'length' Name -'(' Punctuation -'t' Name -')' Punctuation -')' Punctuation -'\n' Text - -'\n' Text - -' ' Text -'RopeString' Keyword.Type -'(' Punctuation -'h' Name -'::' Operator -'RopeString' Keyword.Type -',' Punctuation -' ' Text -'t' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -'\n' Text - -' ' Text -'depth' Name -'(' Punctuation -'h' Name -'.' Operator -'tail' Name -')' Punctuation -' ' Text -'<' Operator -' ' Text -'depth' Name -'(' Punctuation -'h' Name -'.' Operator -'head' Name -')' Punctuation -' ' Text -'?' Operator -'\n' Text - -' ' Text -'RopeString' Keyword.Type -'(' Punctuation -'h' Name -'.' Operator -'head' Name -',' Punctuation -' ' Text -'RopeString' Keyword.Type -'(' Punctuation -'h' Name -'.' Operator -'tail' Name -',' Punctuation -' ' Text -'t' Name -')' Punctuation -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'new' Name -'(' Punctuation -'h' Name -',' Punctuation -' ' Text -'t' Name -',' Punctuation -' ' Text -'h' Name -'.' Operator -'depth' Name -'+' Operator -'1' Literal.Number.Integer -',' Punctuation -' ' Text -'length' Name -'(' Punctuation -'h' Name -')' Punctuation -'+' Operator -'length' Name -'(' Punctuation -'t' Name -')' Punctuation -')' Punctuation -'\n' Text - -'\n' Text - -' ' Text -'RopeString' Keyword.Type -'(' Punctuation -'h' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'t' Name -'::' Operator -'RopeString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -'\n' Text - -' ' Text -'depth' Name -'(' Punctuation -'t' Name -'.' Operator -'head' Name -')' Punctuation -' ' Text -'<' Operator -' ' Text -'depth' Name -'(' Punctuation -'t' Name -'.' Operator -'tail' Name -')' Punctuation -' ' Text -'?' Operator -'\n' Text - -' ' Text -'RopeString' Keyword.Type -'(' Punctuation -'RopeString' Keyword.Type -'(' Punctuation -'h' Name -',' Punctuation -' ' Text -'t' Name -'.' Operator -'head' Name -')' Punctuation -',' Punctuation -' ' Text -'t' Name -'.' Operator -'tail' Name -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'new' Name -'(' Punctuation -'h' Name -',' Punctuation -' ' Text -'t' Name -',' Punctuation -' ' Text -'t' Name -'.' Operator -'depth' Name -'+' Operator -'1' Literal.Number.Integer -',' Punctuation -' ' Text -'length' Name -'(' Punctuation -'h' Name -')' Punctuation -'+' Operator -'length' Name -'(' Punctuation -'t' Name -')' Punctuation -')' Punctuation -'\n' Text - -'\n' Text - -' ' Text -'RopeString' Keyword.Type -'(' Punctuation -'h' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'t' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -'\n' Text - -' ' Text -'new' Name -'(' Punctuation -'h' Name -',' Punctuation -' ' Text -'t' Name -',' Punctuation -' ' Text -'1' Literal.Number.Integer -',' Punctuation -' ' Text -'length' Name -'(' Punctuation -'h' Name -')' Punctuation -'+' Operator -'length' Name -'(' Punctuation -'t' Name -')' Punctuation -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'depth' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'0' Literal.Number.Integer -'\n' Text - -'depth' Name -'(' Punctuation -'s' Name -'::' Operator -'RopeString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'s' Name -'.' Operator -'depth' Name -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'next' Name -'(' Punctuation -'s' Name -'::' Operator -'RopeString' Keyword.Type -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'i' Name -' ' Text -'<=' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -'.' Operator -'head' Name -')' Punctuation -'\n' Text - -' ' Text -'return' Keyword -' ' Text -'next' Name -'(' Punctuation -'s' Name -'.' Operator -'head' Name -',' Punctuation -' ' Text -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'else' Keyword -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -'.' Operator -'tail' Name -',' Punctuation -' ' Text -'i' Name -'-' Operator -'length' Name -'(' Punctuation -'s' Name -'.' Operator -'head' Name -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'return' Keyword -' ' Text -'c' Name -',' Punctuation -' ' Text -'j' Name -'+' Operator -'length' Name -'(' Punctuation -'s' Name -'.' Operator -'head' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'length' Name -'(' Punctuation -'s' Name -'::' Operator -'RopeString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'s' Name -'.' Operator -'length' Name -'\n' Text - -'strlen' Name -'(' Punctuation -'s' Name -'::' Operator -'RopeString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'strlen' Name -'(' Punctuation -'s' Name -'.' Operator -'head' Name -')' Punctuation -' ' Text -'+' Operator -' ' Text -'strlen' Name -'(' Punctuation -'s' Name -'.' Operator -'tail' Name -')' Punctuation -'\n' Text - -'\n' Text - -'strcat' Name -'(' Punctuation -')' Punctuation -' ' Text -'=' Operator -' ' Text -'"' Literal.String -'"' Literal.String -'\n' Text - -'strcat' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'s' Name -'\n' Text - -'strcat' Name -'(' Punctuation -'x' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -' ' Text -'=' Operator -' ' Text -'strcat' Name -'(' Punctuation -'map' Name -'(' Punctuation -'string' Name -',' Punctuation -'x' Name -')' Punctuation -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -'\n' Text - -'strcat' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'t' Name -'::' Operator -'String' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -' ' Text -'=' Operator -'\n' Text - -' ' Text -'(' Punctuation -'t' Name -' ' Text -'=' Operator -' ' Text -'strcat' Name -'(' Punctuation -'t' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -';' Punctuation -' ' Text -'isempty' Name -'(' Punctuation -'s' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'t' Name -' ' Text -':' Operator -' ' Text -'isempty' Name -'(' Punctuation -'t' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'s' Name -' ' Text -':' Operator -' ' Text -'RopeString' Keyword.Type -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'t' Name -')' Punctuation -')' Punctuation -'\n' Text - -'\n' Text - -'print' Name -'(' Punctuation -'s' Name -'::' Operator -'RopeString' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'print' Name -'(' Punctuation -'s' Name -'.' Operator -'head' Name -',' Punctuation -' ' Text -'s' Name -'.' Operator -'tail' Name -')' Punctuation -'\n' Text - -'\n' Text - -'## transformed strings ##' Comment -'\n' Text - -'\n' Text - -'type' Keyword -' ' Text -'TransformedString' Name -' ' Text -'<:' Operator -' ' Text -'String' Name -'\n' Text - -' ' Text -'transform' Name -'::' Operator -'Function' Keyword.Type -'\n' Text - -' ' Text -'string' Name -'::' Operator -'String' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'length' Name -'(' Punctuation -'s' Name -'::' Operator -'TransformedString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -')' Punctuation -'\n' Text - -'strlen' Name -'(' Punctuation -'s' Name -'::' Operator -'TransformedString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'strlen' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -')' Punctuation -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'next' Name -'(' Punctuation -'s' Name -'::' Operator -'TransformedString' Name -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -'.' Operator -'string' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -' ' Text -'=' Operator -' ' Text -'s' Name -'.' Operator -'transform' Name -'(' Punctuation -'c' Name -',' Punctuation -' ' Text -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'return' Keyword -' ' Text -'c' Name -',' Punctuation -' ' Text -'j' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'## uppercase and lowercase transformations ##' Comment -'\n' Text - -'\n' Text - -'uppercase' Name -'(' Punctuation -'c' Name -'::' Operator -'Char' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'ccall' Keyword -'(' Punctuation -':' Operator -'towupper' Name -',' Punctuation -' ' Text -'Char' Keyword.Type -',' Punctuation -' ' Text -'(' Punctuation -'Char' Keyword.Type -',' Punctuation -')' Punctuation -',' Punctuation -' ' Text -'c' Name -')' Punctuation -'\n' Text - -'lowercase' Name -'(' Punctuation -'c' Name -'::' Operator -'Char' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'ccall' Keyword -'(' Punctuation -':' Operator -'towlower' Name -',' Punctuation -' ' Text -'Char' Keyword.Type -',' Punctuation -' ' Text -'(' Punctuation -'Char' Keyword.Type -',' Punctuation -')' Punctuation -',' Punctuation -' ' Text -'c' Name -')' Punctuation -'\n' Text - -'\n' Text - -'uppercase' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'TransformedString' Name -'(' Punctuation -'(' Punctuation -'c' Name -',' Punctuation -'i' Name -')' Punctuation -'-' Operator -'>' Operator -'uppercase' Name -'(' Punctuation -'c' Name -')' Punctuation -',' Punctuation -' ' Text -'s' Name -')' Punctuation -'\n' Text - -'lowercase' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'TransformedString' Name -'(' Punctuation -'(' Punctuation -'c' Name -',' Punctuation -'i' Name -')' Punctuation -'-' Operator -'>' Operator -'lowercase' Name -'(' Punctuation -'c' Name -')' Punctuation -',' Punctuation -' ' Text -'s' Name -')' Punctuation -'\n' Text - -'\n' Text - -'ucfirst' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'TransformedString' Name -'(' Punctuation -'(' Punctuation -'c' Name -',' Punctuation -'i' Name -')' Punctuation -'-' Operator -'>' Operator -'i' Name -'==' Operator -'1' Literal.Number.Integer -' ' Text -'?' Operator -' ' Text -'uppercase' Name -'(' Punctuation -'c' Name -')' Punctuation -' ' Text -':' Operator -' ' Text -'c' Name -',' Punctuation -' ' Text -'s' Name -')' Punctuation -'\n' Text - -'lcfirst' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'TransformedString' Name -'(' Punctuation -'(' Punctuation -'c' Name -',' Punctuation -'i' Name -')' Punctuation -'-' Operator -'>' Operator -'i' Name -'==' Operator -'1' Literal.Number.Integer -' ' Text -'?' Operator -' ' Text -'lowercase' Name -'(' Punctuation -'c' Name -')' Punctuation -' ' Text -':' Operator -' ' Text -'c' Name -',' Punctuation -' ' Text -'s' Name -')' Punctuation -'\n' Text - -'\n' Text - -'const' Keyword.Declaration -' ' Text -'uc' Name -' ' Text -'=' Operator -' ' Text -'uppercase' Name -'\n' Text - -'const' Keyword.Declaration -' ' Text -'lc' Name -' ' Text -'=' Operator -' ' Text -'lowercase' Name -'\n' Text - -'\n' Text - -'## string map ##' Comment -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'map' Name -'(' Punctuation -'f' Name -'::' Operator -'Function' Keyword.Type -',' Punctuation -' ' Text -'s' Name -'::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'out' Name -' ' Text -'=' Operator -' ' Text -'memio' Name -'(' Punctuation -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'for' Keyword -' ' Text -'c' Name -' ' Text -'in' Keyword.Pseudo -' ' Text -'s' Name -'\n' Text - -' ' Text -'write' Name -'(' Punctuation -'out' Name -',' Punctuation -' ' Text -'f' Name -'(' Punctuation -'c' Name -')' Punctuation -'::' Operator -'Char' Keyword.Type -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'takebuf_string' Name -'(' Punctuation -'out' Name -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'## conversion of general objects to strings ##' Comment -'\n' Text - -'\n' Text - -'string' Name -'(' Punctuation -'x' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'print_to_string' Name -'(' Punctuation -'show' Name -',' Punctuation -' ' Text -'x' Name -')' Punctuation -'\n' Text - -'cstring' Name -'(' Punctuation -'x' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -' ' Text -'=' Operator -' ' Text -'print_to_string' Name -'(' Punctuation -'print' Name -',' Punctuation -' ' Text -'x' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'cstring' Name -'(' Punctuation -'p' Name -'::' Operator -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'p' Name -' ' Text -'==' Operator -' ' Text -'C_NULL' Name.Builtin -' ' Text -'?' Operator -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'c' Literal.String -'a' Literal.String -'n' Literal.String -'n' Literal.String -'o' Literal.String -'t' Literal.String -' ' Literal.String -'c' Literal.String -'o' Literal.String -'n' Literal.String -'v' Literal.String -'e' Literal.String -'r' Literal.String -'t' Literal.String -' ' Literal.String -'N' Literal.String -'U' Literal.String -'L' Literal.String -'L' Literal.String -' ' Literal.String -'t' Literal.String -'o' Literal.String -' ' Literal.String -'s' Literal.String -'t' Literal.String -'r' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -'"' Literal.String -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'ccall' Keyword -'(' Punctuation -':' Operator -'jl_cstr_to_string' Name -',' Punctuation -' ' Text -'Any' Keyword.Type -',' Punctuation -' ' Text -'(' Punctuation -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -',' Punctuation -')' Punctuation -',' Punctuation -' ' Text -'p' Name -')' Punctuation -'::' Operator -'ByteString' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'## string promotion rules ##' Comment -'\n' Text - -'\n' Text - -'promote_rule' Name -'(' Punctuation -'::' Operator -'Type' Keyword.Type -'{' Punctuation -'UTF8String' Keyword.Type -'}' Punctuation -' ' Text -',' Punctuation -' ' Text -'::' Operator -'Type' Keyword.Type -'{' Punctuation -'ASCIIString' Keyword.Type -'}' Punctuation -')' Punctuation -' ' Text -'=' Operator -' ' Text -'UTF8String' Keyword.Type -'\n' Text - -'promote_rule' Name -'(' Punctuation -'::' Operator -'Type' Keyword.Type -'{' Punctuation -'UTF8String' Keyword.Type -'}' Punctuation -' ' Text -',' Punctuation -' ' Text -'::' Operator -'Type' Keyword.Type -'{' Punctuation -'CharString' Name -'}' Punctuation -' ' Text -')' Punctuation -' ' Text -'=' Operator -' ' Text -'UTF8String' Keyword.Type -'\n' Text - -'promote_rule' Name -'(' Punctuation -'::' Operator -'Type' Keyword.Type -'{' Punctuation -'ASCIIString' Keyword.Type -'}' Punctuation -',' Punctuation -' ' Text -'::' Operator -'Type' Keyword.Type -'{' Punctuation -'CharString' Name -'}' Punctuation -' ' Text -')' Punctuation -' ' Text -'=' Operator -' ' Text -'UTF8String' Keyword.Type -'\n' Text - -'\n' Text - -'## printing literal quoted string data ##' Comment -'\n' Text - -'\n' Text - -'# TODO: this is really the inverse of print_unbackslashed' Comment -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'print_quoted_literal' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'\'"\'' Literal.String.Char -')' Punctuation -'\n' Text - -' ' Text -'for' Keyword -' ' Text -'c' Name -' ' Text -'=' Operator -' ' Text -'s' Name -';' Punctuation -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -'\'"\'' Literal.String.Char -' ' Text -'?' Operator -' ' Text -'print' Name -'(' Punctuation -'"' Literal.String -'\\\\' Literal.String.Escape -'\\"' Literal.String.Escape -'"' Literal.String -')' Punctuation -' ' Text -':' Operator -' ' Text -'print' Name -'(' Punctuation -'c' Name -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'\'"\'' Literal.String.Char -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'## string escaping & unescaping ##' Comment -'\n' Text - -'\n' Text - -'escape_nul' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -'\n' Text - -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -' ' Text -'&&' Operator -' ' Text -"'0'" Literal.String.Char -' ' Text -'<=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'[' Punctuation -'1' Literal.Number.Integer -']' Punctuation -' ' Text -'<=' Operator -' ' Text -"'7'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'L' Name -'"' Literal.String -'\\x00' Literal.String.Escape -'"' Literal.String -' ' Text -':' Operator -' ' Text -'L' Name -'"' Literal.String -'\\0' Literal.String.Escape -'"' Literal.String -'\n' Text - -'\n' Text - -'is_hex_digit' Name -'(' Punctuation -'c' Name -'::' Operator -'Char' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -"'0'" Literal.String.Char -'<=' Operator -'c' Name -'<=' Operator -"'9'" Literal.String.Char -' ' Text -'||' Operator -' ' Text -"'a'" Literal.String.Char -'<=' Operator -'c' Name -'<=' Operator -"'f'" Literal.String.Char -' ' Text -'||' Operator -' ' Text -"'A'" Literal.String.Char -'<=' Operator -'c' Name -'<=' Operator -"'F'" Literal.String.Char -'\n' Text - -'need_full_hex' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'i' Name -'::' Operator -'Int' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -' ' Text -'&&' Operator -' ' Text -'is_hex_digit' Name -'(' Punctuation -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'[' Punctuation -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'print_escaped' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'esc' Name -'::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'start' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'\\0'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'print' Name -'(' Punctuation -'escape_nul' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'\\e'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'print' Name -'(' Punctuation -'L' Name -'"' Literal.String -'\\' Literal.String -'e' Literal.String -'"' Literal.String -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'\\\\'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'print' Name -'(' Punctuation -'"' Literal.String -'\\\\' Literal.String.Escape -'\\\\' Literal.String.Escape -'"' Literal.String -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'contains' Name -'(' Punctuation -'esc' Name -',' Punctuation -'c' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'print' Name -'(' Punctuation -"'\\\\'" Literal.String.Char -',' Punctuation -' ' Text -'c' Name -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'iswprint' Name -'(' Punctuation -'c' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'print' Name -'(' Punctuation -'c' Name -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'7' Literal.Number.Integer -' ' Text -'<=' Operator -' ' Text -'c' Name -' ' Text -'<=' Operator -' ' Text -'13' Literal.Number.Integer -' ' Text -'?' Operator -' ' Text -'print' Name -'(' Punctuation -"'\\\\'" Literal.String.Char -',' Punctuation -' ' Text -'"' Literal.String -'a' Literal.String -'b' Literal.String -'t' Literal.String -'n' Literal.String -'v' Literal.String -'f' Literal.String -'r' Literal.String -'"' Literal.String -'[' Punctuation -'c' Name -'-' Operator -'6' Literal.Number.Integer -']' Punctuation -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'<=' Operator -' ' Text -"'\\x7f'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'print' Name -'(' Punctuation -'L' Name -'"' Literal.String -'\\' Literal.String -'x' Literal.String -'"' Literal.String -',' Punctuation -' ' Text -'hex' Name -'(' Punctuation -'c' Name -',' Punctuation -' ' Text -'2' Literal.Number.Integer -')' Punctuation -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'<=' Operator -' ' Text -"'\\uffff'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'print' Name -'(' Punctuation -'L' Name -'"' Literal.String -'\\' Literal.String -'u' Literal.String -'"' Literal.String -',' Punctuation -' ' Text -'hex' Name -'(' Punctuation -'c' Name -',' Punctuation -' ' Text -'need_full_hex' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'4' Literal.Number.Integer -' ' Text -':' Operator -' ' Text -'2' Literal.Number.Integer -')' Punctuation -')' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'L' Name -'"' Literal.String -'\\' Literal.String -'U' Literal.String -'"' Literal.String -',' Punctuation -' ' Text -'hex' Name -'(' Punctuation -'c' Name -',' Punctuation -' ' Text -'need_full_hex' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'8' Literal.Number.Integer -' ' Text -':' Operator -' ' Text -'4' Literal.Number.Integer -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'j' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'escape_string' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'print_to_string' Name -'(' Punctuation -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -',' Punctuation -' ' Text -'print_escaped' Name -',' Punctuation -' ' Text -'s' Name -',' Punctuation -' ' Text -'"' Literal.String -'\\"' Literal.String.Escape -'"' Literal.String -')' Punctuation -'\n' Text - -'print_quoted' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'(' Punctuation -'print' Name -'(' Punctuation -'\'"\'' Literal.String.Char -')' Punctuation -';' Punctuation -' ' Text -'print_escaped' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'"' Literal.String -'\\"' Literal.String.Escape -'\\$' Literal.String.Escape -'"' Literal.String -')' Punctuation -';' Punctuation -' ' Text -'print' Name -'(' Punctuation -'\'"\'' Literal.String.Char -')' Punctuation -')' Punctuation -'\n' Text - -'#" # work around syntax highlighting problem' Comment -'\n' Text - -'quote_string' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'print_to_string' Name -'(' Punctuation -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -'+' Operator -'2' Literal.Number.Integer -',' Punctuation -' ' Text -'print_quoted' Name -',' Punctuation -' ' Text -'s' Name -')' Punctuation -'\n' Text - -'\n' Text - -'# bare minimum unescaping function unescapes only given characters' Comment -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'print_unescaped_chars' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'esc' Name -'::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'contains' Name -'(' Punctuation -'esc' Name -',' Punctuation -"'\\\\'" Literal.String.Char -')' Punctuation -'\n' Text - -' ' Text -'esc' Name -' ' Text -'=' Operator -' ' Text -'strcat' Name -'(' Punctuation -'"' Literal.String -'\\\\' Literal.String.Escape -'"' Literal.String -',' Punctuation -' ' Text -'esc' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'start' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'\\\\'" Literal.String.Char -' ' Text -'&&' Operator -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -' ' Text -'&&' Operator -' ' Text -'contains' Name -'(' Punctuation -'esc' Name -',' Punctuation -'s' Name -'[' Punctuation -'i' Name -']' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'c' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'unescape_chars' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'esc' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -'\n' Text - -' ' Text -'print_to_string' Name -'(' Punctuation -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -',' Punctuation -' ' Text -'print_unescaped_chars' Name -',' Punctuation -' ' Text -'s' Name -',' Punctuation -' ' Text -'esc' Name -')' Punctuation -'\n' Text - -'\n' Text - -'# general unescaping of traditional C and Unicode escape sequences' Comment -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'print_unescaped' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'start' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -' ' Text -'&&' Operator -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'\\\\'" Literal.String.Char -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'x'" Literal.String.Char -' ' Text -'||' Operator -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'u'" Literal.String.Char -' ' Text -'||' Operator -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'U'" Literal.String.Char -'\n' Text - -' ' Text -'n' Name -' ' Text -'=' Operator -' ' Text -'k' Name -' ' Text -'=' Operator -' ' Text -'0' Literal.Number.Integer -'\n' Text - -' ' Text -'m' Name -' ' Text -'=' Operator -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'x'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'2' Literal.Number.Integer -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'u'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'4' Literal.Number.Integer -' ' Text -':' Operator -' ' Text -'8' Literal.Number.Integer -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'(' Punctuation -'k' Name -'+=' Operator -'1' Literal.Number.Integer -')' Punctuation -' ' Text -'<=' Operator -' ' Text -'m' Name -' ' Text -'&&' Operator -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'n' Name -' ' Text -'=' Operator -' ' Text -"'0'" Literal.String.Char -' ' Text -'<=' Operator -' ' Text -'c' Name -' ' Text -'<=' Operator -' ' Text -"'9'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'n' Name -'<<' Operator -'4' Literal.Number.Integer -' ' Text -'+' Operator -' ' Text -'c' Name -'-' Operator -"'0'" Literal.String.Char -' ' Text -':' Operator -'\n' Text - -' ' Text -"'a'" Literal.String.Char -' ' Text -'<=' Operator -' ' Text -'c' Name -' ' Text -'<=' Operator -' ' Text -"'f'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'n' Name -'<<' Operator -'4' Literal.Number.Integer -' ' Text -'+' Operator -' ' Text -'c' Name -'-' Operator -"'a'" Literal.String.Char -'+' Operator -'10' Literal.Number.Integer -' ' Text -':' Operator -'\n' Text - -' ' Text -"'A'" Literal.String.Char -' ' Text -'<=' Operator -' ' Text -'c' Name -' ' Text -'<=' Operator -' ' Text -"'F'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'n' Name -'<<' Operator -'4' Literal.Number.Integer -' ' Text -'+' Operator -' ' Text -'c' Name -'-' Operator -"'A'" Literal.String.Char -'+' Operator -'10' Literal.Number.Integer -' ' Text -':' Operator -' ' Text -'break' Keyword -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'j' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'k' Name -' ' Text -'==' Operator -' ' Text -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'\\\\' Literal.String.Escape -'x' Literal.String -' ' Literal.String -'u' Literal.String -'s' Literal.String -'e' Literal.String -'d' Literal.String -' ' Literal.String -'w' Literal.String -'i' Literal.String -'t' Literal.String -'h' Literal.String -' ' Literal.String -'n' Literal.String -'o' Literal.String -' ' Literal.String -'f' Literal.String -'o' Literal.String -'l' Literal.String -'l' Literal.String -'o' Literal.String -'w' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -' ' Literal.String -'h' Literal.String -'e' Literal.String -'x' Literal.String -' ' Literal.String -'d' Literal.String -'i' Literal.String -'g' Literal.String -'i' Literal.String -'t' Literal.String -'s' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'m' Name -' ' Text -'==' Operator -' ' Text -'2' Literal.Number.Integer -' ' Text -'# \\x escape sequence' Comment -'\n' Text - -' ' Text -'write' Name -'(' Punctuation -'uint8' Name -'(' Punctuation -'n' Name -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'else' Keyword -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'char' Name -'(' Punctuation -'n' Name -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'elseif' Keyword -' ' Text -"'0'" Literal.String.Char -' ' Text -'<=' Operator -' ' Text -'c' Name -' ' Text -'<=' Operator -' ' Text -"'7'" Literal.String.Char -'\n' Text - -' ' Text -'k' Name -' ' Text -'=' Operator -' ' Text -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'n' Name -' ' Text -'=' Operator -' ' Text -'c' Name -'-' Operator -"'0'" Literal.String.Char -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'(' Punctuation -'k' Name -'+=' Operator -'1' Literal.Number.Integer -')' Punctuation -' ' Text -'<=' Operator -' ' Text -'3' Literal.Number.Integer -' ' Text -'&&' Operator -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'n' Name -' ' Text -'=' Operator -' ' Text -"'0'" Literal.String.Char -' ' Text -'<=' Operator -' ' Text -'c' Name -' ' Text -'<=' Operator -' ' Text -"'7'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'n' Name -'<<' Operator -'3' Literal.Number.Integer -' ' Text -'+' Operator -' ' Text -'c' Name -'-' Operator -"'0'" Literal.String.Char -' ' Text -':' Operator -' ' Text -'break' Keyword -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'j' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'n' Name -' ' Text -'>' Operator -' ' Text -'255' Literal.Number.Integer -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'o' Literal.String -'c' Literal.String -'t' Literal.String -'a' Literal.String -'l' Literal.String -' ' Literal.String -'e' Literal.String -'s' Literal.String -'c' Literal.String -'a' Literal.String -'p' Literal.String -'e' Literal.String -' ' Literal.String -'s' Literal.String -'e' Literal.String -'q' Literal.String -'u' Literal.String -'e' Literal.String -'n' Literal.String -'c' Literal.String -'e' Literal.String -' ' Literal.String -'o' Literal.String -'u' Literal.String -'t' Literal.String -' ' Literal.String -'o' Literal.String -'f' Literal.String -' ' Literal.String -'r' Literal.String -'a' Literal.String -'n' Literal.String -'g' Literal.String -'e' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'write' Name -'(' Punctuation -'uint8' Name -'(' Punctuation -'n' Name -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'else' Keyword -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'c' Name -' ' Text -'==' Operator -' ' Text -"'a'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -"'\\a'" Literal.String.Char -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'b'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -"'\\b'" Literal.String.Char -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'t'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -"'\\t'" Literal.String.Char -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'n'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -"'\\n'" Literal.String.Char -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'v'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -"'\\v'" Literal.String.Char -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'f'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -"'\\f'" Literal.String.Char -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'r'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -"'\\r'" Literal.String.Char -' ' Text -':' Operator -'\n' Text - -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'e'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -"'\\e'" Literal.String.Char -' ' Text -':' Operator -' ' Text -'c' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'else' Keyword -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'c' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'unescape_string' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'print_to_string' Name -'(' Punctuation -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -',' Punctuation -' ' Text -'print_unescaped' Name -',' Punctuation -' ' Text -'s' Name -')' Punctuation -'\n' Text - -'\n' Text - -'## checking UTF-8 & ACSII validity ##' Comment -'\n' Text - -'\n' Text - -'byte_string_classify' Name -'(' Punctuation -'s' Name -'::' Operator -'ByteString' Name -')' Punctuation -' ' Text -'=' Operator -'\n' Text - -' ' Text -'ccall' Keyword -'(' Punctuation -':' Operator -'u8_isvalid' Name -',' Punctuation -' ' Text -'Int32' Keyword.Type -',' Punctuation -' ' Text -'(' Punctuation -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -',' Punctuation -' ' Text -'Int' Keyword.Type -')' Punctuation -',' Punctuation -' ' Text -'s' Name -'.' Operator -'data' Name -',' Punctuation -' ' Text -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'# 0: neither valid ASCII nor UTF-8' Comment -'\n' Text - -' ' Text -'# 1: valid ASCII' Comment -'\n' Text - -' ' Text -'# 2: valid UTF-8' Comment -'\n' Text - -'\n' Text - -'is_valid_ascii' Name -'(' Punctuation -'s' Name -'::' Operator -'ByteString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'byte_string_classify' Name -'(' Punctuation -'s' Name -')' Punctuation -' ' Text -'==' Operator -' ' Text -'1' Literal.Number.Integer -'\n' Text - -'is_valid_utf8' Name -' ' Text -'(' Punctuation -'s' Name -'::' Operator -'ByteString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'byte_string_classify' Name -'(' Punctuation -'s' Name -')' Punctuation -' ' Text -'!=' Operator -' ' Text -'0' Literal.Number.Integer -'\n' Text - -'\n' Text - -'check_ascii' Name -'(' Punctuation -'s' Name -'::' Operator -'ByteString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'is_valid_ascii' Name -'(' Punctuation -'s' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'s' Name -' ' Text -':' Operator -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'i' Literal.String -'n' Literal.String -'v' Literal.String -'a' Literal.String -'l' Literal.String -'i' Literal.String -'d' Literal.String -' ' Literal.String -'A' Literal.String -'S' Literal.String -'C' Literal.String -'I' Literal.String -'I' Literal.String -' ' Literal.String -'s' Literal.String -'e' Literal.String -'q' Literal.String -'u' Literal.String -'e' Literal.String -'n' Literal.String -'c' Literal.String -'e' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -'check_utf8' Name -' ' Text -'(' Punctuation -'s' Name -'::' Operator -'ByteString' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'is_valid_utf8' Name -'(' Punctuation -'s' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'s' Name -' ' Text -':' Operator -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'i' Literal.String -'n' Literal.String -'v' Literal.String -'a' Literal.String -'l' Literal.String -'i' Literal.String -'d' Literal.String -' ' Literal.String -'U' Literal.String -'T' Literal.String -'F' Literal.String -'-' Literal.String -'8' Literal.String -' ' Literal.String -'s' Literal.String -'e' Literal.String -'q' Literal.String -'u' Literal.String -'e' Literal.String -'n' Literal.String -'c' Literal.String -'e' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -'\n' Text - -'## string interpolation parsing ##' Comment -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'_jl_interp_parse' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'unescape' Name -'::' Operator -'Function' Keyword.Type -',' Punctuation -' ' Text -'printer' Name -'::' Operator -'Function' Keyword.Type -')' Punctuation -'\n' Text - -' ' Text -'sx' Name -' ' Text -'=' Operator -' ' Text -'{' Punctuation -'}' Punctuation -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'start' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'k' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'$'" Literal.String.Char -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'isempty' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'push' Name -'(' Punctuation -'sx' Name -',' Punctuation -' ' Text -'unescape' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'ex' Name -',' Punctuation -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'parseatom' Name -'(' Punctuation -'s' Name -',' Punctuation -'k' Name -')' Punctuation -'\n' Text - -' ' Text -'push' Name -'(' Punctuation -'sx' Name -',' Punctuation -' ' Text -'ex' Name -')' Punctuation -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'j' Name -'\n' Text - -' ' Text -'elseif' Keyword -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'\\\\'" Literal.String.Char -' ' Text -'&&' Operator -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'k' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'s' Name -'[' Punctuation -'k' Name -']' Punctuation -' ' Text -'==' Operator -' ' Text -"'$'" Literal.String.Char -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'isempty' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'push' Name -'(' Punctuation -'sx' Name -',' Punctuation -' ' Text -'unescape' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'k' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'k' Name -')' Punctuation -'\n' Text - -' ' Text -'else' Keyword -'\n' Text - -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'k' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'isempty' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -']' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'push' Name -'(' Punctuation -'sx' Name -',' Punctuation -' ' Text -'unescape' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'length' Name -'(' Punctuation -'sx' Name -')' Punctuation -' ' Text -'==' Operator -' ' Text -'1' Literal.Number.Integer -' ' Text -'&&' Operator -' ' Text -'isa' Keyword.Pseudo -'(' Punctuation -'sx' Name -'[' Punctuation -'1' Literal.Number.Integer -']' Punctuation -',' Punctuation -'ByteString' Name -')' Punctuation -' ' Text -'?' Operator -' ' Text -'sx' Name -'[' Punctuation -'1' Literal.Number.Integer -']' Punctuation -' ' Text -':' Operator -'\n' Text - -' ' Text -'expr' Name -'(' Punctuation -':' Operator -'call' Name -',' Punctuation -' ' Text -':' Operator -'print_to_string' Name -',' Punctuation -' ' Text -'printer' Name -',' Punctuation -' ' Text -'sx' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'_jl_interp_parse' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'u' Name -'::' Operator -'Function' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'_jl_interp_parse' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'u' Name -',' Punctuation -' ' Text -'print' Name -')' Punctuation -'\n' Text - -'_jl_interp_parse' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'_jl_interp_parse' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'x' Name -'-' Operator -'>' Operator -'check_utf8' Name -'(' Punctuation -'unescape_string' Name -'(' Punctuation -'x' Name -')' Punctuation -')' Punctuation -')' Punctuation -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'_jl_interp_parse_bytes' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'writer' Name -'(' Punctuation -'x' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -' ' Text -'=' Operator -' ' Text -'for' Keyword -' ' Text -'w' Name -'=' Operator -'x' Name -';' Punctuation -' ' Text -'write' Name -'(' Punctuation -'w' Name -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'_jl_interp_parse' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'unescape_string' Name -',' Punctuation -' ' Text -'writer' Name -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'## core string macros ##' Comment -'\n' Text - -'\n' Text - -'macro' Keyword -' ' Text -'str' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'_jl_interp_parse' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -'macro' Keyword -' ' Text -'S_str' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'_jl_interp_parse' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -'macro' Keyword -' ' Text -'I_str' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'_jl_interp_parse' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'x' Name -'-' Operator -'>' Operator -'unescape_chars' Name -'(' Punctuation -'x' Name -',' Punctuation -'"' Literal.String -'\\"' Literal.String.Escape -'"' Literal.String -')' Punctuation -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -'macro' Keyword -' ' Text -'E_str' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'check_utf8' Name -'(' Punctuation -'unescape_string' Name -'(' Punctuation -'s' Name -')' Punctuation -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -'macro' Keyword -' ' Text -'B_str' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'_jl_interp_parse_bytes' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -'macro' Keyword -' ' Text -'b_str' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -'ex' Name -' ' Text -'=' Operator -' ' Text -'_jl_interp_parse_bytes' Name -'(' Punctuation -'s' Name -')' Punctuation -';' Punctuation -' ' Text -':' Operator -'(' Punctuation -'(' Punctuation -'$' Operator -'ex' Name -')' Punctuation -'.' Operator -'data' Name -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -'\n' Text - -'## shell-like command parsing ##' Comment -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'_jl_shell_parse' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'interp' Name -'::' Operator -'Bool' Keyword.Type -')' Punctuation -'\n' Text - -'\n' Text - -' ' Text -'in_single_quotes' Name -' ' Text -'=' Operator -' ' Text -'false' Keyword.Constant -'\n' Text - -' ' Text -'in_double_quotes' Name -' ' Text -'=' Operator -' ' Text -'false' Keyword.Constant -'\n' Text - -'\n' Text - -' ' Text -'args' Name -' ' Text -'=' Operator -' ' Text -'{' Punctuation -'}' Punctuation -'\n' Text - -' ' Text -'arg' Name -' ' Text -'=' Operator -' ' Text -'{' Punctuation -'}' Punctuation -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'start' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'i' Name -'\n' Text - -'\n' Text - -' ' Text -'function' Keyword -' ' Text -'update_arg' Name -'(' Punctuation -'x' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'isa' Keyword.Pseudo -'(' Punctuation -'x' Name -',' Punctuation -'String' Name -')' Punctuation -' ' Text -'||' Operator -' ' Text -'!' Operator -'isempty' Name -'(' Punctuation -'x' Name -')' Punctuation -'\n' Text - -' ' Text -'push' Name -'(' Punctuation -'arg' Name -',' Punctuation -' ' Text -'x' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'function' Keyword -' ' Text -'append_arg' Name -'(' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'isempty' Name -'(' Punctuation -'arg' Name -')' Punctuation -';' Punctuation -' ' Text -'arg' Name -' ' Text -'=' Operator -' ' Text -'{' Punctuation -'"' Literal.String -'"' Literal.String -',' Punctuation -'}' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'push' Name -'(' Punctuation -'args' Name -',' Punctuation -' ' Text -'arg' Name -')' Punctuation -'\n' Text - -' ' Text -'arg' Name -' ' Text -'=' Operator -' ' Text -'{' Punctuation -'}' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'k' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'in_single_quotes' Name -' ' Text -'&&' Operator -' ' Text -'!' Operator -'in_double_quotes' Name -' ' Text -'&&' Operator -' ' Text -'iswspace' Name -'(' Punctuation -'c' Name -')' Punctuation -'\n' Text - -' ' Text -'update_arg' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'append_arg' Name -'(' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'k' Name -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'k' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'iswspace' Name -'(' Punctuation -'c' Name -')' Punctuation -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'j' Name -'\n' Text - -' ' Text -'break' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'k' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'elseif' Keyword -' ' Text -'interp' Name -' ' Text -'&&' Operator -' ' Text -'!' Operator -'in_single_quotes' Name -' ' Text -'&&' Operator -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'$'" Literal.String.Char -'\n' Text - -' ' Text -'update_arg' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -';' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'k' Name -';' Punctuation -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'k' Name -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'k' Name -')' Punctuation -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'\\$' Literal.String.Escape -' ' Literal.String -'r' Literal.String -'i' Literal.String -'g' Literal.String -'h' Literal.String -'t' Literal.String -' ' Literal.String -'b' Literal.String -'e' Literal.String -'f' Literal.String -'o' Literal.String -'r' Literal.String -'e' Literal.String -' ' Literal.String -'e' Literal.String -'n' Literal.String -'d' Literal.String -' ' Literal.String -'o' Literal.String -'f' Literal.String -' ' Literal.String -'c' Literal.String -'o' Literal.String -'m' Literal.String -'m' Literal.String -'a' Literal.String -'n' Literal.String -'d' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'iswspace' Name -'(' Punctuation -'s' Name -'[' Punctuation -'k' Name -']' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'s' Literal.String -'p' Literal.String -'a' Literal.String -'c' Literal.String -'e' Literal.String -' ' Literal.String -'n' Literal.String -'o' Literal.String -'t' Literal.String -' ' Literal.String -'a' Literal.String -'l' Literal.String -'l' Literal.String -'o' Literal.String -'w' Literal.String -'e' Literal.String -'d' Literal.String -' ' Literal.String -'r' Literal.String -'i' Literal.String -'g' Literal.String -'h' Literal.String -'t' Literal.String -' ' Literal.String -'a' Literal.String -'f' Literal.String -'t' Literal.String -'e' Literal.String -'r' Literal.String -' ' Literal.String -'\\$' Literal.String.Escape -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'ex' Name -',' Punctuation -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'parseatom' Name -'(' Punctuation -'s' Name -',' Punctuation -'j' Name -')' Punctuation -'\n' Text - -' ' Text -'update_arg' Name -'(' Punctuation -'ex' Name -')' Punctuation -';' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'j' Name -'\n' Text - -' ' Text -'else' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'in_double_quotes' Name -' ' Text -'&&' Operator -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'\\''" Literal.String.Char -'\n' Text - -' ' Text -'in_single_quotes' Name -' ' Text -'=' Operator -' ' Text -'!' Operator -'in_single_quotes' Name -'\n' Text - -' ' Text -'update_arg' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -';' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'k' Name -'\n' Text - -' ' Text -'elseif' Keyword -' ' Text -'!' Operator -'in_single_quotes' Name -' ' Text -'&&' Operator -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -'\'"\'' Literal.String.Char -'\n' Text - -' ' Text -'in_double_quotes' Name -' ' Text -'=' Operator -' ' Text -'!' Operator -'in_double_quotes' Name -'\n' Text - -' ' Text -'update_arg' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -';' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'k' Name -'\n' Text - -' ' Text -'elseif' Keyword -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'\\\\'" Literal.String.Char -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'in_double_quotes' Name -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'k' Name -')' Punctuation -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'u' Literal.String -'n' Literal.String -'t' Literal.String -'e' Literal.String -'r' Literal.String -'m' Literal.String -'i' Literal.String -'n' Literal.String -'a' Literal.String -'t' Literal.String -'e' Literal.String -'d' Literal.String -' ' Literal.String -'d' Literal.String -'o' Literal.String -'u' Literal.String -'b' Literal.String -'l' Literal.String -'e' Literal.String -' ' Literal.String -'q' Literal.String -'u' Literal.String -'o' Literal.String -'t' Literal.String -'e' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'s' Name -'[' Punctuation -'k' Name -']' Punctuation -' ' Text -'==' Operator -' ' Text -'\'"\'' Literal.String.Char -' ' Text -'||' Operator -' ' Text -'s' Name -'[' Punctuation -'k' Name -']' Punctuation -' ' Text -'==' Operator -' ' Text -"'$'" Literal.String.Char -'\n' Text - -' ' Text -'update_arg' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -';' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'k' Name -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'k' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'k' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'elseif' Keyword -' ' Text -'!' Operator -'in_single_quotes' Name -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'k' Name -')' Punctuation -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'d' Literal.String -'a' Literal.String -'n' Literal.String -'g' Literal.String -'l' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -' ' Literal.String -'b' Literal.String -'a' Literal.String -'c' Literal.String -'k' Literal.String -'s' Literal.String -'l' Literal.String -'a' Literal.String -'s' Literal.String -'h' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'update_arg' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -'j' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -';' Punctuation -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'k' Name -'\n' Text - -' ' Text -'c' Name -',' Punctuation -' ' Text -'k' Name -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'k' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'j' Name -' ' Text -'=' Operator -' ' Text -'k' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'in_single_quotes' Name -';' Punctuation -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'u' Literal.String -'n' Literal.String -'t' Literal.String -'e' Literal.String -'r' Literal.String -'m' Literal.String -'i' Literal.String -'n' Literal.String -'a' Literal.String -'t' Literal.String -'e' Literal.String -'d' Literal.String -' ' Literal.String -'s' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -'l' Literal.String -'e' Literal.String -' ' Literal.String -'q' Literal.String -'u' Literal.String -'o' Literal.String -'t' Literal.String -'e' Literal.String -'"' Literal.String -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'in_double_quotes' Name -';' Punctuation -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'u' Literal.String -'n' Literal.String -'t' Literal.String -'e' Literal.String -'r' Literal.String -'m' Literal.String -'i' Literal.String -'n' Literal.String -'a' Literal.String -'t' Literal.String -'e' Literal.String -'d' Literal.String -' ' Literal.String -'d' Literal.String -'o' Literal.String -'u' Literal.String -'b' Literal.String -'l' Literal.String -'e' Literal.String -' ' Literal.String -'q' Literal.String -'u' Literal.String -'o' Literal.String -'t' Literal.String -'e' Literal.String -'"' Literal.String -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -'\n' Text - -' ' Text -'update_arg' Name -'(' Punctuation -'s' Name -'[' Punctuation -'i' Name -':' Operator -']' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'append_arg' Name -'(' Punctuation -')' Punctuation -'\n' Text - -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'interp' Name -'\n' Text - -' ' Text -'return' Keyword -' ' Text -'args' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'\n' Text - -' ' Text -'# construct an expression' Comment -'\n' Text - -' ' Text -'exprs' Name -' ' Text -'=' Operator -' ' Text -'{' Punctuation -'}' Punctuation -'\n' Text - -' ' Text -'for' Keyword -' ' Text -'arg' Name -' ' Text -'in' Keyword.Pseudo -' ' Text -'args' Name -'\n' Text - -' ' Text -'push' Name -'(' Punctuation -'exprs' Name -',' Punctuation -' ' Text -'expr' Name -'(' Punctuation -':' Operator -'tuple' Name -',' Punctuation -' ' Text -'arg' Name -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'expr' Name -'(' Punctuation -':' Operator -'tuple' Name -',' Punctuation -'exprs' Name -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'_jl_shell_parse' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'_jl_shell_parse' Name -'(' Punctuation -'s' Name -',' Punctuation -'true' Keyword.Constant -')' Punctuation -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'shell_split' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'parsed' Name -' ' Text -'=' Operator -' ' Text -'_jl_shell_parse' Name -'(' Punctuation -'s' Name -',' Punctuation -'false' Keyword.Constant -')' Punctuation -'\n' Text - -' ' Text -'args' Name -' ' Text -'=' Operator -' ' Text -'String' Name -'[' Punctuation -']' Punctuation -'\n' Text - -' ' Text -'for' Keyword -' ' Text -'arg' Name -' ' Text -'in' Keyword.Pseudo -' ' Text -'parsed' Name -'\n' Text - -' ' Text -'push' Name -'(' Punctuation -'args' Name -',' Punctuation -' ' Text -'strcat' Name -'(' Punctuation -'arg' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'args' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'print_shell_word' Name -'(' Punctuation -'word' Name -'::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'isempty' Name -'(' Punctuation -'word' Name -')' Punctuation -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'"' Literal.String -"'" Literal.String -"'" Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'has_single' Name -' ' Text -'=' Operator -' ' Text -'false' Keyword.Constant -'\n' Text - -' ' Text -'has_special' Name -' ' Text -'=' Operator -' ' Text -'false' Keyword.Constant -'\n' Text - -' ' Text -'for' Keyword -' ' Text -'c' Name -' ' Text -'in' Keyword.Pseudo -' ' Text -'word' Name -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'iswspace' Name -'(' Punctuation -'c' Name -')' Punctuation -' ' Text -'||' Operator -' ' Text -'c' Name -'==' Operator -"'\\\\'" Literal.String.Char -' ' Text -'||' Operator -' ' Text -'c' Name -'==' Operator -"'\\''" Literal.String.Char -' ' Text -'||' Operator -' ' Text -'c' Name -'==' Operator -'\'"\'' Literal.String.Char -' ' Text -'||' Operator -' ' Text -'c' Name -'==' Operator -"'$'" Literal.String.Char -'\n' Text - -' ' Text -'has_special' Name -' ' Text -'=' Operator -' ' Text -'true' Keyword.Constant -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'\\''" Literal.String.Char -'\n' Text - -' ' Text -'has_single' Name -' ' Text -'=' Operator -' ' Text -'true' Keyword.Constant -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'has_special' Name -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'word' Name -')' Punctuation -'\n' Text - -' ' Text -'elseif' Keyword -' ' Text -'!' Operator -'has_single' Name -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -"'\\''" Literal.String.Char -',' Punctuation -' ' Text -'word' Name -',' Punctuation -' ' Text -"'\\''" Literal.String.Char -')' Punctuation -'\n' Text - -' ' Text -'else' Keyword -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'\'"\'' Literal.String.Char -')' Punctuation -'\n' Text - -' ' Text -'for' Keyword -' ' Text -'c' Name -' ' Text -'in' Keyword.Pseudo -' ' Text -'word' Name -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -'\'"\'' Literal.String.Char -' ' Text -'||' Operator -' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'$'" Literal.String.Char -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -"'\\\\'" Literal.String.Char -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'c' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'\'"\'' Literal.String.Char -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'print_shell_escaped' Name -'(' Punctuation -'cmd' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'args' Name -'::' Operator -'String' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -'\n' Text - -' ' Text -'print_shell_word' Name -'(' Punctuation -'cmd' Name -')' Punctuation -'\n' Text - -' ' Text -'for' Keyword -' ' Text -'arg' Name -' ' Text -'in' Keyword.Pseudo -' ' Text -'args' Name -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -"' '" Literal.String.Char -')' Punctuation -'\n' Text - -' ' Text -'print_shell_word' Name -'(' Punctuation -'arg' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'shell_escape' Name -'(' Punctuation -'cmd' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'args' Name -'::' Operator -'String' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -' ' Text -'=' Operator -'\n' Text - -' ' Text -'print_to_string' Name -'(' Punctuation -'print_shell_escaped' Name -',' Punctuation -' ' Text -'cmd' Name -',' Punctuation -' ' Text -'args' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation -'\n' Text - -'\n' Text - -'## interface to parser ##' Comment -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'parse' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'pos' Name -',' Punctuation -' ' Text -'greedy' Name -')' Punctuation -'\n' Text - -' ' Text -'# returns (expr, end_pos). expr is () in case of parse error.' Comment -'\n' Text - -' ' Text -'ex' Name -',' Punctuation -' ' Text -'pos' Name -' ' Text -'=' Operator -' ' Text -'ccall' Keyword -'(' Punctuation -':' Operator -'jl_parse_string' Name -',' Punctuation -' ' Text -'Any' Keyword.Type -',' Punctuation -'\n' Text - -' ' Text -'(' Punctuation -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -',' Punctuation -' ' Text -'Int32' Keyword.Type -',' Punctuation -' ' Text -'Int32' Keyword.Type -')' Punctuation -',' Punctuation -'\n' Text - -' ' Text -'cstring' Name -'(' Punctuation -'s' Name -')' Punctuation -',' Punctuation -' ' Text -'pos' Name -'-' Operator -'1' Literal.Number.Integer -',' Punctuation -' ' Text -'greedy' Name -' ' Text -'?' Operator -' ' Text -'1' Literal.Number.Integer -':' Operator -'0' Literal.Number.Integer -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'isa' Keyword.Pseudo -'(' Punctuation -'ex' Name -',' Punctuation -'Expr' Keyword.Type -')' Punctuation -' ' Text -'&&' Operator -' ' Text -'is' Name -'(' Punctuation -'ex' Name -'.' Operator -'head' Name -',' Punctuation -':' Operator -'error' Name -')' Punctuation -'\n' Text - -' ' Text -'throw' Name -'(' Punctuation -'ParseError' Keyword.Type -'(' Punctuation -'ex' Name -'.' Operator -'args' Name -'[' Punctuation -'1' Literal.Number.Integer -']' Punctuation -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'ex' Name -' ' Text -'==' Operator -' ' Text -'(' Punctuation -')' Punctuation -';' Punctuation -' ' Text -'throw' Name -'(' Punctuation -'ParseError' Keyword.Type -'(' Punctuation -'"' Literal.String -'e' Literal.String -'n' Literal.String -'d' Literal.String -' ' Literal.String -'o' Literal.String -'f' Literal.String -' ' Literal.String -'i' Literal.String -'n' Literal.String -'p' Literal.String -'u' Literal.String -'t' Literal.String -'"' Literal.String -')' Punctuation -')' Punctuation -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'ex' Name -',' Punctuation -' ' Text -'pos' Name -'+' Operator -'1' Literal.Number.Integer -' ' Text -'# C is zero-based, Julia is 1-based' Comment -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'parse' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'parse' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'1' Literal.Number.Integer -',' Punctuation -' ' Text -'true' Keyword.Constant -')' Punctuation -'\n' Text - -'parse' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'pos' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'parse' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'pos' Name -',' Punctuation -' ' Text -'true' Keyword.Constant -')' Punctuation -'\n' Text - -'parseatom' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'parse' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'1' Literal.Number.Integer -',' Punctuation -' ' Text -'false' Keyword.Constant -')' Punctuation -'\n' Text - -'parseatom' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'pos' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'parse' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'pos' Name -',' Punctuation -' ' Text -'false' Keyword.Constant -')' Punctuation -'\n' Text - -'\n' Text - -'## miscellaneous string functions ##' Comment -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'lpad' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'n' Name -'::' Operator -'Integer' Keyword.Type -',' Punctuation -' ' Text -'p' Name -'::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'m' Name -' ' Text -'=' Operator -' ' Text -'n' Name -' ' Text -'-' Operator -' ' Text -'strlen' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'m' Name -' ' Text -'<=' Operator -' ' Text -'0' Literal.Number.Integer -';' Punctuation -' ' Text -'return' Keyword -' ' Text -'s' Name -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'l' Name -' ' Text -'=' Operator -' ' Text -'strlen' Name -'(' Punctuation -'p' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'l' Name -'==' Operator -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'return' Keyword -' ' Text -'p' Name -'^' Operator -'m' Name -' ' Text -'*' Operator -' ' Text -'s' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'q' Name -' ' Text -'=' Operator -' ' Text -'div' Name -'(' Punctuation -'m' Name -',' Punctuation -'l' Name -')' Punctuation -'\n' Text - -' ' Text -'r' Name -' ' Text -'=' Operator -' ' Text -'m' Name -' ' Text -'-' Operator -' ' Text -'q' Name -'*' Operator -'l' Name -'\n' Text - -' ' Text -'cstring' Name -'(' Punctuation -'p' Name -'^' Operator -'q' Name -'*' Operator -'p' Name -'[' Punctuation -'1' Literal.Number.Integer -':' Operator -'chr2ind' Name -'(' Punctuation -'p' Name -',' Punctuation -'r' Name -')' Punctuation -']' Punctuation -'*' Operator -'s' Name -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'rpad' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'n' Name -'::' Operator -'Integer' Keyword.Type -',' Punctuation -' ' Text -'p' Name -'::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'m' Name -' ' Text -'=' Operator -' ' Text -'n' Name -' ' Text -'-' Operator -' ' Text -'strlen' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'m' Name -' ' Text -'<=' Operator -' ' Text -'0' Literal.Number.Integer -';' Punctuation -' ' Text -'return' Keyword -' ' Text -'s' Name -';' Punctuation -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'l' Name -' ' Text -'=' Operator -' ' Text -'strlen' Name -'(' Punctuation -'p' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'l' Name -'==' Operator -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'return' Keyword -' ' Text -'s' Name -' ' Text -'*' Operator -' ' Text -'p' Name -'^' Operator -'m' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'q' Name -' ' Text -'=' Operator -' ' Text -'div' Name -'(' Punctuation -'m' Name -',' Punctuation -'l' Name -')' Punctuation -'\n' Text - -' ' Text -'r' Name -' ' Text -'=' Operator -' ' Text -'m' Name -' ' Text -'-' Operator -' ' Text -'q' Name -'*' Operator -'l' Name -'\n' Text - -' ' Text -'cstring' Name -'(' Punctuation -'s' Name -'*' Operator -'p' Name -'^' Operator -'q' Name -'*' Operator -'p' Name -'[' Punctuation -'1' Literal.Number.Integer -':' Operator -'chr2ind' Name -'(' Punctuation -'p' Name -',' Punctuation -'r' Name -')' Punctuation -']' Punctuation -')' Punctuation -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'lpad' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'n' Name -'::' Operator -'Integer' Keyword.Type -',' Punctuation -' ' Text -'p' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'lpad' Name -'(' Punctuation -'string' Name -'(' Punctuation -'s' Name -')' Punctuation -',' Punctuation -' ' Text -'n' Name -',' Punctuation -' ' Text -'string' Name -'(' Punctuation -'p' Name -')' Punctuation -')' Punctuation -'\n' Text - -'rpad' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'n' Name -'::' Operator -'Integer' Keyword.Type -',' Punctuation -' ' Text -'p' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'rpad' Name -'(' Punctuation -'string' Name -'(' Punctuation -'s' Name -')' Punctuation -',' Punctuation -' ' Text -'n' Name -',' Punctuation -' ' Text -'string' Name -'(' Punctuation -'p' Name -')' Punctuation -')' Punctuation -'\n' Text - -'\n' Text - -'lpad' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'n' Name -'::' Operator -'Integer' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'lpad' Name -'(' Punctuation -'string' Name -'(' Punctuation -'s' Name -')' Punctuation -',' Punctuation -' ' Text -'n' Name -',' Punctuation -' ' Text -'"' Literal.String -' ' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -'rpad' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'n' Name -'::' Operator -'Integer' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'rpad' Name -'(' Punctuation -'string' Name -'(' Punctuation -'s' Name -')' Punctuation -',' Punctuation -' ' Text -'n' Name -',' Punctuation -' ' Text -'"' Literal.String -' ' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -'\n' Text - -'function' Keyword -' ' Text -'split' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'delims' Name -',' Punctuation -' ' Text -'include_empty' Name -'::' Operator -'Bool' Keyword.Type -')' Punctuation -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'strs' Name -' ' Text -'=' Operator -' ' Text -'String' Name -'[' Punctuation -']' Punctuation -'\n' Text - -' ' Text -'len' Name -' ' Text -'=' Operator -' ' Text -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'true' Keyword.Constant -'\n' Text - -' ' Text -'tokstart' Name -' ' Text -'=' Operator -' ' Text -'tokend' Name -' ' Text -'=' Operator -' ' Text -'i' Name -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'(' Punctuation -'c' Name -',' Punctuation -'i' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'next' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'contains' Name -'(' Punctuation -'delims' Name -',' Punctuation -' ' Text -'c' Name -')' Punctuation -'\n' Text - -' ' Text -'break' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'tokend' Name -' ' Text -'=' Operator -' ' Text 'i' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'tok' Name ' ' Text -'=' Operator +'+=' Operator ' ' Text -'s' Name -'[' Punctuation -'tokstart' Name -':' Operator -'(' Punctuation -'tokend' Name -'-' Operator '1' Literal.Number.Integer ')' Punctuation -']' Punctuation -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'include_empty' Name -' ' Text -'||' Operator -' ' Text -'!' Operator -'isempty' Name -'(' Punctuation -'tok' Name -')' Punctuation -'\n' Text - -' ' Text -'push' Name -'(' Punctuation -'strs' Name -',' Punctuation -' ' Text -'tok' Name -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword -' ' Text -'!' Operator -'(' Punctuation -'(' Punctuation -'i' Name -' ' Text -'<=' Operator -' ' Text -'len' Name -')' Punctuation ' ' Text -'||' Operator +'>' Operator ' ' Text -'(' Punctuation -'i' Name -'==' Operator -'len' Name -'+' Operator -'1' Literal.Number.Integer +'n' Name ' ' Text '&&' Operator ' ' Text -'tokend!' Name -'=' Operator +'return' Keyword +' ' Text 'i' Name -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'break' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'end' Keyword '\n' Text ' ' Text -'strs' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'split' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'split' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'(' Punctuation -"' '" Literal.String.Char -',' Punctuation -"'\\t'" Literal.String.Char -',' Punctuation -"'\\n'" Literal.String.Char -',' Punctuation -"'\\v'" Literal.String.Char -',' Punctuation -"'\\f'" Literal.String.Char -',' Punctuation -"'\\r'" Literal.String.Char -')' Punctuation -',' Punctuation -' ' Text -'false' Keyword.Constant -')' Punctuation -'\n' Text - -'split' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'x' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'split' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'x' Name -',' Punctuation -' ' Text -'true' Keyword.Constant -')' Punctuation -'\n' Text - -'split' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -',' Punctuation -' ' Text -'x' Name -'::' Operator -'Char' Keyword.Type -',' Punctuation +'@inbounds' Name.Decorator ' ' Text -'incl' Name -'::' Operator -'Bool' Keyword.Type -')' Punctuation +'b' Name ' ' Text '=' Operator -' ' Text -'split' Name -'(' Punctuation -'s' Name -',' Punctuation -' ' Text -'(' Punctuation -'x' Name -',' Punctuation -')' Punctuation +' ' Text +'codeunit' Name +'(' Punctuation +'s' Name ',' Punctuation ' ' Text -'incl' Name +'i' Name ')' Punctuation '\n' Text -'\n' Text - -'function' Keyword +' ' Text +'b' Name ' ' Text -'print_joined' Name -'(' Punctuation -'strings' Name -',' Punctuation +'&' Operator ' ' Text -'delim' Name -',' Punctuation +'0xc0' Literal.Number.Hex ' ' Text -'last' Name -')' Punctuation +'≠' Operator +' ' Text +'0x80' Literal.Number.Hex +' ' Text +'&&' Operator +' ' Text +'return' Keyword +' ' Text +'i' Name '\n' Text ' ' Text +'(' Punctuation +'(' Punctuation 'i' Name ' ' Text -'=' Operator +'+=' Operator ' ' Text -'start' Name -'(' Punctuation -'strings' Name +'1' Literal.Number.Integer ')' Punctuation -'\n' Text - -' ' Text -'if' Keyword ' ' Text -'done' Name +'>' Operator +' ' Text +'n' Name +')' Punctuation +' ' Text +'|' Operator +' ' Text '(' Punctuation -'strings' Name -',' Punctuation -'i' Name +'l' Name +' ' Text +'<' Operator +' ' Text +'0xe0' Literal.Number.Hex ')' Punctuation -'\n' Text - -' ' Text +' ' Text +'&&' Operator +' ' Text 'return' Keyword +' ' Text +'i' Name '\n' Text ' ' Text -'end' Keyword +'# second continuation byte' Comment '\n' Text ' ' Text -'str' Name -',' Punctuation +'@inbounds' Name.Decorator ' ' Text -'i' Name +'b' Name ' ' Text '=' Operator ' ' Text -'next' Name +'codeunit' Name '(' Punctuation -'strings' Name +'s' Name ',' Punctuation +' ' Text 'i' Name ')' Punctuation '\n' Text ' ' Text -'print' Name -'(' Punctuation -'str' Name -')' Punctuation -'\n' Text - -' ' Text -'while' Keyword +'b' Name ' ' Text -'!' Operator -'done' Name -'(' Punctuation -'strings' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'str' Name -',' Punctuation +'&' Operator ' ' Text -'i' Name +'0xc0' Literal.Number.Hex ' ' Text -'=' Operator +'≠' Operator +' ' Text +'0x80' Literal.Number.Hex +' ' Text +'&&' Operator +' ' Text +'return' Keyword ' ' Text -'next' Name -'(' Punctuation -'strings' Name -',' Punctuation 'i' Name -')' Punctuation '\n' Text -' ' Text -'print' Name +' ' Text '(' Punctuation -'done' Name '(' Punctuation -'strings' Name -',' Punctuation 'i' Name -')' Punctuation ' ' Text -'?' Operator +'+=' Operator ' ' Text -'last' Name +'1' Literal.Number.Integer +')' Punctuation ' ' Text -':' Operator +'>' Operator ' ' Text -'delim' Name -')' Punctuation -'\n' Text - -' ' Text -'print' Name -'(' Punctuation -'str' Name +'n' Name ')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'function' Keyword ' ' Text -'print_joined' Name +'|' Operator +' ' Text '(' Punctuation -'strings' Name -',' Punctuation +'l' Name +' ' Text +'<' Operator ' ' Text -'delim' Name +'0xf0' Literal.Number.Hex ')' Punctuation -'\n' Text - -' ' Text -'i' Name ' ' Text -'=' Operator +'&&' Operator ' ' Text -'start' Name -'(' Punctuation -'strings' Name -')' Punctuation +'return' Keyword +' ' Text +'i' Name '\n' Text ' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name -'(' Punctuation -'strings' Name -',' Punctuation -'i' Name -')' Punctuation +'# third continuation byte' Comment '\n' Text -' ' Text -'str' Name -',' Punctuation +' ' Text +'@inbounds' Name.Decorator ' ' Text -'i' Name +'b' Name ' ' Text '=' Operator ' ' Text -'next' Name +'codeunit' Name '(' Punctuation -'strings' Name +'s' Name ',' Punctuation +' ' Text 'i' Name ')' Punctuation '\n' Text -' ' Text -'print' Name +' ' Text +'ifelse' Name '(' Punctuation -'str' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword +'b' Name ' ' Text -'!' Operator -'done' Name -'(' Punctuation -'strings' Name +'&' Operator +' ' Text +'0xc0' Literal.Number.Hex +' ' Text +'≠' Operator +' ' Text +'0x80' Literal.Number.Hex +',' Punctuation +' ' Text +'i' Name ',' Punctuation +' ' Text 'i' Name +'+' Operator +'1' Literal.Number.Integer ')' Punctuation '\n' Text -' ' Text -'print' Name -'(' Punctuation -'delim' Name -')' Punctuation +'end' Keyword '\n' Text -' ' Text -'end' Keyword '\n' Text -' ' Text -'end' Keyword +'## checking UTF-8 & ACSII validity ##' Comment '\n' Text -'end' Keyword '\n' Text -'print_joined' Name +'byte_string_classify' Name '(' Punctuation -'strings' Name +'s' Name +'::' Operator +'Union' Keyword.Type +'{' Punctuation +'String' Keyword.Type +',' Punctuation +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +'FastContiguousSubArray' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +'}' Punctuation +'}' Punctuation ')' Punctuation ' ' Text '=' Operator -' ' Text -'print_joined' Name -'(' Punctuation -'strings' Name -',' Punctuation -' ' Text -'"' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - '\n' Text -'join' Name +' ' Text +'ccall' Keyword '(' Punctuation -'args' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation +':u8_isvalid' Literal.String.Symbol +',' Punctuation ' ' Text -'=' Operator +'Int32' Keyword.Type +',' Punctuation ' ' Text -'print_to_string' Name '(' Punctuation -'print_joined' Name +'Ptr' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation ',' Punctuation ' ' Text -'args' Name -'.' Operator -'.' Operator -'.' Operator +'Int' Keyword.Type +')' Punctuation +',' Punctuation +' ' Text +'s' Name +',' Punctuation +' ' Text +'sizeof' Name +'(' Punctuation +'s' Name ')' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'# 0: neither valid ASCII nor UTF-8' Comment +'\n' Text + +' ' Text +'# 1: valid ASCII' Comment +'\n' Text + +' ' Text +'# 2: valid UTF-8' Comment '\n' Text '\n' Text -'chop' Name +'isvalid' Name '(' Punctuation +'::' Operator +'Type' Keyword.Type +'{' Punctuation +'String' Keyword.Type +'}' Punctuation +',' Punctuation +' ' Text 's' Name '::' Operator -'String' Name +'Union' Keyword.Type +'{' Punctuation +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +',' Punctuation +'FastContiguousSubArray' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +',' Punctuation +'1' Literal.Number.Integer +',' Punctuation +'Vector' Keyword.Type +'{' Punctuation +'UInt8' Keyword.Type +'}' Punctuation +'}' Punctuation +',' Punctuation +'String' Keyword.Type +'}' Punctuation ')' Punctuation ' ' Text '=' Operator ' ' Text -'s' Name -'[' Punctuation -'1' Literal.Number.Integer -':' Operator -'thisind' Name -'(' Punctuation -'s' Name -',' Punctuation -'length' Name +'byte_string_classify' Name '(' Punctuation 's' Name ')' Punctuation -')' Punctuation -'-' Operator -'1' Literal.Number.Integer -']' Punctuation +' ' Text +'≠' Operator +' ' Text +'0' Literal.Number.Integer '\n' Text -'chomp' Name +'isvalid' Name '(' Punctuation 's' Name '::' Operator -'String' Name +'String' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text +'isvalid' Name '(' Punctuation -'i' Name -'=' Operator -'thisind' Name -'(' Punctuation -'s' Name +'String' Keyword.Type ',' Punctuation -'length' Name -'(' Punctuation -'s' Name -')' Punctuation -')' Punctuation -';' Punctuation -' ' Text -'s' Name -'[' Punctuation -'i' Name -']' Punctuation -'==' Operator -"'\\n'" Literal.String.Char -' ' Text -'?' Operator -' ' Text -'s' Name -'[' Punctuation -'1' Literal.Number.Integer -':' Operator -'i' Name -'-' Operator -'1' Literal.Number.Integer -']' Punctuation -' ' Text -':' Operator ' ' Text 's' Name ')' Punctuation '\n' Text -'chomp' Name +'\n' Text + +'is_valid_continuation' Name '(' Punctuation -'s' Name -'::' Operator -'ByteString' Name +'c' Name ')' Punctuation ' ' Text '=' Operator ' ' Text -'s' Name -'.' Operator -'data' Name -'[' Punctuation -'end' Keyword -']' Punctuation -'==' Operator -'0x0a' Literal.Number.Hex +'c' Name ' ' Text -'?' Operator +'&' Operator ' ' Text -'s' Name -'[' Punctuation -'1' Literal.Number.Integer -':' Operator -'end' Keyword -'-' Operator -'1' Literal.Number.Integer -']' Punctuation +'0xc0' Literal.Number.Hex ' ' Text -':' Operator +'==' Operator ' ' Text -'s' Name +'0x80' Literal.Number.Hex +'\n' Text + '\n' Text +'## required core functionality ##' Comment '\n' Text +'\n' Text + +'@inline' Name.Decorator +' ' Text 'function' Keyword ' ' Text -'lstrip' Name +'iterate' Name '(' Punctuation 's' Name '::' Operator -'String' Name -')' Punctuation -'\n' Text - -' ' Text -'i' Name +'String' Keyword.Type +',' Punctuation ' ' Text +'i' Name +'::' Operator +'Int' Keyword.Type '=' Operator -' ' Text -'start' Name +'firstindex' Name '(' Punctuation 's' Name ')' Punctuation +')' Punctuation '\n' Text ' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name '(' Punctuation -'s' Name -',' Punctuation 'i' Name +' ' Text +'%' Operator +' ' Text +'UInt' Keyword.Type ')' Punctuation -'\n' Text - -' ' Text -'c' Name -',' Punctuation ' ' Text -'j' Name +'-' Operator ' ' Text -'=' Operator +'1' Literal.Number.Integer +' ' Text +'<' Operator ' ' Text -'next' Name +'ncodeunits' Name '(' Punctuation 's' Name -',' Punctuation -'i' Name ')' Punctuation -'\n' Text - -' ' Text -'if' Keyword ' ' Text -'!' Operator -'iswspace' Name -'(' Punctuation -'c' Name -')' Punctuation -'\n' Text - -' ' Text +'||' Operator +' ' Text 'return' Keyword ' ' Text -'s' Name -'[' Punctuation -'i' Name -':' Operator -'end' Keyword -']' Punctuation +'nothing' Name.Builtin '\n' Text -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'i' Name +' ' Text +'b' Name ' ' Text '=' Operator ' ' Text -'j' Name -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'"' Literal.String -'"' Literal.String -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'function' Keyword +'@inbounds' Name.Decorator ' ' Text -'rstrip' Name +'codeunit' Name '(' Punctuation 's' Name -'::' Operator -'String' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation '\n' Text ' ' Text -'r' Name +'u' Name ' ' Text '=' Operator ' ' Text -'reverse' Name +'UInt32' Keyword.Type '(' Punctuation -'s' Name +'b' Name ')' Punctuation -'\n' Text - -' ' Text -'i' Name ' ' Text -'=' Operator +'<<' Operator ' ' Text -'start' Name -'(' Punctuation -'r' Name -')' Punctuation +'24' Literal.Number.Integer '\n' Text ' ' Text -'while' Keyword -' ' Text -'!' Operator -'done' Name +'between' Name '(' Punctuation -'r' Name +'b' Name ',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'c' Name +' ' Text +'0x80' Literal.Number.Hex ',' Punctuation ' ' Text -'j' Name +'0xf7' Literal.Number.Hex +')' Punctuation ' ' Text -'=' Operator +'||' Operator +' ' Text +'return' Keyword ' ' Text -'next' Name +'reinterpret' Name '(' Punctuation -'r' Name +'Char' Keyword.Type ',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'if' Keyword ' ' Text -'!' Operator -'iswspace' Name -'(' Punctuation -'c' Name +'u' Name ')' Punctuation -'\n' Text - -' ' Text -'return' Keyword +',' Punctuation ' ' Text -'s' Name -'[' Punctuation -'1' Literal.Number.Integer -':' Operator -'end' Keyword -'-' Operator 'i' Name '+' Operator '1' Literal.Number.Integer -']' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator -' ' Text -'j' Name -'\n' Text - -' ' Text -'end' Keyword '\n' Text ' ' Text -'"' Literal.String -'"' Literal.String -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'strip' Name +'return' Keyword +' ' Text +'iterate_continued' Name '(' Punctuation 's' Name -'::' Operator -'String' Name -')' Punctuation +',' Punctuation ' ' Text -'=' Operator +'i' Name +',' Punctuation ' ' Text -'lstrip' Name -'(' Punctuation -'rstrip' Name -'(' Punctuation -'s' Name -')' Punctuation +'u' Name ')' Punctuation '\n' Text -'\n' Text - -'## string to integer functions ##' Comment +'end' Keyword '\n' Text '\n' Text 'function' Keyword ' ' Text -'parse_int' Name -'{' Punctuation -'T' Name -'<:' Operator -'Integer' Keyword.Type -'}' Punctuation +'iterate_continued' Name '(' Punctuation +'s' Name '::' Operator -'Type' Keyword.Type -'{' Punctuation -'T' Name -'}' Punctuation +'String' Keyword.Type ',' Punctuation ' ' Text -'s' Name +'i' Name '::' Operator -'String' Name +'Int' Keyword.Type ',' Punctuation ' ' Text -'base' Name +'u' Name '::' Operator -'Integer' Keyword.Type +'UInt32' Keyword.Type ')' Punctuation '\n' Text ' ' Text -'if' Keyword +'u' Name ' ' Text -'!' Operator -'(' Punctuation -'2' Literal.Number.Integer +'<' Operator ' ' Text -'<=' Operator +'0xc0000000' Literal.Number.Hex ' ' Text -'base' Name +'&&' Operator ' ' Text -'<=' Operator +'(' Punctuation +'i' Name ' ' Text -'36' Literal.Number.Integer -')' Punctuation -';' Punctuation +'+=' Operator ' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'i' Literal.String -'n' Literal.String -'v' Literal.String -'a' Literal.String -'l' Literal.String -'i' Literal.String -'d' Literal.String -' ' Literal.String -'b' Literal.String -'a' Literal.String -'s' Literal.String -'e' Literal.String -':' Literal.String -' ' Literal.String -'"' Literal.String -',' Punctuation -'base' Name -')' Punctuation +'1' Literal.Number.Integer ';' Punctuation ' ' Text -'end' Keyword -'\n' Text - -' ' Text -'i' Name -' ' Text -'=' Operator +'@goto' Name.Decorator ' ' Text -'start' Name -'(' Punctuation -'s' Name +'ret' Name ')' Punctuation '\n' Text ' ' Text -'if' Keyword +'n' Name ' ' Text -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'p' Literal.String -'r' Literal.String -'e' Literal.String -'m' Literal.String -'a' Literal.String -'t' Literal.String -'u' Literal.String -'r' Literal.String -'e' Literal.String -' ' Literal.String -'e' Literal.String -'n' Literal.String -'d' Literal.String -' ' Literal.String -'o' Literal.String -'f' Literal.String -' ' Literal.String -'i' Literal.String -'n' Literal.String -'t' Literal.String -'e' Literal.String -'g' Literal.String -'e' Literal.String -'r' Literal.String -' ' Literal.String -'(' Literal.String -'i' Literal.String -'n' Literal.String -' ' Literal.String -'"' Literal.String -',' Punctuation -'show_to_string' Name +'=' Operator +' ' Text +'ncodeunits' Name '(' Punctuation 's' Name ')' Punctuation -',' Punctuation -'"' Literal.String -')' Literal.String -'"' Literal.String -')' Punctuation '\n' Text ' ' Text -'end' Keyword +'# first continuation byte' Comment '\n' Text ' ' Text -'c' Name -',' Punctuation -'i' Name -' ' Text -'=' Operator -' ' Text -'next' Name '(' Punctuation -'s' Name -',' Punctuation 'i' Name -')' Punctuation -'\n' Text - -' ' Text -'sgn' Name ' ' Text -'=' Operator +'+=' Operator ' ' Text -'one' Name -'(' Punctuation -'T' Name +'1' Literal.Number.Integer ')' Punctuation -'\n' Text - -' ' Text -'if' Keyword ' ' Text -'T' Name -' ' Text -'<:' Operator +'>' Operator ' ' Text -'Signed' Keyword.Type +'n' Name ' ' Text '&&' Operator ' ' Text -'c' Name -' ' Text -'==' Operator -' ' Text -"'-'" Literal.String.Char -'\n' Text - -' ' Text -'sgn' Name -' ' Text -'=' Operator +'@goto' Name.Decorator ' ' Text -'-' Operator -'sgn' Name +'ret' Name '\n' Text -' ' Text -'if' Keyword +' ' Text +'@inbounds' Name.Decorator ' ' Text -'done' Name -'(' Punctuation -'s' Name -',' Punctuation -'i' Name -')' Punctuation -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'"' Literal.String -'p' Literal.String -'r' Literal.String -'e' Literal.String -'m' Literal.String -'a' Literal.String -'t' Literal.String -'u' Literal.String -'r' Literal.String -'e' Literal.String -' ' Literal.String -'e' Literal.String -'n' Literal.String -'d' Literal.String -' ' Literal.String -'o' Literal.String -'f' Literal.String -' ' Literal.String -'i' Literal.String -'n' Literal.String -'t' Literal.String -'e' Literal.String -'g' Literal.String -'e' Literal.String -'r' Literal.String -' ' Literal.String -'(' Literal.String -'i' Literal.String -'n' Literal.String -' ' Literal.String -'"' Literal.String -',' Punctuation -'show_to_string' Name -'(' Punctuation -'s' Name -')' Punctuation -',' Punctuation -'"' Literal.String -')' Literal.String -'"' Literal.String -')' Punctuation -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'c' Name -',' Punctuation -'i' Name +'b' Name ' ' Text '=' Operator ' ' Text -'next' Name +'codeunit' Name '(' Punctuation 's' Name ',' Punctuation +' ' Text 'i' Name ')' Punctuation '\n' Text ' ' Text -'end' Keyword +'b' Name +' ' Text +'&' Operator +' ' Text +'0xc0' Literal.Number.Hex +' ' Text +'==' Operator +' ' Text +'0x80' Literal.Number.Hex +' ' Text +'||' Operator +' ' Text +'@goto' Name.Decorator +' ' Text +'ret' Name '\n' Text ' ' Text -'base' Name +'u' Name ' ' Text -'=' Operator +'|=' Operator ' ' Text -'convert' Name +'UInt32' Keyword.Type '(' Punctuation -'T' Name -',' Punctuation -'base' Name +'b' Name ')' Punctuation -'\n' Text - -' ' Text -'n' Name -'::' Operator -'T' Name ' ' Text -'=' Operator +'<<' Operator ' ' Text -'0' Literal.Number.Integer +'16' Literal.Number.Integer '\n' Text ' ' Text -'while' Keyword -' ' Text -'true' Keyword.Constant +'# second continuation byte' Comment '\n' Text -' ' Text -'d' Name -' ' Text -'=' Operator +' ' Text +'(' Punctuation +'(' Punctuation +'i' Name ' ' Text -"'0'" Literal.String.Char +'+=' Operator ' ' Text -'<=' Operator +'1' Literal.Number.Integer +')' Punctuation ' ' Text -'c' Name +'>' Operator ' ' Text -'<=' Operator +'n' Name +')' Punctuation ' ' Text -"'9'" Literal.String.Char +'|' Operator ' ' Text -'?' Operator +'(' Punctuation +'u' Name ' ' Text -'c' Name -'-' Operator -"'0'" Literal.String.Char +'<' Operator ' ' Text -':' Operator -'\n' Text - -' ' Text -"'A'" Literal.String.Char +'0xe0000000' Literal.Number.Hex +')' Punctuation ' ' Text -'<=' Operator +'&&' Operator ' ' Text -'c' Name +'@goto' Name.Decorator ' ' Text -'<=' Operator +'ret' Name +'\n' Text + +' ' Text +'@inbounds' Name.Decorator ' ' Text -"'Z'" Literal.String.Char +'b' Name ' ' Text -'?' Operator +'=' Operator ' ' Text -'c' Name -'-' Operator -"'A'" Literal.String.Char -'+' Operator -'10' Literal.Number.Integer +'codeunit' Name +'(' Punctuation +'s' Name +',' Punctuation ' ' Text -':' Operator +'i' Name +')' Punctuation '\n' Text -' ' Text -"'a'" Literal.String.Char -' ' Text -'<=' Operator +' ' Text +'b' Name ' ' Text -'c' Name +'&' Operator ' ' Text -'<=' Operator +'0xc0' Literal.Number.Hex ' ' Text -"'z'" Literal.String.Char +'==' Operator ' ' Text -'?' Operator +'0x80' Literal.Number.Hex ' ' Text -'c' Name -'-' Operator -"'a'" Literal.String.Char -'+' Operator -'10' Literal.Number.Integer +'||' Operator ' ' Text -':' Operator +'@goto' Name.Decorator ' ' Text -'typemax' Name -'(' Punctuation -'Int' Keyword.Type -')' Punctuation +'ret' Name '\n' Text -' ' Text -'if' Keyword -' ' Text -'d' Name +' ' Text +'u' Name ' ' Text -'>=' Operator +'|=' Operator ' ' Text -'base' Name -'\n' Text - -' ' Text -'error' Name -'(' Punctuation -'show_to_string' Name -'(' Punctuation -'c' Name -')' Punctuation -',' Punctuation -'"' Literal.String -' ' Literal.String -'i' Literal.String -'s' Literal.String -' ' Literal.String -'n' Literal.String -'o' Literal.String -'t' Literal.String -' ' Literal.String -'a' Literal.String -' ' Literal.String -'v' Literal.String -'a' Literal.String -'l' Literal.String -'i' Literal.String -'d' Literal.String -' ' Literal.String -'d' Literal.String -'i' Literal.String -'g' Literal.String -'i' Literal.String -'t' Literal.String -' ' Literal.String -'(' Literal.String -'i' Literal.String -'n' Literal.String -' ' Literal.String -'"' Literal.String -',' Punctuation -'show_to_string' Name +'UInt32' Keyword.Type '(' Punctuation -'s' Name -')' Punctuation -',' Punctuation -'"' Literal.String -')' Literal.String -'"' Literal.String +'b' Name ')' Punctuation +' ' Text +'<<' Operator +' ' Text +'8' Literal.Number.Integer '\n' Text -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'# TODO: overflow detection?' Comment +' ' Text +'# third continuation byte' Comment '\n' Text -' ' Text -'n' Name +' ' Text +'(' Punctuation +'(' Punctuation +'i' Name ' ' Text -'=' Operator +'+=' Operator +' ' Text +'1' Literal.Number.Integer +')' Punctuation +' ' Text +'>' Operator ' ' Text 'n' Name -'*' Operator -'base' Name +')' Punctuation ' ' Text -'+' Operator +'|' Operator +' ' Text +'(' Punctuation +'u' Name +' ' Text +'<' Operator +' ' Text +'0xf0000000' Literal.Number.Hex +')' Punctuation +' ' Text +'&&' Operator +' ' Text +'@goto' Name.Decorator ' ' Text -'d' Name +'ret' Name '\n' Text -' ' Text -'if' Keyword +' ' Text +'@inbounds' Name.Decorator +' ' Text +'b' Name +' ' Text +'=' Operator ' ' Text -'done' Name +'codeunit' Name '(' Punctuation 's' Name ',' Punctuation +' ' Text 'i' Name ')' Punctuation '\n' Text -' ' Text -'break' Keyword -'\n' Text - -' ' Text -'end' Keyword +' ' Text +'b' Name +' ' Text +'&' Operator +' ' Text +'0xc0' Literal.Number.Hex +' ' Text +'==' Operator +' ' Text +'0x80' Literal.Number.Hex +' ' Text +'||' Operator +' ' Text +'@goto' Name.Decorator +' ' Text +'ret' Name '\n' Text -' ' Text -'c' Name -',' Punctuation -'i' Name +' ' Text +'u' Name ' ' Text -'=' Operator +'|=' Operator ' ' Text -'next' Name +'UInt32' Keyword.Type '(' Punctuation -'s' Name -',' Punctuation -'i' Name +'b' Name ')' Punctuation +';' Punctuation +' ' Text +'i' Name +' ' Text +'+=' Operator +' ' Text +'1' Literal.Number.Integer '\n' Text -' ' Text -'end' Keyword +'@label' Name.Decorator +' ' Text +'ret' Name '\n' Text ' ' Text 'return' Keyword ' ' Text -'flipsign' Name +'reinterpret' Name '(' Punctuation -'n' Name +'Char' Keyword.Type ',' Punctuation -'sgn' Name +' ' Text +'u' Name ')' Punctuation +',' Punctuation +' ' Text +'i' Name '\n' Text 'end' Keyword @@ -10491,1022 +2650,874 @@ '\n' Text -'parse_int' Name +'@propagate_inbounds' Name.Decorator +' ' Text +'function' Keyword +' ' Text +'getindex' Name '(' Punctuation 's' Name '::' Operator -'String' Name +'String' Keyword.Type ',' Punctuation ' ' Text -'base' Name +'i' Name '::' Operator -'Integer' Keyword.Type -')' Punctuation -' ' Text -'=' Operator -' ' Text -'parse_int' Name -'(' Punctuation 'Int' Keyword.Type -',' Punctuation -'s' Name -',' Punctuation -'base' Name ')' Punctuation '\n' Text -'parse_int' Name -'(' Punctuation -'T' Name -'::' Operator -'Type' Keyword.Type -',' Punctuation +' ' Text +'b' Name ' ' Text -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text '=' Operator ' ' Text -'parse_int' Name +'codeunit' Name '(' Punctuation -'T' Name -',' Punctuation 's' Name ',' Punctuation -'10' Literal.Number.Integer -')' Punctuation -'\n' Text - -'parse_int' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator ' ' Text -'parse_int' Name -'(' Punctuation -'Int' Keyword.Type -',' Punctuation -'s' Name -',' Punctuation -'10' Literal.Number.Integer +'i' Name ')' Punctuation '\n' Text -'\n' Text - -'parse_bin' Name -'(' Punctuation -'T' Name -'::' Operator -'Type' Keyword.Type -',' Punctuation -' ' Text -'s' Name -'::' Operator -'String' Name -')' Punctuation +' ' Text +'u' Name ' ' Text '=' Operator ' ' Text -'parse_int' Name +'UInt32' Keyword.Type '(' Punctuation -'T' Name -',' Punctuation -'s' Name -',' Punctuation -'2' Literal.Number.Integer +'b' Name ')' Punctuation +' ' Text +'<<' Operator +' ' Text +'24' Literal.Number.Integer '\n' Text -'parse_oct' Name +' ' Text +'between' Name '(' Punctuation -'T' Name -'::' Operator -'Type' Keyword.Type +'b' Name ',' Punctuation ' ' Text -'s' Name -'::' Operator -'String' Name +'0x80' Literal.Number.Hex +',' Punctuation +' ' Text +'0xf7' Literal.Number.Hex ')' Punctuation ' ' Text -'=' Operator +'||' Operator +' ' Text +'return' Keyword ' ' Text -'parse_int' Name +'reinterpret' Name '(' Punctuation -'T' Name -',' Punctuation -'s' Name +'Char' Keyword.Type ',' Punctuation -'8' Literal.Number.Integer +' ' Text +'u' Name ')' Punctuation '\n' Text -'parse_hex' Name -'(' Punctuation -'T' Name -'::' Operator -'Type' Keyword.Type -',' Punctuation -' ' Text -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator +' ' Text +'return' Keyword ' ' Text -'parse_int' Name +'getindex_continued' Name '(' Punctuation -'T' Name -',' Punctuation 's' Name ',' Punctuation -'16' Literal.Number.Integer +' ' Text +'i' Name +',' Punctuation +' ' Text +'u' Name ')' Punctuation '\n' Text +'end' Keyword '\n' Text -'parse_bin' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'parse_int' Name -'(' Punctuation -'Int' Keyword.Type -',' Punctuation -'s' Name -',' Punctuation -'2' Literal.Number.Integer -')' Punctuation '\n' Text -'parse_oct' Name +'function' Keyword +' ' Text +'getindex_continued' Name '(' Punctuation 's' Name '::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator +'String' Keyword.Type +',' Punctuation ' ' Text -'parse_int' Name -'(' Punctuation +'i' Name +'::' Operator 'Int' Keyword.Type ',' Punctuation -'s' Name -',' Punctuation -'8' Literal.Number.Integer +' ' Text +'u' Name +'::' Operator +'UInt32' Keyword.Type ')' Punctuation '\n' Text -'parse_hex' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +' ' Text +'if' Keyword ' ' Text -'=' Operator +'u' Name ' ' Text -'parse_int' Name -'(' Punctuation -'Int' Keyword.Type -',' Punctuation -'s' Name -',' Punctuation -'16' Literal.Number.Integer -')' Punctuation +'<' Operator +' ' Text +'0xc0000000' Literal.Number.Hex '\n' Text +' ' Text +'# called from `getindex` which checks bounds' Comment '\n' Text -'integer' Name +' ' Text +'@inbounds' Name.Decorator ' ' Text +'isvalid' Name '(' Punctuation 's' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator +',' Punctuation ' ' Text -'int' Name -'(' Punctuation -'s' Name -')' Punctuation -'\n' Text - -'unsigned' Name -'(' Punctuation -'s' Name -'::' Operator -'String' Name +'i' Name ')' Punctuation ' ' Text -'=' Operator +'&&' Operator ' ' Text -'uint' Name -'(' Punctuation -'s' Name -')' Punctuation +'@goto' Name.Decorator +' ' Text +'ret' Name '\n' Text -'int' Name -' ' Text -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation -' ' Text -'=' Operator -' ' Text -'parse_int' Name +' ' Text +'string_index_err' Name '(' Punctuation -'Int' Keyword.Type -',' Punctuation 's' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation '\n' Text -'uint' Name ' ' Text -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +'end' Keyword +'\n' Text + +' ' Text +'n' Name ' ' Text '=' Operator ' ' Text -'parse_int' Name +'ncodeunits' Name '(' Punctuation -'Uint' Name -',' Punctuation 's' Name ')' Punctuation '\n' Text -'int8' Name +'\n' Text + ' ' Text '(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +'i' Name ' ' Text -'=' Operator +'+=' Operator ' ' Text -'parse_int' Name -'(' Punctuation -'Int8' Keyword.Type -',' Punctuation -'s' Name +'1' Literal.Number.Integer ')' Punctuation +' ' Text +'>' Operator +'\xa0' Text +'n' Name +' ' Text +'&&' Operator +' ' Text +'@goto' Name.Decorator +' ' Text +'ret' Name '\n' Text -'uint8' Name -' ' Text -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +' ' Text +'@inbounds' Name.Decorator +' ' Text +'b' Name ' ' Text '=' Operator ' ' Text -'parse_int' Name +'codeunit' Name '(' Punctuation -'Uint8' Name -',' Punctuation 's' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation +' ' Text +'# cont byte 1' Comment '\n' Text -'int16' Name -' ' Text -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +' ' Text +'b' Name ' ' Text -'=' Operator +'&' Operator ' ' Text -'parse_int' Name -'(' Punctuation -'Int16' Keyword.Type -',' Punctuation -'s' Name -')' Punctuation +'0xc0' Literal.Number.Hex +' ' Text +'==' Operator +' ' Text +'0x80' Literal.Number.Hex +' ' Text +'||' Operator +' ' Text +'@goto' Name.Decorator +' ' Text +'ret' Name '\n' Text -'uint16' Name -' ' Text -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +' ' Text +'u' Name ' ' Text -'=' Operator +'|=' Operator ' ' Text -'parse_int' Name +'UInt32' Keyword.Type '(' Punctuation -'Uint16' Name -',' Punctuation -'s' Name +'b' Name ')' Punctuation +' ' Text +'<<' Operator +' ' Text +'16' Literal.Number.Integer +'\n' Text + '\n' Text -'int32' Name -' ' Text +' ' Text '(' Punctuation -'s' Name -'::' Operator -'String' Name +'(' Punctuation +'i' Name +' ' Text +'+=' Operator +' ' Text +'1' Literal.Number.Integer ')' Punctuation ' ' Text -'=' Operator +'>' Operator +' ' Text +'n' Name +')' Punctuation +' ' Text +'|' Operator ' ' Text -'parse_int' Name '(' Punctuation -'Int32' Keyword.Type -',' Punctuation -'s' Name +'u' Name +' ' Text +'<' Operator +' ' Text +'0xe0000000' Literal.Number.Hex ')' Punctuation +' ' Text +'&&' Operator +' ' Text +'@goto' Name.Decorator +' ' Text +'ret' Name '\n' Text -'uint32' Name -' ' Text -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +' ' Text +'@inbounds' Name.Decorator +' ' Text +'b' Name ' ' Text '=' Operator ' ' Text -'parse_int' Name +'codeunit' Name '(' Punctuation -'Uint32' Name -',' Punctuation 's' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation +' ' Text +'# cont byte 2' Comment '\n' Text -'int64' Name -' ' Text -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +' ' Text +'b' Name ' ' Text -'=' Operator +'&' Operator ' ' Text -'parse_int' Name -'(' Punctuation -'Int64' Keyword.Type -',' Punctuation -'s' Name -')' Punctuation +'0xc0' Literal.Number.Hex +' ' Text +'==' Operator +' ' Text +'0x80' Literal.Number.Hex +' ' Text +'||' Operator +' ' Text +'@goto' Name.Decorator +' ' Text +'ret' Name '\n' Text -'uint64' Name -' ' Text -'(' Punctuation -'s' Name -'::' Operator -'String' Name -')' Punctuation +' ' Text +'u' Name ' ' Text -'=' Operator +'|=' Operator ' ' Text -'parse_int' Name +'UInt32' Keyword.Type '(' Punctuation -'Uint64' Name -',' Punctuation -'s' Name +'b' Name ')' Punctuation +' ' Text +'<<' Operator +' ' Text +'8' Literal.Number.Integer '\n' Text '\n' Text -'## integer to string functions ##' Comment -'\n' Text - -'\n' Text - -'const' Keyword.Declaration +' ' Text +'(' Punctuation +'(' Punctuation +'i' Name ' ' Text -'_jl_dig_syms' Name +'+=' Operator ' ' Text -'=' Operator +'1' Literal.Number.Integer +')' Punctuation ' ' Text -'"' Literal.String -'0' Literal.String -'1' Literal.String -'2' Literal.String -'3' Literal.String -'4' Literal.String -'5' Literal.String -'6' Literal.String -'7' Literal.String -'8' Literal.String -'9' Literal.String -'a' Literal.String -'b' Literal.String -'c' Literal.String -'d' Literal.String -'e' Literal.String -'f' Literal.String -'g' Literal.String -'h' Literal.String -'i' Literal.String -'j' Literal.String -'k' Literal.String -'l' Literal.String -'m' Literal.String -'n' Literal.String -'o' Literal.String -'p' Literal.String -'q' Literal.String -'r' Literal.String -'s' Literal.String -'t' Literal.String -'u' Literal.String -'v' Literal.String -'w' Literal.String -'x' Literal.String -'y' Literal.String -'z' Literal.String -'"' Literal.String -'.' Operator -'data' Name -'\n' Text - -'\n' Text - -'function' Keyword +'>' Operator ' ' Text -'int2str' Name -'(' Punctuation 'n' Name -'::' Operator -'Union' Keyword.Type +')' Punctuation +' ' Text +'|' Operator +' ' Text '(' Punctuation -'Int64' Keyword.Type -',' Punctuation -'Uint64' Name +'u' Name +' ' Text +'<' Operator +' ' Text +'0xf0000000' Literal.Number.Hex ')' Punctuation -',' Punctuation +' ' Text +'&&' Operator +' ' Text +'@goto' Name.Decorator +' ' Text +'ret' Name +'\n' Text + +' ' Text +'@inbounds' Name.Decorator ' ' Text 'b' Name -'::' Operator -'Integer' Keyword.Type +' ' Text +'=' Operator +' ' Text +'codeunit' Name +'(' Punctuation +'s' Name ',' Punctuation ' ' Text -'l' Name -'::' Operator -'Int' Keyword.Type +'i' Name ')' Punctuation +' ' Text +'# cont byte 3' Comment '\n' Text ' ' Text -'if' Keyword -' ' Text 'b' Name ' ' Text -'<' Operator +'&' Operator ' ' Text -'2' Literal.Number.Integer +'0xc0' Literal.Number.Hex +' ' Text +'==' Operator +' ' Text +'0x80' Literal.Number.Hex ' ' Text '||' Operator ' ' Text -'b' Name +'@goto' Name.Decorator ' ' Text -'>' Operator +'ret' Name +'\n' Text + +' ' Text +'u' Name ' ' Text -'36' Literal.Number.Integer -';' Punctuation +'|=' Operator ' ' Text -'error' Name +'UInt32' Keyword.Type '(' Punctuation -'"' Literal.String -'i' Literal.String -'n' Literal.String -'t' Literal.String -'2' Literal.String -'s' Literal.String -'t' Literal.String -'r' Literal.String -':' Literal.String -' ' Literal.String -'i' Literal.String -'n' Literal.String -'v' Literal.String -'a' Literal.String -'l' Literal.String -'i' Literal.String -'d' Literal.String -' ' Literal.String -'b' Literal.String -'a' Literal.String -'s' Literal.String -'e' Literal.String -' ' Literal.String -'"' Literal.String -',' Punctuation -' ' Text 'b' Name ')' Punctuation -';' Punctuation +'\n' Text + +'@label' Name.Decorator ' ' Text -'end' Keyword +'ret' Name '\n' Text ' ' Text -'neg' Name -' ' Text -'=' Operator -' ' Text -'n' Name +'return' Keyword ' ' Text -'<' Operator +'reinterpret' Name +'(' Punctuation +'Char' Keyword.Type +',' Punctuation ' ' Text -'0' Literal.Number.Integer +'u' Name +')' Punctuation '\n' Text -' ' Text -'n' Name +'end' Keyword +'\n' Text + +'\n' Text + +'getindex' Name +'(' Punctuation +'s' Name +'::' Operator +'String' Keyword.Type +',' Punctuation +' ' Text +'r' Name +'::' Operator +'UnitRange' Keyword.Type +'{' Punctuation +'<:' Operator +'Integer' Keyword.Type +'}' Punctuation +')' Punctuation ' ' Text '=' Operator ' ' Text -'unsigned' Name +'s' Name +'[' Punctuation +'Int' Keyword.Type '(' Punctuation -'abs' Name +'first' Name '(' Punctuation -'n' Name +'r' Name ')' Punctuation ')' Punctuation -'\n' Text - -' ' Text -'b' Name -' ' Text -'=' Operator -' ' Text -'convert' Name +':' Operator +'Int' Keyword.Type '(' Punctuation -'typeof' Name +'last' Name '(' Punctuation -'n' Name +'r' Name ')' Punctuation -',' Punctuation -' ' Text -'b' Name ')' Punctuation +']' Punctuation '\n' Text -' ' Text -'ndig' Name +'\n' Text + +'@inline' Name.Decorator ' ' Text -'=' Operator +'function' Keyword ' ' Text -'ndigits' Name +'getindex' Name '(' Punctuation -'n' Name +'s' Name +'::' Operator +'String' Keyword.Type ',' Punctuation ' ' Text -'b' Name +'r' Name +'::' Operator +'UnitRange' Keyword.Type +'{' Punctuation +'Int' Keyword.Type +'}' Punctuation ')' Punctuation '\n' Text ' ' Text -'sz' Name -' ' Text -'=' Operator -' ' Text -'max' Name -'(' Punctuation -'convert' Name +'isempty' Name '(' Punctuation -'Int' Keyword.Type -',' Punctuation -' ' Text -'ndig' Name +'r' Name ')' Punctuation -',' Punctuation ' ' Text -'l' Name -')' Punctuation +'&&' Operator ' ' Text -'+' Operator +'return' Keyword ' ' Text -'neg' Name +'"' Literal.String +'"' Literal.String '\n' Text ' ' Text -'data' Name +'i' Name +',' Punctuation +' ' Text +'j' Name ' ' Text '=' Operator ' ' Text -'Array' Keyword.Type +'first' Name '(' Punctuation -'Uint8' Name +'r' Name +')' Punctuation ',' Punctuation ' ' Text -'sz' Name +'last' Name +'(' Punctuation +'r' Name ')' Punctuation '\n' Text ' ' Text -'i' Name -' ' Text -'=' Operator +'@boundscheck' Name.Decorator ' ' Text -'sz' Name +'begin' Keyword '\n' Text -' ' Text -'if' Keyword -' ' Text -'ispow2' Name +' ' Text +'checkbounds' Name '(' Punctuation -'b' Name +'s' Name +',' Punctuation +' ' Text +'r' Name ')' Punctuation '\n' Text ' ' Text -'digmask' Name +'@inbounds' Name.Decorator ' ' Text -'=' Operator +'isvalid' Name +'(' Punctuation +'s' Name +',' Punctuation ' ' Text -'b' Name -'-' Operator -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'shift' Name +'i' Name +')' Punctuation ' ' Text -'=' Operator +'||' Operator ' ' Text -'trailing_zeros' Name +'string_index_err' Name '(' Punctuation -'b' Name +'s' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation '\n' Text ' ' Text -'while' Keyword -' ' Text -'i' Name +'@inbounds' Name.Decorator ' ' Text -'>' Operator -' ' Text -'neg' Name -'\n' Text - -' ' Text -'ch' Name +'isvalid' Name +'(' Punctuation +'s' Name +',' Punctuation ' ' Text -'=' Operator +'j' Name +')' Punctuation ' ' Text -'n' Name +'||' Operator ' ' Text -'&' Operator +'string_index_err' Name +'(' Punctuation +'s' Name +',' Punctuation ' ' Text -'digmask' Name +'j' Name +')' Punctuation '\n' Text -' ' Text -'data' Name -'[' Punctuation -'i' Name -']' Punctuation +' ' Text +'end' Keyword +'\n' Text + +' ' Text +'j' Name ' ' Text '=' Operator ' ' Text -'_jl_dig_syms' Name -'[' Punctuation -'int' Name +'nextind' Name '(' Punctuation -'ch' Name -')' Punctuation -'+' Operator -'1' Literal.Number.Integer -']' Punctuation -'\n' Text - -' ' Text -'n' Name -' ' Text -'>>=' Operator +'s' Name +',' Punctuation ' ' Text -'shift' Name -'\n' Text - -' ' Text -'i' Name +'j' Name +')' Punctuation ' ' Text -'-=' Operator +'-' Operator ' ' Text '1' Literal.Number.Integer '\n' Text -' ' Text -'end' Keyword -'\n' Text - ' ' Text -'else' Keyword -'\n' Text - -' ' Text -'while' Keyword -' ' Text -'i' Name -' ' Text -'>' Operator -' ' Text -'neg' Name -'\n' Text - -' ' Text -'ch' Name +'n' Name ' ' Text '=' Operator ' ' Text -'n' Name +'j' Name ' ' Text -'%' Operator +'-' Operator ' ' Text -'b' Name -'\n' Text - -' ' Text -'data' Name -'[' Punctuation 'i' Name -']' Punctuation -' ' Text -'=' Operator ' ' Text -'_jl_dig_syms' Name -'[' Punctuation -'int' Name -'(' Punctuation -'ch' Name -')' Punctuation '+' Operator +' ' Text '1' Literal.Number.Integer -']' Punctuation '\n' Text -' ' Text -'n' Name +' ' Text +'ss' Name ' ' Text '=' Operator ' ' Text -'div' Name +'_string_n' Name '(' Punctuation 'n' Name -',' Punctuation -'b' Name ')' Punctuation '\n' Text -' ' Text -'i' Name +' ' Text +'GC' Name +'.' Operator +'@preserve' Name.Decorator ' ' Text -'-=' Operator +'s' Name ' ' Text -'1' Literal.Number.Integer -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'if' Keyword +'ss' Name ' ' Text -'neg' Name -'\n' Text - -' ' Text -'data' Name -'[' Punctuation -'1' Literal.Number.Integer -']' Punctuation +'unsafe_copyto!' Name +'(' Punctuation +'pointer' Name +'(' Punctuation +'ss' Name +')' Punctuation +',' Punctuation ' ' Text -'=' Operator +'pointer' Name +'(' Punctuation +'s' Name +',' Punctuation +' ' Text +'i' Name +')' Punctuation +',' Punctuation ' ' Text -"'-'" Literal.String.Char +'n' Name +')' Punctuation '\n' Text ' ' Text -'end' Keyword +'return' Keyword +' ' Text +'ss' Name '\n' Text -' ' Text -'ASCIIString' Keyword.Type -'(' Punctuation -'data' Name -')' Punctuation +'end' Keyword '\n' Text -'end' Keyword '\n' Text -'int2str' Name -'(' Punctuation -'n' Name -'::' Operator -'Integer' Keyword.Type -',' Punctuation -' ' Text -'b' Name +'length' Name +'(' Punctuation +'s' Name '::' Operator -'Integer' Keyword.Type +'String' Keyword.Type ')' Punctuation -' ' Text +' ' Text '=' Operator ' ' Text -'int2str' Name +'length_continued' Name '(' Punctuation -'n' Name +'s' Name ',' Punctuation ' ' Text -'b' Name +'1' Literal.Number.Integer ',' Punctuation ' ' Text -'0' Literal.Number.Integer +'ncodeunits' Name +'(' Punctuation +'s' Name +')' Punctuation +',' Punctuation +' ' Text +'ncodeunits' Name +'(' Punctuation +'s' Name ')' Punctuation +')' Punctuation +'\n' Text + '\n' Text -'int2str' Name +'@inline' Name.Decorator +' ' Text +'function' Keyword +' ' Text +'length' Name '(' Punctuation -'n' Name +'s' Name '::' Operator -'Integer' Keyword.Type +'String' Keyword.Type ',' Punctuation ' ' Text -'b' Name +'i' Name '::' Operator -'Integer' Keyword.Type +'Int' Keyword.Type ',' Punctuation ' ' Text -'l' Name +'j' Name '::' Operator 'Int' Keyword.Type ')' Punctuation -' ' Text -'=' Operator -' ' Text -'int2str' Name -'(' Punctuation -'int64' Name -'(' Punctuation -'n' Name -')' Punctuation -',' Punctuation -' ' Text -'b' Name -',' Punctuation -' ' Text -'l' Name -')' Punctuation '\n' Text +' ' Text +'@boundscheck' Name.Decorator +' ' Text +'begin' Keyword '\n' Text -'string' Name +' ' Text +'0' Literal.Number.Integer +' ' Text +'<' Operator +' ' Text +'i' Name +' ' Text +'≤' Operator +' ' Text +'ncodeunits' Name '(' Punctuation -'x' Name -'::' Operator -'Signed' Keyword.Type +'s' Name ')' Punctuation +'+' Operator +'1' Literal.Number.Integer ' ' Text -'=' Operator +'||' Operator ' ' Text -'dec' Name +'throw' Name '(' Punctuation -'int64' Name +'BoundsError' Keyword.Type '(' Punctuation -'x' Name +'s' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation ')' Punctuation '\n' Text -'cstring' Name +' ' Text +'0' Literal.Number.Integer +' ' Text +'≤' Operator +'\xa0' Text +'j' Name +' ' Text +'<' Operator +' ' Text +'ncodeunits' Name '(' Punctuation -'x' Name -'::' Operator -'Signed' Keyword.Type +'s' Name ')' Punctuation +'+' Operator +'1' Literal.Number.Integer ' ' Text -'=' Operator +'||' Operator ' ' Text -'dec' Name +'throw' Name '(' Punctuation -'int64' Name +'BoundsError' Keyword.Type '(' Punctuation -'x' Name +'s' Name +',' Punctuation +' ' Text +'j' Name ')' Punctuation ')' Punctuation '\n' Text +' ' Text +'end' Keyword '\n' Text -'## string to float functions ##' Comment -'\n' Text - +' ' Text +'j' Name +' ' Text +'<' Operator +' ' Text +'i' Name +' ' Text +'&&' Operator +' ' Text +'return' Keyword +' ' Text +'0' Literal.Number.Integer '\n' Text -'function' Keyword +' ' Text +'@inbounds' Name.Decorator +' ' Text +'i' Name +',' Punctuation ' ' Text -'float64_isvalid' Name +'k' Name +' ' Text +'=' Operator +' ' Text +'thisind' Name '(' Punctuation 's' Name -'::' Operator -'String' Name ',' Punctuation ' ' Text -'out' Name -'::' Operator -'Array' Keyword.Type -'{' Punctuation -'Float64' Keyword.Type -',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation +'i' Name ')' Punctuation +',' Punctuation +' ' Text +'i' Name '\n' Text ' ' Text -'s' Name +'c' Name ' ' Text '=' Operator ' ' Text -'cstring' Name +'j' Name +' ' Text +'-' Operator +' ' Text +'i' Name +' ' Text +'+' Operator +' ' Text '(' Punctuation -'s' Name +'i' Name +' ' Text +'==' Operator +' ' Text +'k' Name ')' Punctuation '\n' Text ' ' Text -'return' Keyword -' ' Text -'(' Punctuation -'ccall' Keyword +'length_continued' Name '(' Punctuation -':' Operator -'jl_strtod' Name -',' Punctuation -' ' Text -'Int32' Keyword.Type +'s' Name ',' Punctuation ' ' Text -'(' Punctuation -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -',' Punctuation -'Ptr' Keyword.Type -'{' Punctuation -'Float64' Keyword.Type -'}' Punctuation -')' Punctuation +'i' Name ',' Punctuation ' ' Text -'s' Name +'j' Name ',' Punctuation ' ' Text -'out' Name -')' Punctuation -'==' Operator -'0' Literal.Number.Integer +'c' Name ')' Punctuation '\n' Text @@ -11515,581 +3526,590 @@ '\n' Text +'@inline' Name.Decorator +' ' Text 'function' Keyword ' ' Text -'float32_isvalid' Name +'length_continued' Name '(' Punctuation 's' Name '::' Operator -'String' Name +'String' Keyword.Type ',' Punctuation ' ' Text -'out' Name +'i' Name '::' Operator -'Array' Keyword.Type -'{' Punctuation -'Float32' Keyword.Type +'Int' Keyword.Type ',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation +' ' Text +'n' Name +'::' Operator +'Int' Keyword.Type +',' Punctuation +' ' Text +'c' Name +'::' Operator +'Int' Keyword.Type ')' Punctuation '\n' Text ' ' Text -'s' Name +'i' Name +' ' Text +'<' Operator +' ' Text +'n' Name +' ' Text +'||' Operator +' ' Text +'return' Keyword +' ' Text +'c' Name +'\n' Text + +' ' Text +'@inbounds' Name.Decorator +' ' Text +'b' Name ' ' Text '=' Operator ' ' Text -'cstring' Name +'codeunit' Name '(' Punctuation 's' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation '\n' Text ' ' Text -'return' Keyword +'@inbounds' Name.Decorator ' ' Text -'(' Punctuation -'ccall' Keyword -'(' Punctuation -':' Operator -'jl_strtof' Name -',' Punctuation +'while' Keyword ' ' Text -'Int32' Keyword.Type -',' Punctuation +'true' Name.Builtin +'\n' Text + +' ' Text +'while' Keyword ' ' Text +'true' Name.Builtin +'\n' Text + +' ' Text '(' Punctuation -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -',' Punctuation -'Ptr' Keyword.Type -'{' Punctuation -'Float32' Keyword.Type -'}' Punctuation +'i' Name +' ' Text +'+=' Operator +' ' Text +'1' Literal.Number.Integer ')' Punctuation -',' Punctuation ' ' Text +'≤' Operator +'\xa0' Text +'n' Name +' ' Text +'||' Operator +' ' Text +'return' Keyword +' ' Text +'c' Name +'\n' Text + +' ' Text +'0xc0' Literal.Number.Hex +' ' Text +'≤' Operator +'\xa0' Text +'b' Name +' ' Text +'≤' Operator +'\xa0' Text +'0xf7' Literal.Number.Hex +' ' Text +'&&' Operator +' ' Text +'break' Keyword +'\n' Text + +' ' Text +'b' Name +' ' Text +'=' Operator +' ' Text +'codeunit' Name +'(' Punctuation 's' Name ',' Punctuation ' ' Text -'out' Name -')' Punctuation -'==' Operator -'0' Literal.Number.Integer +'i' Name ')' Punctuation '\n' Text +' ' Text 'end' Keyword '\n' Text +' ' Text +'l' Name +' ' Text +'=' Operator +' ' Text +'b' Name '\n' Text -'begin' Keyword -'\n' Text - -' ' Text -'local' Keyword.Declaration -' ' Text -'tmp' Name -'::' Operator -'Array' Keyword.Type -'{' Punctuation -'Float64' Keyword.Type -',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation +' ' Text +'b' Name ' ' Text '=' Operator ' ' Text -'Array' Keyword.Type +'codeunit' Name '(' Punctuation -'Float64' Keyword.Type +'s' Name ',' Punctuation -'1' Literal.Number.Integer +' ' Text +'i' Name ')' Punctuation +' ' Text +'# cont byte 1' Comment '\n' Text -' ' Text -'local' Keyword.Declaration +' ' Text +'c' Name ' ' Text -'tmpf' Name -'::' Operator -'Array' Keyword.Type -'{' Punctuation -'Float32' Keyword.Type -',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation +'-=' Operator +' ' Text +'(' Punctuation +'x' Name ' ' Text '=' Operator ' ' Text -'Array' Keyword.Type -'(' Punctuation -'Float32' Keyword.Type -',' Punctuation -'1' Literal.Number.Integer +'b' Name +' ' Text +'&' Operator +' ' Text +'0xc0' Literal.Number.Hex +' ' Text +'==' Operator +' ' Text +'0x80' Literal.Number.Hex ')' Punctuation '\n' Text -' ' Text -'global' Keyword.Declaration +' ' Text +'x' Name ' ' Text -'float64' Name -',' Punctuation +'&' Operator +' ' Text +'(' Punctuation +'l' Name +' ' Text +'≥' Operator +' ' Text +'0xe0' Literal.Number.Hex +')' Punctuation ' ' Text -'float32' Name +'||' Operator +' ' Text +'continue' Keyword '\n' Text -' ' Text -'function' Keyword -' ' Text -'float64' Name +'\n' Text + +' ' Text '(' Punctuation -'s' Name -'::' Operator -'String' Name +'i' Name +' ' Text +'+=' Operator +' ' Text +'1' Literal.Number.Integer ')' Punctuation +' ' Text +'≤' Operator +'\xa0' Text +'n' Name +' ' Text +'||' Operator +' ' Text +'return' Keyword +' ' Text +'c' Name '\n' Text ' ' Text -'if' Keyword +'b' Name +' ' Text +'=' Operator ' ' Text -'!' Operator -'float64_isvalid' Name +'codeunit' Name '(' Punctuation 's' Name ',' Punctuation ' ' Text -'tmp' Name +'i' Name ')' Punctuation +' ' Text +'# cont byte 2' Comment '\n' Text -' ' Text -'throw' Name -'(' Punctuation -'ArgumentError' Keyword.Type +' ' Text +'c' Name +' ' Text +'-=' Operator +' ' Text '(' Punctuation -'"' Literal.String -'f' Literal.String -'l' Literal.String -'o' Literal.String -'a' Literal.String -'t' Literal.String -'6' Literal.String -'4' Literal.String -'(' Literal.String -'S' Literal.String -'t' Literal.String -'r' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -')' Literal.String -':' Literal.String -' ' Literal.String -'i' Literal.String -'n' Literal.String -'v' Literal.String -'a' Literal.String -'l' Literal.String -'i' Literal.String -'d' Literal.String -' ' Literal.String -'n' Literal.String -'u' Literal.String -'m' Literal.String -'b' Literal.String -'e' Literal.String -'r' Literal.String -' ' Literal.String -'f' Literal.String -'o' Literal.String -'r' Literal.String -'m' Literal.String -'a' Literal.String -'t' Literal.String -'"' Literal.String -')' Punctuation +'x' Name +' ' Text +'=' Operator +' ' Text +'b' Name +' ' Text +'&' Operator +' ' Text +'0xc0' Literal.Number.Hex +' ' Text +'==' Operator +' ' Text +'0x80' Literal.Number.Hex ')' Punctuation '\n' Text ' ' Text -'end' Keyword -'\n' Text - -' ' Text -'return' Keyword +'x' Name ' ' Text -'tmp' Name -'[' Punctuation -'1' Literal.Number.Integer -']' Punctuation -'\n' Text - -' ' Text -'end' Keyword +'&' Operator +' ' Text +'(' Punctuation +'l' Name +' ' Text +'≥' Operator +' ' Text +'0xf0' Literal.Number.Hex +')' Punctuation +' ' Text +'||' Operator +' ' Text +'continue' Keyword '\n' Text '\n' Text -' ' Text -'function' Keyword -' ' Text -'float32' Name +' ' Text '(' Punctuation -'s' Name -'::' Operator -'String' Name +'i' Name +' ' Text +'+=' Operator +' ' Text +'1' Literal.Number.Integer ')' Punctuation +' ' Text +'≤' Operator +'\xa0' Text +'n' Name +' ' Text +'||' Operator +' ' Text +'return' Keyword +' ' Text +'c' Name '\n' Text ' ' Text -'if' Keyword +'b' Name ' ' Text -'!' Operator -'float32_isvalid' Name +'=' Operator +' ' Text +'codeunit' Name '(' Punctuation 's' Name ',' Punctuation ' ' Text -'tmpf' Name +'i' Name ')' Punctuation +' ' Text +'# cont byte 3' Comment '\n' Text -' ' Text -'throw' Name -'(' Punctuation -'ArgumentError' Keyword.Type +' ' Text +'c' Name +' ' Text +'-=' Operator +' ' Text '(' Punctuation -'"' Literal.String -'f' Literal.String -'l' Literal.String -'o' Literal.String -'a' Literal.String -'t' Literal.String -'3' Literal.String -'2' Literal.String -'(' Literal.String -'S' Literal.String -'t' Literal.String -'r' Literal.String -'i' Literal.String -'n' Literal.String -'g' Literal.String -')' Literal.String -':' Literal.String -' ' Literal.String -'i' Literal.String -'n' Literal.String -'v' Literal.String -'a' Literal.String -'l' Literal.String -'i' Literal.String -'d' Literal.String -' ' Literal.String -'n' Literal.String -'u' Literal.String -'m' Literal.String -'b' Literal.String -'e' Literal.String -'r' Literal.String -' ' Literal.String -'f' Literal.String -'o' Literal.String -'r' Literal.String -'m' Literal.String -'a' Literal.String -'t' Literal.String -'"' Literal.String -')' Punctuation +'b' Name +' ' Text +'&' Operator +' ' Text +'0xc0' Literal.Number.Hex +' ' Text +'==' Operator +' ' Text +'0x80' Literal.Number.Hex ')' Punctuation '\n' Text -' ' Text +' ' Text 'end' Keyword '\n' Text -' ' Text -'return' Keyword -' ' Text -'tmpf' Name -'[' Punctuation -'1' Literal.Number.Integer -']' Punctuation +'end' Keyword '\n' Text -' ' Text -'end' Keyword '\n' Text -'end' Keyword +'## overload methods for efficiency ##' Comment '\n' Text '\n' Text -'float' Name +'isvalid' Name '(' Punctuation -'x' Name +'s' Name +'::' Operator +'String' Keyword.Type +',' Punctuation +' ' Text +'i' Name '::' Operator -'String' Name +'Int' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text -'float64' Name -'(' Punctuation -'x' Name -')' Punctuation -'\n' Text - -'parse_float' Name +'checkbounds' Name '(' Punctuation -'x' Name -'::' Operator -'String' Name +'Bool' Keyword.Type +',' Punctuation +' ' Text +'s' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation ' ' Text -'=' Operator +'&&' Operator ' ' Text -'float64' Name +'thisind' Name '(' Punctuation -'x' Name +'s' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation +' ' Text +'==' Operator +' ' Text +'i' Name '\n' Text -'parse_float' Name -'(' Punctuation -'::' Operator -'Type' Keyword.Type -'{' Punctuation -'Float64' Keyword.Type -'}' Punctuation -',' Punctuation +'\n' Text + +'function' Keyword ' ' Text -'x' Name +'isascii' Name +'(' Punctuation +'s' Name '::' Operator -'String' Name +'String' Keyword.Type ')' Punctuation +'\n' Text + +' ' Text +'@inbounds' Name.Decorator +' ' Text +'for' Keyword +' ' Text +'i' Name ' ' Text '=' Operator ' ' Text -'float64' Name +'1' Literal.Number.Integer +':' Operator +'ncodeunits' Name '(' Punctuation -'x' Name +'s' Name ')' Punctuation '\n' Text -'parse_float' Name +' ' Text +'codeunit' Name '(' Punctuation -'::' Operator -'Type' Keyword.Type -'{' Punctuation -'Float32' Keyword.Type -'}' Punctuation +'s' Name ',' Punctuation ' ' Text -'x' Name -'::' Operator -'String' Name +'i' Name ')' Punctuation ' ' Text -'=' Operator +'>=' Operator ' ' Text -'float32' Name -'(' Punctuation -'x' Name -')' Punctuation +'0x80' Literal.Number.Hex +' ' Text +'&&' Operator +' ' Text +'return' Keyword +' ' Text +'false' Name.Builtin +'\n' Text + +' ' Text +'end' Keyword '\n' Text +' ' Text +'return' Keyword +' ' Text +'true' Name.Builtin '\n' Text -'# copying a byte string (generally not needed due to "immutability")' Comment +'end' Keyword '\n' Text '\n' Text -'strcpy' Name -'{' Punctuation -'T' Name -'<:' Operator -'ByteString' Name -'}' Punctuation +'"""' Literal.String +"\n repeat(c::AbstractChar, r::Integer) -> String\n\nRepeat a character `r` times. This can equivalently be accomplished by calling\n[`c^r`](@ref :^(::Union{AbstractString, AbstractChar}, ::Integer)).\n\n# Examples\n```jldoctest\njulia> repeat('A', 3)\n" Literal.String + +'"' Literal.String +'AAA' Literal.String +'"' Literal.String +'\n```\n' Literal.String + +'"""' Literal.String +'\n' Text + +'repeat' Name '(' Punctuation -'s' Name +'c' Name +'::' Operator +'AbstractChar' Keyword.Type +',' Punctuation +' ' Text +'r' Name '::' Operator -'T' Name +'Integer' Keyword.Type ')' Punctuation ' ' Text '=' Operator ' ' Text -'T' Name +'repeat' Name '(' Punctuation -'copy' Name +'Char' Keyword.Type '(' Punctuation -'s' Name -'.' Operator -'data' Name +'c' Name ')' Punctuation +',' Punctuation +' ' Text +'r' Name ')' Punctuation -'\n' Text - -'\n' Text - -'# lexicographically compare byte arrays (used by Latin-1 and UTF-8)' Comment -'\n' Text - +' ' Text +'# fallback' Comment '\n' Text 'function' Keyword ' ' Text -'lexcmp' Name +'repeat' Name '(' Punctuation -'a' Name +'c' Name '::' Operator -'Array' Keyword.Type -'{' Punctuation -'Uint8' Name -',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation +'Char' Keyword.Type ',' Punctuation ' ' Text -'b' Name +'r' Name '::' Operator -'Array' Keyword.Type -'{' Punctuation -'Uint8' Name -',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation +'Integer' Keyword.Type ')' Punctuation '\n' Text ' ' Text -'c' Name +'r' Name ' ' Text -'=' Operator +'==' Operator ' ' Text -'ccall' Keyword -'(' Punctuation -':' Operator -'memcmp' Name -',' Punctuation +'0' Literal.Number.Integer ' ' Text -'Int32' Keyword.Type -',' Punctuation +'&&' Operator ' ' Text -'(' Punctuation -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -',' Punctuation +'return' Keyword ' ' Text -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -',' Punctuation +'"' Literal.String +'"' Literal.String +'\n' Text + +' ' Text +'r' Name ' ' Text -'Uint' Name +'<' Operator +' ' Text +'0' Literal.Number.Integer +' ' Text +'&&' Operator +' ' Text +'throw' Name +'(' Punctuation +'ArgumentError' Keyword.Type +'(' Punctuation +'"' Literal.String +"can't repeat a character " Literal.String +'$r' Literal.String.Interpol +' times' Literal.String +'"' Literal.String +')' Punctuation ')' Punctuation -',' Punctuation '\n' Text -' ' Text -'a' Name -',' Punctuation +' ' Text +'u' Name ' ' Text -'b' Name -',' Punctuation +'=' Operator ' ' Text -'min' Name +'bswap' Name '(' Punctuation -'length' Name +'reinterpret' Name '(' Punctuation -'a' Name -')' Punctuation +'UInt32' Keyword.Type ',' Punctuation -'length' Name -'(' Punctuation -'b' Name -')' Punctuation +' ' Text +'c' Name ')' Punctuation ')' Punctuation '\n' Text ' ' Text -'c' Name -' ' Text -'<' Operator +'n' Name ' ' Text -'0' Literal.Number.Integer +'=' Operator ' ' Text -'?' Operator +'4' Literal.Number.Integer ' ' Text '-' Operator -'1' Literal.Number.Integer ' ' Text -':' Operator -' ' Text -'c' Name -' ' Text -'>' Operator -' ' Text -'0' Literal.Number.Integer +'(' Punctuation +'leading_zeros' Name +'(' Punctuation +'u' Name ' ' Text -'?' Operator +'|' Operator ' ' Text -'+' Operator -'1' Literal.Number.Integer +'0xff' Literal.Number.Hex +')' Punctuation ' ' Text -':' Operator +'>>' Operator ' ' Text -'cmp' Name -'(' Punctuation -'length' Name -'(' Punctuation -'a' Name -')' Punctuation -',' Punctuation -'length' Name -'(' Punctuation -'b' Name -')' Punctuation +'3' Literal.Number.Integer ')' Punctuation '\n' Text -'end' Keyword -'\n' Text - -'\n' Text - -'# find the index of the first occurrence of a byte value in a byte array' Comment -'\n' Text - -'\n' Text - -'function' Keyword +' ' Text +'s' Name ' ' Text -'memchr' Name -'(' Punctuation -'a' Name -'::' Operator -'Array' Keyword.Type -'{' Punctuation -'Uint8' Name -',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation -',' Punctuation +'=' Operator ' ' Text -'b' Name -'::' Operator -'Integer' Keyword.Type +'_string_n' Name +'(' Punctuation +'n' Name +'*' Operator +'r' Name ')' Punctuation '\n' Text @@ -12100,341 +4120,327 @@ ' ' Text 'pointer' Name '(' Punctuation -'a' Name +'s' Name ')' Punctuation '\n' Text ' ' Text -'q' Name +'GC' Name +'.' Operator +'@preserve' Name.Decorator ' ' Text -'=' Operator +'s' Name +' ' Text +'if' Keyword ' ' Text +'n' Name +' ' Text +'==' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +' ' Text 'ccall' Keyword '(' Punctuation -':' Operator -'memchr' Name +':memset' Literal.String.Symbol ',' Punctuation ' ' Text 'Ptr' Keyword.Type '{' Punctuation -'Uint8' Name +'Cvoid' Keyword.Type '}' Punctuation ',' Punctuation ' ' Text '(' Punctuation 'Ptr' Keyword.Type '{' Punctuation -'Uint8' Name +'UInt8' Keyword.Type '}' Punctuation ',' Punctuation ' ' Text -'Int32' Keyword.Type +'Cint' Keyword.Type ',' Punctuation ' ' Text -'Uint' Name +'Csize_t' Keyword.Type ')' Punctuation ',' Punctuation ' ' Text 'p' Name ',' Punctuation ' ' Text -'b' Name -',' Punctuation -' ' Text -'length' Name -'(' Punctuation -'a' Name -')' Punctuation -')' Punctuation -'\n' Text - -' ' Text -'q' Name -' ' Text -'==' Operator -' ' Text -'C_NULL' Name.Builtin -' ' Text -'?' Operator -' ' Text -'0' Literal.Number.Integer -' ' Text -':' Operator -' ' Text -'q' Name -' ' Text -'-' Operator -' ' Text -'p' Name +'u' Name ' ' Text -'+' Operator +'%' Operator ' ' Text -'1' Literal.Number.Integer -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'# concatenate byte arrays into a single array' Comment +'UInt8' Keyword.Type +',' Punctuation +' ' Text +'r' Name +')' Punctuation '\n' Text +' ' Text +'elseif' Keyword +' ' Text +'n' Name +' ' Text +'==' Operator +' ' Text +'2' Literal.Number.Integer '\n' Text -'memcat' Name -'(' Punctuation -')' Punctuation +' ' Text +'p16' Name ' ' Text '=' Operator ' ' Text -'Array' Keyword.Type +'reinterpret' Name '(' Punctuation -'Uint8' Name +'Ptr' Keyword.Type +'{' Punctuation +'UInt16' Keyword.Type +'}' Punctuation ',' Punctuation -'0' Literal.Number.Integer +' ' Text +'p' Name ')' Punctuation '\n' Text -'memcat' Name -'(' Punctuation -'a' Name -'::' Operator -'Array' Keyword.Type -'{' Punctuation -'Uint8' Name -',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation -')' Punctuation +' ' Text +'for' Keyword +' ' Text +'i' Name ' ' Text '=' Operator ' ' Text -'copy' Name -'(' Punctuation -'a' Name -')' Punctuation -'\n' Text - +'1' Literal.Number.Integer +':' Operator +'r' Name '\n' Text -'function' Keyword -' ' Text -'memcat' Name +' ' Text +'unsafe_store!' Name '(' Punctuation -'arrays' Name -'::' Operator -'Array' Keyword.Type -'{' Punctuation -'Uint8' Name +'p16' Name ',' Punctuation -'1' Literal.Number.Integer -'}' Punctuation -'.' Operator -'.' Operator -'.' Operator +' ' Text +'u' Name +' ' Text +'%' Operator +' ' Text +'UInt16' Keyword.Type +',' Punctuation +' ' Text +'i' Name ')' Punctuation '\n' Text -' ' Text -'n' Name -' ' Text -'=' Operator -' ' Text -'0' Literal.Number.Integer +' ' Text +'end' Keyword '\n' Text ' ' Text -'for' Keyword +'elseif' Keyword ' ' Text -'a' Name +'n' Name ' ' Text -'in' Keyword.Pseudo +'==' Operator ' ' Text -'arrays' Name +'3' Literal.Number.Integer '\n' Text ' ' Text -'n' Name +'b1' Name ' ' Text -'+=' Operator +'=' Operator ' ' Text -'length' Name '(' Punctuation -'a' Name +'u' Name +' ' Text +'>>' Operator +' ' Text +'0' Literal.Number.Integer ')' Punctuation +' ' Text +'%' Operator +' ' Text +'UInt8' Keyword.Type '\n' Text -' ' Text -'end' Keyword -'\n' Text - -' ' Text -'arr' Name +' ' Text +'b2' Name ' ' Text '=' Operator ' ' Text -'Array' Keyword.Type '(' Punctuation -'Uint8' Name -',' Punctuation +'u' Name ' ' Text -'n' Name +'>>' Operator +' ' Text +'8' Literal.Number.Integer ')' Punctuation +' ' Text +'%' Operator +' ' Text +'UInt8' Keyword.Type '\n' Text -' ' Text -'ptr' Name +' ' Text +'b3' Name ' ' Text '=' Operator ' ' Text -'pointer' Name '(' Punctuation -'arr' Name +'u' Name +' ' Text +'>>' Operator +' ' Text +'16' Literal.Number.Integer ')' Punctuation -'\n' Text - -' ' Text -'offset' Name ' ' Text -'=' Operator +'%' Operator ' ' Text -'0' Literal.Number.Integer +'UInt8' Keyword.Type '\n' Text -' ' Text +' ' Text 'for' Keyword ' ' Text -'a' Name +'i' Name ' ' Text -'in' Keyword.Pseudo +'=' Operator ' ' Text -'arrays' Name +'0' Literal.Number.Integer +':' Operator +'r' Name +'-' Operator +'1' Literal.Number.Integer '\n' Text -' ' Text -'ccall' Keyword +' ' Text +'unsafe_store!' Name '(' Punctuation -':' Operator -'memcpy' Name +'p' Name ',' Punctuation ' ' Text -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation +'b1' Name ',' Punctuation ' ' Text -'(' Punctuation -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -',' Punctuation +'3' Literal.Number.Integer +'i' Name ' ' Text -'Ptr' Keyword.Type -'{' Punctuation -'Uint8' Name -'}' Punctuation -',' Punctuation +'+' Operator ' ' Text -'Uint' Name +'1' Literal.Number.Integer ')' Punctuation -',' Punctuation '\n' Text -' ' Text -'ptr' Name -'+' Operator -'offset' Name +' ' Text +'unsafe_store!' Name +'(' Punctuation +'p' Name ',' Punctuation ' ' Text -'a' Name +'b2' Name ',' Punctuation ' ' Text -'length' Name -'(' Punctuation -'a' Name -')' Punctuation +'3' Literal.Number.Integer +'i' Name +' ' Text +'+' Operator +' ' Text +'2' Literal.Number.Integer ')' Punctuation '\n' Text -' ' Text -'offset' Name +' ' Text +'unsafe_store!' Name +'(' Punctuation +'p' Name +',' Punctuation ' ' Text -'+=' Operator +'b3' Name +',' Punctuation ' ' Text -'length' Name -'(' Punctuation -'a' Name +'3' Literal.Number.Integer +'i' Name +' ' Text +'+' Operator +' ' Text +'3' Literal.Number.Integer ')' Punctuation '\n' Text -' ' Text +' ' Text 'end' Keyword '\n' Text ' ' Text -'return' Keyword +'elseif' Keyword ' ' Text -'arr' Name -'\n' Text - -'end' Keyword -'\n' Text - -'\n' Text - -'# concatenate the data fields of byte strings' Comment -'\n' Text - +'n' Name +' ' Text +'==' Operator +' ' Text +'4' Literal.Number.Integer '\n' Text -'memcat' Name -'(' Punctuation -'s' Name -'::' Operator -'ByteString' Name -')' Punctuation +' ' Text +'p32' Name ' ' Text '=' Operator ' ' Text -'memcat' Name +'reinterpret' Name '(' Punctuation -'s' Name -'.' Operator -'data' Name +'Ptr' Keyword.Type +'{' Punctuation +'UInt32' Keyword.Type +'}' Punctuation +',' Punctuation +' ' Text +'p' Name ')' Punctuation '\n' Text -'memcat' Name -'(' Punctuation -'sx' Name -'::' Operator -'ByteString' Name -'.' Operator -'.' Operator -'.' Operator -')' Punctuation +' ' Text +'for' Keyword +' ' Text +'i' Name ' ' Text '=' Operator ' ' Text -'memcat' Name -'(' Punctuation -'map' Name +'1' Literal.Number.Integer +':' Operator +'r' Name +'\n' Text + +' ' Text +'unsafe_store!' Name '(' Punctuation -'s' Name -'-' Operator -'>' Operator -'s' Name -'.' Operator -'data' Name +'p32' Name ',' Punctuation ' ' Text -'sx' Name -')' Punctuation -'.' Operator -'.' Operator -'.' Operator +'u' Name +',' Punctuation +' ' Text +'i' Name ')' Punctuation '\n' Text + +' ' Text +'end' Keyword +'\n' Text + +' ' Text +'end' Keyword +'\n' Text + +' ' Text +'return' Keyword +' ' Text +'s' Name +'\n' Text + +'end' Keyword +'\n' Text diff --git a/tests/examplefiles/kuin/example.kn b/tests/examplefiles/kuin/example.kn new file mode 100644 index 0000000..f3ea1ea --- /dev/null +++ b/tests/examplefiles/kuin/example.kn @@ -0,0 +1,37 @@ +{ Quine in Kuin. @tatt61880 } +func main() + func quine(str: []char) + var s: []char :: "" + foreach c(str) + switch(c) + case '\n' + do s :~ "\\n\" ~\n | \"" + case '\\', '"' + do s :~ "\\\{c}" + default + do s :~ c.toStr() + end switch + end foreach + do cui@print(str ~ s ~ "\"\n do quine(str)\nend func\n") + end func + const str: []char :: "" ~ + | "{ Quine in Kuin. @tatt61880 }\n" ~ + | "func main()\n" ~ + | " func quine(str: []char)\n" ~ + | " var s: []char :: \"\"\n" ~ + | " foreach c(str)\n" ~ + | " switch(c)\n" ~ + | " case '\\n'\n" ~ + | " do s :~ \"\\\\n\\\" ~\\n | \\\"\"\n" ~ + | " case '\\\\', '\"'\n" ~ + | " do s :~ \"\\\\\\{c}\"\n" ~ + | " default\n" ~ + | " do s :~ c.toStr()\n" ~ + | " end switch\n" ~ + | " end foreach\n" ~ + | " do cui@print(str ~ s ~ \"\\\"\\n do quine(str)\\nend func\\n\")\n" ~ + | " end func\n" ~ + | " const str: []char :: \"\" ~\n" ~ + | " | \"" + do quine(str) +end func diff --git a/tests/examplefiles/kuin/example.kn.output b/tests/examplefiles/kuin/example.kn.output new file mode 100644 index 0000000..a7c6673 --- /dev/null +++ b/tests/examplefiles/kuin/example.kn.output @@ -0,0 +1,366 @@ +'{' Comment.Multiline +' Quine in Kuin. @tatt61880 ' Comment.Multiline +'}' Comment.Multiline +'\n' Text + +'func' Keyword +' ' Text +'main' Name.Function +'(' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'func' Keyword +' ' Text +'quine' Name.Function +'(' Punctuation +'str' Name.Variable +':' Operator +' ' Text +'[' Punctuation +']' Punctuation +'char' Keyword.Type +')' Punctuation +'\n' Text + +' ' Text +'var' Keyword +' ' Text +'s' Name.Variable +':' Operator +' ' Text +'[' Punctuation +']' Punctuation +'char' Keyword.Type +' ' Text +'::' Operator +' ' Text +'"' Literal.String.Double +'"' Literal.String.Double +'\n' Text + +' ' Text +'foreach' Keyword +' ' Text +'c' Name.Other +'(' Punctuation +'str' Name.Variable +')' Punctuation +'\n' Text + +' ' Text +'switch' Keyword +'(' Punctuation +'c' Name.Variable +')' Punctuation +'\n' Text + +' ' Text +'case' Keyword +' ' Text +"'\\n'" Literal.String.Char +'\n' Text + +' ' Text +'do' Keyword +' ' Text +'s' Name.Variable +' ' Text +':~' Operator +' ' Text +'"' Literal.String.Double +'\\\\n\\" ~\\n | \\"' Literal.String.Double +'"' Literal.String.Double +'\n' Text + +' ' Text +'case' Keyword +' ' Text +"'\\\\'" Literal.String.Char +',' Punctuation +' ' Text +'\'"\'' Literal.String.Char +'\n' Text + +' ' Text +'do' Keyword +' ' Text +'s' Name.Variable +' ' Text +':~' Operator +' ' Text +'"' Literal.String.Double +'\\\\' Literal.String.Double +'\\{' Literal.String.Double +'c' Name.Variable +'}' Literal.String.Double +'"' Literal.String.Double +'\n' Text + +' ' Text +'default' Keyword +'\n' Text + +' ' Text +'do' Keyword +' ' Text +'s' Name.Variable +' ' Text +':~' Operator +' ' Text +'c' Name.Variable +'.' Operator +'toStr' Name.Variable +'(' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'end' Keyword +' ' Text +'switch' Keyword +'\n' Text + +' ' Text +'end' Keyword +' ' Text +'foreach' Keyword +'\n' Text + +' ' Text +'do' Keyword +' ' Text +'cui' Name +'@' Name.Other +'print' Name.Variable +'(' Punctuation +'str' Name.Variable +' ' Text +'~' Operator +' ' Text +'s' Name.Variable +' ' Text +'~' Operator +' ' Text +'"' Literal.String.Double +'\\"\\n do quine(str)\\nend func\\n' Literal.String.Double +'"' Literal.String.Double +')' Punctuation +'\n' Text + +' ' Text +'end' Keyword +' ' Text +'func' Keyword +'\n' Text + +' ' Text +'const' Keyword +' ' Text +'str' Name.Variable +':' Operator +' ' Text +'[' Punctuation +']' Punctuation +'char' Keyword.Type +' ' Text +'::' Operator +' ' Text +'"' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +'{ Quine in Kuin. @tatt61880 }\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +'func main()\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' func quine(str: []char)\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' var s: []char :: \\"\\"\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' foreach c(str)\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' switch(c)\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +" case '\\\\n'\\n" Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' do s :~ \\"\\\\\\\\n\\\\\\" ~\\\\n | \\\\\\"\\"\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' case \'\\\\\\\\\', \'\\"\'\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' do s :~ \\"\\\\\\\\\\\\{c}\\"\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' default\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' do s :~ c.toStr()\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' end switch\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' end foreach\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' do cui@print(str ~ s ~ \\"\\\\\\"\\\\n do quine(str)\\\\nend func\\\\n\\")\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' end func\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' const str: []char :: \\"\\" ~\\n' Literal.String.Double +'"' Literal.String.Double +' ' Text +'~' Operator +'\n' Text + +' ' Text +'|' Text +' ' Text +'"' Literal.String.Double +' | \\"' Literal.String.Double +'"' Literal.String.Double +'\n' Text + +' ' Text +'do' Keyword +' ' Text +'quine' Name.Variable +'(' Punctuation +'str' Name.Variable +')' Punctuation +'\n' Text + +'end' Keyword +' ' Text +'func' Keyword +'\n' Text diff --git a/tests/examplefiles/mql/example.mqh.output b/tests/examplefiles/mql/example.mqh.output index 3371ade..27ac09e 100644 --- a/tests/examplefiles/mql/example.mqh.output +++ b/tests/examplefiles/mql/example.mqh.output @@ -281,7 +281,7 @@ ' ' Text 'bool' Keyword.Type ' ' Text -'Save' Name +'Save' Name.Function '(' Punctuation 'const' Keyword ' ' Text @@ -297,7 +297,7 @@ ' ' Text 'bool' Keyword.Type ' ' Text -'Load' Name +'Load' Name.Function '(' Punctuation 'const' Keyword ' ' Text diff --git a/tests/examplefiles/nt/test.nt b/tests/examplefiles/nt/test.nt new file mode 100644 index 0000000..eaf0f45 --- /dev/null +++ b/tests/examplefiles/nt/test.nt @@ -0,0 +1,32 @@ +# comment +# + # indented comment + +dict: + key1: dict-like: value + key2: - list-like value + key3: > str-like value + key4: no trailing whitespace + key5: trailing whitespace + 'key: single-quoted': value + "key: double-quoted": value + empty: + +list: + - dict-like: value + - - list-like value + - > str-like value + - no trailing whitespace + - trailing whitespace + +empty list: + - + +string: + > dict-like: value + > - list-like value + > > str-like value + > no trailing whitespace + > trailing whitespace + > + diff --git a/tests/examplefiles/nt/test.nt.output b/tests/examplefiles/nt/test.nt.output new file mode 100644 index 0000000..c2d3e29 --- /dev/null +++ b/tests/examplefiles/nt/test.nt.output @@ -0,0 +1,142 @@ +'# comment' Comment +'\n' Text + +'#' Comment +'\n' Text + +' ' Text +'# indented comment' Comment +'\n' Text + +'\n' Text + +'dict' Name +':' Punctuation +'\n' Text + +' ' Text +'key1' Name +': ' Punctuation +'dict-like: value' Literal.String +'\n' Text + +' ' Text +'key2' Name +': ' Punctuation +'- list-like value' Literal.String +'\n' Text + +' ' Text +'key3' Name +': ' Punctuation +'> str-like value' Literal.String +'\n' Text + +' ' Text +'key4' Name +': ' Punctuation +'no trailing whitespace' Literal.String +'\n' Text + +' ' Text +'key5' Name +': ' Punctuation +'trailing whitespace' Literal.String +' ' Text.Whitespace +'\n' Text + +' ' Text +"'" Punctuation +'key: single-quoted' Name +"': " Punctuation +'value' Literal.String +'\n' Text + +' ' Text +'"' Punctuation +'key: double-quoted' Name +'": ' Punctuation +'value' Literal.String +'\n' Text + +' ' Text +'empty' Name +':' Punctuation +'\n' Text.Whitespace + +'\n' Text + +'list' Name +':' Punctuation +'\n' Text + +' ' Text +'- ' Punctuation +'dict-like: value' Literal.String +'\n' Text + +' ' Text +'- ' Punctuation +'- list-like value' Literal.String +'\n' Text + +' ' Text +'- ' Punctuation +'> str-like value' Literal.String +'\n' Text + +' ' Text +'- ' Punctuation +'no trailing whitespace' Literal.String +'\n' Text + +' ' Text +'- ' Punctuation +'trailing whitespace' Literal.String +' \n' Text.Whitespace + +'\n' Text + +'empty list' Name +':' Punctuation +'\n' Text + +' ' Text +'-' Punctuation +'\n' Text.Whitespace + +'\n' Text + +'string' Name +':' Punctuation +'\n' Text + +' ' Text +'> ' Punctuation +'dict-like: value' Literal.String +'\n' Text + +' ' Text +'> ' Punctuation +'- list-like value' Literal.String +'\n' Text + +' ' Text +'> ' Punctuation +'> str-like value' Literal.String +'\n' Text + +' ' Text +'> ' Punctuation +'no trailing whitespace' Literal.String +'\n' Text + +' ' Text +'> ' Punctuation +'trailing whitespace' Literal.String +' ' Text.Whitespace +'\n' Text + +' ' Text +'>' Punctuation +'\n' Text.Whitespace diff --git a/tests/examplefiles/omg-idl/example.idl b/tests/examplefiles/omg-idl/example.idl new file mode 100644 index 0000000..84e90df --- /dev/null +++ b/tests/examplefiles/omg-idl/example.idl @@ -0,0 +1,86 @@ +/* + * Comment + */ + +/* Comment */ + +// Comment + +#include "local.idl" +#include + +#define MACRO "String that should not be highlighted" + +#ifdef MACRO +# define something "String that should not be highlighted" +# include "local.idl" +# include +#endif + +typedef long ArrayType[10]; + +@annotation the_annotation { + unsigned long value default 10; +}; + +const unsigned long a = 10; +const int8 b = -10; +const uint16 c = 0x10af; +const int32 d = -0X10AF; +const long e = 01234; +const double f = -102.34e+10; +const double f2 = .34; +const double f3 = 0.34; +const double f4 = 102.34; +const double f5 = 102e+4; +const double f6 = .1e4; +const boolean g = TRUE; +const boolean h = FALSE; +const char i = 'i'; +const char j = '\n'; +const char k = '\''; +const string l = "Hello World\n\t\v\b\r\f\a\\\'\"\xff"; +const wchar m = L'i'; +const wchar n = L'\n'; +const wchar o = L'\''; +const wstring p = L"Hello World\n\t\v\b\r\f\a\\\'\"\xff"; + +const long expr = (4 * (2 + 6) / 2 - 7) % 6; +const long expr2 = (~4 >> 8) << 2; + +const long id_with_number_4_in_it = 4; + +@topic +struct the_struct { + @min(10) long x; + @key short t; + sequence anon_seq; +}; + +module the_module { + const long value = 0x30; + + @some_annotation + enum EnumType { + x_value, + @::mod::anno(1) y_value, + z_value + }; +}; + +@some_annotation(x=1, y="Hello\n", z=z_value) +@another_annotation(a=2, b="Goodbye\n", c=y_value) +union the_union switch(@key long) { +case 1: + short x; +case 2: + long y; +case 3: + float z; +default: + char xyz; +}; + +local interface the_interface { + the_struct get_struct(in long in_arg, inout long inout_arg, out long out_arg); +}; diff --git a/tests/examplefiles/omg-idl/example.idl.output b/tests/examplefiles/omg-idl/example.idl.output new file mode 100644 index 0000000..d146330 --- /dev/null +++ b/tests/examplefiles/omg-idl/example.idl.output @@ -0,0 +1,733 @@ +'/*\n * Comment\n */' Comment.Multiline +'\n' Text + +'\n' Text + +'/* Comment */' Comment.Multiline +'\n' Text + +'\n' Text + +'// Comment\n' Comment.Single + +'\n' Text + +'#' Comment.Preproc +'include' Comment.Preproc +' ' Text +'"local.idl"' Comment.PreprocFile +'\n' Comment.Preproc + +'#' Comment.Preproc +'include' Comment.Preproc +' ' Text +'' Comment.PreprocFile +'\n' Comment.Preproc + +'\n' Text + +'#' Comment.Preproc +'define MACRO "String that should not be highlighted"' Comment.Preproc +'\n' Comment.Preproc + +'\n' Text + +'#' Comment.Preproc +'ifdef MACRO' Comment.Preproc +'\n' Comment.Preproc + +'#' Comment.Preproc +' define something "String that should not be highlighted"' Comment.Preproc +'\n' Comment.Preproc + +'#' Comment.Preproc +' ' Text +'include' Comment.Preproc +' ' Text +'"local.idl"' Comment.PreprocFile +'\n' Comment.Preproc + +'#' Comment.Preproc +' ' Text +'include' Comment.Preproc +' ' Text +'' Comment.PreprocFile +'\n' Comment.Preproc + +'#' Comment.Preproc +'endif' Comment.Preproc +'\n' Comment.Preproc + +'\n' Text + +'typedef' Keyword.Declaration +' ' Text +'long' Keyword.Type +' ' Text +'ArrayType' Name +'[' Punctuation +'10' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +'\n' Text + +'@annotation' Keyword +' ' Text.Whitespace +'the_annotation' Name.Class +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'unsigned' Keyword.Type +' ' Text +'long' Keyword.Type +' ' Text +'value' Name +' ' Text +'default' Keyword +' ' Text +'10' Literal.Number.Integer +';' Punctuation +'\n' Text + +'}' Punctuation +';' Punctuation +'\n' Text + +'\n' Text + +'const' Keyword.Declaration +' ' Text +'unsigned' Keyword.Type +' ' Text +'long' Keyword.Type +' ' Text +'a' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'10' Literal.Number.Integer +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'int8' Keyword.Type +' ' Text +'b' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'-10' Literal.Number.Integer +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'uint16' Keyword.Type +' ' Text +'c' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'0x10af' Literal.Number.Hex +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'int32' Keyword.Type +' ' Text +'d' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'-0X10AF' Literal.Number.Hex +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'long' Keyword.Type +' ' Text +'e' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'01234' Literal.Number.Oct +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'double' Keyword.Type +' ' Text +'f' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'-102.34e+10' Literal.Number.Float +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'double' Keyword.Type +' ' Text +'f2' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'.34' Literal.Number.Float +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'double' Keyword.Type +' ' Text +'f3' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'0.34' Literal.Number.Float +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'double' Keyword.Type +' ' Text +'f4' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'102.34' Literal.Number.Float +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'double' Keyword.Type +' ' Text +'f5' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'102e+4' Literal.Number.Float +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'double' Keyword.Type +' ' Text +'f6' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'.1e4' Literal.Number.Float +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'boolean' Keyword.Type +' ' Text +'g' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'TRUE' Literal.Number +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'boolean' Keyword.Type +' ' Text +'h' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'FALSE' Literal.Number +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'char' Keyword.Type +' ' Text +'i' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +"'i'" Literal.String.Char +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'char' Keyword.Type +' ' Text +'j' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +"'" Literal.String.Char +'\\n' Literal.String.Escape +"'" Literal.String.Char +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'char' Keyword.Type +' ' Text +'k' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +"'" Literal.String.Char +"\\'" Literal.String.Escape +"'" Literal.String.Char +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'string' Keyword.Type +' ' Text +'l' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'"' Literal.String.Double +'Hello World' Literal.String +'\\n' Literal.String.Escape +'\\t' Literal.String.Escape +'\\v' Literal.String.Escape +'\\b' Literal.String.Escape +'\\r' Literal.String.Escape +'\\f' Literal.String.Escape +'\\a' Literal.String.Escape +'\\\\' Literal.String.Escape +"\\'" Literal.String.Escape +'\\"' Literal.String.Escape +'\\xff' Literal.String.Escape +'"' Literal.String +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'wchar' Keyword.Type +' ' Text +'m' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'L' Literal.String.Affix +"'i'" Literal.String.Char +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'wchar' Keyword.Type +' ' Text +'n' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'L' Literal.String.Affix +"'" Literal.String.Char +'\\n' Literal.String.Escape +"'" Literal.String.Char +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'wchar' Keyword.Type +' ' Text +'o' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'L' Literal.String.Affix +"'" Literal.String.Char +"\\'" Literal.String.Escape +"'" Literal.String.Char +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'wstring' Keyword.Type +' ' Text +'p' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'L' Literal.String.Affix +'"' Literal.String.Double +'Hello World' Literal.String +'\\n' Literal.String.Escape +'\\t' Literal.String.Escape +'\\v' Literal.String.Escape +'\\b' Literal.String.Escape +'\\r' Literal.String.Escape +'\\f' Literal.String.Escape +'\\a' Literal.String.Escape +'\\\\' Literal.String.Escape +"\\'" Literal.String.Escape +'\\"' Literal.String.Escape +'\\xff' Literal.String.Escape +'"' Literal.String +';' Punctuation +'\n' Text + +'\n' Text + +'const' Keyword.Declaration +' ' Text +'long' Keyword.Type +' ' Text +'expr' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'(' Punctuation +'4' Literal.Number.Integer +' ' Text +'*' Operator +' ' Text +'(' Punctuation +'2' Literal.Number.Integer +' ' Text +'+' Operator +' ' Text +'6' Literal.Number.Integer +')' Punctuation +' ' Text +'/' Operator +' ' Text +'2' Literal.Number.Integer +' ' Text +'-' Operator +' ' Text +'7' Literal.Number.Integer +')' Punctuation +' ' Text +'%' Operator +' ' Text +'6' Literal.Number.Integer +';' Punctuation +'\n' Text + +'const' Keyword.Declaration +' ' Text +'long' Keyword.Type +' ' Text +'expr2' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'(' Punctuation +'~' Operator +'4' Literal.Number.Integer +' ' Text +'>>' Operator +' ' Text +'8' Literal.Number.Integer +')' Punctuation +' ' Text +'<<' Operator +' ' Text +'2' Literal.Number.Integer +';' Punctuation +'\n' Text + +'\n' Text + +'const' Keyword.Declaration +' ' Text +'long' Keyword.Type +' ' Text +'id_with_number_4_in_it' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'4' Literal.Number.Integer +';' Punctuation +'\n' Text + +'\n' Text + +'@topic' Name.Decorator +'\n' Text + +'struct' Keyword +' ' Text.Whitespace +'the_struct' Name.Class +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'@min' Name.Decorator +'(' Punctuation +'10' Literal.Number.Integer +')' Punctuation +' ' Text +'long' Keyword.Type +' ' Text +'x' Name +';' Punctuation +'\n' Text + +' ' Text +'@key' Name.Decorator +' ' Text +'short' Keyword.Type +' ' Text +'t' Name +';' Punctuation +'\n' Text + +' ' Text +'sequence' Keyword.Type +'<' Punctuation +'long' Keyword.Type +'>' Punctuation +' ' Text +'anon_seq' Name +';' Punctuation +'\n' Text + +'}' Punctuation +';' Punctuation +'\n' Text + +'\n' Text + +'module' Keyword.Namespace +' ' Text.Whitespace +'the_module' Name.Namespace +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'const' Keyword.Declaration +' ' Text +'long' Keyword.Type +' ' Text +'value' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'0x30' Literal.Number.Hex +';' Punctuation +'\n' Text + +'\n' Text + +' ' Text +'@some_annotation' Name.Decorator +'\n' Text + +' ' Text +'enum' Keyword +' ' Text.Whitespace +'EnumType' Name.Class +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'x_value' Name.Constant +',' Punctuation +'\n' Text + +' ' Text +'@::mod::anno' Name.Decorator +'(' Punctuation +'1' Literal.Number.Integer +')' Punctuation +' ' Text +'y_value' Name.Constant +',' Punctuation +'\n' Text + +' ' Text +'z_value' Name.Constant +'\n' Text + +' ' Text +'}' Punctuation +';' Punctuation +'\n' Text + +'}' Punctuation +';' Punctuation +'\n' Text + +'\n' Text + +'@some_annotation' Name.Decorator +'(' Punctuation +'x' Name +'=' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text +'y' Name +'=' Punctuation +'"' Literal.String.Double +'Hello' Literal.String +'\\n' Literal.String.Escape +'"' Literal.String +',' Punctuation +' ' Text +'z' Name +'=' Punctuation +'z_value' Name +')' Punctuation +'\n' Text + +'@another_annotation' Name.Decorator +'(' Punctuation +'a' Name +'=' Punctuation +'2' Literal.Number.Integer +',' Punctuation +' ' Text +'b' Name +'=' Punctuation +'"' Literal.String.Double +'Goodbye' Literal.String +'\\n' Literal.String.Escape +'"' Literal.String +',' Punctuation +' ' Text +'c' Name +'=' Punctuation +'y_value' Name +')' Punctuation +'\n' Text + +'union' Keyword +' ' Text.Whitespace +'the_union' Name.Class +' ' Text +'switch' Keyword +'(' Punctuation +'@key' Name.Decorator +' ' Text +'long' Keyword.Type +')' Punctuation +' ' Text +'{' Punctuation +'\n' Text + +'case' Keyword +' ' Text +'1' Literal.Number.Integer +':' Punctuation +'\n' Text + +' ' Text +'short' Keyword.Type +' ' Text +'x' Name +';' Punctuation +'\n' Text + +'case' Keyword +' ' Text +'2' Literal.Number.Integer +':' Punctuation +'\n' Text + +' ' Text +'long' Keyword.Type +' ' Text +'y' Name +';' Punctuation +'\n' Text + +'case' Keyword +' ' Text +'3' Literal.Number.Integer +':' Punctuation +'\n' Text + +' ' Text +'float' Keyword.Type +' ' Text +'z' Name +';' Punctuation +'\n' Text + +'default' Keyword +':' Punctuation +'\n' Text + +' ' Text +'char' Keyword.Type +' ' Text +'xyz' Name +';' Punctuation +'\n' Text + +'}' Punctuation +';' Punctuation +'\n' Text + +'\n' Text + +'local' Keyword.Declaration +' ' Text +'interface' Keyword +' ' Text.Whitespace +'the_interface' Name.Class +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'the_struct' Name +' ' Text +'get_struct' Name +'(' Punctuation +'in' Keyword.Declaration +' ' Text +'long' Keyword.Type +' ' Text +'in_arg' Name +',' Punctuation +' ' Text +'inout' Keyword.Declaration +' ' Text +'long' Keyword.Type +' ' Text +'inout_arg' Name +',' Punctuation +' ' Text +'out' Keyword.Declaration +' ' Text +'long' Keyword.Type +' ' Text +'out_arg' Name +')' Punctuation +';' Punctuation +'\n' Text + +'}' Punctuation +';' Punctuation +'\n' Text diff --git a/tests/examplefiles/pike/FakeFile.pike.output b/tests/examplefiles/pike/FakeFile.pike.output index 936e0e0..6a83acd 100644 --- a/tests/examplefiles/pike/FakeFile.pike.output +++ b/tests/examplefiles/pike/FakeFile.pike.output @@ -46,7 +46,7 @@ 'protected' Keyword ' ' Text -'int' Name.Function +'int' Keyword.Type '(' Punctuation '0.' Literal.Number.Float '.1' Literal.Number.Float @@ -58,7 +58,7 @@ 'protected' Keyword ' ' Text -'int' Name.Function +'int' Keyword.Type '(' Punctuation '0.' Literal.Number.Float '.1' Literal.Number.Float @@ -435,7 +435,7 @@ ' ' Text 'string' Keyword.Type ' ' Text -'make_type_str' Name +'make_type_str' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -506,7 +506,7 @@ 'this_program' Name ' ' Text -'dup' Name +'dup' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -516,7 +516,7 @@ ' ' Text 'return' Keyword ' ' Text -'this_program' Name.Function +'this_program' Name '(' Punctuation 'data' Name ',' Punctuation @@ -544,7 +544,7 @@ 'int' Keyword.Type ' ' Text -'errno' Name +'errno' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -800,7 +800,7 @@ ' ' Text 'return' Keyword ' ' Text -'lambda' Name.Function +'lambda' Keyword.Type '(' Punctuation ')' Punctuation ' ' Text @@ -1649,7 +1649,7 @@ ' ' Text 'return' Keyword ' ' Text -'sizeof' Name.Function +'sizeof' Keyword '(' Punctuation 'data' Name ')' Punctuation @@ -2492,7 +2492,7 @@ ' ' Text 'return' Keyword ' ' Text -'sizeof' Name.Function +'sizeof' Keyword '(' Punctuation 'data' Name ')' Punctuation diff --git a/tests/examplefiles/ragel-cpp/ragel-cpp_rlscan.output b/tests/examplefiles/ragel-cpp/ragel-cpp_rlscan.output index ceaea7c..c867ecc 100644 --- a/tests/examplefiles/ragel-cpp/ragel-cpp_rlscan.output +++ b/tests/examplefiles/ragel-cpp/ragel-cpp_rlscan.output @@ -33,7 +33,7 @@ ' ' Text 'namespace' Keyword ' ' Text -'std' Name +'std' Name.Namespace ';' Punctuation '\n' Text @@ -486,7 +486,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'write' Name +'write' Name.Function '(' Punctuation ' ' Text 'const' Keyword @@ -521,7 +521,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'write' Name +'write' Name.Function '(' Punctuation ' ' Text 'char' Keyword.Type @@ -553,7 +553,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'write' Name +'write' Name.Function '(' Punctuation ' ' Text 'const' Keyword diff --git a/tests/examplefiles/scala/Errors.scala b/tests/examplefiles/scala/Errors.scala deleted file mode 100644 index 7af7028..0000000 --- a/tests/examplefiles/scala/Errors.scala +++ /dev/null @@ -1,23 +0,0 @@ -/* This file /* which is totally legal scala */ will not be highlighted - correcty by pygments */ - -object ⌘ { - val `interface` = """ -A -"Multiline" -String -""" - - val foo_+ = "foo plus" - val foo_⌬⌬ = "double benzene" - - // Test some interpolated strings - val mu = s"${if (true) "a:b" else "c" {with "braces"}}" - val mu2 = f"${if (true) "a:b" else "c" {with "braces"}}" - val raw = raw"a raw\nstring\"with escaped quotes" - - def main(argv: Array[String]) { - println(⌘.interface + " " + foo_+ + " " + foo_⌬⌬ ) - } -} - diff --git a/tests/examplefiles/scala/Errors.scala.output b/tests/examplefiles/scala/Errors.scala.output deleted file mode 100644 index f8b6104..0000000 --- a/tests/examplefiles/scala/Errors.scala.output +++ /dev/null @@ -1,176 +0,0 @@ -'/*' Comment.Multiline -' This file ' Comment.Multiline -'/*' Comment.Multiline -' which is totally legal scala ' Comment.Multiline -'*/' Comment.Multiline -' will not be highlighted\n correcty by pygments ' Comment.Multiline -'*/' Comment.Multiline -'\n' Text - -'\n' Text - -'object' Keyword -' ' Text -'⌘' Name.Class -' ' Text -'{' Operator -'\n' Text - -' ' Text -'val' Keyword -' ' Text -'`interface`' Name -' ' Text -'=' Operator -' ' Text -'"""\nA\n"Multiline"\nString\n"""' Literal.String -'\n' Text - -'\n' Text - -' ' Text -'val' Keyword -' ' Text -'foo_+' Name -' ' Text -'=' Operator -' ' Text -'"foo plus"' Literal.String -'\n' Text - -' ' Text -'val' Keyword -' ' Text -'foo_⌬⌬' Name -' ' Text -'=' Operator -' ' Text -'"double benzene"' Literal.String -'\n' Text - -'\n' Text - -' ' Text -'// Test some interpolated strings\n' Comment.Single - -' ' Text -'val' Keyword -' ' Text -'mu' Name -' ' Text -'=' Operator -' ' Text -'s"' Literal.String -'${' Literal.String.Interpol -'if' Keyword -' ' Text -'(' Operator -'true' Keyword.Constant -')' Operator -' ' Text -'"a:b"' Literal.String -' ' Text -'else' Keyword -' ' Text -'"c"' Literal.String -' ' Text -'{' Literal.String.Interpol -'with' Keyword -' ' Text -'"braces"' Literal.String -'}' Literal.String.Interpol -'}' Literal.String.Interpol -'"' Literal.String -'\n' Text - -' ' Text -'val' Keyword -' ' Text -'mu2' Name -' ' Text -'=' Operator -' ' Text -'f"' Literal.String -'${' Literal.String.Interpol -'if' Keyword -' ' Text -'(' Operator -'true' Keyword.Constant -')' Operator -' ' Text -'"a:b"' Literal.String -' ' Text -'else' Keyword -' ' Text -'"c"' Literal.String -' ' Text -'{' Literal.String.Interpol -'with' Keyword -' ' Text -'"braces"' Literal.String -'}' Literal.String.Interpol -'}' Literal.String.Interpol -'"' Literal.String -'\n' Text - -' ' Text -'val' Keyword -' ' Text -'raw' Name -' ' Text -'=' Operator -' ' Text -'raw"a raw\\nstring\\"with escaped quotes"' Literal.String -'\n' Text - -'\n' Text - -' ' Text -'def' Keyword -' ' Text -'main' Name -'(' Operator -'argv' Name -':' Keyword -' ' Text -'Array' Keyword.Type -'[' Operator -'String' Keyword.Type -']' Operator -')' Operator -' ' Text -'{' Operator -'\n' Text - -' ' Text -'println' Name -'(' Operator -'⌘' Operator -'.' Operator -'interface' Name -' ' Text -'+' Operator -' ' Text -'" "' Literal.String -' ' Text -'+' Operator -' ' Text -'foo_+' Name -' ' Text -'+' Operator -' ' Text -'" "' Literal.String -' ' Text -'+' Operator -' ' Text -'foo_⌬⌬' Name -' ' Text -')' Operator -'\n' Text - -' ' Text -'}' Operator -'\n' Text - -'}' Operator -'\n' Text diff --git a/tests/examplefiles/scala/char.scala.output b/tests/examplefiles/scala/char.scala.output index 5912ddb..fff499f 100644 --- a/tests/examplefiles/scala/char.scala.output +++ b/tests/examplefiles/scala/char.scala.output @@ -1,4 +1,4 @@ -"'symbol" Text.Symbol +"'symbol" Literal.String.Symbol '\n' Text "'a'" Literal.String.Char @@ -7,5 +7,7 @@ "'\\u1234'" Literal.String.Char '\n' Text -"'\\n'" Literal.String.Char +"'" Literal.String.Char +'\\n' Literal.String.Escape +"'" Literal.String.Char '\n' Text diff --git a/tests/examplefiles/scala/comments.scala b/tests/examplefiles/scala/comments.scala new file mode 100644 index 0000000..be712b3 --- /dev/null +++ b/tests/examplefiles/scala/comments.scala @@ -0,0 +1,9 @@ +// Comments +/* Comment block */ +/* Multi-line + * comment block + */ +/* /**/ /** */ /* comments within comments */ */ +/** /* */ /** **/ **/ +// /* Commented-out comment block +// Line comment \ No newline at end of file diff --git a/tests/examplefiles/scala/comments.scala.output b/tests/examplefiles/scala/comments.scala.output new file mode 100644 index 0000000..ccf7c07 --- /dev/null +++ b/tests/examplefiles/scala/comments.scala.output @@ -0,0 +1,51 @@ +'// Comments\n' Comment.Single + +'/*' Comment.Multiline +' Comment block ' Comment.Multiline +'*/' Comment.Multiline +'\n' Text + +'/*' Comment.Multiline +' Multi-line \n ' Comment.Multiline +'*' Comment.Multiline +' comment block\n ' Comment.Multiline +'*/' Comment.Multiline +'\n' Text + +'/*' Comment.Multiline +' ' Comment.Multiline +'/*' Comment.Multiline +'*/' Comment.Multiline +' ' Comment.Multiline +'/*' Comment.Multiline +'*' Comment.Multiline +' ' Comment.Multiline +'*/' Comment.Multiline +' ' Comment.Multiline +'/*' Comment.Multiline +' comments within comments ' Comment.Multiline +'*/' Comment.Multiline +' ' Comment.Multiline +'*/' Comment.Multiline +'\n' Text + +'/*' Comment.Multiline +'*' Comment.Multiline +' ' Comment.Multiline +'/*' Comment.Multiline +' ' Comment.Multiline +'*/' Comment.Multiline +' ' Comment.Multiline +'/*' Comment.Multiline +'*' Comment.Multiline +' ' Comment.Multiline +'*' Comment.Multiline +'*/' Comment.Multiline +' ' Comment.Multiline +'*' Comment.Multiline +'*/' Comment.Multiline +'\n' Text + +'// /* Commented-out comment block\n' Comment.Single + +'// Line comment\n' Comment.Single diff --git a/tests/examplefiles/scala/constants.scala b/tests/examplefiles/scala/constants.scala new file mode 100644 index 0000000..f1bd8d9 --- /dev/null +++ b/tests/examplefiles/scala/constants.scala @@ -0,0 +1,18 @@ +true false null +1 2 3 4 +1L 1l 10L 12123123L +3.0 12.345 +3f 3.0f 3F 3.0F +3d 3.0d 3D 3.0D +110_222_795_799.99 110.9499_999 2_000.343_999e561_100 +1e12 1e+34 1e-56 1e12f 1e+34f 1e-56f 1e12d 1e+34d 1e-56d +1E12 1E+34 1E-56 1E12f 1E+34f 1E-56f 1E12d 1E+34d 1E-56d +.1e12 .1e+34 .1e-56 .1e12f .1e+34f .1e-56f .1e12d .1e+34d .1e-56d +.1E12 .1E+34 .1E-56 .1E12f .1E+34f .1E-56f .1E12d .1E+34d .1E-56d +0x // Can still be highlighted correctly! +0x1234567890ABCDEF 0x1234567890abcdef +0x123_abc 0x123_ABC +"test" "\"test\"" "'test'" // comment +"""test: one ", two "", three """""" // comment +'t' '"' '\'' '\n' ' ' +super this \ No newline at end of file diff --git a/tests/examplefiles/scala/constants.scala.output b/tests/examplefiles/scala/constants.scala.output new file mode 100644 index 0000000..98c0b6c --- /dev/null +++ b/tests/examplefiles/scala/constants.scala.output @@ -0,0 +1,176 @@ +'true' Keyword.Constant +' ' Text +'false' Keyword.Constant +' ' Text +'null' Keyword.Constant +'\n' Text + +'1' Literal.Number.Integer +' ' Text +'2' Literal.Number.Integer +' ' Text +'3' Literal.Number.Integer +' ' Text +'4' Literal.Number.Integer +'\n' Text + +'1L' Literal.Number.Integer.Long +' ' Text +'1l' Literal.Number.Integer.Long +' ' Text +'10L' Literal.Number.Integer.Long +' ' Text +'12123123L' Literal.Number.Integer.Long +'\n' Text + +'3.0' Literal.Number.Float +' ' Text +'12.345' Literal.Number.Float +'\n' Text + +'3f' Literal.Number.Float +' ' Text +'3.0f' Literal.Number.Float +' ' Text +'3F' Literal.Number.Float +' ' Text +'3.0F' Literal.Number.Float +'\n' Text + +'3d' Literal.Number.Float +' ' Text +'3.0d' Literal.Number.Float +' ' Text +'3D' Literal.Number.Float +' ' Text +'3.0D' Literal.Number.Float +'\n' Text + +'110_222_795_799.99' Literal.Number.Float +' ' Text +'110.9499_999' Literal.Number.Float +' ' Text +'2_000.343_999e561_100' Literal.Number.Float +'\n' Text + +'1e12' Literal.Number.Float +' ' Text +'1e+34' Literal.Number.Float +' ' Text +'1e-56' Literal.Number.Float +' ' Text +'1e12f' Literal.Number.Float +' ' Text +'1e+34f' Literal.Number.Float +' ' Text +'1e-56f' Literal.Number.Float +' ' Text +'1e12d' Literal.Number.Float +' ' Text +'1e+34d' Literal.Number.Float +' ' Text +'1e-56d' Literal.Number.Float +'\n' Text + +'1E12' Literal.Number.Float +' ' Text +'1E+34' Literal.Number.Float +' ' Text +'1E-56' Literal.Number.Float +' ' Text +'1E12f' Literal.Number.Float +' ' Text +'1E+34f' Literal.Number.Float +' ' Text +'1E-56f' Literal.Number.Float +' ' Text +'1E12d' Literal.Number.Float +' ' Text +'1E+34d' Literal.Number.Float +' ' Text +'1E-56d' Literal.Number.Float +'\n' Text + +'.1e12' Literal.Number.Float +' ' Text +'.1e+34' Literal.Number.Float +' ' Text +'.1e-56' Literal.Number.Float +' ' Text +'.1e12f' Literal.Number.Float +' ' Text +'.1e+34f' Literal.Number.Float +' ' Text +'.1e-56f' Literal.Number.Float +' ' Text +'.1e12d' Literal.Number.Float +' ' Text +'.1e+34d' Literal.Number.Float +' ' Text +'.1e-56d' Literal.Number.Float +'\n' Text + +'.1E12' Literal.Number.Float +' ' Text +'.1E+34' Literal.Number.Float +' ' Text +'.1E-56' Literal.Number.Float +' ' Text +'.1E12f' Literal.Number.Float +' ' Text +'.1E+34f' Literal.Number.Float +' ' Text +'.1E-56f' Literal.Number.Float +' ' Text +'.1E12d' Literal.Number.Float +' ' Text +'.1E+34d' Literal.Number.Float +' ' Text +'.1E-56d' Literal.Number.Float +'\n' Text + +'0x' Literal.Number.Hex +' ' Text +'// Can still be highlighted correctly!\n' Comment.Single + +'0x1234567890ABCDEF' Literal.Number.Hex +' ' Text +'0x1234567890abcdef' Literal.Number.Hex +'\n' Text + +'0x123_abc' Literal.Number.Hex +' ' Text +'0x123_ABC' Literal.Number.Hex +'\n' Text + +'"test"' Literal.String +' ' Text +'"\\"test\\""' Literal.String +' ' Text +'"\'test\'"' Literal.String +' ' Text +'// comment\n' Comment.Single + +'"""test: one ", two "", three """"""' Literal.String +' ' Text +'// comment\n' Comment.Single + +"'t'" Literal.String.Char +' ' Text +'\'"\'' Literal.String.Char +' ' Text +"'" Literal.String.Char +"\\'" Literal.String.Escape +"'" Literal.String.Char +' ' Text +"'" Literal.String.Char +'\\n' Literal.String.Escape +"'" Literal.String.Char +' ' Text +"' '" Literal.String.Char +'\n' Text + +'super' Name.Builtin.Pseudo +' ' Text +'this' Name.Builtin.Pseudo +'\n' Text diff --git a/tests/examplefiles/scala/declarations.scala b/tests/examplefiles/scala/declarations.scala new file mode 100644 index 0000000..3d690ae --- /dev/null +++ b/tests/examplefiles/scala/declarations.scala @@ -0,0 +1,177 @@ +val x: Int +val y: Int = 1 +val z = 1 +var x: Int +var y: Int = 1 +var z = 1 +val (a, b) = (1, 2) +val Some(a) = Some(1, 2) +var Pair(a, b) = Pair(1, 2) +val Test.Pair(a) = Test.Pair(1, 2) +val a :: b = x :: Nil +var a :: b = x :: Nil +val a +: rest = ??? +val foo_+ = "foo plus" +val foo_⌬⌬ = "double benzene" + +def abs[T](x: Int): Int = if x >= 0 then new x else now -x +def abs(x: Int) = if x >= 0 then new x else now -x +def sum[A](xs: List[A])(implicit m: Monoid[A]): A = ??? +def sum[A](xs: List[A])(implicit Monoid[A]): A = ??? +def sum[A](xs: List[A])(using m: Monoid[A]): A = ??? +def sum[A](xs: List[A])(using Monoid[A]): A = ??? +def reduceRight(op: (T, T) => T): T = ??? +def foldRight[](z: U)(op: (T, U) => U): U = ??? +def obj(fields: (String, Any)*, test: String): Json +def :: (xs: List[T]): List[T] = ::(x, xs) +def ::(xs: List[T]): List[T] = ::(x, xs) + +trait X {} +object X +class Y +open object X: +open class Y: +case object X +case class Y() +package object x {} +package object y: + +type X +type X <: Y +type X = Y +type X[Y] = Y with Z +type X[Y] = Y => (1 | 2, 3) +type X[Y] = (Y, 3) => (1 | 2, 3) +type Foo = Bar.Baz + +given Foo = ??? +given foo = ??? +given foo: Foo with +given listOrd[T: Ordering]: Ordering[List[T]] with +given listOrd(using ev: Ev): Foo with +given Ordering[Int] with +given Foo with +given [T: Ordering]: Ordering[List[T]] with +given (using ev: Ev): Foo with +given intOrd: Ordering[Int] with +given foo: Foo = ??? +given `foo`: Foo = ??? +given listOrd[T: Ordering]: Ordering[List[T]] = ??? +given listOrd(using ev: Ev): Foo = ??? +given Ordering[Int] = ??? +given Foo = ??? +given [T: Ordering]: Ordering[List[T]] = ??? +given (using ev: Ev): Foo = ??? + +given sumMonoid: Monoid[Int] with + extension (x: Int) def combine(y: Int) : Int = x + y + def unit: Int = 0 + +trait Ord[T]: + def compare(x: T, y: T): Int + extension (x: T) def < (y: T) = compare(x, y) < 0 + extension (x: T) def > (y: T) = compare(x, y) > 0 +given intOrd: Ord[Int] with + def compare(x: Int, y: Int) = + if x < y then -1 else if x > y then +1 else 0 +given listOrd[T](using ord: Ord[T]): Ord[List[T]] with + def compare(xs: List[T], ys: List[T]): Int = (xs, ys) match + case (Nil, Nil) => 0 + case (Nil, _) => -1 + case (_, Nil) => +1 + case (x :: xs1, y :: ys1) => + val fst = ord.compare(x, y) + if fst != 0 then fst else compare(xs1, ys1) +trait A with + given ac: C +trait B extends A with + given bc: C +object O extends B with + val x = summon[C] + +// Classes +class A +class B +class Bar with +class Foo with +class :: with +class Rational(x: Int, y: Int) with + def numer = x + def denom = y +class Cons(_head: Int, _tail: IntList) extends IntList with + val head = _head + val tail = _tail +class Int with + def + (that: Double): Double + def + (that: Float): Float + def + (that: Long): Long + def + (that: Int): Int // same for -, *, /, % + def << (cnt: Int): Int // same for >>, >>> */ + def & (that: Long): Long + def & (that: Int): Int // same for |, ^ */ + def == (that: Double): Boolean + def == (that: Float): Boolean + def == (that: Long): Boolean // same for !=, <, >, <=, >= +end Int +class Sub extends Base with Something { + override def foo = 2 + def bar = 3 +} +class Succ(n: Nat) extends Nat with + // ... +open class Writer[T] { + /** Sends to stdout, can be overridden */ + def send(x: T) = println(x) + /** Sends all arguments using `send` */ + def sendAll(xs: T*) = xs.foreach(send) +} +class LazyList[+T](init: => State[T]) with + lazy val state: State[T] = init + +trait Foo with +trait Bar with +trait *: with +trait *: with +trait :: with +1 :: Nil +1 :: + +object ⌘ { + +} +object Foo with +object Bar with +object Zero extends Nat with + ... + +object Enum extends Enumeration { + val Foo, Bar, Baz = Value +} +enum Color with + case Red, Green, Blue, Magenta +enum Color(val test: Int) with + case Red, Green, Blue, Magenta + def isPrimary(color: Color): Boolean = + color match + case Red | Green | Blue => true + case Magenta => false +enum State[T] with + case Empty + case Cons(hd: T, tl: LazyList[T]) +abstract class Color +object Color { + val Red = Color() + val Green = Color() + val Blue = Color() + val Magenta = Color() + ... +} +enum Vehicle(val numberOfWheels: Int) { + case Unicycle extends Vehicle(1) + case Bicycle extends Vehicle(2) + case Car extends Vehicle(4) +} +enum Vehicle(val numberOfWheels: Int): + case Unicycle extends Vehicle(1) + case Bicycle extends Vehicle(2) + case Car extends Vehicle(4) \ No newline at end of file diff --git a/tests/examplefiles/scala/declarations.scala.output b/tests/examplefiles/scala/declarations.scala.output new file mode 100644 index 0000000..d63c86e --- /dev/null +++ b/tests/examplefiles/scala/declarations.scala.output @@ -0,0 +1,2251 @@ +'val' Keyword.Declaration +' ' Text +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +'\n' Text + +'val' Keyword.Declaration +' ' Text +'y' Name +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'val' Keyword.Declaration +' ' Text +'z' Name +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'var' Keyword.Declaration +' ' Text +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +'\n' Text + +'var' Keyword.Declaration +' ' Text +'y' Name +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'var' Keyword.Declaration +' ' Text +'z' Name +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'val' Keyword.Declaration +' ' Text +'(' Punctuation +'a' Name +',' Punctuation +' ' Text +'b' Name +')' Punctuation +' ' Text +'=' Operator +' ' Text +'(' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text +'2' Literal.Number.Integer +')' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'Some' Name.Class +'(' Punctuation +'a' Name +')' Punctuation +' ' Text +'=' Operator +' ' Text +'Some' Name.Class +'(' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text +'2' Literal.Number.Integer +')' Punctuation +'\n' Text + +'var' Keyword.Declaration +' ' Text +'Pair' Name.Class +'(' Punctuation +'a' Name +',' Punctuation +' ' Text +'b' Name +')' Punctuation +' ' Text +'=' Operator +' ' Text +'Pair' Name.Class +'(' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text +'2' Literal.Number.Integer +')' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'Test' Name.Class +'.' Punctuation +'Pair' Name.Class +'(' Punctuation +'a' Name +')' Punctuation +' ' Text +'=' Operator +' ' Text +'Test' Name.Class +'.' Punctuation +'Pair' Name.Class +'(' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text +'2' Literal.Number.Integer +')' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'a' Name +' ' Text +'::' Operator +' ' Text +'b' Name +' ' Text +'=' Operator +' ' Text +'x' Name +' ' Text +'::' Operator +' ' Text +'Nil' Name.Class +'\n' Text + +'var' Keyword.Declaration +' ' Text +'a' Name +' ' Text +'::' Operator +' ' Text +'b' Name +' ' Text +'=' Operator +' ' Text +'x' Name +' ' Text +'::' Operator +' ' Text +'Nil' Name.Class +'\n' Text + +'val' Keyword.Declaration +' ' Text +'a' Name +' ' Text +'+:' Operator +' ' Text +'rest' Name +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'val' Keyword.Declaration +' ' Text +'foo_+' Name +' ' Text +'=' Operator +' ' Text +'"foo plus"' Literal.String +'\n' Text + +'val' Keyword.Declaration +' ' Text +'foo_⌬⌬' Name +' ' Text +'=' Operator +' ' Text +'"double benzene"' Literal.String +'\n\n' Text + +'def' Keyword +' ' Text +'abs' Name.Function +'[' Punctuation +'T' Name.Class +']' Punctuation +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'=' Operator +' ' Text +'if' Keyword +' ' Text +'x' Name +' ' Text +'>=' Operator +' ' Text +'0' Literal.Number.Integer +' ' Text +'then' Keyword +' ' Text +'new' Keyword +' ' Text +'x' Name +' ' Text +'else' Keyword +' ' Text +'now' Name +' ' Text +'-' Operator +'x' Name +'\n' Text + +'def' Keyword +' ' Text +'abs' Name.Function +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'=' Operator +' ' Text +'if' Keyword +' ' Text +'x' Name +' ' Text +'>=' Operator +' ' Text +'0' Literal.Number.Integer +' ' Text +'then' Keyword +' ' Text +'new' Keyword +' ' Text +'x' Name +' ' Text +'else' Keyword +' ' Text +'now' Name +' ' Text +'-' Operator +'x' Name +'\n' Text + +'def' Keyword +' ' Text +'sum' Name.Function +'[' Punctuation +'A' Name.Class +']' Punctuation +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'A' Name.Class +']' Punctuation +')' Punctuation +'(' Punctuation +'implicit' Keyword +' ' Text +'m' Name +':' Punctuation +' ' Text +'Monoid' Name.Class +'[' Punctuation +'A' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'A' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'def' Keyword +' ' Text +'sum' Name.Function +'[' Punctuation +'A' Name.Class +']' Punctuation +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'A' Name.Class +']' Punctuation +')' Punctuation +'(' Punctuation +'implicit' Keyword +' ' Text +'Monoid' Name.Class +'[' Punctuation +'A' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'A' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'def' Keyword +' ' Text +'sum' Name.Function +'[' Punctuation +'A' Name.Class +']' Punctuation +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'A' Name.Class +']' Punctuation +')' Punctuation +'(' Punctuation +'using' Keyword +' ' Text +'m' Name +':' Punctuation +' ' Text +'Monoid' Name.Class +'[' Punctuation +'A' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'A' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'def' Keyword +' ' Text +'sum' Name.Function +'[' Punctuation +'A' Name.Class +']' Punctuation +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'A' Name.Class +']' Punctuation +')' Punctuation +'(' Punctuation +'using' Keyword +' ' Text +'Monoid' Name.Class +'[' Punctuation +'A' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'A' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'def' Keyword +' ' Text +'reduceRight' Name.Function +'(' Punctuation +'op' Name +':' Punctuation +' ' Text +'(' Punctuation +'T' Name.Class +',' Punctuation +' ' Text +'T' Name.Class +')' Punctuation +' ' Text +'=>' Operator +' ' Text +'T' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'T' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'def' Keyword +' ' Text +'foldRight' Name.Function +'[' Punctuation +']' Punctuation +'(' Punctuation +'z' Name +':' Punctuation +' ' Text +'U' Name.Class +')' Punctuation +'(' Punctuation +'op' Name +':' Punctuation +' ' Text +'(' Punctuation +'T' Name.Class +',' Punctuation +' ' Text +'U' Name.Class +')' Punctuation +' ' Text +'=>' Operator +' ' Text +'U' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'U' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'def' Keyword +' ' Text +'obj' Name.Function +'(' Punctuation +'fields' Name +':' Punctuation +' ' Text +'(' Punctuation +'String' Name.Class +',' Punctuation +' ' Text +'Any' Name.Class +')' Punctuation +'*' Operator +',' Punctuation +' ' Text +'test' Name +':' Punctuation +' ' Text +'String' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Json' Name.Class +'\n' Text + +'def' Keyword +' ' Text +'::' Name.Function +' ' Text +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'::' Name +'(' Punctuation +'x' Name +',' Punctuation +' ' Text +'xs' Name +')' Punctuation +'\n' Text + +'def' Keyword +' ' Text +'::' Name.Function +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'::' Name +'(' Punctuation +'x' Name +',' Punctuation +' ' Text +'xs' Name +')' Punctuation +'\n\n' Text + +'trait' Keyword +' ' Text +'X' Name.Class +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'object' Keyword +' ' Text +'X' Name.Class +'\n' Text + +'class' Keyword +' ' Text +'Y' Name.Class +'\n' Text + +'open' Keyword +' ' Text +'object' Keyword +' ' Text +'X' Name.Class +':' Punctuation +'\n' Text + +'open' Keyword +' ' Text +'class' Keyword +' ' Text +'Y' Name.Class +':' Punctuation +'\n' Text + +'case' Keyword +' ' Text +'object' Keyword +' ' Text +'X' Name.Class +'\n' Text + +'case' Keyword +' ' Text +'class' Keyword +' ' Text +'Y' Name.Class +'(' Punctuation +')' Punctuation +'\n' Text + +'package' Keyword +' ' Text +'object' Keyword +' ' Text +'x' Name.Namespace +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'package' Keyword +' ' Text +'object' Keyword +' ' Text +'y' Name.Namespace +':' Punctuation +'\n\n' Text + +'type' Keyword +' ' Text +'X' Name.Class +'\n' Text + +'type' Keyword +' ' Text +'X' Name.Class +' ' Text +'<:' Operator +' ' Text +'Y' Name.Class +'\n' Text + +'type' Keyword +' ' Text +'X' Name.Class +' ' Text +'=' Operator +' ' Text +'Y' Name.Class +'\n' Text + +'type' Keyword +' ' Text +'X' Name.Class +'[' Punctuation +'Y' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'Y' Name.Class +' ' Text +'with' Keyword +' ' Text +'Z' Name.Class +'\n' Text + +'type' Keyword +' ' Text +'X' Name.Class +'[' Punctuation +'Y' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'Y' Name.Class +' ' Text +'=>' Operator +' ' Text +'(' Punctuation +'1' Literal.Number.Integer +' ' Text +'|' Operator +' ' Text +'2' Literal.Number.Integer +',' Punctuation +' ' Text +'3' Literal.Number.Integer +')' Punctuation +'\n' Text + +'type' Keyword +' ' Text +'X' Name.Class +'[' Punctuation +'Y' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'(' Punctuation +'Y' Name.Class +',' Punctuation +' ' Text +'3' Literal.Number.Integer +')' Punctuation +' ' Text +'=>' Operator +' ' Text +'(' Punctuation +'1' Literal.Number.Integer +' ' Text +'|' Operator +' ' Text +'2' Literal.Number.Integer +',' Punctuation +' ' Text +'3' Literal.Number.Integer +')' Punctuation +'\n' Text + +'type' Keyword +' ' Text +'Foo' Name.Class +' ' Text +'=' Operator +' ' Text +'Bar' Name.Class +'.' Punctuation +'Baz' Name.Class +'\n\n' Text + +'given' Keyword +' ' Text +'Foo' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'given' Keyword +' ' Text +'foo' Name +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'given' Keyword +' ' Text +'foo' Name +':' Punctuation +' ' Text +'Foo' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'given' Keyword +' ' Text +'listOrd' Name +'[' Punctuation +'T' Name.Class +':' Punctuation +' ' Text +'Ordering' Name.Class +']' Punctuation +':' Punctuation +' ' Text +'Ordering' Name.Class +'[' Punctuation +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +']' Punctuation +' ' Text +'with' Keyword +'\n' Text + +'given' Keyword +' ' Text +'listOrd' Name +'(' Punctuation +'using' Keyword +' ' Text +'ev' Name +':' Punctuation +' ' Text +'Ev' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Foo' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'given' Keyword +' ' Text +'Ordering' Name.Class +'[' Punctuation +'Int' Name.Class +']' Punctuation +' ' Text +'with' Keyword +'\n' Text + +'given' Keyword +' ' Text +'Foo' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'given' Keyword +' ' Text +'[' Punctuation +'T' Name.Class +':' Punctuation +' ' Text +'Ordering' Name.Class +']' Punctuation +':' Punctuation +' ' Text +'Ordering' Name.Class +'[' Punctuation +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +']' Punctuation +' ' Text +'with' Keyword +'\n' Text + +'given' Keyword +' ' Text +'(' Punctuation +'using' Keyword +' ' Text +'ev' Name +':' Punctuation +' ' Text +'Ev' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Foo' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'given' Keyword +' ' Text +'intOrd' Name +':' Punctuation +' ' Text +'Ordering' Name.Class +'[' Punctuation +'Int' Name.Class +']' Punctuation +' ' Text +'with' Keyword +'\n' Text + +'given' Keyword +' ' Text +'foo' Name +':' Punctuation +' ' Text +'Foo' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'given' Keyword +' ' Text +'`foo`' Name +':' Punctuation +' ' Text +'Foo' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'given' Keyword +' ' Text +'listOrd' Name +'[' Punctuation +'T' Name.Class +':' Punctuation +' ' Text +'Ordering' Name.Class +']' Punctuation +':' Punctuation +' ' Text +'Ordering' Name.Class +'[' Punctuation +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +']' Punctuation +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'given' Keyword +' ' Text +'listOrd' Name +'(' Punctuation +'using' Keyword +' ' Text +'ev' Name +':' Punctuation +' ' Text +'Ev' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Foo' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'given' Keyword +' ' Text +'Ordering' Name.Class +'[' Punctuation +'Int' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'given' Keyword +' ' Text +'Foo' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'given' Keyword +' ' Text +'[' Punctuation +'T' Name.Class +':' Punctuation +' ' Text +'Ordering' Name.Class +']' Punctuation +':' Punctuation +' ' Text +'Ordering' Name.Class +'[' Punctuation +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +']' Punctuation +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'given' Keyword +' ' Text +'(' Punctuation +'using' Keyword +' ' Text +'ev' Name +':' Punctuation +' ' Text +'Ev' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Foo' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n\n' Text + +'given' Keyword +' ' Text +'sumMonoid' Name +':' Punctuation +' ' Text +'Monoid' Name.Class +'[' Punctuation +'Int' Name.Class +']' Punctuation +' ' Text +'with' Keyword +'\n ' Text +'extension' Keyword +' ' Text +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'def' Keyword +' ' Text +'combine' Name.Function +'(' Punctuation +'y' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'=' Operator +' ' Text +'x' Name +' ' Text +'+' Operator +' ' Text +'y' Name +' \n ' Text +'def' Keyword +' ' Text +'unit' Name.Function +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'=' Operator +' ' Text +'0' Literal.Number.Integer +'\n\n' Text + +'trait' Keyword +' ' Text +'Ord' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +':' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'compare' Name.Function +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'T' Name.Class +',' Punctuation +' ' Text +'y' Name +':' Punctuation +' ' Text +'T' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Int' Name.Class +'\n ' Text +'extension' Keyword +' ' Text +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'T' Name.Class +')' Punctuation +' ' Text +'def' Keyword +' ' Text +'<' Name.Function +' ' Text +'(' Punctuation +'y' Name +':' Punctuation +' ' Text +'T' Name.Class +')' Punctuation +' ' Text +'=' Operator +' ' Text +'compare' Name +'(' Punctuation +'x' Name +',' Punctuation +' ' Text +'y' Name +')' Punctuation +' ' Text +'<' Operator +' ' Text +'0' Literal.Number.Integer +'\n ' Text +'extension' Keyword +' ' Text +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'T' Name.Class +')' Punctuation +' ' Text +'def' Keyword +' ' Text +'>' Name.Function +' ' Text +'(' Punctuation +'y' Name +':' Punctuation +' ' Text +'T' Name.Class +')' Punctuation +' ' Text +'=' Operator +' ' Text +'compare' Name +'(' Punctuation +'x' Name +',' Punctuation +' ' Text +'y' Name +')' Punctuation +' ' Text +'>' Operator +' ' Text +'0' Literal.Number.Integer +'\n' Text + +'given' Keyword +' ' Text +'intOrd' Name +':' Punctuation +' ' Text +'Ord' Name.Class +'[' Punctuation +'Int' Name.Class +']' Punctuation +' ' Text +'with' Keyword +'\n ' Text +'def' Keyword +' ' Text +'compare' Name.Function +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +',' Punctuation +' ' Text +'y' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'=' Operator +'\n ' Text +'if' Keyword +' ' Text +'x' Name +' ' Text +'<' Operator +' ' Text +'y' Name +' ' Text +'then' Keyword +' ' Text +'-' Operator +'1' Literal.Number.Integer +' ' Text +'else' Keyword +' ' Text +'if' Keyword +' ' Text +'x' Name +' ' Text +'>' Operator +' ' Text +'y' Name +' ' Text +'then' Keyword +' ' Text +'+' Operator +'1' Literal.Number.Integer +' ' Text +'else' Keyword +' ' Text +'0' Literal.Number.Integer +'\n' Text + +'given' Keyword +' ' Text +'listOrd' Name +'[' Punctuation +'T' Name.Class +']' Punctuation +'(' Punctuation +'using' Keyword +' ' Text +'ord' Name +':' Punctuation +' ' Text +'Ord' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'Ord' Name.Class +'[' Punctuation +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +']' Punctuation +' ' Text +'with' Keyword +'\n ' Text +'def' Keyword +' ' Text +'compare' Name.Function +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +',' Punctuation +' ' Text +'ys' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'=' Operator +' ' Text +'(' Punctuation +'xs' Name +',' Punctuation +' ' Text +'ys' Name +')' Punctuation +' ' Text +'match' Keyword +'\n ' Text +'case' Keyword +' ' Text +'(' Punctuation +'Nil' Name.Class +',' Punctuation +' ' Text +'Nil' Name.Class +')' Punctuation +' ' Text +'=>' Operator +' ' Text +'0' Literal.Number.Integer +'\n ' Text +'case' Keyword +' ' Text +'(' Punctuation +'Nil' Name.Class +',' Punctuation +' ' Text +'_' Name +')' Punctuation +' ' Text +'=>' Operator +' ' Text +'-' Operator +'1' Literal.Number.Integer +'\n ' Text +'case' Keyword +' ' Text +'(' Punctuation +'_' Name +',' Punctuation +' ' Text +'Nil' Name.Class +')' Punctuation +' ' Text +'=>' Operator +' ' Text +'+' Operator +'1' Literal.Number.Integer +'\n ' Text +'case' Keyword +' ' Text +'(' Punctuation +'x' Name +' ' Text +'::' Operator +' ' Text +'xs1' Name +',' Punctuation +' ' Text +'y' Name +' ' Text +'::' Operator +' ' Text +'ys1' Name +')' Punctuation +' ' Text +'=>' Operator +'\n ' Text +'val' Keyword.Declaration +' ' Text +'fst' Name +' ' Text +'=' Operator +' ' Text +'ord' Name +'.' Punctuation +'compare' Name +'(' Punctuation +'x' Name +',' Punctuation +' ' Text +'y' Name +')' Punctuation +'\n ' Text +'if' Keyword +' ' Text +'fst' Name +' ' Text +'!=' Operator +' ' Text +'0' Literal.Number.Integer +' ' Text +'then' Keyword +' ' Text +'fst' Name +' ' Text +'else' Keyword +' ' Text +'compare' Name +'(' Punctuation +'xs1' Name +',' Punctuation +' ' Text +'ys1' Name +')' Punctuation +'\n' Text + +'trait' Keyword +' ' Text +'A' Name.Class +' ' Text +'with' Keyword +'\n ' Text +'given' Keyword +' ' Text +'ac' Name +':' Punctuation +' ' Text +'C' Name.Class +'\n' Text + +'trait' Keyword +' ' Text +'B' Name.Class +' ' Text +'extends' Keyword +' ' Text +'A' Name.Class +' ' Text +'with' Keyword +'\n ' Text +'given' Keyword +' ' Text +'bc' Name +':' Punctuation +' ' Text +'C' Name.Class +'\n' Text + +'object' Keyword +' ' Text +'O' Name.Class +' ' Text +'extends' Keyword +' ' Text +'B' Name.Class +' ' Text +'with' Keyword +'\n ' Text +'val' Keyword.Declaration +' ' Text +'x' Name +' ' Text +'=' Operator +' ' Text +'summon' Name +'[' Punctuation +'C' Name.Class +']' Punctuation +'\n\n' Text + +'// Classes\n' Comment.Single + +'class' Keyword +' ' Text +'A' Name.Class +'\n' Text + +'class' Keyword +' ' Text +'B' Name.Class +'\n' Text + +'class' Keyword +' ' Text +'Bar' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'class' Keyword +' ' Text +'Foo' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'class' Keyword +' ' Text +'::' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'class' Keyword +' ' Text +'Rational' Name.Class +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +',' Punctuation +' ' Text +'y' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'with' Keyword +'\n ' Text +'def' Keyword +' ' Text +'numer' Name.Function +' ' Text +'=' Operator +' ' Text +'x' Name +'\n ' Text +'def' Keyword +' ' Text +'denom' Name.Function +' ' Text +'=' Operator +' ' Text +'y' Name +'\n' Text + +'class' Keyword +' ' Text +'Cons' Name.Class +'(' Punctuation +'_head' Name +':' Punctuation +' ' Text +'Int' Name.Class +',' Punctuation +' ' Text +'_tail' Name +':' Punctuation +' ' Text +'IntList' Name.Class +')' Punctuation +' ' Text +'extends' Keyword +' ' Text +'IntList' Name.Class +' ' Text +'with' Keyword +'\n ' Text +'val' Keyword.Declaration +' ' Text +'head' Name +' ' Text +'=' Operator +' ' Text +'_head' Name +'\n ' Text +'val' Keyword.Declaration +' ' Text +'tail' Name +' ' Text +'=' Operator +' ' Text +'_tail' Name +'\n' Text + +'class' Keyword +' ' Text +'Int' Name.Class +' ' Text +'with' Keyword +'\n ' Text +'def' Keyword +' ' Text +'+' Name.Function +' ' Text +'(' Punctuation +'that' Name +':' Punctuation +' ' Text +'Double' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Double' Name.Class +'\n ' Text +'def' Keyword +' ' Text +'+' Name.Function +' ' Text +'(' Punctuation +'that' Name +':' Punctuation +' ' Text +'Float' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Float' Name.Class +'\n ' Text +'def' Keyword +' ' Text +'+' Name.Function +' ' Text +'(' Punctuation +'that' Name +':' Punctuation +' ' Text +'Long' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Long' Name.Class +'\n ' Text +'def' Keyword +' ' Text +'+' Name.Function +' ' Text +'(' Punctuation +'that' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'// same for -, *, /, %\n' Comment.Single + +' ' Text +'def' Keyword +' ' Text +'<<' Name.Function +' ' Text +'(' Punctuation +'cnt' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'// same for >>, >>> */\n' Comment.Single + +' ' Text +'def' Keyword +' ' Text +'&' Name.Function +' ' Text +'(' Punctuation +'that' Name +':' Punctuation +' ' Text +'Long' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Long' Name.Class +'\n ' Text +'def' Keyword +' ' Text +'&' Name.Function +' ' Text +'(' Punctuation +'that' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'// same for |, ^ */\n' Comment.Single + +' ' Text +'def' Keyword +' ' Text +'==' Name.Function +' ' Text +'(' Punctuation +'that' Name +':' Punctuation +' ' Text +'Double' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Boolean' Name.Class +'\n ' Text +'def' Keyword +' ' Text +'==' Name.Function +' ' Text +'(' Punctuation +'that' Name +':' Punctuation +' ' Text +'Float' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Boolean' Name.Class +'\n ' Text +'def' Keyword +' ' Text +'==' Name.Function +' ' Text +'(' Punctuation +'that' Name +':' Punctuation +' ' Text +'Long' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Boolean' Name.Class +' ' Text +'// same for !=, <, >, <=, >=\n' Comment.Single + +'end' Keyword +' ' Text +'Int' Name.Class +'\n' Text + +'class' Keyword +' ' Text +'Sub' Name.Class +' ' Text +'extends' Keyword +' ' Text +'Base' Name.Class +' ' Text +'with' Keyword +' ' Text +'Something' Name.Class +' ' Text +'{' Punctuation +'\n ' Text +'override' Keyword +' ' Text +'def' Keyword +' ' Text +'foo' Name.Function +' ' Text +'=' Operator +' ' Text +'2' Literal.Number.Integer +'\n ' Text +'def' Keyword +' ' Text +'bar' Name.Function +' ' Text +'=' Operator +' ' Text +'3' Literal.Number.Integer +'\n' Text + +'}' Punctuation +'\n' Text + +'class' Keyword +' ' Text +'Succ' Name.Class +'(' Punctuation +'n' Name +':' Punctuation +' ' Text +'Nat' Name.Class +')' Punctuation +' ' Text +'extends' Keyword +' ' Text +'Nat' Name.Class +' ' Text +'with' Keyword +'\n ' Text +'// ...\n' Comment.Single + +'open' Keyword +' ' Text +'class' Keyword +' ' Text +'Writer' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +' ' Text +'{' Punctuation +'\n ' Text +'/*' Comment.Multiline +'*' Comment.Multiline +' Sends to stdout, can be overridden ' Comment.Multiline +'*/' Comment.Multiline +'\n ' Text +'def' Keyword +' ' Text +'send' Name.Function +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'T' Name.Class +')' Punctuation +' ' Text +'=' Operator +' ' Text +'println' Name +'(' Punctuation +'x' Name +')' Punctuation +'\n ' Text +'/*' Comment.Multiline +'*' Comment.Multiline +' Sends all arguments using `send` ' Comment.Multiline +'*/' Comment.Multiline +'\n ' Text +'def' Keyword +' ' Text +'sendAll' Name.Function +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'T' Name.Class +'*' Operator +')' Punctuation +' ' Text +'=' Operator +' ' Text +'xs' Name +'.' Punctuation +'foreach' Name +'(' Punctuation +'send' Name +')' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text + +'class' Keyword +' ' Text +'LazyList' Name.Class +'[' Punctuation +'+' Operator +'T' Name.Class +']' Punctuation +'(' Punctuation +'init' Name +':' Punctuation +' ' Text +'=>' Operator +' ' Text +'State' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +' ' Text +'with' Keyword +'\n ' Text +'lazy' Keyword +' ' Text +'val' Keyword.Declaration +' ' Text +'state' Name +':' Punctuation +' ' Text +'State' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'init' Name +'\t\t\t\n\n' Text + +'trait' Keyword +' ' Text +'Foo' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'trait' Keyword +' ' Text +'Bar' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'trait' Keyword +' ' Text +'*:' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'trait' Keyword +' ' Text +'*:' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'trait' Keyword +' ' Text +'::' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'1' Literal.Number.Integer +' ' Text +'::' Operator +' ' Text +'Nil' Name.Class +'\n' Text + +'1' Literal.Number.Integer +' ' Text +'::' Operator +'\n\n' Text + +'object' Keyword +' ' Text +'⌘' Name.Class +' ' Text +'{' Punctuation +'\n \n' Text + +'}' Punctuation +'\n' Text + +'object' Keyword +' ' Text +'Foo' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'object' Keyword +' ' Text +'Bar' Name.Class +' ' Text +'with' Keyword +'\n' Text + +'object' Keyword +' ' Text +'Zero' Name.Class +' ' Text +'extends' Keyword +' ' Text +'Nat' Name.Class +' ' Text +'with' Keyword +'\n ' Text +'.' Punctuation +'.' Punctuation +'.' Punctuation +'\n\n' Text + +'object' Keyword +' ' Text +'Enum' Name.Class +' ' Text +'extends' Keyword +' ' Text +'Enumeration' Name.Class +' ' Text +'{' Punctuation +'\n ' Text +'val' Keyword.Declaration +' ' Text +'Foo' Name.Class +',' Punctuation +' ' Text +'Bar' Name.Class +',' Punctuation +' ' Text +'Baz' Name.Class +' ' Text +'=' Operator +' ' Text +'Value' Name.Class +'\n' Text + +'}' Punctuation +'\n' Text + +'enum' Keyword +' ' Text +'Color' Name.Class +' ' Text +'with' Keyword +'\n ' Text +'case' Keyword +' ' Text +'Red' Name.Class +',' Punctuation +' ' Text +'Green' Name.Class +',' Punctuation +' ' Text +'Blue' Name.Class +',' Punctuation +' ' Text +'Magenta' Name.Class +'\n' Text + +'enum' Keyword +' ' Text +'Color' Name.Class +'(' Punctuation +'val' Keyword.Declaration +' ' Text +'test' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'with' Keyword +'\n ' Text +'case' Keyword +' ' Text +'Red' Name.Class +',' Punctuation +' ' Text +'Green' Name.Class +',' Punctuation +' ' Text +'Blue' Name.Class +',' Punctuation +' ' Text +'Magenta' Name.Class +'\n ' Text +'def' Keyword +' ' Text +'isPrimary' Name.Function +'(' Punctuation +'color' Name +':' Punctuation +' ' Text +'Color' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Boolean' Name.Class +' ' Text +'=' Operator +'\n ' Text +'color' Name +' ' Text +'match' Keyword +'\n ' Text +'case' Keyword +' ' Text +'Red' Name.Class +' ' Text +'|' Operator +' ' Text +'Green' Name.Class +' ' Text +'|' Operator +' ' Text +'Blue' Name.Class +' ' Text +'=>' Operator +' ' Text +'true' Keyword.Constant +'\n ' Text +'case' Keyword +' ' Text +'Magenta' Name.Class +' ' Text +'=>' Operator +' ' Text +'false' Keyword.Constant +'\n' Text + +'enum' Keyword +' ' Text +'State' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +' ' Text +'with' Keyword +'\n ' Text +'case' Keyword +' ' Text +'Empty' Name.Class +'\n ' Text +'case' Keyword +' ' Text +'Cons' Name.Class +'(' Punctuation +'hd' Name +':' Punctuation +' ' Text +'T' Name.Class +',' Punctuation +' ' Text +'tl' Name +':' Punctuation +' ' Text +'LazyList' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +'\n' Text + +'abstract' Keyword +' ' Text +'class' Keyword +' ' Text +'Color' Name.Class +'\n' Text + +'object' Keyword +' ' Text +'Color' Name.Class +' ' Text +'{' Punctuation +'\n ' Text +'val' Keyword.Declaration +' ' Text +'Red' Name.Class +' ' Text +'=' Operator +' ' Text +'Color' Name.Class +'(' Punctuation +')' Punctuation +'\n ' Text +'val' Keyword.Declaration +' ' Text +'Green' Name.Class +' ' Text +'=' Operator +' ' Text +'Color' Name.Class +'(' Punctuation +')' Punctuation +'\n ' Text +'val' Keyword.Declaration +' ' Text +'Blue' Name.Class +' ' Text +'=' Operator +' ' Text +'Color' Name.Class +'(' Punctuation +')' Punctuation +'\n ' Text +'val' Keyword.Declaration +' ' Text +'Magenta' Name.Class +' ' Text +'=' Operator +' ' Text +'Color' Name.Class +'(' Punctuation +')' Punctuation +'\n ' Text +'.' Punctuation +'.' Punctuation +'.' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text + +'enum' Keyword +' ' Text +'Vehicle' Name.Class +'(' Punctuation +'val' Keyword.Declaration +' ' Text +'numberOfWheels' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'{' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'Unicycle' Name.Class +' ' Text +'extends' Keyword +' ' Text +'Vehicle' Name.Class +'(' Punctuation +'1' Literal.Number.Integer +')' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'Bicycle' Name.Class +' ' Text +'extends' Keyword +' ' Text +'Vehicle' Name.Class +'(' Punctuation +'2' Literal.Number.Integer +')' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'Car' Name.Class +' ' Text +'extends' Keyword +' ' Text +'Vehicle' Name.Class +'(' Punctuation +'4' Literal.Number.Integer +')' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text + +'enum' Keyword +' ' Text +'Vehicle' Name.Class +'(' Punctuation +'val' Keyword.Declaration +' ' Text +'numberOfWheels' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +':' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'Unicycle' Name.Class +' ' Text +'extends' Keyword +' ' Text +'Vehicle' Name.Class +'(' Punctuation +'1' Literal.Number.Integer +')' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'Bicycle' Name.Class +' ' Text +'extends' Keyword +' ' Text +'Vehicle' Name.Class +'(' Punctuation +'2' Literal.Number.Integer +')' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'Car' Name.Class +' ' Text +'extends' Keyword +' ' Text +'Vehicle' Name.Class +'(' Punctuation +'4' Literal.Number.Integer +')' Punctuation +'\n' Text diff --git a/tests/examplefiles/scala/dependent-types.scala b/tests/examplefiles/scala/dependent-types.scala new file mode 100644 index 0000000..8ac232b --- /dev/null +++ b/tests/examplefiles/scala/dependent-types.scala @@ -0,0 +1,6 @@ +trait Entry { type Key; val key: Key } +def extractKey(e: Entry): e.Key = e.key +val extractor: (e: Entry) => e.Key = extractKey +type Extractor = Function1[Entry, Entry#Key] { + def apply(e: Entry): e.Key +} \ No newline at end of file diff --git a/tests/examplefiles/scala/dependent-types.scala.output b/tests/examplefiles/scala/dependent-types.scala.output new file mode 100644 index 0000000..70f2ad5 --- /dev/null +++ b/tests/examplefiles/scala/dependent-types.scala.output @@ -0,0 +1,102 @@ +'trait' Keyword +' ' Text +'Entry' Name.Class +' ' Text +'{' Punctuation +' ' Text +'type' Keyword +' ' Text +'Key' Name.Class +';' Punctuation +' ' Text +'val' Keyword.Declaration +' ' Text +'key' Name +':' Punctuation +' ' Text +'Key' Name.Class +' ' Text +'}' Punctuation +'\n' Text + +'def' Keyword +' ' Text +'extractKey' Name.Function +'(' Punctuation +'e' Name +':' Punctuation +' ' Text +'Entry' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'e' Name +'.' Punctuation +'Key' Name.Class +' ' Text +'=' Operator +' ' Text +'e' Name +'.' Punctuation +'key' Name +'\n' Text + +'val' Keyword.Declaration +' ' Text +'extractor' Name +':' Punctuation +' ' Text +'(' Punctuation +'e' Name +':' Punctuation +' ' Text +'Entry' Name.Class +')' Punctuation +' ' Text +'=>' Operator +' ' Text +'e' Name +'.' Punctuation +'Key' Name.Class +' ' Text +'=' Operator +' ' Text +'extractKey' Name +'\n' Text + +'type' Keyword +' ' Text +'Extractor' Name.Class +' ' Text +'=' Operator +' ' Text +'Function1' Name.Class +'[' Punctuation +'Entry' Name.Class +',' Punctuation +' ' Text +'Entry' Name.Class +'#' Name +'Key' Name.Class +']' Punctuation +' ' Text +'{' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'apply' Name.Function +'(' Punctuation +'e' Name +':' Punctuation +' ' Text +'Entry' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'e' Name +'.' Punctuation +'Key' Name.Class +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/examplefiles/scala/end-soft-keyword.scala b/tests/examplefiles/scala/end-soft-keyword.scala new file mode 100644 index 0000000..f734e42 --- /dev/null +++ b/tests/examplefiles/scala/end-soft-keyword.scala @@ -0,0 +1 @@ +end + 2 \ No newline at end of file diff --git a/tests/examplefiles/scala/end-soft-keyword.scala.output b/tests/examplefiles/scala/end-soft-keyword.scala.output new file mode 100644 index 0000000..39ead49 --- /dev/null +++ b/tests/examplefiles/scala/end-soft-keyword.scala.output @@ -0,0 +1,6 @@ +'end' Name +' ' Text +'+' Operator +' ' Text +'2' Literal.Number.Integer +'\n' Text diff --git a/tests/examplefiles/scala/end.scala b/tests/examplefiles/scala/end.scala new file mode 100644 index 0000000..b09bf2d --- /dev/null +++ b/tests/examplefiles/scala/end.scala @@ -0,0 +1,52 @@ +new Foo: + // ... +end new +end extension +end if +end while +end for +end match +class Foo +end Foo +end bar +end `bar` +end // test comment +package p1.p2: + abstract class C(): + def this(x: Int) = + this() + if x > 0 then + val a :: b = + x :: Nil + end val // test comment + var y = + x + end y // test comment + while y > 0 do + println(y) + y -= 1 + end while // test comment + try + x match + case 0 => println("0") + case _ => + end match // test comment + finally + println("done") + end try // test comment + end if // test comment + end this // test comment + def f: String + end C // test comment + object C: + given C = + new C: + def f = "!" + end f // test comment + end new // test comment + end given // test comment + end C // test comment + extension (x: C) + def ff: String = x.f ++ x.f + end extension // test comment +end p2 // test comment \ No newline at end of file diff --git a/tests/examplefiles/scala/end.scala.output b/tests/examplefiles/scala/end.scala.output new file mode 100644 index 0000000..3f3205c --- /dev/null +++ b/tests/examplefiles/scala/end.scala.output @@ -0,0 +1,332 @@ +'new' Keyword +' ' Text +'Foo' Name.Class +':' Punctuation +'\n ' Text +'// ...\n' Comment.Single + +'end' Keyword +' ' Text +'new' Keyword +'\n' Text + +'end' Keyword +' ' Text +'extension' Keyword +'\n' Text + +'end' Keyword +' ' Text +'if' Keyword +'\n' Text + +'end' Keyword +' ' Text +'while' Keyword +'\n' Text + +'end' Keyword +' ' Text +'for' Keyword +'\n' Text + +'end' Keyword +' ' Text +'match' Keyword +'\n' Text + +'class' Keyword +' ' Text +'Foo' Name.Class +'\n' Text + +'end' Keyword +' ' Text +'Foo' Name.Class +'\n' Text + +'end' Keyword +' ' Text +'bar' Name.Namespace +'\n' Text + +'end' Keyword +' ' Text +'`bar`' Name.Namespace +'\n' Text + +'end' Keyword +' ' Text +'// test comment\n' Comment.Single + +'package' Keyword +' ' Text +'p1' Name.Namespace +'.' Punctuation +'p2' Name +':' Punctuation +'\n ' Text +'abstract' Keyword +' ' Text +'class' Keyword +' ' Text +'C' Name.Class +'(' Punctuation +')' Punctuation +':' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'this' Name.Function +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'=' Operator +'\n ' Text +'this' Name.Builtin.Pseudo +'(' Punctuation +')' Punctuation +'\n ' Text +'if' Keyword +' ' Text +'x' Name +' ' Text +'>' Operator +' ' Text +'0' Literal.Number.Integer +' ' Text +'then' Keyword +'\n ' Text +'val' Keyword.Declaration +' ' Text +'a' Name +' ' Text +'::' Operator +' ' Text +'b' Name +' ' Text +'=' Operator +'\n ' Text +'x' Name +' ' Text +'::' Operator +' ' Text +'Nil' Name.Class +'\n ' Text +'end' Keyword +' ' Text +'val' Keyword +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'var' Keyword.Declaration +' ' Text +'y' Name +' ' Text +'=' Operator +'\n ' Text +'x' Name +'\n ' Text +'end' Keyword +' ' Text +'y' Name.Namespace +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'while' Keyword +' ' Text +'y' Name +' ' Text +'>' Operator +' ' Text +'0' Literal.Number.Integer +' ' Text +'do' Keyword +'\n ' Text +'println' Name +'(' Punctuation +'y' Name +')' Punctuation +'\n ' Text +'y' Name +' ' Text +'-=' Operator +' ' Text +'1' Literal.Number.Integer +'\n ' Text +'end' Keyword +' ' Text +'while' Keyword +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'try' Keyword +'\n ' Text +'x' Name +' ' Text +'match' Keyword +'\n ' Text +'case' Keyword +' ' Text +'0' Literal.Number.Integer +' ' Text +'=>' Operator +' ' Text +'println' Name +'(' Punctuation +'"0"' Literal.String +')' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'_' Name +' ' Text +'=>' Operator +'\n ' Text +'end' Keyword +' ' Text +'match' Keyword +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'finally' Keyword +'\n ' Text +'println' Name +'(' Punctuation +'"done"' Literal.String +')' Punctuation +'\n ' Text +'end' Keyword +' ' Text +'try' Name.Namespace +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'end' Keyword +' ' Text +'if' Keyword +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'end' Keyword +' ' Text +'this' Name.Namespace +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'def' Keyword +' ' Text +'f' Name.Function +':' Punctuation +' ' Text +'String' Name.Class +'\n ' Text +'end' Keyword +' ' Text +'C' Name.Class +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'object' Keyword +' ' Text +'C' Name.Class +':' Punctuation +'\n ' Text +'given' Keyword +' ' Text +'C' Name.Class +' ' Text +'=' Operator +'\n ' Text +'new' Keyword +' ' Text +'C' Name.Class +':' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'f' Name.Function +' ' Text +'=' Operator +' ' Text +'"!"' Literal.String +'\n ' Text +'end' Keyword +' ' Text +'f' Name.Namespace +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'end' Keyword +' ' Text +'new' Keyword +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'end' Keyword +' ' Text +'given' Name.Namespace +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'end' Keyword +' ' Text +'C' Name.Class +' ' Text +'// test comment\n' Comment.Single + +' ' Text +'extension' Keyword +' ' Text +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'C' Name.Class +')' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'ff' Name.Function +':' Punctuation +' ' Text +'String' Name.Class +' ' Text +'=' Operator +' ' Text +'x' Name +'.' Punctuation +'f' Name +' ' Text +'++' Operator +' ' Text +'x' Name +'.' Punctuation +'f' Name +'\n ' Text +'end' Keyword +' ' Text +'extension' Keyword +' ' Text +'// test comment\n' Comment.Single + +'end' Keyword +' ' Text +'p2' Name.Namespace +' ' Text +'// test comment\n' Comment.Single diff --git a/tests/examplefiles/scala/exports.scala b/tests/examplefiles/scala/exports.scala new file mode 100644 index 0000000..3223150 --- /dev/null +++ b/tests/examplefiles/scala/exports.scala @@ -0,0 +1,17 @@ +export // This is incorrect Scala but can still be highlighted correctly +export a._ +export a.x // Test comment +export a.x.y.z // Test comment +export a.{x, y} +export a.{x => y} +export a.{x => } // This is incorrect Scala but can still be highlighted correctly +export a.{x => `test-name`} // Test comment +export given +export given a // Test comment +export given a.x // Test comment +export given a._ +export given a.{x, y} // Test comment +export given a.{x => y} +export given a.{x => `test-name`} + export scanUnit.scan + export printUnit.{status => _, _} diff --git a/tests/examplefiles/scala/exports.scala.output b/tests/examplefiles/scala/exports.scala.output new file mode 100644 index 0000000..cb8f8a8 --- /dev/null +++ b/tests/examplefiles/scala/exports.scala.output @@ -0,0 +1,193 @@ +'export' Keyword +' ' Text +'// This is incorrect Scala but can still be highlighted correctly\n' Comment.Single + +'' Text +'export' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'_' Name +'\n' Text + +'export' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'x' Name +' ' Text +'// Test comment\n' Comment.Single + +'' Text +'export' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'x' Name.Namespace +'.' Punctuation +'y' Name.Namespace +'.' Punctuation +'z' Name +' ' Text +'// Test comment\n' Comment.Single + +'' Text +'export' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +',' Punctuation +' ' Text +'y' Name +'}' Punctuation +'\n' Text + +'export' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +' ' Text +'=>' Operator +' ' Text +'y' Name +'}' Punctuation +'\n' Text + +'export' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +' ' Text +'=>' Operator +' ' Text +'}' Punctuation +' ' Text +'// This is incorrect Scala but can still be highlighted correctly\n' Comment.Single + +'' Text +'export' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +' ' Text +'=>' Operator +' ' Text +'`test-name`' Name +'}' Punctuation +' ' Text +'// Test comment\n' Comment.Single + +'' Text +'export' Keyword +' ' Text +'given' Keyword +'\n' Text + +'' Text +'export' Keyword +' ' Text +'given' Keyword +' ' Text +'a' Name +' ' Text +'// Test comment\n' Comment.Single + +'' Text +'export' Keyword +' ' Text +'given' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'x' Name +' ' Text +'// Test comment\n' Comment.Single + +'' Text +'export' Keyword +' ' Text +'given' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'_' Name +'\n' Text + +'export' Keyword +' ' Text +'given' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +',' Punctuation +' ' Text +'y' Name +'}' Punctuation +' ' Text +'// Test comment\n' Comment.Single + +'' Text +'export' Keyword +' ' Text +'given' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +' ' Text +'=>' Operator +' ' Text +'y' Name +'}' Punctuation +'\n' Text + +'export' Keyword +' ' Text +'given' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +' ' Text +'=>' Operator +' ' Text +'`test-name`' Name +'}' Punctuation +'\n' Text + +' ' Text +'export' Keyword +' ' Text +'scanUnit' Name.Namespace +'.' Punctuation +'scan' Name +'\n' Text + +' ' Text +'export' Keyword +' ' Text +'printUnit' Name.Namespace +'.' Punctuation +'{' Punctuation +'status' Name +' ' Text +'=>' Operator +' ' Text +'_' Name +',' Punctuation +' ' Text +'_' Name +'}' Punctuation +'\n' Text diff --git a/tests/examplefiles/scala/extensions.scala b/tests/examplefiles/scala/extensions.scala new file mode 100644 index 0000000..2542090 --- /dev/null +++ b/tests/examplefiles/scala/extensions.scala @@ -0,0 +1,25 @@ +extension (x: String) + def < (y: String): Boolean = ... +extension (x: Elem) + def +: (xs: Seq[Elem]): Seq[Elem] = ... +extension (x: Number) + infix def min (y: Number): Number = ... +extension (ss: Seq[String]) + def longestStrings: Seq[String] = + val maxLength = ss.map(_.length).max + ss.filter(_.length == maxLength) + def longestString: String = longestStrings.head +extension (ss: Seq[String]) { + def longestStrings: Seq[String] = { + val maxLength = ss.map(_.length).max + ss.filter(_.length == maxLength) + } + def longestString: String = longestStrings.head +} +extension (i: Int) def isZero: Boolean = i == 0 +extension (i: Int) def divide(d: Int): Option[(Int, Int)] = ??? +extension (x: Rational) + infix def min(that Rational): Rational = ... +given [T: Ordering]: Ordering[List[T]] with + extension (xs: List[T]) + def < (ys: List[T]): Boolean = ... \ No newline at end of file diff --git a/tests/examplefiles/scala/extensions.scala.output b/tests/examplefiles/scala/extensions.scala.output new file mode 100644 index 0000000..b925515 --- /dev/null +++ b/tests/examplefiles/scala/extensions.scala.output @@ -0,0 +1,388 @@ +'extension' Keyword +' ' Text +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'String' Name.Class +')' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'<' Name.Function +' ' Text +'(' Punctuation +'y' Name +':' Punctuation +' ' Text +'String' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Boolean' Name.Class +' ' Text +'=' Operator +' ' Text +'.' Punctuation +'.' Punctuation +'.' Punctuation +'\n' Text + +'extension' Keyword +' ' Text +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Elem' Name.Class +')' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'+:' Name.Function +' ' Text +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'Seq' Name.Class +'[' Punctuation +'Elem' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'Seq' Name.Class +'[' Punctuation +'Elem' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'.' Punctuation +'.' Punctuation +'.' Punctuation +'\n' Text + +'extension' Keyword +' ' Text +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Number' Name.Class +')' Punctuation +'\n ' Text +'infix' Keyword +' ' Text +'def' Keyword +' ' Text +'min' Name.Function +' ' Text +'(' Punctuation +'y' Name +':' Punctuation +' ' Text +'Number' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Number' Name.Class +' ' Text +'=' Operator +' ' Text +'.' Punctuation +'.' Punctuation +'.' Punctuation +'\n' Text + +'extension' Keyword +' ' Text +'(' Punctuation +'ss' Name +':' Punctuation +' ' Text +'Seq' Name.Class +'[' Punctuation +'String' Name.Class +']' Punctuation +')' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'longestStrings' Name.Function +':' Punctuation +' ' Text +'Seq' Name.Class +'[' Punctuation +'String' Name.Class +']' Punctuation +' ' Text +'=' Operator +'\n ' Text +'val' Keyword.Declaration +' ' Text +'maxLength' Name +' ' Text +'=' Operator +' ' Text +'ss' Name +'.' Punctuation +'map' Name +'(' Punctuation +'_' Name +'.' Punctuation +'length' Name +')' Punctuation +'.' Punctuation +'max' Name +'\n ' Text +'ss' Name +'.' Punctuation +'filter' Name +'(' Punctuation +'_' Name +'.' Punctuation +'length' Name +' ' Text +'==' Operator +' ' Text +'maxLength' Name +')' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'longestString' Name.Function +':' Punctuation +' ' Text +'String' Name.Class +' ' Text +'=' Operator +' ' Text +'longestStrings' Name +'.' Punctuation +'head' Name +'\n' Text + +'extension' Keyword +' ' Text +'(' Punctuation +'ss' Name +':' Punctuation +' ' Text +'Seq' Name.Class +'[' Punctuation +'String' Name.Class +']' Punctuation +')' Punctuation +' ' Text +'{' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'longestStrings' Name.Function +':' Punctuation +' ' Text +'Seq' Name.Class +'[' Punctuation +'String' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'{' Punctuation +'\n ' Text +'val' Keyword.Declaration +' ' Text +'maxLength' Name +' ' Text +'=' Operator +' ' Text +'ss' Name +'.' Punctuation +'map' Name +'(' Punctuation +'_' Name +'.' Punctuation +'length' Name +')' Punctuation +'.' Punctuation +'max' Name +'\n ' Text +'ss' Name +'.' Punctuation +'filter' Name +'(' Punctuation +'_' Name +'.' Punctuation +'length' Name +' ' Text +'==' Operator +' ' Text +'maxLength' Name +')' Punctuation +'\n ' Text +'}' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'longestString' Name.Function +':' Punctuation +' ' Text +'String' Name.Class +' ' Text +'=' Operator +' ' Text +'longestStrings' Name +'.' Punctuation +'head' Name +'\n' Text + +'}' Punctuation +'\n' Text + +'extension' Keyword +' ' Text +'(' Punctuation +'i' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'def' Keyword +' ' Text +'isZero' Name.Function +':' Punctuation +' ' Text +'Boolean' Name.Class +' ' Text +'=' Operator +' ' Text +'i' Name +' ' Text +'==' Operator +' ' Text +'0' Literal.Number.Integer +'\n' Text + +'extension' Keyword +' ' Text +'(' Punctuation +'i' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'def' Keyword +' ' Text +'divide' Name.Function +'(' Punctuation +'d' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Option' Name.Class +'[' Punctuation +'(' Punctuation +'Int' Name.Class +',' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +']' Punctuation +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'extension' Keyword +' ' Text +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Rational' Name.Class +')' Punctuation +'\n ' Text +'infix' Keyword +' ' Text +'def' Keyword +' ' Text +'min' Name.Function +'(' Punctuation +'that' Name +' ' Text +'Rational' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Rational' Name.Class +' ' Text +'=' Operator +' ' Text +'.' Punctuation +'.' Punctuation +'.' Punctuation +'\n' Text + +'given' Keyword +' ' Text +'[' Punctuation +'T' Name.Class +':' Punctuation +' ' Text +'Ordering' Name.Class +']' Punctuation +':' Punctuation +' ' Text +'Ordering' Name.Class +'[' Punctuation +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +']' Punctuation +' ' Text +'with' Keyword +'\n ' Text +'extension' Keyword +' ' Text +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'<' Name.Function +' ' Text +'(' Punctuation +'ys' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'Boolean' Name.Class +' ' Text +'=' Operator +' ' Text +'.' Punctuation +'.' Punctuation +'.' Punctuation +'\n' Text diff --git a/tests/examplefiles/scala/for-comprehension.scala b/tests/examplefiles/scala/for-comprehension.scala new file mode 100644 index 0000000..053e554 --- /dev/null +++ b/tests/examplefiles/scala/for-comprehension.scala @@ -0,0 +1,2 @@ +for ( i <- 1 to 10 ) +for (user <- userBase if user.age >= 20 && user.age < 30) yield user.name \ No newline at end of file diff --git a/tests/examplefiles/scala/for-comprehension.scala.output b/tests/examplefiles/scala/for-comprehension.scala.output new file mode 100644 index 0000000..55147d5 --- /dev/null +++ b/tests/examplefiles/scala/for-comprehension.scala.output @@ -0,0 +1,53 @@ +'for' Keyword +' ' Text +'(' Punctuation +' ' Text +'i' Name +' ' Text +'<-' Operator +' ' Text +'1' Literal.Number.Integer +' ' Text +'to' Name +' ' Text +'10' Literal.Number.Integer +' ' Text +')' Punctuation +'\n' Text + +'for' Keyword +' ' Text +'(' Punctuation +'user' Name +' ' Text +'<-' Operator +' ' Text +'userBase' Name +' ' Text +'if' Keyword +' ' Text +'user' Name +'.' Punctuation +'age' Name +' ' Text +'>=' Operator +' ' Text +'20' Literal.Number.Integer +' ' Text +'&&' Operator +' ' Text +'user' Name +'.' Punctuation +'age' Name +' ' Text +'<' Operator +' ' Text +'30' Literal.Number.Integer +')' Punctuation +' ' Text +'yield' Keyword +' ' Text +'user' Name +'.' Punctuation +'name' Name +'\n' Text diff --git a/tests/examplefiles/scala/imports.scala b/tests/examplefiles/scala/imports.scala new file mode 100644 index 0000000..357a2f8 --- /dev/null +++ b/tests/examplefiles/scala/imports.scala @@ -0,0 +1,16 @@ +import // This is incorrect Scala but can still be highlighted correctly +import a.{x => y} // Test comment +import a.{x => } // This is incorrect Scala but can still be highlighted correctly +import a.{x => `test-name`} +import a.given +import a.{given a} +import a.{x, y} +import a._ +import a.x +import a.x.y.z +import java.io.{File, IOException, FileNotFoundException} +import java.io.File +import scala.math.{given Ordering[Int]} +import scala.math.{given Ordering[?]} +import a.givenSomething +import givenPackage diff --git a/tests/examplefiles/scala/imports.scala.output b/tests/examplefiles/scala/imports.scala.output new file mode 100644 index 0000000..408e910 --- /dev/null +++ b/tests/examplefiles/scala/imports.scala.output @@ -0,0 +1,171 @@ +'import' Keyword +' ' Text +'// This is incorrect Scala but can still be highlighted correctly\n' Comment.Single + +'' Text +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +' ' Text +'=>' Operator +' ' Text +'y' Name +'}' Punctuation +' ' Text +'// Test comment\n' Comment.Single + +'' Text +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +' ' Text +'=>' Operator +' ' Text +'}' Punctuation +' ' Text +'// This is incorrect Scala but can still be highlighted correctly\n' Comment.Single + +'' Text +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +' ' Text +'=>' Operator +' ' Text +'`test-name`' Name +'}' Punctuation +'\n' Text + +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'given' Keyword +'\n' Text + +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'given' Keyword +' ' Text +'a' Name +'}' Punctuation +'\n' Text + +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'{' Punctuation +'x' Name +',' Punctuation +' ' Text +'y' Name +'}' Punctuation +'\n' Text + +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'_' Name +'\n' Text + +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'x' Name +'\n' Text + +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'x' Name.Namespace +'.' Punctuation +'y' Name.Namespace +'.' Punctuation +'z' Name +'\n' Text + +'import' Keyword +' ' Text +'java' Name.Namespace +'.' Punctuation +'io' Name.Namespace +'.' Punctuation +'{' Punctuation +'File' Name.Class +',' Punctuation +' ' Text +'IOException' Name.Class +',' Punctuation +' ' Text +'FileNotFoundException' Name.Class +'}' Punctuation +'\n' Text + +'import' Keyword +' ' Text +'java' Name.Namespace +'.' Punctuation +'io' Name.Namespace +'.' Punctuation +'File' Name.Class +'\n' Text + +'import' Keyword +' ' Text +'scala' Name.Namespace +'.' Punctuation +'math' Name.Namespace +'.' Punctuation +'{' Punctuation +'given' Keyword +' ' Text +'Ordering' Name.Class +'[' Punctuation +'Int' Name.Class +']' Punctuation +'}' Punctuation +'\n' Text + +'import' Keyword +' ' Text +'scala' Name.Namespace +'.' Punctuation +'math' Name.Namespace +'.' Punctuation +'{' Punctuation +'given' Keyword +' ' Text +'Ordering' Name.Class +'[' Punctuation +'?' Name +']' Punctuation +'}' Punctuation +'\n' Text + +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'givenSomething' Name +'\n' Text + +'import' Keyword +' ' Text +'givenPackage' Name +'\n' Text diff --git a/tests/examplefiles/scala/inheritance.scala b/tests/examplefiles/scala/inheritance.scala new file mode 100644 index 0000000..a9d2494 --- /dev/null +++ b/tests/examplefiles/scala/inheritance.scala @@ -0,0 +1,11 @@ +// Extends +trait A extends B +trait A extends (B => B){} +trait Color +object Red extends Color + +// Derives +enum Tree[T] derives Eq, Ordering, Show { + case Branch[T](left: Tree[T], right: Tree[T]) + case Leaf[T](elem: T) +} \ No newline at end of file diff --git a/tests/examplefiles/scala/inheritance.scala.output b/tests/examplefiles/scala/inheritance.scala.output new file mode 100644 index 0000000..c55eec6 --- /dev/null +++ b/tests/examplefiles/scala/inheritance.scala.output @@ -0,0 +1,104 @@ +'// Extends\n' Comment.Single + +'trait' Keyword +' ' Text +'A' Name.Class +' ' Text +'extends' Keyword +' ' Text +'B' Name.Class +'\n' Text + +'trait' Keyword +' ' Text +'A' Name.Class +' ' Text +'extends' Keyword +' ' Text +'(' Punctuation +'B' Name.Class +' ' Text +'=>' Operator +' ' Text +'B' Name.Class +')' Punctuation +'{' Punctuation +'}' Punctuation +'\n' Text + +'trait' Keyword +' ' Text +'Color' Name.Class +'\n' Text + +'object' Keyword +' ' Text +'Red' Name.Class +' ' Text +'extends' Keyword +' ' Text +'Color' Name.Class +'\n\n' Text + +'// Derives\n' Comment.Single + +'enum' Keyword +' ' Text +'Tree' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +' ' Text +'derives' Keyword +' ' Text +'Eq' Name.Class +',' Punctuation +' ' Text +'Ordering' Name.Class +',' Punctuation +' ' Text +'Show' Name.Class +' ' Text +'{' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'Branch' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +'(' Punctuation +'left' Name +':' Punctuation +' ' Text +'Tree' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +',' Punctuation +' ' Text +'right' Name +':' Punctuation +' ' Text +'Tree' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'Leaf' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +'(' Punctuation +'elem' Name +':' Punctuation +' ' Text +'T' Name.Class +')' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/examplefiles/scala/inline.scala b/tests/examplefiles/scala/inline.scala new file mode 100644 index 0000000..fce07bb --- /dev/null +++ b/tests/examplefiles/scala/inline.scala @@ -0,0 +1,4 @@ +inline def inline(inline x: Int): Double = ??? +inline def power(x: Double, inline n: Int): Double = +inline if (n == 0) 1 else 2 +inline val c = 0 \ No newline at end of file diff --git a/tests/examplefiles/scala/inline.scala.output b/tests/examplefiles/scala/inline.scala.output new file mode 100644 index 0000000..4104d2b --- /dev/null +++ b/tests/examplefiles/scala/inline.scala.output @@ -0,0 +1,77 @@ +'inline' Keyword +' ' Text +'def' Keyword +' ' Text +'inline' Name.Function +'(' Punctuation +'inline' Keyword +' ' Text +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Double' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'inline' Keyword +' ' Text +'def' Keyword +' ' Text +'power' Name.Function +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Double' Name.Class +',' Punctuation +' ' Text +'inline' Keyword +' ' Text +'n' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Double' Name.Class +' ' Text +'=' Operator +'\n' Text + +'inline' Keyword +' ' Text +'if' Keyword +' ' Text +'(' Punctuation +'n' Name +' ' Text +'==' Operator +' ' Text +'0' Literal.Number.Integer +')' Punctuation +' ' Text +'1' Literal.Number.Integer +' ' Text +'else' Keyword +' ' Text +'2' Literal.Number.Integer +'\n' Text + +'inline' Keyword +' ' Text +'val' Keyword.Declaration +' ' Text +'c' Name +' ' Text +'=' Operator +' ' Text +'0' Literal.Number.Integer +'\n' Text diff --git a/tests/examplefiles/scala/interp.scala b/tests/examplefiles/scala/interp.scala deleted file mode 100644 index 4131b75..0000000 --- a/tests/examplefiles/scala/interp.scala +++ /dev/null @@ -1,10 +0,0 @@ -val n = 123; -val a = s"n=$n"; -val a2 = s"n=$n''"; -val b = s"""n=$n"""; -val c = f"n=$n%f"; -val d = f"""n=$n%f"""; -val d2 = s"""a""""; -val e = s"abc\u00e9"; -val f = s"a${n}b"; -val g = s"a${n + 1}b"; diff --git a/tests/examplefiles/scala/interp.scala.output b/tests/examplefiles/scala/interp.scala.output deleted file mode 100644 index 4c4c2d1..0000000 --- a/tests/examplefiles/scala/interp.scala.output +++ /dev/null @@ -1,140 +0,0 @@ -'val' Keyword -' ' Text -'n' Name -' ' Text -'=' Operator -' ' Text -'123' Literal.Number.Integer -';' Operator -'\n' Text - -'val' Keyword -' ' Text -'a' Name -' ' Text -'=' Operator -' ' Text -'s"' Literal.String -'n=' Literal.String -'$n' Literal.String.Interpol -'"' Literal.String -';' Operator -'\n' Text - -'val' Keyword -' ' Text -'a2' Name -' ' Text -'=' Operator -' ' Text -'s"' Literal.String -'n=' Literal.String -'$n' Literal.String.Interpol -"''" Literal.String -'"' Literal.String -';' Operator -'\n' Text - -'val' Keyword -' ' Text -'b' Name -' ' Text -'=' Operator -' ' Text -'s"""' Literal.String -'n=' Literal.String -'$n' Literal.String.Interpol -'"""' Literal.String -';' Operator -'\n' Text - -'val' Keyword -' ' Text -'c' Name -' ' Text -'=' Operator -' ' Text -'f"' Literal.String -'n=' Literal.String -'$n' Literal.String.Interpol -'%f' Literal.String -'"' Literal.String -';' Operator -'\n' Text - -'val' Keyword -' ' Text -'d' Name -' ' Text -'=' Operator -' ' Text -'f"""' Literal.String -'n=' Literal.String -'$n' Literal.String.Interpol -'%f' Literal.String -'"""' Literal.String -';' Operator -'\n' Text - -'val' Keyword -' ' Text -'d2' Name -' ' Text -'=' Operator -' ' Text -'s"""' Literal.String -'a' Literal.String -'"' Literal.String -'"""' Literal.String -';' Operator -'\n' Text - -'val' Keyword -' ' Text -'e' Name -' ' Text -'=' Operator -' ' Text -'s"' Literal.String -'abc' Literal.String -'\\u' Literal.String -'00e9' Literal.String -'"' Literal.String -';' Operator -'\n' Text - -'val' Keyword -' ' Text -'f' Name -' ' Text -'=' Operator -' ' Text -'s"' Literal.String -'a' Literal.String -'${' Literal.String.Interpol -'n' Name -'}' Literal.String.Interpol -'b' Literal.String -'"' Literal.String -';' Operator -'\n' Text - -'val' Keyword -' ' Text -'g' Name -' ' Text -'=' Operator -' ' Text -'s"' Literal.String -'a' Literal.String -'${' Literal.String.Interpol -'n' Name -' ' Text -'+' Operator -' ' Text -'1' Literal.Number.Integer -'}' Literal.String.Interpol -'b' Literal.String -'"' Literal.String -';' Operator -'\n' Text diff --git a/tests/examplefiles/scala/interpolated-string.scala b/tests/examplefiles/scala/interpolated-string.scala new file mode 100644 index 0000000..71ab34b --- /dev/null +++ b/tests/examplefiles/scala/interpolated-string.scala @@ -0,0 +1,25 @@ +val n = 123; +val a = s"n=$n"; +val a2 = s"n=$n''"; +val b = s"""n=$n"""; +val c = f"n=$n%f"; +val d = f"""n=$n%f"""; +val d2 = s"""a""""; +val e = s"abc\u00e9"; +val f = s"a${n}b"; +val g = s"a${n + 1}b"; + +s"1 + 2 = ${ 1 + { val x = 2; x } }." +s"""1 + 2 = ${ + def add(x: Int, y: Int) = { + x + y + } + add(1, 2) +}.""" +s"$first$second" +s"$safeTagMarker${mtch.matched}$safeTagMarker" +s"$a$a$a${b}$a${b}${b}" +s"${x$}" +s"$a$$$a" // $$ is an escape +val a = 4; foo(a) +s"$safeTagMarker${val a = 4; foo(a)}$safeTagMarker" diff --git a/tests/examplefiles/scala/interpolated-string.scala.output b/tests/examplefiles/scala/interpolated-string.scala.output new file mode 100644 index 0000000..9c65037 --- /dev/null +++ b/tests/examplefiles/scala/interpolated-string.scala.output @@ -0,0 +1,316 @@ +'val' Keyword.Declaration +' ' Text +'n' Name +' ' Text +'=' Operator +' ' Text +'123' Literal.Number.Integer +';' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'a' Name +' ' Text +'=' Operator +' ' Text +'s"' Literal.String +'n=' Literal.String +'$' Literal.String.Interpol +'n' Name +'"' Literal.String +';' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'a2' Name +' ' Text +'=' Operator +' ' Text +'s"' Literal.String +'n=' Literal.String +'$' Literal.String.Interpol +'n' Name +"''" Literal.String +'"' Literal.String +';' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'b' Name +' ' Text +'=' Operator +' ' Text +'s"""' Literal.String +'n=' Literal.String +'$' Literal.String.Interpol +'n' Name +'"""' Literal.String +';' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'c' Name +' ' Text +'=' Operator +' ' Text +'f"' Literal.String +'n=' Literal.String +'$' Literal.String.Interpol +'n' Name +'%f' Literal.String +'"' Literal.String +';' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'d' Name +' ' Text +'=' Operator +' ' Text +'f"""' Literal.String +'n=' Literal.String +'$' Literal.String.Interpol +'n' Name +'%f' Literal.String +'"""' Literal.String +';' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'d2' Name +' ' Text +'=' Operator +' ' Text +'s"""' Literal.String +'a' Literal.String +'"' Literal.String +'"""' Literal.String +';' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'e' Name +' ' Text +'=' Operator +' ' Text +'s"' Literal.String +'abc' Literal.String +'\\u' Literal.String +'00e9' Literal.String +'"' Literal.String +';' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'f' Name +' ' Text +'=' Operator +' ' Text +'s"' Literal.String +'a' Literal.String +'${' Literal.String.Interpol +'n' Name +'}' Literal.String.Interpol +'b' Literal.String +'"' Literal.String +';' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'g' Name +' ' Text +'=' Operator +' ' Text +'s"' Literal.String +'a' Literal.String +'${' Literal.String.Interpol +'n' Name +' ' Text +'+' Operator +' ' Text +'1' Literal.Number.Integer +'}' Literal.String.Interpol +'b' Literal.String +'"' Literal.String +';' Punctuation +'\n\n' Text + +'s"' Literal.String +'1 + 2 = ' Literal.String +'${' Literal.String.Interpol +' ' Text +'1' Literal.Number.Integer +' ' Text +'+' Operator +' ' Text +'{' Punctuation +' ' Text +'val' Keyword.Declaration +' ' Text +'x' Name +' ' Text +'=' Operator +' ' Text +'2' Literal.Number.Integer +';' Punctuation +' ' Text +'x' Name +' ' Text +'}' Punctuation +' ' Text +'}' Literal.String.Interpol +'.' Literal.String +'"' Literal.String +'\n' Text + +'s"""' Literal.String +'1 + 2 = ' Literal.String +'${' Literal.String.Interpol +'\n ' Text +'def' Keyword +' ' Text +'add' Name.Function +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +',' Punctuation +' ' Text +'y' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'=' Operator +' ' Text +'{' Punctuation +'\n ' Text +'x' Name +' ' Text +'+' Operator +' ' Text +'y' Name +'\n ' Text +'}' Punctuation +'\n ' Text +'add' Name +'(' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text +'2' Literal.Number.Integer +')' Punctuation +'\n' Text + +'}' Literal.String.Interpol +'.' Literal.String +'"""' Literal.String +'\n' Text + +'s"' Literal.String +'$' Literal.String.Interpol +'first' Name +'$' Literal.String.Interpol +'second' Name +'"' Literal.String +'\n' Text + +'s"' Literal.String +'$' Literal.String.Interpol +'safeTagMarker' Name +'${' Literal.String.Interpol +'mtch' Name +'.' Punctuation +'matched' Name +'}' Literal.String.Interpol +'$' Literal.String.Interpol +'safeTagMarker' Name +'"' Literal.String +'\n' Text + +'s"' Literal.String +'$' Literal.String.Interpol +'a' Name +'$' Literal.String.Interpol +'a' Name +'$' Literal.String.Interpol +'a' Name +'${' Literal.String.Interpol +'b' Name +'}' Literal.String.Interpol +'$' Literal.String.Interpol +'a' Name +'${' Literal.String.Interpol +'b' Name +'}' Literal.String.Interpol +'${' Literal.String.Interpol +'b' Name +'}' Literal.String.Interpol +'"' Literal.String +'\n' Text + +'s"' Literal.String +'${' Literal.String.Interpol +'x$' Name +'}' Literal.String.Interpol +'"' Literal.String +'\n' Text + +'s"' Literal.String +'$' Literal.String.Interpol +'a' Name +'$$' Literal.String.Escape +'$' Literal.String.Interpol +'a' Name +'"' Literal.String +' ' Text +'// $$ is an escape\n' Comment.Single + +'val' Keyword.Declaration +' ' Text +'a' Name +' ' Text +'=' Operator +' ' Text +'4' Literal.Number.Integer +';' Punctuation +' ' Text +'foo' Name +'(' Punctuation +'a' Name +')' Punctuation +'\n' Text + +'s"' Literal.String +'$' Literal.String.Interpol +'safeTagMarker' Name +'${' Literal.String.Interpol +'val' Keyword.Declaration +' ' Text +'a' Name +' ' Text +'=' Operator +' ' Text +'4' Literal.Number.Integer +';' Punctuation +' ' Text +'foo' Name +'(' Punctuation +'a' Name +')' Punctuation +'}' Literal.String.Interpol +'$' Literal.String.Interpol +'safeTagMarker' Name +'"' Literal.String +'\n' Text diff --git a/tests/examplefiles/scala/match-types.scala b/tests/examplefiles/scala/match-types.scala new file mode 100644 index 0000000..380a598 --- /dev/null +++ b/tests/examplefiles/scala/match-types.scala @@ -0,0 +1,10 @@ +type Elem[X] = X match { + case String => Char + case Array[t] => t + case Iterable[t] => t +} + +type Concat[Xs <: Tuple, +Ys <: Tuple] <: Tuple = Xs match { + case Unit => Ys + case x *: xs => x *: Concat[xs, Ys] +} \ No newline at end of file diff --git a/tests/examplefiles/scala/match-types.scala.output b/tests/examplefiles/scala/match-types.scala.output new file mode 100644 index 0000000..a1d5823 --- /dev/null +++ b/tests/examplefiles/scala/match-types.scala.output @@ -0,0 +1,113 @@ +'type' Keyword +' ' Text +'Elem' Name.Class +'[' Punctuation +'X' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'X' Name.Class +' ' Text +'match' Keyword +' ' Text +'{' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'String' Name.Class +' ' Text +'=>' Operator +' ' Text +'Char' Name.Class +'\n ' Text +'case' Keyword +' ' Text +'Array' Name.Class +'[' Punctuation +'t' Name +']' Punctuation +' ' Text +'=>' Operator +' ' Text +'t' Name +'\n ' Text +'case' Keyword +' ' Text +'Iterable' Name.Class +'[' Punctuation +'t' Name +']' Punctuation +' ' Text +'=>' Operator +' ' Text +'t' Name +'\n' Text + +'}' Punctuation +'\n\n' Text + +'type' Keyword +' ' Text +'Concat' Name.Class +'[' Punctuation +'Xs' Name.Class +' ' Text +'<:' Operator +' ' Text +'Tuple' Name.Class +',' Punctuation +' ' Text +'+' Operator +'Ys' Name.Class +' ' Text +'<:' Operator +' ' Text +'Tuple' Name.Class +']' Punctuation +' ' Text +'<:' Operator +' ' Text +'Tuple' Name.Class +' ' Text +'=' Operator +' ' Text +'Xs' Name.Class +' ' Text +'match' Keyword +' ' Text +'{' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'Unit' Name.Class +' ' Text +'=>' Operator +' ' Text +'Ys' Name.Class +'\n ' Text +'case' Keyword +' ' Text +'x' Name +' ' Text +'*:' Operator +' ' Text +'xs' Name +' ' Text +'=>' Operator +' ' Text +'x' Name +' ' Text +'*:' Operator +' ' Text +'Concat' Name.Class +'[' Punctuation +'xs' Name +',' Punctuation +' ' Text +'Ys' Name.Class +']' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/examplefiles/scala/new.scala b/tests/examplefiles/scala/new.scala new file mode 100644 index 0000000..df34bf8 --- /dev/null +++ b/tests/examplefiles/scala/new.scala @@ -0,0 +1,7 @@ +new A +new { } +new Foo +new foo.Foo +new Foo.Foo +new A: + def f = 3 \ No newline at end of file diff --git a/tests/examplefiles/scala/new.scala.output b/tests/examplefiles/scala/new.scala.output new file mode 100644 index 0000000..809c218 --- /dev/null +++ b/tests/examplefiles/scala/new.scala.output @@ -0,0 +1,44 @@ +'new' Keyword +' ' Text +'A' Name.Class +'\n' Text + +'new' Keyword +' ' Text +'{' Punctuation +' ' Text +'}' Punctuation +'\n' Text + +'new' Keyword +' ' Text +'Foo' Name.Class +'\n' Text + +'new' Keyword +' ' Text +'foo' Name +'.' Punctuation +'Foo' Name.Class +'\n' Text + +'new' Keyword +' ' Text +'Foo' Name.Class +'.' Punctuation +'Foo' Name.Class +'\n' Text + +'new' Keyword +' ' Text +'A' Name.Class +':' Punctuation +'\n ' Text +'def' Keyword +' ' Text +'f' Name.Function +' ' Text +'=' Operator +' ' Text +'3' Literal.Number.Integer +'\n' Text diff --git a/tests/examplefiles/scala/operators.scala b/tests/examplefiles/scala/operators.scala new file mode 100644 index 0000000..632ecfc --- /dev/null +++ b/tests/examplefiles/scala/operators.scala @@ -0,0 +1,7 @@ +1 :: 2 :: Nil +a ++ b +a :+ b +a +: b +a :++ b +a ++: b +a + b \ No newline at end of file diff --git a/tests/examplefiles/scala/operators.scala.output b/tests/examplefiles/scala/operators.scala.output new file mode 100644 index 0000000..19449e0 --- /dev/null +++ b/tests/examplefiles/scala/operators.scala.output @@ -0,0 +1,52 @@ +'1' Literal.Number.Integer +' ' Text +'::' Operator +' ' Text +'2' Literal.Number.Integer +' ' Text +'::' Operator +' ' Text +'Nil' Name.Class +'\n' Text + +'a' Name +' ' Text +'++' Operator +' ' Text +'b' Name +'\n' Text + +'a' Name +' ' Text +':+' Operator +' ' Text +'b' Name +'\n' Text + +'a' Name +' ' Text +'+:' Operator +' ' Text +'b' Name +'\n' Text + +'a' Name +' ' Text +':++' Operator +' ' Text +'b' Name +'\n' Text + +'a' Name +' ' Text +'++:' Operator +' ' Text +'b' Name +'\n' Text + +'a' Name +' ' Text +'+' Operator +' ' Text +'b' Name +'\n' Text diff --git a/tests/examplefiles/scala/package.scala b/tests/examplefiles/scala/package.scala new file mode 100644 index 0000000..f27704f --- /dev/null +++ b/tests/examplefiles/scala/package.scala @@ -0,0 +1,3 @@ +package +package com +package com.example diff --git a/tests/examplefiles/scala/package.scala.output b/tests/examplefiles/scala/package.scala.output new file mode 100644 index 0000000..79d03b7 --- /dev/null +++ b/tests/examplefiles/scala/package.scala.output @@ -0,0 +1,15 @@ +'package' Keyword +'\n' Text + +'' Text +'package' Keyword +' ' Text +'com' Name +'\n' Text + +'package' Keyword +' ' Text +'com' Name.Namespace +'.' Punctuation +'example' Name +'\n' Text diff --git a/tests/examplefiles/scala/pattern-matching.scala b/tests/examplefiles/scala/pattern-matching.scala new file mode 100644 index 0000000..54197c8 --- /dev/null +++ b/tests/examplefiles/scala/pattern-matching.scala @@ -0,0 +1,11 @@ +def f(x: Int, y: Int) = x match { + case `y` => + case s @ Seq(_, _, _) => + case Seq(first, tail @ _*) => + case first +: tail => + case 3 | 5 | 6 => + case y: Number => y.n + case Lit(n) => n + case IsZero(u) => eval(u) == 0 + case _ => 15 +} \ No newline at end of file diff --git a/tests/examplefiles/scala/pattern-matching.scala.output b/tests/examplefiles/scala/pattern-matching.scala.output new file mode 100644 index 0000000..0a22da0 --- /dev/null +++ b/tests/examplefiles/scala/pattern-matching.scala.output @@ -0,0 +1,142 @@ +'def' Keyword +' ' Text +'f' Name.Function +'(' Punctuation +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +',' Punctuation +' ' Text +'y' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +' ' Text +'=' Operator +' ' Text +'x' Name +' ' Text +'match' Keyword +' ' Text +'{' Punctuation +'\n ' Text +'case' Keyword +' ' Text +'`y`' Name +' ' Text +'=>' Operator +' \n ' Text +'case' Keyword +' ' Text +'s' Name +' ' Text +'@' Operator +' ' Text +'Seq' Name.Class +'(' Punctuation +'_' Name +',' Punctuation +' ' Text +'_' Name +',' Punctuation +' ' Text +'_' Name +')' Punctuation +' ' Text +'=>' Operator +' \n ' Text +'case' Keyword +' ' Text +'Seq' Name.Class +'(' Punctuation +'first' Name +',' Punctuation +' ' Text +'tail' Name +' ' Text +'@' Operator +' ' Text +'_*' Name +')' Punctuation +' ' Text +'=>' Operator +'\n ' Text +'case' Keyword +' ' Text +'first' Name +' ' Text +'+:' Operator +' ' Text +'tail' Name +' ' Text +'=>' Operator +'\n ' Text +'case' Keyword +' ' Text +'3' Literal.Number.Integer +' ' Text +'|' Operator +' ' Text +'5' Literal.Number.Integer +' ' Text +'|' Operator +' ' Text +'6' Literal.Number.Integer +' ' Text +'=>' Operator +'\n ' Text +'case' Keyword +' ' Text +'y' Name +':' Punctuation +' ' Text +'Number' Name.Class +' ' Text +'=>' Operator +' ' Text +'y' Name +'.' Punctuation +'n' Name +'\n ' Text +'case' Keyword +' ' Text +'Lit' Name.Class +'(' Punctuation +'n' Name +')' Punctuation +' ' Text +'=>' Operator +' ' Text +'n' Name +'\n ' Text +'case' Keyword +' ' Text +'IsZero' Name.Class +'(' Punctuation +'u' Name +')' Punctuation +' ' Text +'=>' Operator +' ' Text +'eval' Name +'(' Punctuation +'u' Name +')' Punctuation +' ' Text +'==' Operator +' ' Text +'0' Literal.Number.Integer +'\n ' Text +'case' Keyword +' ' Text +'_' Name +' ' Text +'=>' Operator +' ' Text +'15' Literal.Number.Integer +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/examplefiles/scala/quoted.scala b/tests/examplefiles/scala/quoted.scala new file mode 100644 index 0000000..cdd3c15 --- /dev/null +++ b/tests/examplefiles/scala/quoted.scala @@ -0,0 +1,2 @@ +'{ 2 } +'[ String ] \ No newline at end of file diff --git a/tests/examplefiles/scala/quoted.scala.output b/tests/examplefiles/scala/quoted.scala.output new file mode 100644 index 0000000..755821c --- /dev/null +++ b/tests/examplefiles/scala/quoted.scala.output @@ -0,0 +1,13 @@ +"'{" Punctuation +' ' Text +'2' Literal.Number.Integer +' ' Text +'}' Punctuation +'\n' Text + +"'[" Punctuation +' ' Text +'String' Name.Class +' ' Text +']' Punctuation +'\n' Text diff --git a/tests/examplefiles/scala/singleton-types.scala b/tests/examplefiles/scala/singleton-types.scala new file mode 100644 index 0000000..9092363 --- /dev/null +++ b/tests/examplefiles/scala/singleton-types.scala @@ -0,0 +1,9 @@ +val x = ??? +trait Foo[T <: x.type] +val a: x.type = ??? +val b: Foo[x.type] = ??? + +type Test[A] = Int +type MyTest = Test[1] + +val one: 1 = 1 \ No newline at end of file diff --git a/tests/examplefiles/scala/singleton-types.scala.output b/tests/examplefiles/scala/singleton-types.scala.output new file mode 100644 index 0000000..dbfe9e4 --- /dev/null +++ b/tests/examplefiles/scala/singleton-types.scala.output @@ -0,0 +1,89 @@ +'val' Keyword.Declaration +' ' Text +'x' Name +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'trait' Keyword +' ' Text +'Foo' Name.Class +'[' Punctuation +'T' Name.Class +' ' Text +'<:' Operator +' ' Text +'x' Name +'.' Punctuation +'type' Keyword +']' Punctuation +'\n' Text + +'val' Keyword.Declaration +' ' Text +'a' Name +':' Punctuation +' ' Text +'x' Name +'.' Punctuation +'type' Keyword +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'val' Keyword.Declaration +' ' Text +'b' Name +':' Punctuation +' ' Text +'Foo' Name.Class +'[' Punctuation +'x' Name +'.' Punctuation +'type' Keyword +']' Punctuation +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n\n' Text + +'type' Keyword +' ' Text +'Test' Name.Class +'[' Punctuation +'A' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'Int' Name.Class +'\n' Text + +'type' Keyword +' ' Text +'MyTest' Name.Class +' ' Text +'=' Operator +' ' Text +'Test' Name.Class +'[' Punctuation +'1' Literal.Number.Integer +']' Punctuation +'\n\n' Text + +'val' Keyword.Declaration +' ' Text +'one' Name +':' Punctuation +' ' Text +'1' Literal.Number.Integer +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text diff --git a/tests/examplefiles/scala/soft-keywords.scala b/tests/examplefiles/scala/soft-keywords.scala new file mode 100644 index 0000000..187468a --- /dev/null +++ b/tests/examplefiles/scala/soft-keywords.scala @@ -0,0 +1,6 @@ +val open = true +val inline = true +inline xval +val x = inline + 2 +(using) +(usingSomething) diff --git a/tests/examplefiles/scala/soft-keywords.scala.output b/tests/examplefiles/scala/soft-keywords.scala.output new file mode 100644 index 0000000..e8f3c5d --- /dev/null +++ b/tests/examplefiles/scala/soft-keywords.scala.output @@ -0,0 +1,45 @@ +'val' Keyword.Declaration +' ' Text +'open' Name +' ' Text +'=' Operator +' ' Text +'true' Keyword.Constant +'\n' Text + +'val' Keyword.Declaration +' ' Text +'inline' Name +' ' Text +'=' Operator +' ' Text +'true' Keyword.Constant +'\n' Text + +'inline' Keyword +' ' Text +'xval' Name +'\n' Text + +'val' Keyword.Declaration +' ' Text +'x' Name +' ' Text +'=' Operator +' ' Text +'inline' Name +' ' Text +'+' Operator +' ' Text +'2' Literal.Number.Integer +'\n' Text + +'(' Punctuation +'using' Name +')' Punctuation +'\n' Text + +'(' Punctuation +'usingSomething' Name +')' Punctuation +'\n' Text diff --git a/tests/examplefiles/scala/storage-modifiers.scala b/tests/examplefiles/scala/storage-modifiers.scala new file mode 100644 index 0000000..083a59e --- /dev/null +++ b/tests/examplefiles/scala/storage-modifiers.scala @@ -0,0 +1,17 @@ +private object a {} +private[com] object b {} +private[com.example] object c {} +protected object d {} +protected[com] object e {} +protected[com.example] object f {} +synchronized {} +abstract class g {} +final val h = ??? +lazy val i = ??? +sealed trait j +implicit val k = ??? +enum m {} +inline val n = ??? +opaque type o = Unit +@volatile @transient @native +override def p = ??? \ No newline at end of file diff --git a/tests/examplefiles/scala/storage-modifiers.scala.output b/tests/examplefiles/scala/storage-modifiers.scala.output new file mode 100644 index 0000000..a013e45 --- /dev/null +++ b/tests/examplefiles/scala/storage-modifiers.scala.output @@ -0,0 +1,179 @@ +'private' Keyword +' ' Text +'object' Keyword +' ' Text +'a' Name.Class +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'private' Keyword +'[' Punctuation +'com' Name +']' Punctuation +' ' Text +'object' Keyword +' ' Text +'b' Name.Class +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'private' Keyword +'[' Punctuation +'com' Name +'.' Punctuation +'example' Name +']' Punctuation +' ' Text +'object' Keyword +' ' Text +'c' Name.Class +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'protected' Keyword +' ' Text +'object' Keyword +' ' Text +'d' Name.Class +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'protected' Keyword +'[' Punctuation +'com' Name +']' Punctuation +' ' Text +'object' Keyword +' ' Text +'e' Name.Class +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'protected' Keyword +'[' Punctuation +'com' Name +'.' Punctuation +'example' Name +']' Punctuation +' ' Text +'object' Keyword +' ' Text +'f' Name.Class +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'synchronized' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'abstract' Keyword +' ' Text +'class' Keyword +' ' Text +'g' Name.Class +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'final' Keyword +' ' Text +'val' Keyword.Declaration +' ' Text +'h' Name +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'lazy' Keyword +' ' Text +'val' Keyword.Declaration +' ' Text +'i' Name +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'sealed' Keyword +' ' Text +'trait' Keyword +' ' Text +'j' Name.Class +'\n' Text + +'implicit' Keyword +' ' Text +'val' Keyword.Declaration +' ' Text +'k' Name +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'enum' Keyword +' ' Text +'m' Name.Class +' ' Text +'{' Punctuation +'}' Punctuation +'\n' Text + +'inline' Keyword +' ' Text +'val' Keyword.Declaration +' ' Text +'n' Name +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'opaque' Keyword +' ' Text +'type' Keyword +' ' Text +'o' Name.Class +' ' Text +'=' Operator +' ' Text +'Unit' Name.Class +'\n' Text + +'@volatile' Name.Decorator +' ' Text +'@transient' Name.Decorator +' ' Text +'@native' Name.Decorator +'\n' Text + +'override' Keyword +' ' Text +'def' Keyword +' ' Text +'p' Name.Function +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text diff --git a/tests/examplefiles/scala/symbols.scala b/tests/examplefiles/scala/symbols.scala new file mode 100644 index 0000000..950a972 --- /dev/null +++ b/tests/examplefiles/scala/symbols.scala @@ -0,0 +1,14 @@ +// Symbols: +'* //test +'* +'symbol_* +'symbol1 //' +'ξφδ +'φδφ0 +'δφξφξ_+- +'*** + +// Not (just) symbols: +'symbol* +'**_x //' +'x' \ No newline at end of file diff --git a/tests/examplefiles/scala/symbols.scala.output b/tests/examplefiles/scala/symbols.scala.output new file mode 100644 index 0000000..2a27f6f --- /dev/null +++ b/tests/examplefiles/scala/symbols.scala.output @@ -0,0 +1,41 @@ +'// Symbols:\n' Comment.Single + +"'*" Literal.String.Symbol +' ' Text +'//test\n' Comment.Single + +"'*" Literal.String.Symbol +'\n' Text + +"'symbol_*" Literal.String.Symbol +'\n' Text + +"'symbol1" Literal.String.Symbol +' ' Text +"//'\n" Comment.Single + +"'ξφδ" Literal.String.Symbol +'\n' Text + +"'φδφ0" Literal.String.Symbol +'\n' Text + +"'δφξφξ_+-" Literal.String.Symbol +'\n' Text + +"'***" Literal.String.Symbol +'\n\n' Text + +'// Not (just) symbols:\n' Comment.Single + +"'symbol" Literal.String.Symbol +'*' Operator +'\n' Text + +"'**" Literal.String.Symbol +'_x' Name +' ' Text +"//'\n" Comment.Single + +"'x'" Literal.String.Char +'\n' Text diff --git a/tests/examplefiles/scala/type-operators.scala b/tests/examplefiles/scala/type-operators.scala new file mode 100644 index 0000000..d9337fa --- /dev/null +++ b/tests/examplefiles/scala/type-operators.scala @@ -0,0 +1,6 @@ +Type[A with "user provided string" with B] +def help(id: UserName | Password) = ??? +val either: Password | UserName = ??? +val both: Object & Product = ??? +<% =:= <:< <%< >: <: +[X, Y] =>> Map[Y, X] \ No newline at end of file diff --git a/tests/examplefiles/scala/type-operators.scala.output b/tests/examplefiles/scala/type-operators.scala.output new file mode 100644 index 0000000..ff17f80 --- /dev/null +++ b/tests/examplefiles/scala/type-operators.scala.output @@ -0,0 +1,95 @@ +'Type' Name.Class +'[' Punctuation +'A' Name.Class +' ' Text +'with' Keyword +' ' Text +'"user provided string"' Literal.String +' ' Text +'with' Keyword +' ' Text +'B' Name.Class +']' Punctuation +'\n' Text + +'def' Keyword +' ' Text +'help' Name.Function +'(' Punctuation +'id' Name +':' Punctuation +' ' Text +'UserName' Name.Class +' ' Text +'|' Operator +' ' Text +'Password' Name.Class +')' Punctuation +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'val' Keyword.Declaration +' ' Text +'either' Name +':' Punctuation +' ' Text +'Password' Name.Class +' ' Text +'|' Operator +' ' Text +'UserName' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'val' Keyword.Declaration +' ' Text +'both' Name +':' Punctuation +' ' Text +'Object' Name.Class +' ' Text +'&' Name +' ' Text +'Product' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text + +'<%' Operator +' ' Text +'=:=' Operator +' ' Text +'<:<' Operator +' ' Text +'<%<' Operator +' ' Text +'>:' Operator +' ' Text +'<:' Operator +'\n' Text + +'[' Punctuation +'X' Name.Class +',' Punctuation +' ' Text +'Y' Name.Class +']' Punctuation +' ' Text +'=>>' Operator +' ' Text +'Map' Name.Class +'[' Punctuation +'Y' Name.Class +',' Punctuation +' ' Text +'X' Name.Class +']' Punctuation +'\n' Text diff --git a/tests/examplefiles/scala/using.scala b/tests/examplefiles/scala/using.scala new file mode 100644 index 0000000..e40d49f --- /dev/null +++ b/tests/examplefiles/scala/using.scala @@ -0,0 +1,9 @@ +def f(using x: Int): Unit = () +f(using 2) +f(using .2) +class A(using x: Int) +new A(using 3) +f(using ()) +f(using {}) +f(using ' ') +f(using "") diff --git a/tests/examplefiles/scala/using.scala.output b/tests/examplefiles/scala/using.scala.output new file mode 100644 index 0000000..7e87d77 --- /dev/null +++ b/tests/examplefiles/scala/using.scala.output @@ -0,0 +1,93 @@ +'def' Keyword +' ' Text +'f' Name.Function +'(' Punctuation +'using' Keyword +' ' Text +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Unit' Name.Class +' ' Text +'=' Operator +' ' Text +'(' Punctuation +')' Punctuation +'\n' Text + +'f' Name +'(' Punctuation +'using' Keyword +' ' Text +'2' Literal.Number.Integer +')' Punctuation +'\n' Text + +'f' Name +'(' Punctuation +'using' Keyword +' ' Text +'.2' Literal.Number.Float +')' Punctuation +'\n' Text + +'class' Keyword +' ' Text +'A' Name.Class +'(' Punctuation +'using' Keyword +' ' Text +'x' Name +':' Punctuation +' ' Text +'Int' Name.Class +')' Punctuation +'\n' Text + +'new' Keyword +' ' Text +'A' Name.Class +'(' Punctuation +'using' Keyword +' ' Text +'3' Literal.Number.Integer +')' Punctuation +'\n' Text + +'f' Name +'(' Punctuation +'using' Keyword +' ' Text +'(' Punctuation +')' Punctuation +')' Punctuation +'\n' Text + +'f' Name +'(' Punctuation +'using' Keyword +' ' Text +'{' Punctuation +'}' Punctuation +')' Punctuation +'\n' Text + +'f' Name +'(' Punctuation +'using' Keyword +' ' Text +"' '" Literal.String.Char +')' Punctuation +'\n' Text + +'f' Name +'(' Punctuation +'using' Keyword +' ' Text +'""' Literal.String +')' Punctuation +'\n' Text diff --git a/tests/examplefiles/scaml/test.scaml.output b/tests/examplefiles/scaml/test.scaml.output index 52b83c5..e30a34d 100644 --- a/tests/examplefiles/scaml/test.scaml.output +++ b/tests/examplefiles/scaml/test.scaml.output @@ -2,11 +2,11 @@ '-@ ' Punctuation 'import' Keyword ' ' Text -'val' Keyword +'val' Keyword.Declaration ' ' Text 'city' Name -':' Keyword -'String' Keyword.Type +':' Punctuation +'String' Name.Class ' ' Text '=' Operator ' ' Text @@ -16,11 +16,11 @@ '' Text '-' Punctuation ' ' Text -'val' Keyword +'val' Keyword.Declaration ' ' Text 'name' Name -':' Keyword -'String' Keyword.Type +':' Punctuation +'String' Name.Class ' ' Text '=' Operator ' ' Text @@ -56,7 +56,7 @@ ' ' Text 'for' Keyword ' ' Text -'(' Operator +'(' Punctuation ' ' Text 'i' Name ' ' Text @@ -68,7 +68,7 @@ ' ' Text '10' Literal.Number.Integer ' ' Text -')' Operator +')' Punctuation '\n' Text ' ' Text diff --git a/tests/examplefiles/swig/swig_java.swg.output b/tests/examplefiles/swig/swig_java.swg.output index 426d323..75d49d7 100644 --- a/tests/examplefiles/swig/swig_java.swg.output +++ b/tests/examplefiles/swig/swig_java.swg.output @@ -447,7 +447,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword ' ' Text '(' Punctuation '(' Punctuation @@ -507,7 +507,7 @@ ' ' Text 'else' Keyword ' \n ' Text -'return' Name.Function +'return' Keyword ' ' Text '(' Punctuation 'char' Keyword.Type @@ -585,7 +585,7 @@ ' ' Text 'else' Keyword ' ' Text -'if' Name.Function +'if' Keyword ' ' Text '(' Punctuation '(' Punctuation @@ -639,7 +639,7 @@ ' ' Text 'else' Keyword ' \n ' Text -'return' Name.Function +'return' Keyword ' ' Text '(' Punctuation 'char' Keyword.Type @@ -13310,7 +13310,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'finalize' Name +'finalize' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -13642,7 +13642,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'$methodname' Name +'$methodname' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -13696,7 +13696,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'$methodname' Name +'$methodname' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -13750,7 +13750,7 @@ ' ' Text 'void' Keyword.Type ' ' Text -'$methodname' Name +'$methodname' Name.Function '(' Punctuation ')' Punctuation ' ' Text diff --git a/tests/examplefiles/swig/swig_std_vector.i.output b/tests/examplefiles/swig/swig_std_vector.i.output index 5b7a51c..3c3dc70 100644 --- a/tests/examplefiles/swig/swig_std_vector.i.output +++ b/tests/examplefiles/swig/swig_std_vector.i.output @@ -189,7 +189,7 @@ 'namespace' Keyword ' ' Text -'std' Name +'std' Name.Namespace ' ' Text '{' Punctuation '\n' Text @@ -382,7 +382,7 @@ ' ' Text 'namespace' Keyword ' ' Text -'swig' Name +'swig' Name.Namespace ' ' Text '{' Punctuation '\n' Text @@ -431,7 +431,7 @@ 'char' Keyword.Type '*' Operator ' ' Text -'type_name' Name +'type_name' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -730,7 +730,7 @@ ' ' Text 'namespace' Keyword ' ' Text -'swig' Name +'swig' Name.Namespace ' ' Text '{' Punctuation '\n' Text @@ -780,7 +780,7 @@ 'char' Keyword.Type '*' Operator ' ' Text -'type_name' Name +'type_name' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -1088,7 +1088,7 @@ ' ' Text 'namespace' Keyword ' ' Text -'swig' Name +'swig' Name.Namespace ' ' Text '{' Punctuation '\n' Text @@ -1140,7 +1140,7 @@ 'char' Keyword.Type '*' Operator ' ' Text -'type_name' Name +'type_name' Name.Function '(' Punctuation ')' Punctuation ' ' Text @@ -1435,7 +1435,7 @@ ' ' Text 'namespace' Keyword ' ' Text -'swig' Name +'swig' Name.Namespace ' ' Text '{' Punctuation '\n' Text @@ -1484,7 +1484,7 @@ 'char' Keyword.Type '*' Operator ' ' Text -'type_name' Name +'type_name' Name.Function '(' Punctuation ')' Punctuation ' ' Text diff --git a/tests/examplefiles/teal/example.teal b/tests/examplefiles/teal/example.teal new file mode 100644 index 0000000..bf9e927 --- /dev/null +++ b/tests/examplefiles/teal/example.teal @@ -0,0 +1,26 @@ +//example teal code taken from https://developer.algorand.org/tutorials/writing-simple-smart-contract/ +// Check the Fee is resonable +// In this case 10,000 microalgos +txn Fee +int 10000 +<= + +// Check the length of the passphrase is correct +arg 0 +len +int 73 +== +&& + +// The sha256 value of the passphrase +arg 0 +sha256 +byte base64 30AT2gOReDBdJmLBO/DgvjC6hIXgACecTpFDcP1bJHU= +== +&& + +// Make sure the CloseRemainderTo is not set +txn CloseRemainderTo +txn Receiver +== +&& diff --git a/tests/examplefiles/teal/example.teal.output b/tests/examplefiles/teal/example.teal.output new file mode 100644 index 0000000..f25e26b --- /dev/null +++ b/tests/examplefiles/teal/example.teal.output @@ -0,0 +1,93 @@ +'//example teal code taken from https://developer.algorand.org/tutorials/writing-simple-smart-contract/' Comment.Single +'\n' Text + +'// Check the Fee is resonable ' Comment.Single +'\n' Text + +'// In this case 10,000 microalgos' Comment.Single +'\n' Text + +'txn' Name.Function +' ' Text +'Fee' Keyword +'\n' Text + +'int' Name.Function +' ' Text +'10000' Literal.Number.Integer +'\n' Text + +'<=' Name.Function +'\n' Text + +'\n' Text + +'// Check the length of the passphrase is correct ' Comment.Single +'\n' Text + +'arg' Name.Function +' ' Text +'0' Literal.Number.Integer +'\n' Text + +'len' Name.Function +' ' Text +'\n' Text + +'int' Name.Function +' ' Text +'73' Literal.Number.Integer +'\n' Text + +'==' Name.Function +'\n' Text + +'&&' Name.Function +'\n' Text + +'\n' Text + +'// The sha256 value of the passphrase' Comment.Single +'\n' Text + +'arg' Name.Function +' ' Text +'0' Literal.Number.Integer +'\n' Text + +'sha256' Name.Function +'\n' Text + +'byte' Name.Function +' ' Text +'base64 ' Literal.String.Affix +'30AT2gOReDBdJmLBO/DgvjC6hIXgACecTpFDcP1bJHU=' Literal.String.Other +'\n' Text + +'==' Name.Function +'\n' Text + +'&&' Name.Function +'\n' Text + +'\n' Text + +'// Make sure the CloseRemainderTo is not set' Comment.Single +'\n' Text + +'txn' Name.Function +' ' Text +'CloseRemainderTo' Keyword +'\n' Text + +'txn' Name.Function +' ' Text +'Receiver' Keyword +' ' Text +'\n' Text + +'==' Name.Function +'\n' Text + +'&&' Name.Function +'\n' Text diff --git a/tests/examplefiles/terraform/example.tf b/tests/examplefiles/terraform/example.tf deleted file mode 100644 index 94cff72..0000000 --- a/tests/examplefiles/terraform/example.tf +++ /dev/null @@ -1,224 +0,0 @@ -terraform { - backend "consul" { - address = "demo.consul.io" - path = "tfdocs" - } -} - -module "consul" { - source = "hashicorp/consul/aws" - servers = 3 -} - -variable "key_name" { - description = "Name of the SSH keypair to use in AWS." -} - -variable "key_path" { - description = "Path to the private portion of the SSH key specified." -} - -variable "aws_region" { - description = "AWS region to launch servers." - default = "us-west-2" - somevar = true -} - -# Ubuntu Precise 12.04 LTS (x64) -variable "aws_amis" { - default = { - eu-west-1 = "ami-b1cf19c6" - us-east-1 = "ami-de7ab6b6" - us-west-1 = "ami-3f75767a" - us-west-2 = "ami-21f78e11" - } -} - -resource "aws_internet_gateway" "base_igw" { - vpc_id = "${aws_vpc.something.id}" - tags { - Name = "igw-${var.something}-${var.something}" - } -} - -provider "aws" { - access_key = "${myvar}" - secret_key = "your aws secret key" - region = "us-east-1" -} -/* multiline - - comment - -*/ - - -resource "aws_route53_record" "test" { - zone_id = "zone" - name = "name" - type = "A" - alias { - name = "alias name" - } -} - -# Single line comment -resource "aws_instance" "example" { - ami = "ami-408c7f28" - instance_type = "t1.micro" - key_name = "your-aws-key-name" -} - -# Create our Heroku application. Heroku will -# automatically assign a name. -resource "heroku_app" "web" {} - -# Create our DNSimple record to point to the -# heroku application. -resource "dnsimple_record" "web" { - domain = "${var.dnsimple_domain}" - - # heroku_hostname is a computed attribute on the heroku - # application we can use to determine the hostname - value = "${heroku_app.web.heroku_hostname}" - - type = "CNAME" - ttl = 3600 -} - -# The Heroku domain, which will be created and added -# to the heroku application after we have assigned the domain -# in DNSimple -resource "heroku_domain" "foobar" { - app = "${heroku_app.web.name}" - hostname = "${dnsimple_record.web.hostname}" -} - -# Specify the provider and access details -provider "aws" { - region = "${var.aws_region}" - value = "${file("path.txt")}" -} - -# Our default security group to access -# the instances over SSH and HTTP -resource "aws_security_group" "default" { - name = "terraform_example" - description = "Used in the terraform" - - # SSH access from anywhere - ingress { - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - # HTTP access from anywhere - ingress { - from_port = 80 - to_port = 80 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } -} - -resource "aws_elb" "web" { - name = "terraform-example-elb" - - # The same availability zone as our instance - availability_zones = ["${aws_instance.web.availability_zone}"] - - listener { - instance_port = 80 - instance_protocol = "http" - lb_port = 80 - lb_protocol = "http" - } - - # The instance is registered automatically - instances = ["${aws_instance.web.id}"] -} - -resource "aws_instance" "web" { - # The connection block tells our provisioner how to - # communicate with the resource (instance) - connection { - # The default username for our AMI - user = "ubuntu" - - # The path to your keyfile - key_file = "${var.key_path}" - } - - instance_type = "m1.small" - - # Lookup the correct AMI based on the region - # we specified - ami = "${lookup(var.aws_amis, var.aws_region)}" - - # The name of our SSH keypair you've created and downloaded - # from the AWS console. - # - # https://console.aws.amazon.com/ec2/v2/home?region=us-west-2#KeyPairs: - # - key_name = "${var.key_name}" - - # Our Security group to allow HTTP and SSH access - security_groups = ["${aws_security_group.default.name}"] - - tags { - Name = "web-small" - } - - # We run a remote provisioner on the instance after creating it. - # In this case, we just install nginx and start it. By default, - # this should be on port 80 - provisioner "remote-exec" { - inline = [ - "sudo apt-get -y update", - "sudo apt-get -y install nginx", - "sudo service nginx start" - ] - } -} - -data "template_file" "iam_policy" { - count = 5 - - vars { - region = "us-west-1" - } - - config { - name = "hashicorp/vpc-prod" - } -} - -output "web_public_ip" { - value = ["${aws_instance.web.public_ip}"] -} - -resource "aws_autoscaling_group" "bar" { - name = "terraform-asg-example" - launch_configuration = "${aws_launch_configuration.as_conf.name}" - min_size = 1 - max_size = 2 - - lifecycle { - create_before_destroy = true - } -} - -resource "aws_db_instance" "timeout_example" { - allocated_storage = 10 - engine = "mysql" - engine_version = "5.6.17" - instance_class = "db.t1.micro" - name = "mydb" - - timeouts { - create = "60m" - delete = "2h" - } -} diff --git a/tests/examplefiles/terraform/example.tf.output b/tests/examplefiles/terraform/example.tf.output deleted file mode 100644 index 39a36ec..0000000 --- a/tests/examplefiles/terraform/example.tf.output +++ /dev/null @@ -1,1003 +0,0 @@ -'terraform' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' ' Text -'backend' Keyword.Reserved -' ' Text -'"consul"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' address' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"demo.consul.io"' Literal.String.Double -'\n' Text - -' path' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"tfdocs"' Literal.String.Double -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'module' Keyword.Reserved -' ' Text -'"consul"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' source' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"hashicorp/consul/aws"' Literal.String.Double -'\n' Text - -' servers' Name.Attribute -' ' Text -'=' Operator -' ' Text -'3' Literal.Number -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'variable' Keyword.Reserved -' ' Text -'"key_name"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' description' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"Name of the SSH keypair to use in AWS."' Literal.String.Double -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'variable' Keyword.Reserved -' ' Text -'"key_path"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' description' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"Path to the private portion of the SSH key specified."' Literal.String.Double -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'variable' Keyword.Reserved -' ' Text -'"aws_region"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' description' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"AWS region to launch servers."' Literal.String.Double -'\n' Text - -' default' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"us-west-2"' Literal.String.Double -'\n' Text - -' somevar' Name.Attribute -' ' Text -'=' Operator -' ' Text -'true' Keyword.Type -'\n' Text - -'}' Text.Punctuation -'\n\n# Ubuntu Precise 12.04 LTS (x64)\n' Comment.Single - -'variable' Keyword.Reserved -' ' Text -'"aws_amis"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' default' Name.Attribute -' ' Text -'=' Operator -' ' Text -'{' Text.Punctuation -'\n' Text - -' eu-west-1' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"ami-b1cf19c6"' Literal.String.Double -'\n' Text - -' us-east-1' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"ami-de7ab6b6"' Literal.String.Double -'\n' Text - -' us-west-1' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"ami-3f75767a"' Literal.String.Double -'\n' Text - -' us-west-2' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"ami-21f78e11"' Literal.String.Double -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'resource' Keyword.Reserved -' ' Text -'"aws_internet_gateway" "base_igw"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' vpc_id' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${aws_vpc.something.id}"' Literal.String.Double -'\n' Text - -' ' Text -'tags' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' Name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"igw-${var.something}-${var.something}"' Literal.String.Double -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'provider' Keyword.Reserved -' ' Text -'"aws"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' access_key' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${myvar}"' Literal.String.Double -'\n' Text - -' secret_key' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"your aws secret key"' Literal.String.Double -'\n' Text - -' region' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"us-east-1"' Literal.String.Double -'\n' Text - -'}' Text.Punctuation -'\n/*' Comment.Multiline -' ' Comment.Multiline -'m' Comment.Multiline -'u' Comment.Multiline -'l' Comment.Multiline -'t' Comment.Multiline -'i' Comment.Multiline -'l' Comment.Multiline -'i' Comment.Multiline -'n' Comment.Multiline -'e' Comment.Multiline -'\n' Comment.Multiline - -'\n' Comment.Multiline - -' ' Comment.Multiline -' ' Comment.Multiline -'c' Comment.Multiline -'o' Comment.Multiline -'m' Comment.Multiline -'m' Comment.Multiline -'e' Comment.Multiline -'n' Comment.Multiline -'t' Comment.Multiline -'\n' Comment.Multiline - -'\n' Comment.Multiline - -'*/' Comment.Multiline -'\n' Text - -'\n' Text - -'\n' Text - -'resource' Keyword.Reserved -' ' Text -'"aws_route53_record" "test"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' zone_id' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"zone"' Literal.String.Double -'\n' Text - -' name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"name"' Literal.String.Double -'\n' Text - -' type' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"A"' Literal.String.Double -'\n' Text - -' ' Text -'alias' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"alias name"' Literal.String.Double -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'}' Text.Punctuation -'\n\n# Single line comment\n' Comment.Single - -'resource' Keyword.Reserved -' ' Text -'"aws_instance" "example"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' ami' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"ami-408c7f28"' Literal.String.Double -'\n' Text - -' instance_type' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"t1.micro"' Literal.String.Double -'\n' Text - -' key_name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"your-aws-key-name"' Literal.String.Double -'\n' Text - -'}' Text.Punctuation -'\n\n# Create our Heroku application. Heroku will\n' Comment.Single - -'# automatically assign a name.\n' Comment.Single - -'resource' Keyword.Reserved -' ' Text -'"heroku_app" "web"' Literal.String -' ' Text -'{' Text.Punctuation -'}' Text.Punctuation -'\n' Text - -'\n# Create our DNSimple record to point to the\n' Comment.Single - -'# heroku application.\n' Comment.Single - -'resource' Keyword.Reserved -' ' Text -'"dnsimple_record" "web"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' domain' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${var.dnsimple_domain}"' Literal.String.Double -'\n\n # heroku_hostname is a computed attribute on the heroku\n' Comment.Single - -' # application we can use to determine the hostname\n' Comment.Single - -' value' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${heroku_app.web.heroku_hostname}"' Literal.String.Double -'\n' Text - -'\n' Text - -' type' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"CNAME"' Literal.String.Double -'\n' Text - -' ttl' Name.Attribute -' ' Text -'=' Operator -' ' Text -'3600' Literal.Number -'\n' Text - -'}' Text.Punctuation -'\n\n# The Heroku domain, which will be created and added\n' Comment.Single - -'# to the heroku application after we have assigned the domain\n' Comment.Single - -'# in DNSimple\n' Comment.Single - -'resource' Keyword.Reserved -' ' Text -'"heroku_domain" "foobar"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' app' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${heroku_app.web.name}"' Literal.String.Double -'\n' Text - -' hostname' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${dnsimple_record.web.hostname}"' Literal.String.Double -'\n' Text - -'}' Text.Punctuation -'\n\n# Specify the provider and access details\n' Comment.Single - -'provider' Keyword.Reserved -' ' Text -'"aws"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' region' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${var.aws_region}"' Literal.String.Double -'\n' Text - -' value' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${file("path.txt")}"' Literal.String.Double -'\n' Text - -'}' Text.Punctuation -'\n\n# Our default security group to access\n' Comment.Single - -'# the instances over SSH and HTTP\n' Comment.Single - -'resource' Keyword.Reserved -' ' Text -'"aws_security_group" "default"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"terraform_example"' Literal.String.Double -'\n' Text - -' description' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"Used in the terraform"' Literal.String.Double -'\n\n # SSH access from anywhere\n' Comment.Single - -' ' Text -'ingress' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' from_port' Name.Attribute -' ' Text -'=' Operator -' ' Text -'22' Literal.Number -'\n' Text - -' to_port' Name.Attribute -' ' Text -'=' Operator -' ' Text -'22' Literal.Number -'\n' Text - -' protocol' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"tcp"' Literal.String.Double -'\n' Text - -' cidr_blocks' Name.Attribute -' ' Text -'=' Operator -' ' Text -'[' Punctuation -'"0.0.0.0/0"' Literal.String.Double -']' Punctuation -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n\n # HTTP access from anywhere\n' Comment.Single - -' ' Text -'ingress' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' from_port' Name.Attribute -' ' Text -'=' Operator -' ' Text -'80' Literal.Number -'\n' Text - -' to_port' Name.Attribute -' ' Text -'=' Operator -' ' Text -'80' Literal.Number -'\n' Text - -' protocol' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"tcp"' Literal.String.Double -'\n' Text - -' cidr_blocks' Name.Attribute -' ' Text -'=' Operator -' ' Text -'[' Punctuation -'"0.0.0.0/0"' Literal.String.Double -']' Punctuation -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'resource' Keyword.Reserved -' ' Text -'"aws_elb" "web"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"terraform-example-elb"' Literal.String.Double -'\n\n # The same availability zone as our instance\n' Comment.Single - -' availability_zones' Name.Attribute -' ' Text -'=' Operator -' ' Text -'[' Punctuation -'"${aws_instance.web.availability_zone}"' Literal.String.Double -']' Punctuation -'\n' Text - -'\n' Text - -' ' Text -'listener' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' instance_port' Name.Attribute -' ' Text -'=' Operator -' ' Text -'80' Literal.Number -'\n' Text - -' instance_protocol' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"http"' Literal.String.Double -'\n' Text - -' lb_port' Name.Attribute -' ' Text -'=' Operator -' ' Text -'80' Literal.Number -'\n' Text - -' lb_protocol' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"http"' Literal.String.Double -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n\n # The instance is registered automatically\n' Comment.Single - -' instances' Name.Attribute -' ' Text -'=' Operator -' ' Text -'[' Punctuation -'"${aws_instance.web.id}"' Literal.String.Double -']' Punctuation -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'resource' Keyword.Reserved -' ' Text -'"aws_instance" "web"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' # The connection block tells our provisioner how to\n' Comment.Single - -' # communicate with the resource (instance)\n' Comment.Single - -' ' Text -'connection' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n # The default username for our AMI\n' Comment.Single - -' user' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"ubuntu"' Literal.String.Double -'\n\n # The path to your keyfile\n' Comment.Single - -' key_file' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${var.key_path}"' Literal.String.Double -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'\n' Text - -' instance_type' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"m1.small"' Literal.String.Double -'\n\n # Lookup the correct AMI based on the region\n' Comment.Single - -' # we specified\n' Comment.Single - -' ami' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${lookup(var.aws_amis, var.aws_region)}"' Literal.String.Double -"\n\n # The name of our SSH keypair you've created and downloaded\n" Comment.Single - -' # from the AWS console.\n' Comment.Single - -' #\n' Comment.Single - -' # https://console.aws.amazon.com/ec2/v2/home?region=us-west-2#KeyPairs:\n' Comment.Single - -' #\n' Comment.Single - -' key_name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${var.key_name}"' Literal.String.Double -'\n\n # Our Security group to allow HTTP and SSH access\n' Comment.Single - -' security_groups' Name.Attribute -' ' Text -'=' Operator -' ' Text -'[' Punctuation -'"${aws_security_group.default.name}"' Literal.String.Double -']' Punctuation -'\n' Text - -'\n' Text - -' ' Text -'tags' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' Name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"web-small"' Literal.String.Double -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n\n # We run a remote provisioner on the instance after creating it.\n' Comment.Single - -' # In this case, we just install nginx and start it. By default,\n' Comment.Single - -' # this should be on port 80\n' Comment.Single - -' ' Text -'provisioner' Keyword.Reserved -' ' Text -'"remote-exec"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' inline' Name.Attribute -' ' Text -'=' Operator -' ' Text -'[' Punctuation -'\n' Text - -' ' Text -'"sudo apt-get -y update"' Literal.String.Double -',' Punctuation -'\n' Text - -' ' Text -'"sudo apt-get -y install nginx"' Literal.String.Double -',' Punctuation -'\n' Text - -' ' Text -'"sudo service nginx start"' Literal.String.Double -'\n' Text - -' ' Text -']' Punctuation -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'data' Keyword.Reserved -' ' Text -'"template_file" "iam_policy"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' count' Name.Attribute -' ' Text -'=' Operator -' ' Text -'5' Literal.Number -'\n' Text - -'\n' Text - -' ' Text -'vars' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' region' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"us-west-1"' Literal.String.Double -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'\n' Text - -' ' Text -'config' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"hashicorp/vpc-prod"' Literal.String.Double -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'output' Keyword.Reserved -' ' Text -'"web_public_ip"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' value' Name.Attribute -' ' Text -'=' Operator -' ' Text -'[' Punctuation -'"${aws_instance.web.public_ip}"' Literal.String.Double -']' Punctuation -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'resource' Keyword.Reserved -' ' Text -'"aws_autoscaling_group" "bar"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"terraform-asg-example"' Literal.String.Double -'\n' Text - -' launch_configuration' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"${aws_launch_configuration.as_conf.name}"' Literal.String.Double -'\n' Text - -' min_size' Name.Attribute -' ' Text -'=' Operator -' ' Text -'1' Literal.Number -'\n' Text - -' max_size' Name.Attribute -' ' Text -'=' Operator -' ' Text -'2' Literal.Number -'\n' Text - -'\n' Text - -' ' Text -'lifecycle' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' create_before_destroy' Name.Attribute -' ' Text -'=' Operator -' ' Text -'true' Keyword.Type -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'}' Text.Punctuation -'\n' Text - -'\n' Text - -'resource' Keyword.Reserved -' ' Text -'"aws_db_instance" "timeout_example"' Literal.String -' ' Text -'{' Text.Punctuation -'\n' Text - -' allocated_storage' Name.Attribute -' ' Text -'=' Operator -' ' Text -'10' Literal.Number -'\n' Text - -' engine' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"mysql"' Literal.String.Double -'\n' Text - -' engine_version' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"5.6.17"' Literal.String.Double -'\n' Text - -' instance_class' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"db.t1.micro"' Literal.String.Double -'\n' Text - -' name' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"mydb"' Literal.String.Double -'\n' Text - -'\n' Text - -' ' Text -'timeouts' Keyword.Declaration -' ' Text -'{' Text.Punctuation -'\n' Text - -' create' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"60m"' Literal.String.Double -'\n' Text - -' delete' Name.Attribute -' ' Text -'=' Operator -' ' Text -'"2h"' Literal.String.Double -'\n' Text - -' ' Text -'}' Text.Punctuation -'\n' Text - -'}' Text.Punctuation -'\n' Text diff --git a/tests/examplefiles/thingsdb/test.ti b/tests/examplefiles/thingsdb/test.ti new file mode 100644 index 0000000..a45411d --- /dev/null +++ b/tests/examplefiles/thingsdb/test.ti @@ -0,0 +1,76 @@ +/* + * Multi-line comment + */ + +// Single line comment + +[ + 0b110 & 0b011, + 0b110 | 0b011, + 0b110 ^ 0b011, +]; + +x = 0; +[ + false && x += 1, + true || x += 1, + x +]; // expression x += 1 will never be executed + +0b101010; +0xff; ++0.314e+1; +nan; +-inf; +inf; +42; +-10; + +!false; + +true; +false; +nil; // nil +/.*test/i; + +'single quote string'; +"double quote string"; + +nodes_info(); +id(); +.id(); +.add(#12, #42); + +variable; +.property; + +|x, y| x + y; + +{ + nil; // block +} + +.users.map(|user| { + // property, with function and closure + user.name; +}); + +x.y.z.filter(|| true); + +.iris = { + name: 'Iris', + age: 6, +}; + +.arr = [1, 2, 3]; + +cato = {} + +x = { + 6 * 7; /* yes, 42 ! */ +}; + +a == b; +a += 1; + +bool = (a == b || (a == c && c != d)); diff --git a/tests/examplefiles/thingsdb/test.ti.output b/tests/examplefiles/thingsdb/test.ti.output new file mode 100644 index 0000000..b34c9d2 --- /dev/null +++ b/tests/examplefiles/thingsdb/test.ti.output @@ -0,0 +1,424 @@ +'/*' Comment.Multiline +'\n ' Comment.Multiline +'*' Comment.Multiline +' Multi-line comment\n ' Comment.Multiline +'*/' Comment.Multiline +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'// Single line comment\n' Comment.Single + +'\n' Text.Whitespace + +'[' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'0b110' Literal.Number.Bin +' ' Text.Whitespace +'&' Operator +' ' Text.Whitespace +'0b011' Literal.Number.Bin +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'0b110' Literal.Number.Bin +' ' Text.Whitespace +'|' Operator +' ' Text.Whitespace +'0b011' Literal.Number.Bin +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'0b110' Literal.Number.Bin +' ' Text.Whitespace +'^' Operator +' ' Text.Whitespace +'0b011' Literal.Number.Bin +',' Punctuation +'\n' Text.Whitespace + +']' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'x' Name.Variable +' ' Text +'=' Operator +' ' Text.Whitespace +'0' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace + +'[' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'false' Keyword.Constant +' ' Text.Whitespace +'&' Operator +'&' Operator +' ' Text.Whitespace +'x' Name.Variable +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'true' Keyword.Constant +' ' Text.Whitespace +'|' Operator +'|' Operator +' ' Text.Whitespace +'x' Name.Variable +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'x' Name.Variable +'\n' Text.Whitespace + +']' Punctuation +';' Punctuation +' ' Text.Whitespace +'// expression x += 1 will never be executed\n' Comment.Single + +'\n' Text.Whitespace + +'0b101010' Literal.Number.Bin +';' Punctuation +'\n' Text.Whitespace + +'0xff' Literal.Number.Hex +';' Punctuation +'\n' Text.Whitespace + +'+0' Literal.Number.Integer +'.314e+1' Literal.Number.Float +';' Punctuation +'\n' Text.Whitespace + +'nan;' Literal.Number.Float +'\n' Text.Whitespace + +'-inf;' Literal.Number.Float +'\n' Text.Whitespace + +'inf;' Literal.Number.Float +'\n' Text.Whitespace + +'42' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace + +'-10' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'!' Operator +'false' Keyword.Constant +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'true' Keyword.Constant +';' Punctuation +'\n' Text.Whitespace + +'false' Keyword.Constant +';' Punctuation +'\n' Text.Whitespace + +'nil' Keyword.Constant +';' Punctuation +' ' Text.Whitespace +'// nil\n' Comment.Single + +'/.*test/i' Literal.String.Regex +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +"'single quote string'" Literal.String.Single +';' Punctuation +'\n' Text.Whitespace + +'"double quote string"' Literal.String.Double +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'nodes_info' Name.Function +'(' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'id' Name.Variable +'(' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'.' Name.Function +'id' Name.Function +'(' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'.' Name.Function +'add' Name.Function +'(' Punctuation +'#12' Comment.Preproc +',' Punctuation +' ' Text.Whitespace +'#42' Comment.Preproc +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'variable' Name.Variable +';' Punctuation +'\n' Text.Whitespace + +'.property' Name.Attribute +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'|' Operator +'x' Name.Variable +',' Punctuation +' ' Text.Whitespace +'y' Name.Variable +'|' Operator +' ' Text.Whitespace +'x' Name.Variable +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'y' Name.Variable +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'nil' Keyword.Constant +';' Punctuation +' ' Text.Whitespace +'// block\n' Comment.Single + +'}' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'.users' Name.Attribute +'.' Name.Function +'map' Name.Function +'(' Punctuation +'|' Operator +'user' Name.Variable +'|' Operator +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'// property, with function and closure\n' Comment.Single + +' ' Text.Whitespace +'user' Name.Variable +'.name' Name.Attribute +';' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'x' Name.Variable +'.y' Name.Attribute +'.z' Name.Attribute +'.' Name.Function +'filter' Name.Function +'(' Punctuation +'|' Operator +'|' Operator +' ' Text.Whitespace +'true' Keyword.Constant +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'.iris' Name.Attribute +' ' Text +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'name' Name.Variable +':' Operator +' ' Text.Whitespace +"'Iris'" Literal.String.Single +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'age' Name.Variable +':' Operator +' ' Text.Whitespace +'6' Literal.Number.Integer +',' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'.arr' Name.Attribute +' ' Text +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'2' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'3' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'cato' Name.Variable +' ' Text +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'}' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'x' Name.Variable +' ' Text +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'6' Literal.Number.Integer +' ' Text.Whitespace +'*' Operator +' ' Text.Whitespace +'7' Literal.Number.Integer +';' Punctuation +' ' Text.Whitespace +'/*' Comment.Multiline +' yes, 42 ! ' Comment.Multiline +'*/' Comment.Multiline +'\n' Text.Whitespace + +'}' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'a' Name.Variable +' ' Text +'=' Operator +'=' Operator +' ' Text.Whitespace +'b' Name.Variable +';' Punctuation +'\n' Text.Whitespace + +'a' Name.Variable +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'bool' Name.Variable +' ' Text +'=' Operator +' ' Text.Whitespace +'(' Punctuation +'a' Name.Variable +' ' Text +'=' Operator +'=' Operator +' ' Text.Whitespace +'b' Name.Variable +' ' Text.Whitespace +'|' Operator +'|' Operator +' ' Text.Whitespace +'(' Punctuation +'a' Name.Variable +' ' Text +'=' Operator +'=' Operator +' ' Text.Whitespace +'c' Name.Variable +' ' Text.Whitespace +'&' Operator +'&' Operator +' ' Text.Whitespace +'c' Name.Variable +' ' Text.Whitespace +'!' Operator +'=' Operator +' ' Text.Whitespace +'d' Name.Variable +')' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/examplefiles/wat/fib.wat b/tests/examplefiles/wat/fib.wat new file mode 100644 index 0000000..c14b303 --- /dev/null +++ b/tests/examplefiles/wat/fib.wat @@ -0,0 +1,35 @@ +(module + (func $fib (param $n i32) (result i32) + (local $a i32) + (local $b i32) + (local $result i32) + (if + (i32.eqz (local.get $n)) + (then + (return (i32.const 1)) + ) + ) + (local.set $b (i32.const 1)) + (; nested (; comment ;) ;) + loop + (local.set $result (i32.add (local.get $a) (local.get $b))) + (local.set $a (local.get $b)) + (local.set $b (local.get $result)) + + ;; decrement $n + (local.tee $n (i32.sub (local.get $n) (i32.const 1))) + + (; test if $n > 0 ;) + (i32.gt_u (i32.const 0)) + + ;; if so, jump to the beginning of the loop + br_if 0 + end + local.get $result + ) + (func $test_memory_store_args + i32.const 1 + f64.store align=8 offset=16 + ) + (export "fib" (func $fib)) +) \ No newline at end of file diff --git a/tests/examplefiles/wat/fib.wat.output b/tests/examplefiles/wat/fib.wat.output new file mode 100644 index 0000000..e170228 --- /dev/null +++ b/tests/examplefiles/wat/fib.wat.output @@ -0,0 +1,234 @@ +'(' Punctuation +'module' Keyword +'\n ' Text +'(' Punctuation +'func' Keyword +' ' Text +'$fib' Name.Variable +' ' Text +'(' Punctuation +'param' Keyword +' ' Text +'$n' Name.Variable +' ' Text +'i32' Keyword.Type +')' Punctuation +' ' Text +'(' Punctuation +'result' Keyword +' ' Text +'i32' Keyword.Type +')' Punctuation +'\n ' Text +'(' Punctuation +'local' Keyword +' ' Text +'$a' Name.Variable +' ' Text +'i32' Keyword.Type +')' Punctuation +'\n ' Text +'(' Punctuation +'local' Keyword +' ' Text +'$b' Name.Variable +' ' Text +'i32' Keyword.Type +')' Punctuation +'\n ' Text +'(' Punctuation +'local' Keyword +' ' Text +'$result' Name.Variable +' ' Text +'i32' Keyword.Type +')' Punctuation +'\n ' Text +'(' Punctuation +'if' Keyword +'\n ' Text +'(' Punctuation +'i32.eqz' Name.Builtin +' ' Text +'(' Punctuation +'local.get' Name.Builtin +' ' Text +'$n' Name.Variable +')' Punctuation +')' Punctuation +'\n ' Text +'(' Punctuation +'then' Keyword +'\n ' Text +'(' Punctuation +'return' Name.Builtin +' ' Text +'(' Punctuation +'i32.const' Name.Builtin +' ' Text +'1' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n ' Text +')' Punctuation +'\n ' Text +')' Punctuation +'\n ' Text +'(' Punctuation +'local.set' Name.Builtin +' ' Text +'$b' Name.Variable +' ' Text +'(' Punctuation +'i32.const' Name.Builtin +' ' Text +'1' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n ' Text +'(;' Comment.Multiline +' nested ' Comment.Multiline +'(;' Comment.Multiline +' comment ' Comment.Multiline +';)' Comment.Multiline +' ' Comment.Multiline +';)' Comment.Multiline +'\n ' Text +'loop' Keyword +'\n ' Text +'(' Punctuation +'local.set' Name.Builtin +' ' Text +'$result' Name.Variable +' ' Text +'(' Punctuation +'i32.add' Name.Builtin +' ' Text +'(' Punctuation +'local.get' Name.Builtin +' ' Text +'$a' Name.Variable +')' Punctuation +' ' Text +'(' Punctuation +'local.get' Name.Builtin +' ' Text +'$b' Name.Variable +')' Punctuation +')' Punctuation +')' Punctuation +'\n ' Text +'(' Punctuation +'local.set' Name.Builtin +' ' Text +'$a' Name.Variable +' ' Text +'(' Punctuation +'local.get' Name.Builtin +' ' Text +'$b' Name.Variable +')' Punctuation +')' Punctuation +'\n ' Text +'(' Punctuation +'local.set' Name.Builtin +' ' Text +'$b' Name.Variable +' ' Text +'(' Punctuation +'local.get' Name.Builtin +' ' Text +'$result' Name.Variable +')' Punctuation +')' Punctuation +'\n\n ' Text +';; decrement $n' Comment.Single +'\n ' Text +'(' Punctuation +'local.tee' Name.Builtin +' ' Text +'$n' Name.Variable +' ' Text +'(' Punctuation +'i32.sub' Name.Builtin +' ' Text +'(' Punctuation +'local.get' Name.Builtin +' ' Text +'$n' Name.Variable +')' Punctuation +' ' Text +'(' Punctuation +'i32.const' Name.Builtin +' ' Text +'1' Literal.Number.Integer +')' Punctuation +')' Punctuation +')' Punctuation +'\n\n ' Text +'(;' Comment.Multiline +' test if $n > 0 ' Comment.Multiline +';)' Comment.Multiline +'\n ' Text +'(' Punctuation +'i32.gt_u' Name.Builtin +' ' Text +'(' Punctuation +'i32.const' Name.Builtin +' ' Text +'0' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n\n ' Text +';; if so, jump to the beginning of the loop' Comment.Single +'\n ' Text +'br_if' Name.Builtin +' ' Text +'0' Literal.Number.Integer +'\n ' Text +'end' Keyword +'\n ' Text +'local.get' Name.Builtin +' ' Text +'$result' Name.Variable +'\n ' Text +')' Punctuation +'\n ' Text +'(' Punctuation +'func' Keyword +' ' Text +'$test_memory_store_args' Name.Variable +'\n ' Text +'i32.const' Name.Builtin +' ' Text +'1' Literal.Number.Integer +'\n ' Text +'f64.store' Name.Builtin +' ' Text +'align' Keyword +'=' Operator +'8' Literal.Number.Integer +' ' Text +'offset' Keyword +'=' Operator +'16' Literal.Number.Integer +'\n ' Text +')' Punctuation +'\n ' Text +'(' Punctuation +'export' Keyword +' ' Text +'"' Literal.String.Double +'fib' Literal.String.Double +'"' Literal.String.Double +' ' Text +'(' Punctuation +'func' Keyword +' ' Text +'$fib' Name.Variable +')' Punctuation +')' Punctuation +'\n' Text + +')' Punctuation +'\n' Text diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor_filename.html new file mode 100644 index 0000000..0cd6cb3 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
1# a
+2# b
+3# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor.html rename to tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor_filename.html new file mode 100644 index 0000000..9d7300a --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
1# a
+2# b
+3# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor.html rename to tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor_filename.html new file mode 100644 index 0000000..75776e2 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
1# a
+2# b
+3# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor.html rename to tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor_filename.html new file mode 100644 index 0000000..c5d15c5 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
1# a
+2# b
+3# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor.html rename to tests/html_linenos_expected_output/inline_cls_step_1_start_1_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor_filename.html new file mode 100644 index 0000000..3a390f6 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+ 9# b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor.html rename to tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor_filename.html new file mode 100644 index 0000000..7ae7563 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+ 9# b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor.html rename to tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor_filename.html new file mode 100644 index 0000000..29237ea --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+ 9# b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor.html rename to tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor_filename.html new file mode 100644 index 0000000..de9ea75 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+ 9# b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor.html b/tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor.html rename to tests/html_linenos_expected_output/inline_cls_step_1_start_8_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor_filename.html new file mode 100644 index 0000000..36a342f --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 # a
+2# b
+ # c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor.html rename to tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor_filename.html new file mode 100644 index 0000000..de54669 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 # a
+2# b
+ # c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor.html rename to tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor_filename.html new file mode 100644 index 0000000..d182767 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 # a
+2# b
+ # c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor.html rename to tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor_filename.html new file mode 100644 index 0000000..d14fc45 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 # a
+2# b
+ # c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor.html rename to tests/html_linenos_expected_output/inline_cls_step_2_start_1_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor_filename.html new file mode 100644 index 0000000..0af3d70 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+  # b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor.html rename to tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor_filename.html new file mode 100644 index 0000000..4bd4074 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+  # b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor.html rename to tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor_filename.html new file mode 100644 index 0000000..dedb4a6 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+  # b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor.html rename to tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor_filename.html new file mode 100644 index 0000000..8134afd --- /dev/null +++ b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+  # b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor.html b/tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor.html rename to tests/html_linenos_expected_output/inline_cls_step_2_start_8_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor_filename.html new file mode 100644 index 0000000..4734b09 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
1# a
+2# b
+3# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor_filename.html new file mode 100644 index 0000000..8d1572a --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
1# a
+2# b
+3# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor_filename.html new file mode 100644 index 0000000..731554e --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
1# a
+2# b
+3# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor_filename.html new file mode 100644 index 0000000..bc20d57 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
1# a
+2# b
+3# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_1_start_1_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor_filename.html new file mode 100644 index 0000000..e68f0ed --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+ 9# b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor_filename.html new file mode 100644 index 0000000..c9a20dc --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+ 9# b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor_filename.html new file mode 100644 index 0000000..2ba1c5c --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+ 9# b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor_filename.html new file mode 100644 index 0000000..55dbacc --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+ 9# b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor.html b/tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_1_start_8_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor_filename.html new file mode 100644 index 0000000..28416c3 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 # a
+2# b
+ # c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor_filename.html new file mode 100644 index 0000000..51c4199 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 # a
+2# b
+ # c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor_filename.html new file mode 100644 index 0000000..4597a83 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 # a
+2# b
+ # c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor_filename.html new file mode 100644 index 0000000..a9aafc4 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 # a
+2# b
+ # c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_2_start_1_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor_filename.html new file mode 100644 index 0000000..dd56896 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+  # b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor_filename.html new file mode 100644 index 0000000..a43477a --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+  # b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor_filename.html new file mode 100644 index 0000000..dc63bf0 --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+  # b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor_filename.html new file mode 100644 index 0000000..ff1d26c --- /dev/null +++ b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor_filename.html @@ -0,0 +1,6 @@ +
testfilename +
 8# a
+  # b
+10# c
+
+
diff --git a/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor.html b/tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor.html rename to tests/html_linenos_expected_output/inline_nocls_step_2_start_8_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor_filename.html new file mode 100644 index 0000000..a850fac --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
1
+2
+3
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor.html b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor.html rename to tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor_filename.html new file mode 100644 index 0000000..64f2b87 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
1
+2
+3
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor.html b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor.html rename to tests/html_linenos_expected_output/table_cls_step_1_start_1_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor_filename.html new file mode 100644 index 0000000..cd34176 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
1
+2
+3
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor.html b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor.html rename to tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor_filename.html new file mode 100644 index 0000000..0bcfb2d --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
1
+2
+3
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor.html b/tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor.html rename to tests/html_linenos_expected_output/table_cls_step_1_start_1_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor_filename.html new file mode 100644 index 0000000..8ed1cc7 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+ 9
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor.html b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor.html rename to tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor_filename.html new file mode 100644 index 0000000..bb228b6 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+ 9
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor.html b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor.html rename to tests/html_linenos_expected_output/table_cls_step_1_start_8_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor_filename.html new file mode 100644 index 0000000..263744a --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+ 9
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor.html b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor.html rename to tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor_filename.html new file mode 100644 index 0000000..5e4b3e4 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+ 9
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor.html b/tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor.html rename to tests/html_linenos_expected_output/table_cls_step_1_start_8_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor_filename.html new file mode 100644 index 0000000..af394e5 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 
+2
+ 
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor.html b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor.html rename to tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor_filename.html new file mode 100644 index 0000000..ae08d46 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 
+2
+ 
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor.html b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor.html rename to tests/html_linenos_expected_output/table_cls_step_2_start_1_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor_filename.html new file mode 100644 index 0000000..96e4e0e --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 
+2
+ 
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor.html b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor.html rename to tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor_filename.html new file mode 100644 index 0000000..9f72184 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 
+2
+ 
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor.html b/tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor.html rename to tests/html_linenos_expected_output/table_cls_step_2_start_1_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor_filename.html new file mode 100644 index 0000000..2c48502 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+  
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor.html b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor.html rename to tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor_filename.html new file mode 100644 index 0000000..8d6f197 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+  
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor.html b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor.html rename to tests/html_linenos_expected_output/table_cls_step_2_start_8_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor_filename.html new file mode 100644 index 0000000..2215f06 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+  
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor.html b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor.html rename to tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor_filename.html new file mode 100644 index 0000000..c3e77f6 --- /dev/null +++ b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+  
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor.html b/tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor.html rename to tests/html_linenos_expected_output/table_cls_step_2_start_8_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor_filename.html new file mode 100644 index 0000000..66582b6 --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
1
+2
+3
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor.html rename to tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor_filename.html new file mode 100644 index 0000000..eec949f --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
1
+2
+3
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor.html rename to tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor_filename.html new file mode 100644 index 0000000..12e606a --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
1
+2
+3
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor.html rename to tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor_filename.html new file mode 100644 index 0000000..c6c9212 --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
1
+2
+3
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor.html rename to tests/html_linenos_expected_output/table_nocls_step_1_start_1_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor_filename.html new file mode 100644 index 0000000..c0bb465 --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+ 9
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor.html rename to tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor_filename.html new file mode 100644 index 0000000..fedf8aa --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+ 9
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor.html rename to tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor_filename.html new file mode 100644 index 0000000..50087f2 --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+ 9
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor.html rename to tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor_filename.html new file mode 100644 index 0000000..7a0ce3b --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+ 9
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor.html b/tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor.html rename to tests/html_linenos_expected_output/table_nocls_step_1_start_8_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor_filename.html new file mode 100644 index 0000000..6b9b33c --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 
+2
+ 
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor.html rename to tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor_filename.html new file mode 100644 index 0000000..ecaa52d --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 
+2
+ 
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor.html rename to tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor_filename.html new file mode 100644 index 0000000..9c82741 --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 
+2
+ 
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor.html rename to tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor_filename.html new file mode 100644 index 0000000..c094ea5 --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 
+2
+ 
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor.html rename to tests/html_linenos_expected_output/table_nocls_step_2_start_1_special_3_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor_filename.html new file mode 100644 index 0000000..79a51c2 --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+  
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor.html rename to tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor_filename.html new file mode 100644 index 0000000..5758759 --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+  
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor.html rename to tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_0_noanchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor_filename.html new file mode 100644 index 0000000..08f506d --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+  
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor.html rename to tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_anchor_nofilename.html diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor_filename.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor_filename.html new file mode 100644 index 0000000..a79329c --- /dev/null +++ b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor_filename.html @@ -0,0 +1,25 @@ + + + + + + + +
+
+ testfilename +
+
+
+
 8
+  
+10
+
+
+
+
# a
+# b
+# c
+
+
+
diff --git a/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor.html b/tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor_nofilename.html similarity index 100% rename from tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor.html rename to tests/html_linenos_expected_output/table_nocls_step_2_start_8_special_3_noanchor_nofilename.html diff --git a/tests/snippets/apl/test_leading_underscore.txt b/tests/snippets/apl/test_leading_underscore.txt new file mode 100644 index 0000000..217b60e --- /dev/null +++ b/tests/snippets/apl/test_leading_underscore.txt @@ -0,0 +1,26 @@ +---input--- +_op_←{_←⍺ ⍵⋄(⍺⍺ ⍺)+⍵⍵ ⍵} + +---tokens--- +'_op_' Name.Variable +'←' Keyword.Declaration +'{' Keyword.Type +'_' Name.Variable +'←' Keyword.Declaration +'⍺' Name.Builtin.Pseudo +' ' Text +'⍵' Name.Builtin.Pseudo +'⋄' Punctuation +'(' Punctuation +'⍺' Name.Builtin.Pseudo +'⍺' Name.Builtin.Pseudo +' ' Text +'⍺' Name.Builtin.Pseudo +')' Punctuation +'+' Operator +'⍵' Name.Builtin.Pseudo +'⍵' Name.Builtin.Pseudo +' ' Text +'⍵' Name.Builtin.Pseudo +'}' Keyword.Type +'\n' Text diff --git a/tests/snippets/c/test_preproc_file.txt b/tests/snippets/c/test_preproc_file.txt index c00af1d..6454702 100644 --- a/tests/snippets/c/test_preproc_file.txt +++ b/tests/snippets/c/test_preproc_file.txt @@ -1,5 +1,6 @@ ---input--- #include +# include ---tokens--- '#' Comment.Preproc @@ -7,3 +8,10 @@ ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc + +'#' Comment.Preproc +' ' Text +'include' Comment.Preproc +' ' Text +'' Comment.PreprocFile +'\n' Comment.Preproc diff --git a/tests/snippets/c/test_preproc_file2.txt b/tests/snippets/c/test_preproc_file2.txt index a0ce5a6..985ed74 100644 --- a/tests/snippets/c/test_preproc_file2.txt +++ b/tests/snippets/c/test_preproc_file2.txt @@ -1,5 +1,6 @@ ---input--- #include "foo.h" +# include "foo.h" ---tokens--- '#' Comment.Preproc @@ -7,3 +8,10 @@ ' ' Text '"foo.h"' Comment.PreprocFile '\n' Comment.Preproc + +'#' Comment.Preproc +' ' Text +'include' Comment.Preproc +' ' Text +'"foo.h"' Comment.PreprocFile +'\n' Comment.Preproc diff --git a/tests/snippets/julia-repl/test_repl.txt b/tests/snippets/julia-repl/test_repl.txt new file mode 100644 index 0000000..798f004 --- /dev/null +++ b/tests/snippets/julia-repl/test_repl.txt @@ -0,0 +1,51 @@ +Tests separating Julia's commands from output in REPL-like code blocks + +---input--- +julia> f(x) = sin(π/2x) +f (generic function with 1 method) + +julia> @. f(1:2) +2-element Vector{Float64}: + 1.0 + 0.7071067811865475 + +---tokens--- +'julia>' Generic.Prompt +' ' Text +'f' Name +'(' Punctuation +'x' Name +')' Punctuation +' ' Text +'=' Operator +' ' Text +'sin' Name +'(' Punctuation +'π' Name.Builtin +'/' Operator +'2' Literal.Number.Integer +'x' Name +')' Punctuation +'\n' Text + +'f (generic function with 1 method)\n' Generic.Output + +'\n' Generic.Output + +'julia>' Generic.Prompt +' ' Text +'@.' Name.Decorator +' ' Text +'f' Name +'(' Punctuation +'1' Literal.Number.Integer +':' Operator +'2' Literal.Number.Integer +')' Punctuation +'\n' Text + +'2-element Vector{Float64}:\n' Generic.Output + +' 1.0\n' Generic.Output + +' 0.7071067811865475\n' Generic.Output diff --git a/tests/snippets/julia/test_keywords.txt b/tests/snippets/julia/test_keywords.txt new file mode 100644 index 0000000..235c411 --- /dev/null +++ b/tests/snippets/julia/test_keywords.txt @@ -0,0 +1,89 @@ +# Test keywords are identified + +---input--- +mutable struct MutableType end +struct ImmutableType end +abstract type AbstractMyType end +primitive type MyPrimitive 32 end +(abstract, mutable, type) = true, π, missing + +abstract type AbstractMyType end +primitive type MyPrimitive 32 end +mutable struct MutableType end + +---tokens--- +'mutable struct' Keyword +' ' Text +'MutableType' Keyword.Type +' ' Text +'end' Keyword +'\n' Text + +'struct' Keyword +' ' Text +'ImmutableType' Keyword.Type +' ' Text +'end' Keyword +'\n' Text + +'abstract type' Keyword +' ' Text +'AbstractMyType' Keyword.Type +' ' Text +'end' Keyword +'\n' Text + +'primitive type' Keyword +' ' Text +'MyPrimitive' Keyword.Type +' ' Text +'32' Literal.Number.Integer +' ' Text +'end' Keyword +'\n' Text + +'(' Punctuation +'abstract' Name +',' Punctuation +' ' Text +'mutable' Name +',' Punctuation +' ' Text +'type' Name +')' Punctuation +' ' Text +'=' Operator +' ' Text +'true' Name.Builtin +',' Punctuation +' ' Text +'π' Name.Builtin +',' Punctuation +' ' Text +'missing' Name.Builtin +'\n' Text + +'\n' Text + +'abstract type' Keyword +' ' Text +'AbstractMyType' Keyword.Type +' ' Text +'end' Keyword +'\n' Text + +'primitive \ttype' Keyword +' ' Text +'MyPrimitive' Keyword.Type +' ' Text +'32' Literal.Number.Integer +' ' Text +'end' Keyword +'\n' Text + +'mutable struct' Keyword +' ' Text +'MutableType' Keyword.Type +' ' Text +'end' Keyword +'\n' Text diff --git a/tests/snippets/julia/test_macros.txt b/tests/snippets/julia/test_macros.txt new file mode 100644 index 0000000..8dc2718 --- /dev/null +++ b/tests/snippets/julia/test_macros.txt @@ -0,0 +1,56 @@ +# Test that macros are parsed, including ones which are defined as symbols + +---input--- +@generated function +@. a + b +@~ a + b +@± a + b +@mymacro(a, b) +@+¹ᵀ a + +---tokens--- +'@generated' Name.Decorator +' ' Text +'function' Keyword +'\n' Text + +'@.' Name.Decorator +' ' Text +'a' Name +' ' Text +'+' Operator +' ' Text +'b' Name +'\n' Text + +'@~' Name.Decorator +' ' Text +'a' Name +' ' Text +'+' Operator +' ' Text +'b' Name +'\n' Text + +'@±' Name.Decorator +' ' Text +'a' Name +' ' Text +'+' Operator +' ' Text +'b' Name +'\n' Text + +'@mymacro' Name.Decorator +'(' Punctuation +'a' Name +',' Punctuation +' ' Text +'b' Name +')' Punctuation +'\n' Text + +'@+¹ᵀ' Name.Decorator +' ' Text +'a' Name +'\n' Text diff --git a/tests/snippets/julia/test_names.txt b/tests/snippets/julia/test_names.txt new file mode 100644 index 0000000..338f483 --- /dev/null +++ b/tests/snippets/julia/test_names.txt @@ -0,0 +1,148 @@ +# Test that the range of Julia variable names are correctly identified + +---input--- +a # single character variable +a_simple_name +_leading_underscore +5implicit_mul +6_more_mul +nums1 +nums_2 +nameswith! +multiple!! +embedded!_inthemiddle +embed!1 +prime_suffix′ +for_each # starts with keyword substring + +# variables with characters > \u00A1 +ð # category Ll +Aʺ # category Lm -- \U02BA (MODIFIER LETTER DOUBLE PRIME), not \U2033 (DOUBLE PRIME) +א # category Lo +Ð # category Lu +A̅ # category Mn -- \U0305 (COMBINING OVERLINE) +ⅿ # category Nl -- \U217F (SMALL ROMAN NUMERAL ONE THOUSAND) +A₁ # category No +A² # category No +€ # category Sc +© # category So + +# number-like names +𝟙 # category Nd +𝟏 # category Nd + +---tokens--- +'a' Name +' ' Text +'# single character variable' Comment +'\n' Text + +'a_simple_name' Name +'\n' Text + +'_leading_underscore' Name +'\n' Text + +'5' Literal.Number.Integer +'implicit_mul' Name +'\n' Text + +'6' Literal.Number.Integer +'_more_mul' Name +'\n' Text + +'nums1' Name +'\n' Text + +'nums_2' Name +'\n' Text + +'nameswith!' Name +'\n' Text + +'multiple!!' Name +'\n' Text + +'embedded!_inthemiddle' Name +'\n' Text + +'embed!1' Name +'\n' Text + +'prime_suffix′' Name +'\n' Text + +'for_each' Name +' ' Text +'# starts with keyword substring' Comment +'\n' Text + +'\n' Text + +'# variables with characters > \\u00A1' Comment +'\n' Text + +'ð' Name +' ' Text +'# category Ll' Comment +'\n' Text + +'Aʺ' Name +' ' Text +'# category Lm -- \\U02BA (MODIFIER LETTER DOUBLE PRIME), not \\U2033 (DOUBLE PRIME)' Comment +'\n' Text + +'א' Name +' ' Text +'# category Lo' Comment +'\n' Text + +'Ð' Name +' ' Text +'# category Lu' Comment +'\n' Text + +'A̅' Name +' ' Text +'# category Mn -- \\U0305 (COMBINING OVERLINE)' Comment +'\n' Text + +'ⅿ' Name +' ' Text +'# category Nl -- \\U217F (SMALL ROMAN NUMERAL ONE THOUSAND)' Comment +'\n' Text + +'A₁' Name +' ' Text +'# category No' Comment +'\n' Text + +'A²' Name +' ' Text +'# category No' Comment +'\n' Text + +'€' Name +' ' Text +'# category Sc' Comment +'\n' Text + +'©' Name +' ' Text +'# category So' Comment +'\n' Text + +'\n' Text + +'# number-like names' Comment +'\n' Text + +'𝟙' Name +' ' Text +'# category Nd' Comment +'\n' Text + +'𝟏' Name +' ' Text +'# category Nd' Comment +'\n' Text diff --git a/tests/snippets/julia/test_numbers.txt b/tests/snippets/julia/test_numbers.txt new file mode 100644 index 0000000..5c57243 --- /dev/null +++ b/tests/snippets/julia/test_numbers.txt @@ -0,0 +1,261 @@ +# Tests identification of number forms + +---input--- +# floats + 1e1 1e+1 1e-1 +1.1e1 1.1e+1 1.1e-1 .1e1 .1_1e1 1_1.1e1 1.1_1e1 1.1_11e1 +1.1E1 1.1E+1 1.1E-1 .1E1 .1_1E1 1_1.1E1 1.1_1E1 1.1_11E1 +1.1f1 1.1f+1 1.1f-1 .1f1 .1_1f1 1_1.1f1 1.1_1f1 1.1_11f1 +1E1 1E+1 1E-1 +1f1 1f+1 1f-1 +.1 1. 1.1 1.1_1 1.1_11 .1_1 .1_11 1_1.1_1 +# hex floats +0x1p1 0xa_bp10 0x01_ap11 0x01_abp1 +0x1.1p1 0xA.Bp10 0x0.1_Ap9 0x0_1.Ap1 0x0_1.A_Bp9 + +# integers +1 01 10_1 10_11 + +# non-decimal +0xf 0xf_0 0xfff_000 +0o7 0o7_0 0o777_000 +0b1 0b1_0 0b111_000 + +# invalid in Julia - out of range values +0xg 0o8 0b2 0x1pA +# invalid in Julia - no trailing underscores +1_ 1.1_ 0xf_ 0o7_ 0b1_ 0xF_p1 +# parsed as juxtaposed numeral + variable in Julia (no underscores in exponents) +1e1_1 1E1_1 1f1_1 0xfp1_1 + +# not floats -- range-like expression parts +1..1 ..1 1.. + +---tokens--- +'# floats' Comment +'\n' Text + +' ' Text +'1e1' Literal.Number.Float +' ' Text +'1e+1' Literal.Number.Float +' ' Text +'1e-1' Literal.Number.Float +'\n' Text + +'1.1e1' Literal.Number.Float +' ' Text +'1.1e+1' Literal.Number.Float +' ' Text +'1.1e-1' Literal.Number.Float +' ' Text +'.1e1' Literal.Number.Float +' ' Text +'.1_1e1' Literal.Number.Float +' ' Text +'1_1.1e1' Literal.Number.Float +' ' Text +'1.1_1e1' Literal.Number.Float +' ' Text +'1.1_11e1' Literal.Number.Float +'\n' Text + +'1.1E1' Literal.Number.Float +' ' Text +'1.1E+1' Literal.Number.Float +' ' Text +'1.1E-1' Literal.Number.Float +' ' Text +'.1E1' Literal.Number.Float +' ' Text +'.1_1E1' Literal.Number.Float +' ' Text +'1_1.1E1' Literal.Number.Float +' ' Text +'1.1_1E1' Literal.Number.Float +' ' Text +'1.1_11E1' Literal.Number.Float +'\n' Text + +'1.1f1' Literal.Number.Float +' ' Text +'1.1f+1' Literal.Number.Float +' ' Text +'1.1f-1' Literal.Number.Float +' ' Text +'.1f1' Literal.Number.Float +' ' Text +'.1_1f1' Literal.Number.Float +' ' Text +'1_1.1f1' Literal.Number.Float +' ' Text +'1.1_1f1' Literal.Number.Float +' ' Text +'1.1_11f1' Literal.Number.Float +'\n' Text + +'1E1' Literal.Number.Float +' ' Text +'1E+1' Literal.Number.Float +' ' Text +'1E-1' Literal.Number.Float +'\n' Text + +'1f1' Literal.Number.Float +' ' Text +'1f+1' Literal.Number.Float +' ' Text +'1f-1' Literal.Number.Float +'\n' Text + +'.1' Literal.Number.Float +' ' Text +'1.' Literal.Number.Float +' ' Text +'1.1' Literal.Number.Float +' ' Text +'1.1_1' Literal.Number.Float +' ' Text +'1.1_11' Literal.Number.Float +' ' Text +'.1_1' Literal.Number.Float +' ' Text +'.1_11' Literal.Number.Float +' ' Text +'1_1.1_1' Literal.Number.Float +'\n' Text + +'# hex floats' Comment +'\n' Text + +'0x1p1' Literal.Number.Float +' ' Text +'0xa_bp10' Literal.Number.Float +' ' Text +'0x01_ap11' Literal.Number.Float +' ' Text +'0x01_abp1' Literal.Number.Float +'\n' Text + +'0x1.1p1' Literal.Number.Float +' ' Text +'0xA.Bp10' Literal.Number.Float +' ' Text +'0x0.1_Ap9' Literal.Number.Float +' ' Text +'0x0_1.Ap1' Literal.Number.Float +' ' Text +'0x0_1.A_Bp9' Literal.Number.Float +'\n' Text + +'\n' Text + +'# integers' Comment +'\n' Text + +'1' Literal.Number.Integer +' ' Text +'01' Literal.Number.Integer +' ' Text +'10_1' Literal.Number.Integer +' ' Text +'10_11' Literal.Number.Integer +'\n' Text + +'\n' Text + +'# non-decimal' Comment +'\n' Text + +'0xf' Literal.Number.Hex +' ' Text +'0xf_0' Literal.Number.Hex +' ' Text +'0xfff_000' Literal.Number.Hex +'\n' Text + +'0o7' Literal.Number.Oct +' ' Text +'0o7_0' Literal.Number.Oct +' ' Text +'0o777_000' Literal.Number.Oct +'\n' Text + +'0b1' Literal.Number.Bin +' ' Text +'0b1_0' Literal.Number.Bin +' ' Text +'0b111_000' Literal.Number.Bin +'\n' Text + +'\n' Text + +'# invalid in Julia - out of range values' Comment +'\n' Text + +'0' Literal.Number.Integer +'xg' Name +' ' Text +'0' Literal.Number.Integer +'o8' Name +' ' Text +'0' Literal.Number.Integer +'b2' Name +' ' Text +'0x1' Literal.Number.Hex +'pA' Name +'\n' Text + +'# invalid in Julia - no trailing underscores' Comment +'\n' Text + +'1' Literal.Number.Integer +'_' Name +' ' Text +'1.1' Literal.Number.Float +'_' Name +' ' Text +'0xf' Literal.Number.Hex +'_' Name +' ' Text +'0o7' Literal.Number.Oct +'_' Name +' ' Text +'0b1' Literal.Number.Bin +'_' Name +' ' Text +'0xF' Literal.Number.Hex +'_p1' Name +'\n' Text + +'# parsed as juxtaposed numeral + variable in Julia (no underscores in exponents)' Comment +'\n' Text + +'1e1' Literal.Number.Float +'_1' Name +' ' Text +'1E1' Literal.Number.Float +'_1' Name +' ' Text +'1f1' Literal.Number.Float +'_1' Name +' ' Text +'0xfp1' Literal.Number.Float +'_1' Name +'\n' Text + +'\n' Text + +'# not floats -- range-like expression parts' Comment +'\n' Text + +'1' Literal.Number.Integer +'..' Operator +'1' Literal.Number.Integer +' ' Text +'..' Operator +'1' Literal.Number.Integer +' ' Text +'1' Literal.Number.Integer +'..' Operator +'\n' Text diff --git a/tests/snippets/julia/test_operators.txt b/tests/snippets/julia/test_operators.txt new file mode 100644 index 0000000..017a48e --- /dev/null +++ b/tests/snippets/julia/test_operators.txt @@ -0,0 +1,172 @@ +# Test that operators --- dotted and unicode --- are identified correctly. + +---input--- +a += b.c +a .÷= .~b.c +a = !b ⋆ c! +a = b ? c : d ⊕ e +a = √(5) +a -> (a...) .+ 1 +a \ b +1..2 +a = a === b +a <: T +a >: T +a::T +[adjoint]' +(identity)'' +adjoint''' +transpose'ᵀ +suffixed +¹ operator +suffixed +¹²³ operator + +---tokens--- +'a' Name +' ' Text +'+=' Operator +' ' Text +'b' Name +'.' Operator +'c' Name +'\n' Text + +'a' Name +' ' Text +'.÷=' Operator +' ' Text +'.~' Operator +'b' Name +'.' Operator +'c' Name +'\n' Text + +'a' Name +' ' Text +'=' Operator +' ' Text +'!' Operator +'b' Name +' ' Text +'⋆' Operator +' ' Text +'c!' Name +'\n' Text + +'a' Name +' ' Text +'=' Operator +' ' Text +'b' Name +' ' Text +'?' Operator +' ' Text +'c' Name +' ' Text +':' Operator +' ' Text +'d' Name +' ' Text +'⊕' Operator +' ' Text +'e' Name +'\n' Text + +'a' Name +' ' Text +'=' Operator +' ' Text +'√' Operator +'(' Punctuation +'5' Literal.Number.Integer +')' Punctuation +'\n' Text + +'a' Name +' ' Text +'->' Operator +' ' Text +'(' Punctuation +'a' Name +'...' Operator +')' Punctuation +' ' Text +'.+' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'a' Name +' ' Text +'\\' Operator +' ' Text +'b' Name +'\n' Text + +'1' Literal.Number.Integer +'..' Operator +'2' Literal.Number.Integer +'\n' Text + +'a' Name +' ' Text +'=' Operator +' ' Text +'a' Name +' ' Text +'===' Operator +' ' Text +'b' Name +'\n' Text + +'a' Keyword.Type +' ' Text +'<:' Operator +' ' Text +'T' Keyword.Type +'\n' Text + +'a' Keyword.Type +' ' Text +'>:' Operator +' ' Text +'T' Keyword.Type +'\n' Text + +'a' Name +'::' Operator +'T' Keyword.Type +'\n' Text + +'[' Punctuation +'adjoint' Name +']' Punctuation +"'" Operator +'\n' Text + +'(' Punctuation +'identity' Name +')' Punctuation +"''" Operator +'\n' Text + +'adjoint' Name +"'''" Operator +'\n' Text + +'transpose' Name +"'ᵀ" Operator +'\n' Text + +'suffixed' Name +' ' Text +'+¹' Operator +' ' Text +'operator' Name +'\n' Text + +'suffixed' Name +' ' Text +'+¹²³' Operator +' ' Text +'operator' Name +'\n' Text diff --git a/tests/snippets/julia/test_strings.txt b/tests/snippets/julia/test_strings.txt new file mode 100644 index 0000000..436bfe3 --- /dev/null +++ b/tests/snippets/julia/test_strings.txt @@ -0,0 +1,225 @@ +# Tests string forms + +---input--- +"global function" +"An $interpolated variable" +"An $(a + 1) expression" +"""a""" +""" +global function +de e f +"inner string" +""" +raw"\\ a \" $interp $(1 + 1) \"" +raw""" +"inner string" +$interp +$(1 + 1) +""" +# commented "string" + +@sprintf "%0.2f" var +v"1.0" +var"#nonstandard#" + +r"^[abs]+$"m +arbi"trary"suff +arbi"trary"1234 + +`global function` +`abc \` \$ $interpolated` +`abc $(a + 1)` +```a``` +``` +global function +"thing" ` \$ +`now` $(now()) +``` +# commented `command` + +arbi`trary`suff +arbi`trary`1234 + +---tokens--- +'"' Literal.String +'global function' Literal.String +'"' Literal.String +'\n' Text + +'"' Literal.String +'An ' Literal.String +'$interpolated' Literal.String.Interpol +' variable' Literal.String +'"' Literal.String +'\n' Text + +'"' Literal.String +'An ' Literal.String +'$' Literal.String.Interpol +'(' Punctuation +'a' Name +' ' Text +'+' Operator +' ' Text +'1' Literal.Number.Integer +')' Punctuation +' expression' Literal.String +'"' Literal.String +'\n' Text + +'"""' Literal.String +'a' Literal.String +'"""' Literal.String +'\n' Text + +'"""' Literal.String +'\nglobal function\nde e f\n' Literal.String + +'"' Literal.String +'inner string' Literal.String +'"' Literal.String +'\n' Literal.String + +'"""' Literal.String +'\n' Text + +'raw' Literal.String.Affix +'"' Literal.String +'\\\\ a ' Literal.String +'\\"' Literal.String.Escape +' $interp $(1 + 1) ' Literal.String +'\\"' Literal.String.Escape +'"' Literal.String +'\n' Text + +'raw' Literal.String.Affix +'"""' Literal.String +'\n"inner string"\n$interp\n$(1 + 1)\n' Literal.String + +'"""' Literal.String +'\n' Text + +'# commented "string"' Comment +'\n' Text + +'\n' Text + +'@sprintf' Name.Decorator +' ' Text +'"' Literal.String +'%0.2f' Literal.String.Interpol +'"' Literal.String +' ' Text +'var' Name +'\n' Text + +'v' Literal.String.Affix +'"' Literal.String +'1.0' Literal.String +'"' Literal.String +'\n' Text + +'var' Literal.String.Affix +'"' Literal.String +'#nonstandard#' Literal.String +'"' Literal.String +'\n' Text + +'\n' Text + +'r' Literal.String.Affix +'"' Literal.String.Regex +'^[abs]+$' Literal.String.Regex +'"' Literal.String.Regex +'m' Literal.String.Affix +'\n' Text + +'arbi' Literal.String.Affix +'"' Literal.String +'trary' Literal.String +'"' Literal.String +'suff' Literal.String.Affix +'\n' Text + +'arbi' Literal.String.Affix +'"' Literal.String +'trary' Literal.String +'"' Literal.String +'1234' Literal.String.Affix +'\n' Text + +'\n' Text + +'`' Literal.String.Backtick +'global function' Literal.String.Backtick +'`' Literal.String.Backtick +'\n' Text + +'`' Literal.String.Backtick +'abc ' Literal.String.Backtick +'\\`' Literal.String.Escape +' ' Literal.String.Backtick +'\\$' Literal.String.Escape +' ' Literal.String.Backtick +'$interpolated' Literal.String.Interpol +'`' Literal.String.Backtick +'\n' Text + +'`' Literal.String.Backtick +'abc ' Literal.String.Backtick +'$' Literal.String.Interpol +'(' Punctuation +'a' Name +' ' Text +'+' Operator +' ' Text +'1' Literal.Number.Integer +')' Punctuation +'`' Literal.String.Backtick +'\n' Text + +'```' Literal.String.Backtick +'a' Literal.String.Backtick +'```' Literal.String.Backtick +'\n' Text + +'```' Literal.String.Backtick +'\nglobal function\n"thing" ' Literal.String.Backtick +'`' Literal.String.Backtick +' ' Literal.String.Backtick +'\\$' Literal.String.Escape +'\n' Literal.String.Backtick + +'`' Literal.String.Backtick +'now' Literal.String.Backtick +'`' Literal.String.Backtick +' ' Literal.String.Backtick +'$' Literal.String.Interpol +'(' Punctuation +'now' Name +'(' Punctuation +')' Punctuation +')' Punctuation +'\n' Literal.String.Backtick + +'```' Literal.String.Backtick +'\n' Text + +'# commented `command`' Comment +'\n' Text + +'\n' Text + +'arbi' Literal.String.Affix +'`' Literal.String.Backtick +'trary' Literal.String.Backtick +'`' Literal.String.Backtick +'suff' Literal.String.Affix +'\n' Text + +'arbi' Literal.String.Affix +'`' Literal.String.Backtick +'trary' Literal.String.Backtick +'`' Literal.String.Backtick +'1234' Literal.String.Affix +'\n' Text diff --git a/tests/snippets/julia/test_symbols.txt b/tests/snippets/julia/test_symbols.txt new file mode 100644 index 0000000..8b85a8e --- /dev/null +++ b/tests/snippets/julia/test_symbols.txt @@ -0,0 +1,78 @@ +# Tests that symbols are parsed as special literals + +---input--- +:abc_123 +:abc_def +:α +Val{:mysymbol} + +# non-symbols +a:b +1:b +1.:b +a::T +a<:T +a>:T +UInt(1):UInt(2) + +---tokens--- +':abc_123' Literal.String.Symbol +'\n' Text + +':abc_def' Literal.String.Symbol +'\n' Text + +':α' Literal.String.Symbol +'\n' Text + +'Val' Keyword.Type +'{' Punctuation +':mysymbol' Literal.String.Symbol +'}' Punctuation +'\n' Text + +'\n' Text + +'# non-symbols' Comment +'\n' Text + +'a' Name +':' Operator +'b' Name +'\n' Text + +'1' Literal.Number.Integer +':' Operator +'b' Name +'\n' Text + +'1.' Literal.Number.Float +':' Operator +'b' Name +'\n' Text + +'a' Name +'::' Operator +'T' Keyword.Type +'\n' Text + +'a' Keyword.Type +'<:' Operator +'T' Keyword.Type +'\n' Text + +'a' Keyword.Type +'>:' Operator +'T' Keyword.Type +'\n' Text + +'UInt' Keyword.Type +'(' Punctuation +'1' Literal.Number.Integer +')' Punctuation +':' Operator +'UInt' Keyword.Type +'(' Punctuation +'2' Literal.Number.Integer +')' Punctuation +'\n' Text diff --git a/tests/snippets/julia/test_types.txt b/tests/snippets/julia/test_types.txt new file mode 100644 index 0000000..dc47534 --- /dev/null +++ b/tests/snippets/julia/test_types.txt @@ -0,0 +1,196 @@ +# Tests identifying names which must be types from context + +---input--- +Union{} +MyType{Nothing, Any} +f(::Union{T,S}) where S where T = 1 +f(::T) where {T} = 1 +f(::Type{<:T}) = 1 +f(::AT) where AT <: AbstractArray{MyType,1} = 1 +f(::Val{:named}) = 1 +f(::typeof(sin)) = 1 +MyInt <: Integer +Number >: MyInt +AT{T,1} <: B +B>:AT{T,1} +A <: f(B) +g(C) <: T + +---tokens--- +'Union' Keyword.Type +'{' Punctuation +'}' Punctuation +'\n' Text + +'MyType' Keyword.Type +'{' Punctuation +'Nothing' Keyword.Type +',' Punctuation +' ' Text +'Any' Keyword.Type +'}' Punctuation +'\n' Text + +'f' Name +'(' Punctuation +'::' Operator +'Union' Keyword.Type +'{' Punctuation +'T' Keyword.Type +',' Punctuation +'S' Keyword.Type +'}' Punctuation +')' Punctuation +' ' Text +'where' Keyword +' ' Text +'S' Keyword.Type +' ' Text +'where' Keyword +' ' Text +'T' Keyword.Type +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'f' Name +'(' Punctuation +'::' Operator +'T' Keyword.Type +')' Punctuation +' ' Text +'where' Keyword +' ' Text +'{' Punctuation +'T' Keyword.Type +'}' Punctuation +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'f' Name +'(' Punctuation +'::' Operator +'Type' Keyword.Type +'{' Punctuation +'<:' Operator +'T' Keyword.Type +'}' Punctuation +')' Punctuation +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'f' Name +'(' Punctuation +'::' Operator +'AT' Keyword.Type +')' Punctuation +' ' Text +'where' Keyword +' ' Text +'AT' Keyword.Type +' ' Text +'<:' Operator +' ' Text +'AbstractArray' Keyword.Type +'{' Punctuation +'MyType' Keyword.Type +',' Punctuation +'1' Literal.Number.Integer +'}' Punctuation +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'f' Name +'(' Punctuation +'::' Operator +'Val' Keyword.Type +'{' Punctuation +':named' Literal.String.Symbol +'}' Punctuation +')' Punctuation +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'f' Name +'(' Punctuation +'::' Operator +'typeof' Name +'(' Punctuation +'sin' Name +')' Punctuation +')' Punctuation +' ' Text +'=' Operator +' ' Text +'1' Literal.Number.Integer +'\n' Text + +'MyInt' Keyword.Type +' ' Text +'<:' Operator +' ' Text +'Integer' Keyword.Type +'\n' Text + +'Number' Keyword.Type +' ' Text +'>:' Operator +' ' Text +'MyInt' Keyword.Type +'\n' Text + +'AT' Keyword.Type +'{' Punctuation +'T' Keyword.Type +',' Punctuation +'1' Literal.Number.Integer +'}' Punctuation +' ' Text +'<:' Operator +' ' Text +'B' Keyword.Type +'\n' Text + +'B' Keyword.Type +'>:' Operator +'AT' Keyword.Type +'{' Punctuation +'T' Keyword.Type +',' Punctuation +'1' Literal.Number.Integer +'}' Punctuation +'\n' Text + +'A' Keyword.Type +' ' Text +'<:' Operator +' ' Text +'f' Name +'(' Punctuation +'B' Name +')' Punctuation +'\n' Text + +'g' Name +'(' Punctuation +'C' Name +')' Punctuation +' ' Text +'<:' Operator +' ' Text +'T' Keyword.Type +'\n' Text diff --git a/tests/snippets/octave/test_multilinecomment.txt b/tests/snippets/octave/test_multilinecomment.txt new file mode 100644 index 0000000..0987f4e --- /dev/null +++ b/tests/snippets/octave/test_multilinecomment.txt @@ -0,0 +1,27 @@ +---input--- +%{ +This is a long comment + %} + #{ +This too +#} +This isnt + +---tokens--- +'%{\n' Comment.Multiline + +'This is a long comment\n' Comment.Multiline + +' %}' Comment.Multiline +'\n ' Text +'#{\n' Comment.Multiline + +'This too\n' Comment.Multiline + +'#}' Comment.Multiline +'\n' Text + +'This' Name +' ' Text +'isnt' Name +'\n' Text diff --git a/tests/snippets/omg-idl/annotation_named_params.txt b/tests/snippets/omg-idl/annotation_named_params.txt new file mode 100644 index 0000000..d67e7bb --- /dev/null +++ b/tests/snippets/omg-idl/annotation_named_params.txt @@ -0,0 +1,27 @@ +Asserts that annotation named parameters use Name, which is different from the +normal "scoped_name =" lexing, which uses Name.Constant. + +---input--- +@mod::anno(value = const_a) const short const_b = const_a; + +---tokens--- +'@mod::anno' Name.Decorator +'(' Punctuation +'value' Name +' ' Text +'=' Punctuation +' ' Text +'const_a' Name +')' Punctuation +' ' Text +'const' Keyword.Declaration +' ' Text +'short' Keyword.Type +' ' Text +'const_b' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text +'const_a' Name +';' Punctuation +'\n' Text diff --git a/tests/snippets/omg-idl/enumerators.txt b/tests/snippets/omg-idl/enumerators.txt new file mode 100644 index 0000000..c6986ab --- /dev/null +++ b/tests/snippets/omg-idl/enumerators.txt @@ -0,0 +1,18 @@ +Asserts that enumerators use Name.Constant instead of just Name. + +---input--- +enum Enum_t {enum_a, enum_b}; + +---tokens--- +'enum' Keyword +' ' Text.Whitespace +'Enum_t' Name.Class +' ' Text +'{' Punctuation +'enum_a' Name.Constant +',' Punctuation +' ' Text +'enum_b' Name.Constant +'}' Punctuation +';' Punctuation +'\n' Text diff --git a/tests/snippets/powershell/test_colon_punctuation.txt b/tests/snippets/powershell/test_colon_punctuation.txt new file mode 100644 index 0000000..72733c3 --- /dev/null +++ b/tests/snippets/powershell/test_colon_punctuation.txt @@ -0,0 +1,35 @@ +---input--- +$message = (Test-Path C:\) ? "Path exists" : "Path not found" +[math]::pi + +---tokens--- +'$message' Name.Variable +' ' Text +'=' Punctuation +' ' Text +'(' Punctuation +'Test-Path' Name.Builtin +' ' Text +'C' Name +':' Punctuation +'\\' Punctuation +')' Punctuation +' ' Text +'?' Punctuation +' ' Text +'"' Literal.String.Double +'Path exists' Literal.String.Double +'"' Literal.String.Double +' ' Text +':' Punctuation +' ' Text +'"' Literal.String.Double +'Path not found' Literal.String.Double +'"' Literal.String.Double +'\n' Text + +'[math]' Name.Constant +':' Punctuation +':' Punctuation +'pi' Name +'\n' Text diff --git a/tests/snippets/powershell/test_remoting_session.txt b/tests/snippets/powershell/test_remoting_session.txt index 9d9db60..23fa9c2 100644 --- a/tests/snippets/powershell/test_remoting_session.txt +++ b/tests/snippets/powershell/test_remoting_session.txt @@ -7,11 +7,11 @@ '-NetBIOS' Name '-Hostname' Name ']' Punctuation -':' Error +':' Punctuation ' ' Text 'PS ' Name.Builtin 'C' Name -':' Error +':' Punctuation '\\' Punctuation '>' Punctuation ' ' Text diff --git a/tests/snippets/powershell/test_session.txt b/tests/snippets/powershell/test_session.txt index 3821244..7fe8b42 100644 --- a/tests/snippets/powershell/test_session.txt +++ b/tests/snippets/powershell/test_session.txt @@ -8,7 +8,7 @@ PS > Get-ChildItem ---tokens--- 'PS ' Name.Builtin 'C' Name -':' Error +':' Punctuation '\\' Punctuation '>' Punctuation ' ' Text diff --git a/tests/snippets/promql/test_complex_exp_single_quotes.txt b/tests/snippets/promql/test_complex_exp_single_quotes.txt new file mode 100644 index 0000000..cbbde3a --- /dev/null +++ b/tests/snippets/promql/test_complex_exp_single_quotes.txt @@ -0,0 +1,35 @@ +---input--- +(sum(rate(metric_test_app{app='turtle',proc='web'}[2m])) by(node)) + +---tokens--- +'(' Operator +'sum' Keyword +'(' Operator +'rate' Keyword.Reserved +'(' Operator +'metric_test_app' Name.Variable +'{' Punctuation +'app' Name.Label +'=' Operator +"'" Punctuation +'turtle' Literal.String +"'" Punctuation +',' Punctuation +'proc' Name.Label +'=' Operator +"'" Punctuation +'web' Literal.String +"'" Punctuation +'}' Punctuation +'[' Punctuation +'2m' Literal.String +']' Punctuation +')' Operator +')' Operator +' ' Text.Whitespace +'by' Keyword +'(' Operator +'node' Name.Variable +')' Operator +')' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_matching_operator_no_regex_match.txt b/tests/snippets/promql/test_matching_operator_no_regex_match.txt new file mode 100644 index 0000000..9859739 --- /dev/null +++ b/tests/snippets/promql/test_matching_operator_no_regex_match.txt @@ -0,0 +1,16 @@ +---input--- +metric_test_app{status!~'(4|5)..'}[2m] + +---tokens--- +'metric_test_app' Name.Variable +'{' Punctuation +'status' Name.Label +'!~' Operator +"'" Punctuation +'(4|5)..' Literal.String +"'" Punctuation +'}' Punctuation +'[' Punctuation +'2m' Literal.String +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_floats.txt b/tests/snippets/python/test_floats.txt new file mode 100644 index 0000000..20bb1d7 --- /dev/null +++ b/tests/snippets/python/test_floats.txt @@ -0,0 +1,75 @@ +---input--- +123 -11 0 -0 0.5 .5 1. -0.5 +0.5 -.5 -1. 2e1 -2e1 2e -2e +2e e.3 -e.3 11.2e-3 -11.2e-3 5_6 5__6 _5 6_ 5.6_7 5.67_ + +---tokens--- +'123' Literal.Number.Integer +' ' Text +'-' Operator +'11' Literal.Number.Integer +' ' Text +'0' Literal.Number.Integer +' ' Text +'-' Operator +'0' Literal.Number.Integer +' ' Text +'0.5' Literal.Number.Float +' ' Text +'.5' Literal.Number.Float +' ' Text +'1.' Literal.Number.Float +' ' Text +'-' Operator +'0.5' Literal.Number.Float +' ' Text +'+' Operator +'0.5' Literal.Number.Float +' ' Text +'-' Operator +'.5' Literal.Number.Float +' ' Text +'-' Operator +'1.' Literal.Number.Float +' ' Text +'2e1' Literal.Number.Float +' ' Text +'-' Operator +'2e1' Literal.Number.Float +' ' Text +'2' Literal.Number.Integer +'e' Name +' ' Text +'-' Operator +'2' Literal.Number.Integer +'e' Name +' ' Text +'+' Operator +'2' Literal.Number.Integer +'e' Name +' ' Text +'e' Name +'.3' Literal.Number.Float +' ' Text +'-' Operator +'e' Name +'.3' Literal.Number.Float +' ' Text +'11.2e-3' Literal.Number.Float +' ' Text +'-' Operator +'11.2e-3' Literal.Number.Float +' ' Text +'5_6' Literal.Number.Integer +' ' Text +'5' Literal.Number.Integer +'__6' Name +' ' Text +'_5' Name +' ' Text +'6' Literal.Number.Integer +'_' Name +' ' Text +'5.6_7' Literal.Number.Float +' ' Text +'5.67' Literal.Number.Float +'_' Name +'\n' Text diff --git a/tests/snippets/rust/test_rawstrings.txt b/tests/snippets/rust/test_rawstrings.txt new file mode 100644 index 0000000..69524f9 --- /dev/null +++ b/tests/snippets/rust/test_rawstrings.txt @@ -0,0 +1,117 @@ +---input--- +fn main() { + let raw_str = r"Escapes don't work + + here: \x3F \u{211D}"; + println!("{}", raw_str); + + // If you need quotes in a raw string, add a pair of #s + let quotes = r#"And then I said: + + "There is no escape!""#; + println!("{}", quotes); + + // If you need "# in your string, just use more #s in the delimiter. + // There is no limit for the number of #s you can use. + let longer_delimiter = r###"A string + with "# in it. And even "##!"###; + println!("{}", longer_delimiter); +} + +---tokens--- +'fn' Keyword +' ' Text +'main' Name.Function +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'let' Keyword.Declaration +' ' Text.Whitespace +'raw_str' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'r"Escapes don\'t work\n\n here: \\x3F \\u{211D}"' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'println!' Name.Function.Magic +'(' Punctuation +'"' Literal.String +'{}' Literal.String +'"' Literal.String +',' Punctuation +' ' Text.Whitespace +'raw_str' Name +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'// If you need quotes in a raw string, add a pair of #s\n' Comment.Single + +' ' Text.Whitespace +'let' Keyword.Declaration +' ' Text.Whitespace +'quotes' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'r#"And then I said:\n\n "There is no escape!""#' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'println!' Name.Function.Magic +'(' Punctuation +'"' Literal.String +'{}' Literal.String +'"' Literal.String +',' Punctuation +' ' Text.Whitespace +'quotes' Name +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'// If you need "# in your string, just use more #s in the delimiter.\n' Comment.Single + +' ' Text.Whitespace +'// There is no limit for the number of #s you can use.\n' Comment.Single + +' ' Text.Whitespace +'let' Keyword.Declaration +' ' Text.Whitespace +'longer_delimiter' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'r###"A string\n with "# in it. And even "##!"###' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'println!' Name.Function.Magic +'(' Punctuation +'"' Literal.String +'{}' Literal.String +'"' Literal.String +',' Punctuation +' ' Text.Whitespace +'longer_delimiter' Name +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_colon_colon_function_name.txt b/tests/snippets/scala/test_colon_colon_function_name.txt new file mode 100644 index 0000000..eeebed2 --- /dev/null +++ b/tests/snippets/scala/test_colon_colon_function_name.txt @@ -0,0 +1,33 @@ +---input--- +def ::(xs: List[T]): List[T] = ::(x, xs) + +---tokens--- +'def' Keyword +' ' Text +'::' Name.Function +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'::' Name +'(' Punctuation +'x' Name +',' Punctuation +' ' Text +'xs' Name +')' Punctuation +'\n' Text diff --git a/tests/snippets/scala/test_default_parameter.txt b/tests/snippets/scala/test_default_parameter.txt new file mode 100644 index 0000000..a82e5a0 --- /dev/null +++ b/tests/snippets/scala/test_default_parameter.txt @@ -0,0 +1,37 @@ +---input--- +def f(using y: Char = if true then 'a' else 2): Int = ??? + +---tokens--- +'def' Keyword +' ' Text +'f' Name.Function +'(' Punctuation +'using' Keyword +' ' Text +'y' Name +':' Punctuation +' ' Text +'Char' Name.Class +' ' Text +'=' Operator +' ' Text +'if' Keyword +' ' Text +'true' Keyword.Constant +' ' Text +'then' Keyword +' ' Text +"'a'" Literal.String.Char +' ' Text +'else' Keyword +' ' Text +'2' Literal.Number.Integer +')' Punctuation +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text diff --git a/tests/snippets/scala/test_end_val.txt b/tests/snippets/scala/test_end_val.txt new file mode 100644 index 0000000..112cfaf --- /dev/null +++ b/tests/snippets/scala/test_end_val.txt @@ -0,0 +1,8 @@ +---input--- +end val + +---tokens--- +'end' Keyword +' ' Text +'val' Keyword +'\n' Text diff --git a/tests/snippets/scala/test_end_valx.txt b/tests/snippets/scala/test_end_valx.txt new file mode 100644 index 0000000..e72c404 --- /dev/null +++ b/tests/snippets/scala/test_end_valx.txt @@ -0,0 +1,8 @@ +---input--- +end valx + +---tokens--- +'end' Keyword +' ' Text +'valx' Name.Namespace +'\n' Text diff --git a/tests/snippets/scala/test_float_with_exponents.txt b/tests/snippets/scala/test_float_with_exponents.txt new file mode 100644 index 0000000..9a70243 --- /dev/null +++ b/tests/snippets/scala/test_float_with_exponents.txt @@ -0,0 +1,12 @@ +---input--- +.1e12 .1e+34 .1e-56 .1e12f + +---tokens--- +'.1e12' Literal.Number.Float +' ' Text +'.1e+34' Literal.Number.Float +' ' Text +'.1e-56' Literal.Number.Float +' ' Text +'.1e12f' Literal.Number.Float +'\n' Text diff --git a/tests/snippets/scala/test_function_operator_name.txt b/tests/snippets/scala/test_function_operator_name.txt new file mode 100644 index 0000000..a1823f0 --- /dev/null +++ b/tests/snippets/scala/test_function_operator_name.txt @@ -0,0 +1,18 @@ +---input--- +def < (y: String): Boolean + +---tokens--- +'def' Keyword +' ' Text +'<' Name.Function +' ' Text +'(' Punctuation +'y' Name +':' Punctuation +' ' Text +'String' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Boolean' Name.Class +'\n' Text diff --git a/tests/snippets/scala/test_import_path.txt b/tests/snippets/scala/test_import_path.txt new file mode 100644 index 0000000..fc8e5a2 --- /dev/null +++ b/tests/snippets/scala/test_import_path.txt @@ -0,0 +1,12 @@ +---input--- +import a.b.c + +---tokens--- +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'b' Name.Namespace +'.' Punctuation +'c' Name +'\n' Text diff --git a/tests/snippets/scala/test_invalid_symbol_and_invalid_char.txt b/tests/snippets/scala/test_invalid_symbol_and_invalid_char.txt new file mode 100644 index 0000000..9af24e5 --- /dev/null +++ b/tests/snippets/scala/test_invalid_symbol_and_invalid_char.txt @@ -0,0 +1,8 @@ +---input--- +'1 //' + +---tokens--- +"'" Error +'1' Literal.Number.Integer +' ' Text +"//'\n" Comment.Single diff --git a/tests/snippets/scala/test_open_soft_keyword.txt b/tests/snippets/scala/test_open_soft_keyword.txt new file mode 100644 index 0000000..800880e --- /dev/null +++ b/tests/snippets/scala/test_open_soft_keyword.txt @@ -0,0 +1,12 @@ +---input--- +val open = true + +---tokens--- +'val' Keyword.Declaration +' ' Text +'open' Name +' ' Text +'=' Operator +' ' Text +'true' Keyword.Constant +'\n' Text diff --git a/tests/snippets/scala/test_package_name.txt b/tests/snippets/scala/test_package_name.txt new file mode 100644 index 0000000..6b1f348 --- /dev/null +++ b/tests/snippets/scala/test_package_name.txt @@ -0,0 +1,11 @@ +---input--- +package p1.p2: + +---tokens--- +'package' Keyword +' ' Text +'p1' Name.Namespace +'.' Punctuation +'p2' Name +':' Punctuation +'\n' Text diff --git a/tests/snippets/scala/test_prepend_operator.txt b/tests/snippets/scala/test_prepend_operator.txt new file mode 100644 index 0000000..db85047 --- /dev/null +++ b/tests/snippets/scala/test_prepend_operator.txt @@ -0,0 +1,10 @@ +---input--- +a +: b + +---tokens--- +'a' Name +' ' Text +'+:' Operator +' ' Text +'b' Name +'\n' Text diff --git a/tests/snippets/scala/test_qualified_name.txt b/tests/snippets/scala/test_qualified_name.txt new file mode 100644 index 0000000..8a1f06f --- /dev/null +++ b/tests/snippets/scala/test_qualified_name.txt @@ -0,0 +1,10 @@ +---input--- +a.b.c + +---tokens--- +'a' Name +'.' Punctuation +'b' Name +'.' Punctuation +'c' Name +'\n' Text diff --git a/tests/snippets/scala/test_qualified_name_class.txt b/tests/snippets/scala/test_qualified_name_class.txt new file mode 100644 index 0000000..b9d47c9 --- /dev/null +++ b/tests/snippets/scala/test_qualified_name_class.txt @@ -0,0 +1,10 @@ +---input--- +a.b.C + +---tokens--- +'a' Name +'.' Punctuation +'b' Name +'.' Punctuation +'C' Name.Class +'\n' Text diff --git a/tests/snippets/scala/test_script_header.txt b/tests/snippets/scala/test_script_header.txt new file mode 100644 index 0000000..f15ded8 --- /dev/null +++ b/tests/snippets/scala/test_script_header.txt @@ -0,0 +1,6 @@ +---input--- +#!/usr/bin/scala + +---tokens--- +'#!/usr/bin/scala' Comment.Hashbang +'\n' Text diff --git a/tests/snippets/scala/test_symbol_followed_by_op.txt b/tests/snippets/scala/test_symbol_followed_by_op.txt new file mode 100644 index 0000000..5d8a14f --- /dev/null +++ b/tests/snippets/scala/test_symbol_followed_by_op.txt @@ -0,0 +1,7 @@ +---input--- +symbol* + +---tokens--- +'symbol' Name +'*' Operator +'\n' Text diff --git a/tests/snippets/scala/test_symbol_name_ending_with_star.txt b/tests/snippets/scala/test_symbol_name_ending_with_star.txt new file mode 100644 index 0000000..bb1d987 --- /dev/null +++ b/tests/snippets/scala/test_symbol_name_ending_with_star.txt @@ -0,0 +1,6 @@ +---input--- +symbol_* + +---tokens--- +'symbol_*' Name +'\n' Text diff --git a/tests/snippets/scala/test_underscore_name.txt b/tests/snippets/scala/test_underscore_name.txt new file mode 100644 index 0000000..f27754f --- /dev/null +++ b/tests/snippets/scala/test_underscore_name.txt @@ -0,0 +1,12 @@ +---input--- +val head = _head + +---tokens--- +'val' Keyword.Declaration +' ' Text +'head' Name +' ' Text +'=' Operator +' ' Text +'_head' Name +'\n' Text diff --git a/tests/snippets/teal/test_comments.txt b/tests/snippets/teal/test_comments.txt new file mode 100644 index 0000000..20235d0 --- /dev/null +++ b/tests/snippets/teal/test_comments.txt @@ -0,0 +1,28 @@ +---input--- +a//c1 + //c2 +label://c3 +a // c4 +label: implicit comment + +---tokens--- +'a' Name.Function +'//c1' Comment.Single +'\n' Text + +' ' Text +'//c2' Comment.Single +'\n' Text + +'label:' Name.Function +'//c3' Comment.Single +'\n' Text + +'a' Name.Function +' ' Text +'// c4' Comment.Single +'\n' Text + +'label:' Name.Label +' implicit comment' Comment.Single +'\n' Text diff --git a/tests/snippets/teal/test_literals.txt b/tests/snippets/teal/test_literals.txt new file mode 100644 index 0000000..eb0e8cb --- /dev/null +++ b/tests/snippets/teal/test_literals.txt @@ -0,0 +1,28 @@ +---input--- +a 0x1AaAF +a 7777777777777777777777777777777777777777777777777774MSJUVU +a base32(aB/c23=) +a b64 aB/c23= + +---tokens--- +'a' Name.Function +' ' Text +'0x1AaAF' Literal.Number.Hex +'\n' Text + +'a' Name.Function +' ' Text +'7777777777777777777777777777777777777777777777777774MSJUVU' Literal.Number +'\n' Text + +'a' Name.Function +' ' Text +'base32' Literal.String.Affix +'(aB/c23=)' Literal.String.Other +'\n' Text + +'a' Name.Function +' ' Text +'b64 ' Literal.String.Affix +'aB/c23=' Literal.String.Other +'\n' Text diff --git a/tests/snippets/teal/test_strings.txt b/tests/snippets/teal/test_strings.txt new file mode 100644 index 0000000..59d8d6c --- /dev/null +++ b/tests/snippets/teal/test_strings.txt @@ -0,0 +1,15 @@ +---input--- +a "abc\x123\n\"de//f" + +---tokens--- +'a' Name.Function +' ' Text +'"' Literal.String +'abc' Literal.String +'\\x12' Literal.String.Escape +'3' Literal.String +'\\n' Literal.String.Escape +'\\"' Literal.String.Escape +'de//f' Literal.String +'"' Literal.String +'\n' Text diff --git a/tests/snippets/terraform/test_attributes.txt b/tests/snippets/terraform/test_attributes.txt new file mode 100644 index 0000000..db9f933 --- /dev/null +++ b/tests/snippets/terraform/test_attributes.txt @@ -0,0 +1,155 @@ +---input--- + description = "Some description" + + availability_zones = ["${aws_instance.web.availability_zone}-foobar"] + availability_zones = [aws_instance.web.availability_zone] + assume_role_policy = data.aws_iam_policy_document.trust.json + policy_arn = aws_iam_policy.assume_roles[0].arn + + value = file("path.txt") + value = jsonencode(element("value")) + + tags = { + Name = "something" + } + + "ENV_VARIABLE_1" = aws_dynamodb_table.loginsights2metrics.name + "ENV_VARIABLE_2" = "Some string" + + ignore_changes = [last_modified, filename] + + variable = "aws:MultiFactorAuthPresent" + +---tokens--- +' ' Text +'description' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"Some description"' Literal.String.Double +'\n' Text + +'\n' Text + +' ' Text +'availability_zones' Name.Attribute +' ' Text +'=' Operator +' ' Text +'[' Punctuation +'"${aws_instance.web.availability_zone}-foobar"' Literal.String.Double +']' Punctuation +'\n' Text + +' ' Text +'availability_zones' Name.Attribute +' ' Text +'=' Operator +' ' Text +'[' Punctuation +'aws_instance.web.availability_zone' Name.Variable +']' Punctuation +'\n' Text + +' ' Text +'assume_role_policy' Name.Attribute +' ' Text +'=' Operator +' ' Text +'data.aws_iam_policy_document.trust.json' Name.Variable +'\n' Text + +' ' Text +'policy_arn' Name.Attribute +' ' Text +'=' Operator +' ' Text +'aws_iam_policy.assume_roles[0].arn' Name.Variable +'\n' Text + +' \n ' Text +'value' Name.Attribute +' ' Text +'=' Operator +' ' Text +'file' Name.Function +'(' Punctuation +'"path.txt"' Literal.String.Double +')' Punctuation +'\n' Text + +' ' Text +'value' Name.Attribute +' ' Text +'=' Operator +' ' Text +'jsonencode' Name.Function +'(' Punctuation +'element' Name.Function +'(' Punctuation +'"value"' Literal.String.Double +')' Punctuation +')' Punctuation +'\n' Text + +'\n' Text + +' ' Text +'tags' Name.Builtin +' ' Text +'=' Operator +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'Name' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"something"' Literal.String.Double +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +'\n' Text + +' ' Text +'"ENV_VARIABLE_1"' Literal.String.Double +' ' Text +'=' Operator +' ' Text +'aws_dynamodb_table.loginsights2metrics.name' Name.Variable +'\n' Text + +' ' Text +'"ENV_VARIABLE_2"' Literal.String.Double +' ' Text +'=' Operator +' ' Text +'"Some string"' Literal.String.Double +'\n' Text + +'\n' Text + +' ' Text +'ignore_changes' Name.Attribute +' ' Text +'=' Operator +' ' Text +'[' Punctuation +'last_modified, filename' Name.Builtin +']' Punctuation +'\n' Text + +'\n' Text + +' ' Text +'variable' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"aws:MultiFactorAuthPresent"' Literal.String.Double +'\n' Text diff --git a/tests/snippets/terraform/test_backend.txt b/tests/snippets/terraform/test_backend.txt new file mode 100644 index 0000000..c9ea044 --- /dev/null +++ b/tests/snippets/terraform/test_backend.txt @@ -0,0 +1,44 @@ +---input--- +terraform { + backend "consul" { + address = "demo.consul.io" + path = "tfdocs" + } +} + +---tokens--- +'terraform' Name.Builtin +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'backend' Keyword.Reserved +' ' Text +'"consul"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'address' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"demo.consul.io"' Literal.String.Double +'\n' Text + +' ' Text +'path' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"tfdocs"' Literal.String.Double +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/snippets/terraform/test_comment.txt b/tests/snippets/terraform/test_comment.txt new file mode 100644 index 0000000..b874158 --- /dev/null +++ b/tests/snippets/terraform/test_comment.txt @@ -0,0 +1,41 @@ +---input--- +# Single line comment +/* multiline + + comment + +*/ + +---tokens--- +'# Single line comment\n' Comment.Single + +'/*' Comment.Multiline +' ' Comment.Multiline +'m' Comment.Multiline +'u' Comment.Multiline +'l' Comment.Multiline +'t' Comment.Multiline +'i' Comment.Multiline +'l' Comment.Multiline +'i' Comment.Multiline +'n' Comment.Multiline +'e' Comment.Multiline +'\n' Comment.Multiline + +'\n' Comment.Multiline + +' ' Comment.Multiline +' ' Comment.Multiline +'c' Comment.Multiline +'o' Comment.Multiline +'m' Comment.Multiline +'m' Comment.Multiline +'e' Comment.Multiline +'n' Comment.Multiline +'t' Comment.Multiline +'\n' Comment.Multiline + +'\n' Comment.Multiline + +'*/' Comment.Multiline +'\n' Text diff --git a/tests/snippets/terraform/test_functions.txt b/tests/snippets/terraform/test_functions.txt new file mode 100644 index 0000000..e35704d --- /dev/null +++ b/tests/snippets/terraform/test_functions.txt @@ -0,0 +1,56 @@ +---input--- +provider "aws" { + value = file("path.txt") +} + +provider "aws" { + value = jsonencode(element("value")) +} + +---tokens--- +'provider' Keyword.Reserved +' ' Text +'"aws"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'value' Name.Attribute +' ' Text +'=' Operator +' ' Text +'file' Name.Function +'(' Punctuation +'"path.txt"' Literal.String.Double +')' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text + +'\n' Text + +'provider' Keyword.Reserved +' ' Text +'"aws"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'value' Name.Attribute +' ' Text +'=' Operator +' ' Text +'jsonencode' Name.Function +'(' Punctuation +'element' Name.Function +'(' Punctuation +'"value"' Literal.String.Double +')' Punctuation +')' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/snippets/terraform/test_module.txt b/tests/snippets/terraform/test_module.txt new file mode 100644 index 0000000..377897a --- /dev/null +++ b/tests/snippets/terraform/test_module.txt @@ -0,0 +1,32 @@ +---input--- +module "consul" { + source = "hashicorp/consul/aws" + servers = 3 +} + +---tokens--- +'module' Keyword.Reserved +' ' Text +'"consul"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'source' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"hashicorp/consul/aws"' Literal.String.Double +'\n' Text + +' ' Text +'servers' Name.Attribute +' ' Text +'=' Operator +' ' Text +'3' Literal.Number +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/snippets/terraform/test_resource.txt b/tests/snippets/terraform/test_resource.txt new file mode 100644 index 0000000..e4d64ad --- /dev/null +++ b/tests/snippets/terraform/test_resource.txt @@ -0,0 +1,211 @@ +---input--- +resource "aws_internet_gateway" "base_igw" { + vpc_id = aws_vpc.something.id + tags = { + Name = "igw-${var.something}-${var.something}" + } +} + +resource "aws_security_group" "allow_tls" { + name = "allow_tls" + description = "Allow TLS inbound traffic" + vpc_id = aws_vpc.main.id + + # Ingress rules + ingress { + description = "TLS from VPC" + from_port = 443 + to_port = 443 + } + + # Egress rules + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + tags = { + Name = "allow_tls" + } +} + +---tokens--- +'resource' Keyword.Reserved +' ' Text +'"aws_internet_gateway"' Name.Class +' ' Text +'"base_igw"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'vpc_id' Name.Attribute +' ' Text +'=' Operator +' ' Text +'aws_vpc.something.id' Name.Variable +'\n' Text + +' ' Text +'tags' Name.Builtin +' ' Text +'=' Operator +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'Name' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"igw-${var.something}-${var.something}"' Literal.String.Double +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text + +'\n' Text + +'resource' Keyword.Reserved +' ' Text +'"aws_security_group"' Name.Class +' ' Text +'"allow_tls"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'name' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"allow_tls"' Literal.String.Double +'\n' Text + +' ' Text +'description' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"Allow TLS inbound traffic"' Literal.String.Double +'\n' Text + +' ' Text +'vpc_id' Name.Attribute +' ' Text +'=' Operator +' ' Text +'aws_vpc.main.id' Name.Variable +'\n\n # Ingress rules\n' Comment.Single + +' ' Text +'ingress' Name.Builtin +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'description' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"TLS from VPC"' Literal.String.Double +'\n' Text + +' ' Text +'from_port' Name.Attribute +' ' Text +'=' Operator +' ' Text +'443' Literal.Number +'\n' Text + +' ' Text +'to_port' Name.Attribute +' ' Text +'=' Operator +' ' Text +'443' Literal.Number +'\n' Text + +' ' Text +'}' Punctuation +'\n\n # Egress rules\n' Comment.Single + +' ' Text +'egress' Name.Builtin +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'from_port' Name.Attribute +' ' Text +'=' Operator +' ' Text +'0' Literal.Number +'\n' Text + +' ' Text +'to_port' Name.Attribute +' ' Text +'=' Operator +' ' Text +'0' Literal.Number +'\n' Text + +' ' Text +'protocol' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"-1"' Literal.String.Double +'\n' Text + +' ' Text +'cidr_blocks' Name.Attribute +' ' Text +'=' Operator +' ' Text +'[' Punctuation +'"0.0.0.0/0"' Literal.String.Double +']' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +'\n' Text + +' ' Text +'tags' Name.Builtin +' ' Text +'=' Operator +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'Name' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"allow_tls"' Literal.String.Double +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/snippets/terraform/test_types.txt b/tests/snippets/terraform/test_types.txt new file mode 100644 index 0000000..f5b00d7 --- /dev/null +++ b/tests/snippets/terraform/test_types.txt @@ -0,0 +1,70 @@ +---input--- +backend "consul" { +data "aws_ami" "example" { +module "consul" { +output "instance_ip_addr" { +provider "aws" { +provisioner "local-exec" { +resource "aws_internet_gateway" "base_igw" { +variable "aws_region" { + +---tokens--- +'backend' Keyword.Reserved +' ' Text +'"consul"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +'data' Keyword.Reserved +' ' Text +'"aws_ami"' Name.Class +' ' Text +'"example"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +'module' Keyword.Reserved +' ' Text +'"consul"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +'output' Keyword.Reserved +' ' Text +'"instance_ip_addr"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +'provider' Keyword.Reserved +' ' Text +'"aws"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +'provisioner' Keyword.Reserved +' ' Text +'"local-exec"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +'resource' Keyword.Reserved +' ' Text +'"aws_internet_gateway"' Name.Class +' ' Text +'"base_igw"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +'variable' Keyword.Reserved +' ' Text +'"aws_region"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text diff --git a/tests/snippets/terraform/test_variable_declaration.txt b/tests/snippets/terraform/test_variable_declaration.txt new file mode 100644 index 0000000..bedd777 --- /dev/null +++ b/tests/snippets/terraform/test_variable_declaration.txt @@ -0,0 +1,41 @@ +---input--- +variable "aws_region" { + description = "AWS region to launch servers." + default = "us-west-2" + somevar = true +} + +---tokens--- +'variable' Keyword.Reserved +' ' Text +'"aws_region"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'description' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"AWS region to launch servers."' Literal.String.Double +'\n' Text + +' ' Text +'default' Name.Attribute +' ' Text +'=' Operator +' ' Text +'"us-west-2"' Literal.String.Double +'\n' Text + +' ' Text +'somevar' Name.Attribute +' ' Text +'=' Operator +' ' Text +'true' Name.Constant +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/snippets/terraform/test_variable_read.txt b/tests/snippets/terraform/test_variable_read.txt new file mode 100644 index 0000000..635786e --- /dev/null +++ b/tests/snippets/terraform/test_variable_read.txt @@ -0,0 +1,23 @@ +---input--- +provider "aws" { + region = var.aws_region +} + +---tokens--- +'provider' Keyword.Reserved +' ' Text +'"aws"' Name.Variable +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'region' Name.Attribute +' ' Text +'=' Operator +' ' Text +'var.aws_region' Name.Variable +'\n' Text + +'}' Punctuation +'\n' Text diff --git a/tests/snippets/wat/test_align_and_offset_accept_hexadecimal_numbers.txt b/tests/snippets/wat/test_align_and_offset_accept_hexadecimal_numbers.txt new file mode 100644 index 0000000..919e1d2 --- /dev/null +++ b/tests/snippets/wat/test_align_and_offset_accept_hexadecimal_numbers.txt @@ -0,0 +1,14 @@ +---input--- +i32.store offset=0xdeadbeef align=0x1 + +---tokens--- +'i32.store' Name.Builtin +' ' Text +'offset' Keyword +'=' Operator +'0xdeadbeef' Literal.Number.Hex +' ' Text +'align' Keyword +'=' Operator +'0x1' Literal.Number.Hex +'\n' Text diff --git a/tests/snippets/wat/test_comment_with_open_paren.txt b/tests/snippets/wat/test_comment_with_open_paren.txt new file mode 100644 index 0000000..631de4c --- /dev/null +++ b/tests/snippets/wat/test_comment_with_open_paren.txt @@ -0,0 +1,10 @@ +---input--- +(; comment with ( open paren ;) + +---tokens--- +'(;' Comment.Multiline +' comment with ' Comment.Multiline +'(' Comment.Multiline +' open paren ' Comment.Multiline +';)' Comment.Multiline +'\n' Text diff --git a/tests/snippets/wat/test_comment_with_semicolon.txt b/tests/snippets/wat/test_comment_with_semicolon.txt new file mode 100644 index 0000000..0cd3112 --- /dev/null +++ b/tests/snippets/wat/test_comment_with_semicolon.txt @@ -0,0 +1,10 @@ +---input--- +(; comment with ; semicolon ;) + +---tokens--- +'(;' Comment.Multiline +' comment with ' Comment.Multiline +';' Comment.Multiline +' semicolon ' Comment.Multiline +';)' Comment.Multiline +'\n' Text diff --git a/tests/snippets/wat/test_i32_const_is_builtin.txt b/tests/snippets/wat/test_i32_const_is_builtin.txt new file mode 100644 index 0000000..740907c --- /dev/null +++ b/tests/snippets/wat/test_i32_const_is_builtin.txt @@ -0,0 +1,6 @@ +---input--- +i32.const + +---tokens--- +'i32.const' Name.Builtin +'\n' Text diff --git a/tests/snippets/wat/test_multiline_comment.txt b/tests/snippets/wat/test_multiline_comment.txt new file mode 100644 index 0000000..6cbd45e --- /dev/null +++ b/tests/snippets/wat/test_multiline_comment.txt @@ -0,0 +1,11 @@ +---input--- +(; + comment +;) + +---tokens--- +'(;' Comment.Multiline +'\n comment\n' Comment.Multiline + +';)' Comment.Multiline +'\n' Text diff --git a/tests/snippets/wat/test_nested_comment.txt b/tests/snippets/wat/test_nested_comment.txt new file mode 100644 index 0000000..de07293 --- /dev/null +++ b/tests/snippets/wat/test_nested_comment.txt @@ -0,0 +1,14 @@ +---input--- +(; +nested(;;)comment +;) + +---tokens--- +'(;' Comment.Multiline +'\nnested' Comment.Multiline +'(;' Comment.Multiline +';)' Comment.Multiline +'comment\n' Comment.Multiline + +';)' Comment.Multiline +'\n' Text diff --git a/tests/snippets/wat/test_string_byte_escape.txt b/tests/snippets/wat/test_string_byte_escape.txt new file mode 100644 index 0000000..c0b9e4a --- /dev/null +++ b/tests/snippets/wat/test_string_byte_escape.txt @@ -0,0 +1,9 @@ +---input--- +"\001" + +---tokens--- +'"' Literal.String.Double +'\\00' Literal.String.Escape +'1' Literal.String.Double +'"' Literal.String.Double +'\n' Text diff --git a/tests/snippets/wat/test_string_with_escape.txt b/tests/snippets/wat/test_string_with_escape.txt new file mode 100644 index 0000000..c978faa --- /dev/null +++ b/tests/snippets/wat/test_string_with_escape.txt @@ -0,0 +1,9 @@ +---input--- +"string\t" + +---tokens--- +'"' Literal.String.Double +'string' Literal.String.Double +'\\t' Literal.String.Escape +'"' Literal.String.Double +'\n' Text diff --git a/tests/snippets/wat/test_variable_name_pattern.txt b/tests/snippets/wat/test_variable_name_pattern.txt new file mode 100644 index 0000000..d305ab9 --- /dev/null +++ b/tests/snippets/wat/test_variable_name_pattern.txt @@ -0,0 +1,6 @@ +---input--- +$ABCabc123!#$%&'*+./:<=>?@\\^_`|~-A + +---tokens--- +"$ABCabc123!#$%&'*+./:<=>?@\\\\^_`|~-A" Name.Variable +'\n' Text diff --git a/tests/test_devicetree_lexer.py b/tests/test_devicetree_lexer.py new file mode 100644 index 0000000..fd72b15 --- /dev/null +++ b/tests/test_devicetree_lexer.py @@ -0,0 +1,32 @@ +""" + Devicetree Lexer Tests + ~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import pytest + +from pygments.lexers.devicetree import DevicetreeLexer +from pygments.token import Token + + +@pytest.fixture(scope="module") +def lexer(): + yield DevicetreeLexer() + + +@pytest.mark.parametrize( + "fragment", + ( + 'nodelabel: node@0 { foo = "bar"; };', + 'nodelabel: node { foo = "bar"; };', + 'nodelabel0: nodelabel1: node@0 { foo = "bar"; };', + ), +) +def test_fragment_out_of_root_node(lexer, fragment): + """Validate that a devicetree fragment out of a root node is parsed correctly.""" + + tokens = list(lexer.get_tokens(fragment)) + assert all(x[0] != Token.Error for x in tokens) diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py index 5dd7173..983ec29 100644 --- a/tests/test_html_formatter.py +++ b/tests/test_html_formatter.py @@ -99,7 +99,7 @@ def test_lineanchors(): fmt = HtmlFormatter(**optdict) fmt.format(tokensource, outfile) html = outfile.getvalue() - assert re.search("
", html)
+    assert re.search("
", html)
 
 
 def test_lineanchors_with_startnum():
@@ -108,7 +108,7 @@ def test_lineanchors_with_startnum():
     fmt = HtmlFormatter(**optdict)
     fmt.format(tokensource, outfile)
     html = outfile.getvalue()
-    assert re.search("
", html)
+    assert re.search("
", html)
 
 
 def test_valid_output():
diff --git a/tests/test_html_formatter_linenos_elements.py b/tests/test_html_formatter_linenos_elements.py
index c7431bc..ea98a04 100644
--- a/tests/test_html_formatter_linenos_elements.py
+++ b/tests/test_html_formatter_linenos_elements.py
@@ -23,8 +23,9 @@ def single_line(text):
 @pytest.mark.parametrize("linenostart", ["1", "8"])
 @pytest.mark.parametrize("linenospecial", ["0", "3"])
 @pytest.mark.parametrize("anchorlinenos", ["False", "True"])
+@pytest.mark.parametrize("filename", ["", "testfilename"])
 def test_linenos_elements(
-    linenos, noclasses, linenostep, linenostart, linenospecial, anchorlinenos
+    linenos, noclasses, linenostep, linenostart, linenospecial, anchorlinenos, filename
 ):
     options = dict(
         linenos=linenos,
@@ -33,6 +34,7 @@ def test_linenos_elements(
         linenostart=linenostart,
         linenospecial=linenospecial,
         anchorlinenos=anchorlinenos,
+        filename=filename,
     )
 
     output = StringIO()
@@ -47,6 +49,7 @@ def test_linenos_elements(
     filename_parts.append("start_" + linenostart)
     filename_parts.append("special_" + linenospecial)
     filename_parts.append("anchor" if anchorlinenos == "True" else "noanchor")
+    filename_parts.append("filename" if filename else "nofilename")
     expected_html_filename = "_".join(filename_parts) + ".html"
 
     with open(os.path.join(EXPECTED_OUTPUT_DIR, expected_html_filename)) as f:
diff --git a/tests/test_pangomarkup_formatter.py b/tests/test_pangomarkup_formatter.py
new file mode 100644
index 0000000..f454382
--- /dev/null
+++ b/tests/test_pangomarkup_formatter.py
@@ -0,0 +1,45 @@
+"""
+    Pygments Pango Markup formatter tests
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
+    :license: BSD, see LICENSE for details.
+"""
+
+import pytest
+import re
+
+from pygments import highlight
+from pygments.formatters import PangoMarkupFormatter
+from pygments.lexers import JavascriptLexer
+
+INPUT = r"""
+function foobar(a, b) {
+   if (a > b) {
+      return a & b;
+   }
+   if (a < b) {
+      return true;
+   }
+   console.log("single quote ' and double quote \"")
+   console.log('single quote \' and double quote "')
+   // comment with äöü ç
+}
+"""
+
+OUTPUT = r"""function foobar(a, b) {
+   if (a > b) {
+      return a & b;
+   }
+   if (a < b) {
+      return true;
+   }
+   console.log("single quote ' and double quote \"")
+   console.log('single quote \' and double quote "')
+   // comment with äöü ç
+}
+"""
+
+def test_correct_output():
+    markup = highlight(INPUT, JavascriptLexer(), PangoMarkupFormatter())
+    assert OUTPUT == re.sub('', '', markup)
diff --git a/tests/test_templates.py b/tests/test_templates.py
index f557396..326aecb 100644
--- a/tests/test_templates.py
+++ b/tests/test_templates.py
@@ -1,6 +1,6 @@
 import pytest
 
-from pygments.lexers.templates import JavascriptDjangoLexer, MasonLexer
+from pygments.lexers.templates import JavascriptDjangoLexer, MasonLexer, VelocityLexer
 from pygments.token import Comment, Token
 
 
@@ -12,6 +12,10 @@ def lexer():
 def lexerMason():
     yield MasonLexer()
 
+@pytest.fixture(scope='module')
+def lexerVelocity():
+    yield VelocityLexer()
+
 def test_do_not_mistake_JSDoc_for_django_comment(lexer):
     """
     Test to make sure the lexer doesn't mistake
@@ -41,3 +45,39 @@ def test_mason_unnamed_block(lexerMason):
             """
     res = lexerMason.analyse_text(text)
     assert res == 1.0
+
+def test_velocity_macro(lexerVelocity):
+    text = """
+            #macro(getBookListLink, $readingTrackerResult)
+              $readingTrackerResult.getBookListLink()
+            #end
+            """
+    res = lexerVelocity.analyse_text(text)
+    assert res == 0.26
+
+def test_velocity_foreach(lexerVelocity):
+    text = """
+            
    + #foreach( $product in $allProducts ) +
  • $product
  • + #end +
+ """ + res = lexerVelocity.analyse_text(text) + assert res == 0.16 + +def test_velocity_if(lexerVelocity): + text = """ + #if( $display ) + Velocity! + #end + """ + res = lexerVelocity.analyse_text(text) + assert res == 0.16 + +def test_velocity_reference(lexerVelocity): + text = """ + Hello $name! Welcome to Velocity! + """ + res = lexerVelocity.analyse_text(text) + assert res == 0.01 diff --git a/tests/test_thingsdb.py b/tests/test_thingsdb.py new file mode 100644 index 0000000..8641029 --- /dev/null +++ b/tests/test_thingsdb.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +""" + Basic ThingsDB Test + ~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import unittest + +from pygments.token import Operator, Number, Text, Token, Comment +from pygments.lexers import ThingsDBLexer + + +class ThingsDBTest(unittest.TestCase): + + def setUp(self): + self.lexer = ThingsDBLexer() + self.maxDiff = None + + def testNumber(self): + fragment = u'42' + tokens = [ + (Number.Integer, u'42'), + (Text.Whitespace, '\n') + ] + self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) + + def testThingId(self): + fragment = u'#42' + tokens = [ + (Comment.Preproc, u'#42'), + (Text.Whitespace, '\n') + ] + self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) -- 2.34.1