pygments.rb 0.6.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +11 -0
- data/README.md +6 -6
- data/Rakefile +2 -1
- data/cache-lexers.rb +1 -1
- data/circle.yml +7 -0
- data/lib/pygments/lexer.rb +3 -3
- data/lib/pygments/popen.rb +67 -30
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -1
- data/test/test_pygments.rb +16 -16
- data/vendor/pygments-main/AUTHORS +54 -8
- data/vendor/pygments-main/CHANGES +247 -25
- data/vendor/pygments-main/LICENSE +1 -1
- data/vendor/pygments-main/Makefile +15 -6
- data/vendor/pygments-main/README.rst +39 -0
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/TODO +0 -3
- data/vendor/pygments-main/doc/_themes/pygments14/layout.html +1 -1
- data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +1 -1
- data/vendor/pygments-main/doc/conf.py +3 -11
- data/vendor/pygments-main/doc/docs/api.rst +15 -0
- data/vendor/pygments-main/doc/docs/cmdline.rst +6 -2
- data/vendor/pygments-main/doc/docs/filterdevelopment.rst +4 -3
- data/vendor/pygments-main/doc/docs/integrate.rst +11 -15
- data/vendor/pygments-main/doc/docs/java.rst +7 -7
- data/vendor/pygments-main/doc/docs/lexerdevelopment.rst +258 -171
- data/vendor/pygments-main/doc/docs/lexers.rst +2 -2
- data/vendor/pygments-main/doc/docs/styles.rst +58 -0
- data/vendor/pygments-main/doc/docs/tokens.rst +22 -2
- data/vendor/pygments-main/doc/docs/unicode.rst +15 -7
- data/vendor/pygments-main/doc/faq.rst +17 -21
- data/vendor/pygments-main/doc/index.rst +12 -11
- data/vendor/pygments-main/doc/languages.rst +10 -7
- data/vendor/pygments-main/external/autopygmentize +9 -6
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +70 -52
- data/vendor/pygments-main/external/markdown-processor.py +1 -1
- data/vendor/pygments-main/external/moin-parser.py +1 -1
- data/vendor/pygments-main/external/rst-directive.py +1 -1
- data/vendor/pygments-main/pygmentize +2 -1
- data/vendor/pygments-main/pygments/__init__.py +14 -15
- data/vendor/pygments-main/pygments/cmdline.py +188 -113
- data/vendor/pygments-main/pygments/console.py +13 -13
- data/vendor/pygments-main/pygments/filter.py +7 -7
- data/vendor/pygments-main/pygments/filters/__init__.py +24 -32
- data/vendor/pygments-main/pygments/formatter.py +5 -5
- data/vendor/pygments-main/pygments/formatters/__init__.py +92 -44
- data/vendor/pygments-main/pygments/formatters/_mapping.py +51 -69
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +63 -51
- data/vendor/pygments-main/pygments/formatters/img.py +25 -22
- data/vendor/pygments-main/pygments/formatters/irc.py +182 -0
- data/vendor/pygments-main/pygments/formatters/latex.py +34 -22
- data/vendor/pygments-main/pygments/formatters/other.py +5 -7
- data/vendor/pygments-main/pygments/formatters/rtf.py +28 -31
- data/vendor/pygments-main/pygments/formatters/svg.py +1 -2
- data/vendor/pygments-main/pygments/formatters/terminal.py +29 -45
- data/vendor/pygments-main/pygments/formatters/terminal256.py +118 -31
- data/vendor/pygments-main/pygments/lexer.py +120 -34
- data/vendor/pygments-main/pygments/lexers/__init__.py +85 -53
- data/vendor/pygments-main/pygments/lexers/{_asybuiltins.py → _asy_builtins.py} +7 -7
- data/vendor/pygments-main/pygments/lexers/{_clbuiltins.py → _cl_builtins.py} +17 -17
- data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +72 -0
- data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +1346 -0
- data/vendor/pygments-main/pygments/lexers/{_lassobuiltins.py → _lasso_builtins.py} +4699 -4561
- data/vendor/pygments-main/pygments/lexers/{_luabuiltins.py → _lua_builtins.py} +91 -51
- data/vendor/pygments-main/pygments/lexers/_mapping.py +342 -242
- data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1172 -0
- data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +2547 -0
- data/vendor/pygments-main/pygments/lexers/{_phpbuiltins.py → _php_builtins.py} +350 -353
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +600 -212
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3084 -30
- data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +1163 -0
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +91 -13
- data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +419 -0
- data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1004 -0
- data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1939 -0
- data/vendor/pygments-main/pygments/lexers/actionscript.py +240 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +14 -2542
- data/vendor/pygments-main/pygments/lexers/algebra.py +221 -0
- data/vendor/pygments-main/pygments/lexers/ambient.py +76 -0
- data/vendor/pygments-main/pygments/lexers/ampl.py +87 -0
- data/vendor/pygments-main/pygments/lexers/apl.py +101 -0
- data/vendor/pygments-main/pygments/lexers/archetype.py +318 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +276 -81
- data/vendor/pygments-main/pygments/lexers/automation.py +374 -0
- data/vendor/pygments-main/pygments/lexers/basic.py +500 -0
- data/vendor/pygments-main/pygments/lexers/bibtex.py +156 -0
- data/vendor/pygments-main/pygments/lexers/business.py +594 -0
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +252 -0
- data/vendor/pygments-main/pygments/lexers/c_like.py +541 -0
- data/vendor/pygments-main/pygments/lexers/capnproto.py +79 -0
- data/vendor/pygments-main/pygments/lexers/chapel.py +101 -0
- data/vendor/pygments-main/pygments/lexers/clean.py +288 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +24 -5182
- data/vendor/pygments-main/pygments/lexers/configs.py +833 -0
- data/vendor/pygments-main/pygments/lexers/console.py +114 -0
- data/vendor/pygments-main/pygments/lexers/crystal.py +384 -0
- data/vendor/pygments-main/pygments/lexers/csound.py +366 -0
- data/vendor/pygments-main/pygments/lexers/css.py +689 -0
- data/vendor/pygments-main/pygments/lexers/d.py +251 -0
- data/vendor/pygments-main/pygments/lexers/dalvik.py +6 -6
- data/vendor/pygments-main/pygments/lexers/data.py +555 -0
- data/vendor/pygments-main/pygments/lexers/diff.py +165 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +96 -88
- data/vendor/pygments-main/pygments/lexers/dsls.py +878 -0
- data/vendor/pygments-main/pygments/lexers/dylan.py +289 -0
- data/vendor/pygments-main/pygments/lexers/ecl.py +125 -0
- data/vendor/pygments-main/pygments/lexers/eiffel.py +65 -0
- data/vendor/pygments-main/pygments/lexers/elm.py +121 -0
- data/vendor/pygments-main/pygments/lexers/erlang.py +533 -0
- data/vendor/pygments-main/pygments/lexers/esoteric.py +275 -0
- data/vendor/pygments-main/pygments/lexers/ezhil.py +68 -0
- data/vendor/pygments-main/pygments/lexers/factor.py +344 -0
- data/vendor/pygments-main/pygments/lexers/fantom.py +250 -0
- data/vendor/pygments-main/pygments/lexers/felix.py +273 -0
- data/vendor/pygments-main/pygments/lexers/forth.py +177 -0
- data/vendor/pygments-main/pygments/lexers/fortran.py +205 -0
- data/vendor/pygments-main/pygments/lexers/foxpro.py +1 -1
- data/vendor/pygments-main/pygments/lexers/functional.py +11 -3661
- data/vendor/pygments-main/pygments/lexers/go.py +101 -0
- data/vendor/pygments-main/pygments/lexers/grammar_notation.py +213 -0
- data/vendor/pygments-main/pygments/lexers/graph.py +7 -8
- data/vendor/pygments-main/pygments/lexers/graphics.py +553 -0
- data/vendor/pygments-main/pygments/lexers/haskell.py +840 -0
- data/vendor/pygments-main/pygments/lexers/haxe.py +936 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +172 -145
- data/vendor/pygments-main/pygments/lexers/hexdump.py +97 -0
- data/vendor/pygments-main/pygments/lexers/html.py +602 -0
- data/vendor/pygments-main/pygments/lexers/idl.py +270 -0
- data/vendor/pygments-main/pygments/lexers/igor.py +288 -0
- data/vendor/pygments-main/pygments/lexers/inferno.py +3 -3
- data/vendor/pygments-main/pygments/lexers/installers.py +322 -0
- data/vendor/pygments-main/pygments/lexers/int_fiction.py +1343 -0
- data/vendor/pygments-main/pygments/lexers/iolang.py +63 -0
- data/vendor/pygments-main/pygments/lexers/j.py +146 -0
- data/vendor/pygments-main/pygments/lexers/javascript.py +1506 -0
- data/vendor/pygments-main/pygments/lexers/julia.py +333 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +232 -186
- data/vendor/pygments-main/pygments/lexers/lisp.py +2621 -0
- data/vendor/pygments-main/pygments/lexers/make.py +202 -0
- data/vendor/pygments-main/pygments/lexers/markup.py +595 -0
- data/vendor/pygments-main/pygments/lexers/math.py +11 -2276
- data/vendor/pygments-main/pygments/lexers/matlab.py +663 -0
- data/vendor/pygments-main/pygments/lexers/ml.py +769 -0
- data/vendor/pygments-main/pygments/lexers/modeling.py +358 -0
- data/vendor/pygments-main/pygments/lexers/modula2.py +1561 -0
- data/vendor/pygments-main/pygments/lexers/monte.py +203 -0
- data/vendor/pygments-main/pygments/lexers/ncl.py +1053 -0
- data/vendor/pygments-main/pygments/lexers/nimrod.py +159 -0
- data/vendor/pygments-main/pygments/lexers/nit.py +64 -0
- data/vendor/pygments-main/pygments/lexers/nix.py +136 -0
- data/vendor/pygments-main/pygments/lexers/oberon.py +105 -0
- data/vendor/pygments-main/pygments/lexers/objective.py +504 -0
- data/vendor/pygments-main/pygments/lexers/ooc.py +85 -0
- data/vendor/pygments-main/pygments/lexers/other.py +30 -4481
- data/vendor/pygments-main/pygments/lexers/parasail.py +79 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +171 -114
- data/vendor/pygments-main/pygments/lexers/pascal.py +644 -0
- data/vendor/pygments-main/pygments/lexers/pawn.py +199 -0
- data/vendor/pygments-main/pygments/lexers/perl.py +616 -0
- data/vendor/pygments-main/pygments/lexers/php.py +267 -0
- data/vendor/pygments-main/pygments/lexers/praat.py +294 -0
- data/vendor/pygments-main/pygments/lexers/prolog.py +306 -0
- data/vendor/pygments-main/pygments/lexers/python.py +938 -0
- data/vendor/pygments-main/pygments/lexers/qvt.py +152 -0
- data/vendor/pygments-main/pygments/lexers/r.py +453 -0
- data/vendor/pygments-main/pygments/lexers/rdf.py +195 -24
- data/vendor/pygments-main/pygments/lexers/rebol.py +431 -0
- data/vendor/pygments-main/pygments/lexers/resource.py +85 -0
- data/vendor/pygments-main/pygments/lexers/rnc.py +67 -0
- data/vendor/pygments-main/pygments/lexers/roboconf.py +82 -0
- data/vendor/pygments-main/pygments/lexers/{_robotframeworklexer.py → robotframework.py} +20 -18
- data/vendor/pygments-main/pygments/lexers/ruby.py +519 -0
- data/vendor/pygments-main/pygments/lexers/rust.py +209 -0
- data/vendor/pygments-main/pygments/lexers/sas.py +228 -0
- data/vendor/pygments-main/pygments/lexers/scripting.py +1222 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +478 -115
- data/vendor/pygments-main/pygments/lexers/smalltalk.py +195 -0
- data/vendor/pygments-main/pygments/lexers/smv.py +75 -0
- data/vendor/pygments-main/pygments/lexers/snobol.py +83 -0
- data/vendor/pygments-main/pygments/lexers/special.py +6 -2
- data/vendor/pygments-main/pygments/lexers/sql.py +209 -120
- data/vendor/pygments-main/pygments/lexers/stata.py +106 -0
- data/vendor/pygments-main/pygments/lexers/supercollider.py +90 -0
- data/vendor/pygments-main/pygments/lexers/tcl.py +145 -0
- data/vendor/pygments-main/pygments/lexers/templates.py +282 -90
- data/vendor/pygments-main/pygments/lexers/testing.py +207 -0
- data/vendor/pygments-main/pygments/lexers/text.py +15 -2045
- data/vendor/pygments-main/pygments/lexers/textedit.py +169 -0
- data/vendor/pygments-main/pygments/lexers/textfmts.py +297 -0
- data/vendor/pygments-main/pygments/lexers/theorem.py +458 -0
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +54 -0
- data/vendor/pygments-main/pygments/lexers/typoscript.py +225 -0
- data/vendor/pygments-main/pygments/lexers/urbi.py +133 -0
- data/vendor/pygments-main/pygments/lexers/varnish.py +190 -0
- data/vendor/pygments-main/pygments/lexers/verification.py +111 -0
- data/vendor/pygments-main/pygments/lexers/web.py +13 -4499
- data/vendor/pygments-main/pygments/lexers/webmisc.py +979 -0
- data/vendor/pygments-main/pygments/lexers/whiley.py +117 -0
- data/vendor/pygments-main/pygments/lexers/x10.py +69 -0
- data/vendor/pygments-main/pygments/modeline.py +5 -2
- data/vendor/pygments-main/pygments/plugin.py +1 -1
- data/vendor/pygments-main/pygments/regexopt.py +92 -0
- data/vendor/pygments-main/pygments/scanner.py +3 -2
- data/vendor/pygments-main/pygments/sphinxext.py +11 -6
- data/vendor/pygments-main/pygments/style.py +41 -4
- data/vendor/pygments-main/pygments/styles/__init__.py +5 -1
- data/vendor/pygments-main/pygments/styles/algol.py +63 -0
- data/vendor/pygments-main/pygments/styles/algol_nu.py +63 -0
- data/vendor/pygments-main/pygments/styles/arduino.py +98 -0
- data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
- data/vendor/pygments-main/pygments/styles/borland.py +1 -1
- data/vendor/pygments-main/pygments/styles/bw.py +1 -1
- data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
- data/vendor/pygments-main/pygments/styles/default.py +1 -1
- data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
- data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
- data/vendor/pygments-main/pygments/styles/igor.py +1 -1
- data/vendor/pygments-main/pygments/styles/lovelace.py +97 -0
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +1 -1
- data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
- data/vendor/pygments-main/pygments/styles/native.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -1
- data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
- data/vendor/pygments-main/pygments/styles/perldoc.py +2 -2
- data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
- data/vendor/pygments-main/pygments/styles/sas.py +41 -0
- data/vendor/pygments-main/pygments/styles/stata.py +37 -0
- data/vendor/pygments-main/pygments/styles/tango.py +1 -1
- data/vendor/pygments-main/pygments/styles/trac.py +1 -1
- data/vendor/pygments-main/pygments/styles/vim.py +1 -1
- data/vendor/pygments-main/pygments/styles/vs.py +1 -1
- data/vendor/pygments-main/pygments/styles/xcode.py +1 -1
- data/vendor/pygments-main/pygments/token.py +31 -16
- data/vendor/pygments-main/pygments/unistring.py +141 -65
- data/vendor/pygments-main/pygments/util.py +129 -33
- data/vendor/pygments-main/requirements.txt +5 -0
- data/vendor/pygments-main/scripts/check_sources.py +25 -40
- data/vendor/pygments-main/scripts/debug_lexer.py +246 -0
- data/vendor/pygments-main/scripts/find_error.py +1 -0
- data/vendor/pygments-main/scripts/get_vimkw.py +35 -4
- data/vendor/pygments-main/setup.cfg +3 -0
- data/vendor/pygments-main/setup.py +17 -30
- data/vendor/pygments-main/tox.ini +7 -0
- metadata +159 -387
- data/vendor/pygments-main/ez_setup.py +0 -382
- data/vendor/pygments-main/pygments/lexers/_cocoabuiltins.py +0 -73
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +0 -562
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +0 -1077
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +0 -13
- data/vendor/pygments-main/pygments/lexers/qbasic.py +0 -157
- data/vendor/pygments-main/scripts/find_codetags.py +0 -213
- data/vendor/pygments-main/scripts/find_error.py +0 -173
- data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +0 -37
- data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +0 -869
- data/vendor/pygments-main/tests/dtds/HTML4.dcl +0 -88
- data/vendor/pygments-main/tests/dtds/HTML4.dtd +0 -1092
- data/vendor/pygments-main/tests/dtds/HTML4.soc +0 -9
- data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +0 -195
- data/vendor/pygments-main/tests/dtds/HTMLspec.ent +0 -77
- data/vendor/pygments-main/tests/dtds/HTMLsym.ent +0 -241
- data/vendor/pygments-main/tests/examplefiles/99_bottles_of_beer.chpl +0 -118
- data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +0 -209
- data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +0 -102
- data/vendor/pygments-main/tests/examplefiles/BOM.js +0 -1
- data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +0 -611
- data/vendor/pygments-main/tests/examplefiles/Config.in.cache +0 -1973
- data/vendor/pygments-main/tests/examplefiles/Constants.mo +0 -158
- data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +0 -411
- data/vendor/pygments-main/tests/examplefiles/Deflate.fs +0 -578
- data/vendor/pygments-main/tests/examplefiles/Error.pmod +0 -38
- data/vendor/pygments-main/tests/examplefiles/Errors.scala +0 -18
- data/vendor/pygments-main/tests/examplefiles/FakeFile.pike +0 -360
- data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +0 -66
- data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +0 -104
- data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +0 -671
- data/vendor/pygments-main/tests/examplefiles/Intro.java +0 -1660
- data/vendor/pygments-main/tests/examplefiles/Makefile +0 -1131
- data/vendor/pygments-main/tests/examplefiles/Object.st +0 -4394
- data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +0 -584
- data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +0 -23
- data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +0 -378
- data/vendor/pygments-main/tests/examplefiles/Sorting.mod +0 -470
- data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +0 -382
- data/vendor/pygments-main/tests/examplefiles/addressbook.proto +0 -30
- data/vendor/pygments-main/tests/examplefiles/antlr_ANTLRv3.g +0 -608
- data/vendor/pygments-main/tests/examplefiles/antlr_throws +0 -1
- data/vendor/pygments-main/tests/examplefiles/apache2.conf +0 -393
- data/vendor/pygments-main/tests/examplefiles/as3_test.as +0 -143
- data/vendor/pygments-main/tests/examplefiles/as3_test2.as +0 -46
- data/vendor/pygments-main/tests/examplefiles/as3_test3.as +0 -3
- data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +0 -27
- data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +0 -25
- data/vendor/pygments-main/tests/examplefiles/badcase.java +0 -2
- data/vendor/pygments-main/tests/examplefiles/batchfile.bat +0 -49
- data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +0 -308
- data/vendor/pygments-main/tests/examplefiles/boot-9.scm +0 -1557
- data/vendor/pygments-main/tests/examplefiles/ca65_example +0 -284
- data/vendor/pygments-main/tests/examplefiles/cbmbas_example +0 -9
- data/vendor/pygments-main/tests/examplefiles/cells.ps +0 -515
- data/vendor/pygments-main/tests/examplefiles/ceval.c +0 -2604
- data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +0 -13
- data/vendor/pygments-main/tests/examplefiles/classes.dylan +0 -125
- data/vendor/pygments-main/tests/examplefiles/clojure-weird-keywords.clj +0 -5
- data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +0 -10
- data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +0 -447
- data/vendor/pygments-main/tests/examplefiles/core.cljs +0 -52
- data/vendor/pygments-main/tests/examplefiles/database.pytb +0 -20
- data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +0 -2461
- data/vendor/pygments-main/tests/examplefiles/demo.ahk +0 -181
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +0 -50
- data/vendor/pygments-main/tests/examplefiles/demo.hbs +0 -12
- data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +0 -68
- data/vendor/pygments-main/tests/examplefiles/dwarf.cw +0 -17
- data/vendor/pygments-main/tests/examplefiles/ember.handlebars +0 -33
- data/vendor/pygments-main/tests/examplefiles/erl_session +0 -10
- data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +0 -1
- data/vendor/pygments-main/tests/examplefiles/evil_regex.js +0 -48
- data/vendor/pygments-main/tests/examplefiles/example.Rd +0 -78
- data/vendor/pygments-main/tests/examplefiles/example.als +0 -217
- data/vendor/pygments-main/tests/examplefiles/example.bug +0 -54
- data/vendor/pygments-main/tests/examplefiles/example.c +0 -2080
- data/vendor/pygments-main/tests/examplefiles/example.ceylon +0 -52
- data/vendor/pygments-main/tests/examplefiles/example.chai +0 -6
- data/vendor/pygments-main/tests/examplefiles/example.clay +0 -33
- data/vendor/pygments-main/tests/examplefiles/example.cls +0 -15
- data/vendor/pygments-main/tests/examplefiles/example.cob +0 -3556
- data/vendor/pygments-main/tests/examplefiles/example.coffee +0 -27
- data/vendor/pygments-main/tests/examplefiles/example.cpp +0 -2363
- data/vendor/pygments-main/tests/examplefiles/example.e +0 -124
- data/vendor/pygments-main/tests/examplefiles/example.f90 +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.feature +0 -16
- data/vendor/pygments-main/tests/examplefiles/example.gd +0 -23
- data/vendor/pygments-main/tests/examplefiles/example.gi +0 -64
- data/vendor/pygments-main/tests/examplefiles/example.groovy +0 -2
- data/vendor/pygments-main/tests/examplefiles/example.gs +0 -106
- data/vendor/pygments-main/tests/examplefiles/example.gst +0 -7
- data/vendor/pygments-main/tests/examplefiles/example.hs +0 -27
- data/vendor/pygments-main/tests/examplefiles/example.hx +0 -185
- data/vendor/pygments-main/tests/examplefiles/example.i6t +0 -32
- data/vendor/pygments-main/tests/examplefiles/example.i7x +0 -45
- data/vendor/pygments-main/tests/examplefiles/example.inf +0 -374
- data/vendor/pygments-main/tests/examplefiles/example.j +0 -564
- data/vendor/pygments-main/tests/examplefiles/example.jag +0 -48
- data/vendor/pygments-main/tests/examplefiles/example.java +0 -16
- data/vendor/pygments-main/tests/examplefiles/example.kal +0 -75
- data/vendor/pygments-main/tests/examplefiles/example.kt +0 -47
- data/vendor/pygments-main/tests/examplefiles/example.lagda +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.liquid +0 -42
- data/vendor/pygments-main/tests/examplefiles/example.lua +0 -250
- data/vendor/pygments-main/tests/examplefiles/example.ma +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.monkey +0 -152
- data/vendor/pygments-main/tests/examplefiles/example.moo +0 -26
- data/vendor/pygments-main/tests/examplefiles/example.moon +0 -629
- data/vendor/pygments-main/tests/examplefiles/example.mq4 +0 -187
- data/vendor/pygments-main/tests/examplefiles/example.mqh +0 -123
- data/vendor/pygments-main/tests/examplefiles/example.msc +0 -43
- data/vendor/pygments-main/tests/examplefiles/example.ni +0 -57
- data/vendor/pygments-main/tests/examplefiles/example.nim +0 -1010
- data/vendor/pygments-main/tests/examplefiles/example.nix +0 -80
- data/vendor/pygments-main/tests/examplefiles/example.ns2 +0 -69
- data/vendor/pygments-main/tests/examplefiles/example.pas +0 -2708
- data/vendor/pygments-main/tests/examplefiles/example.pp +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.prg +0 -161
- data/vendor/pygments-main/tests/examplefiles/example.rb +0 -1852
- data/vendor/pygments-main/tests/examplefiles/example.red +0 -257
- data/vendor/pygments-main/tests/examplefiles/example.reds +0 -150
- data/vendor/pygments-main/tests/examplefiles/example.reg +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.rexx +0 -50
- data/vendor/pygments-main/tests/examplefiles/example.rhtml +0 -561
- data/vendor/pygments-main/tests/examplefiles/example.rkt +0 -743
- data/vendor/pygments-main/tests/examplefiles/example.rpf +0 -4
- data/vendor/pygments-main/tests/examplefiles/example.sh +0 -22
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.shell-session +0 -45
- data/vendor/pygments-main/tests/examplefiles/example.slim +0 -31
- data/vendor/pygments-main/tests/examplefiles/example.sls +0 -51
- data/vendor/pygments-main/tests/examplefiles/example.sml +0 -156
- data/vendor/pygments-main/tests/examplefiles/example.snobol +0 -15
- data/vendor/pygments-main/tests/examplefiles/example.stan +0 -110
- data/vendor/pygments-main/tests/examplefiles/example.tea +0 -34
- data/vendor/pygments-main/tests/examplefiles/example.todotxt +0 -9
- data/vendor/pygments-main/tests/examplefiles/example.ts +0 -28
- data/vendor/pygments-main/tests/examplefiles/example.u +0 -548
- data/vendor/pygments-main/tests/examplefiles/example.weechatlog +0 -9
- data/vendor/pygments-main/tests/examplefiles/example.xhtml +0 -376
- data/vendor/pygments-main/tests/examplefiles/example.xtend +0 -34
- data/vendor/pygments-main/tests/examplefiles/example.yaml +0 -302
- data/vendor/pygments-main/tests/examplefiles/example2.aspx +0 -29
- data/vendor/pygments-main/tests/examplefiles/example2.msc +0 -79
- data/vendor/pygments-main/tests/examplefiles/exampleScript.cfc +0 -241
- data/vendor/pygments-main/tests/examplefiles/exampleTag.cfc +0 -18
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +0 -205
- data/vendor/pygments-main/tests/examplefiles/example_file.fy +0 -128
- data/vendor/pygments-main/tests/examplefiles/firefox.mak +0 -586
- data/vendor/pygments-main/tests/examplefiles/flipflop.sv +0 -19
- data/vendor/pygments-main/tests/examplefiles/foo.sce +0 -6
- data/vendor/pygments-main/tests/examplefiles/format.ml +0 -1213
- data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +0 -77
- data/vendor/pygments-main/tests/examplefiles/function.mu +0 -1
- data/vendor/pygments-main/tests/examplefiles/functional.rst +0 -1472
- data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +0 -133
- data/vendor/pygments-main/tests/examplefiles/genclass.clj +0 -510
- data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +0 -193
- data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +0 -33
- data/vendor/pygments-main/tests/examplefiles/glsl.frag +0 -7
- data/vendor/pygments-main/tests/examplefiles/glsl.vert +0 -13
- data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +0 -22
- data/vendor/pygments-main/tests/examplefiles/hash_syntax.rb +0 -5
- data/vendor/pygments-main/tests/examplefiles/hello.at +0 -6
- data/vendor/pygments-main/tests/examplefiles/hello.golo +0 -5
- data/vendor/pygments-main/tests/examplefiles/hello.lsl +0 -12
- data/vendor/pygments-main/tests/examplefiles/hello.smali +0 -40
- data/vendor/pygments-main/tests/examplefiles/hello.sp +0 -9
- data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +0 -1
- data/vendor/pygments-main/tests/examplefiles/http_request_example +0 -15
- data/vendor/pygments-main/tests/examplefiles/http_response_example +0 -29
- data/vendor/pygments-main/tests/examplefiles/hybris_File.hy +0 -174
- data/vendor/pygments-main/tests/examplefiles/idl_sample.pro +0 -73
- data/vendor/pygments-main/tests/examplefiles/iex_example +0 -23
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +0 -71
- data/vendor/pygments-main/tests/examplefiles/intro.ik +0 -24
- data/vendor/pygments-main/tests/examplefiles/ints.php +0 -10
- data/vendor/pygments-main/tests/examplefiles/intsyn.fun +0 -675
- data/vendor/pygments-main/tests/examplefiles/intsyn.sig +0 -286
- data/vendor/pygments-main/tests/examplefiles/irb_heredoc +0 -8
- data/vendor/pygments-main/tests/examplefiles/irc.lsp +0 -214
- data/vendor/pygments-main/tests/examplefiles/java.properties +0 -16
- data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +0 -28
- data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +0 -45
- data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +0 -713
- data/vendor/pygments-main/tests/examplefiles/json.lasso +0 -301
- data/vendor/pygments-main/tests/examplefiles/json.lasso9 +0 -213
- data/vendor/pygments-main/tests/examplefiles/language.hy +0 -165
- data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +0 -13
- data/vendor/pygments-main/tests/examplefiles/limbo.b +0 -456
- data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +0 -47
- data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +0 -43
- data/vendor/pygments-main/tests/examplefiles/logos_example.xm +0 -28
- data/vendor/pygments-main/tests/examplefiles/ltmain.sh +0 -2849
- data/vendor/pygments-main/tests/examplefiles/main.cmake +0 -44
- data/vendor/pygments-main/tests/examplefiles/markdown.lsp +0 -679
- data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +0 -3
- data/vendor/pygments-main/tests/examplefiles/matlab_sample +0 -30
- data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +0 -37
- data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +0 -455
- data/vendor/pygments-main/tests/examplefiles/minehunt.qml +0 -112
- data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +0 -4
- data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +0 -340
- data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +0 -38
- data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +0 -95
- data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +0 -96
- data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +0 -30
- data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +0 -87
- data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +0 -118
- data/vendor/pygments-main/tests/examplefiles/numbers.c +0 -12
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +0 -179
- data/vendor/pygments-main/tests/examplefiles/openedge_example +0 -34
- data/vendor/pygments-main/tests/examplefiles/pawn_example +0 -25
- data/vendor/pygments-main/tests/examplefiles/perl_misc +0 -62
- data/vendor/pygments-main/tests/examplefiles/perl_perl5db +0 -998
- data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +0 -120
- data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +0 -856
- data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +0 -163
- data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +0 -567
- data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +0 -1223
- data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +0 -47
- data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +0 -10
- data/vendor/pygments-main/tests/examplefiles/psql_session.txt +0 -122
- data/vendor/pygments-main/tests/examplefiles/py3_test.txt +0 -2
- data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +0 -4
- data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +0 -14
- data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +0 -2
- data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +0 -4
- data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +0 -234
- data/vendor/pygments-main/tests/examplefiles/qbasic_example +0 -2
- data/vendor/pygments-main/tests/examplefiles/qsort.prolog +0 -13
- data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +0 -38
- data/vendor/pygments-main/tests/examplefiles/r6rs-comments.scm +0 -23
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +0 -280
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +0 -2
- data/vendor/pygments-main/tests/examplefiles/regex.js +0 -22
- data/vendor/pygments-main/tests/examplefiles/reversi.lsp +0 -427
- data/vendor/pygments-main/tests/examplefiles/robotframework_test.txt +0 -39
- data/vendor/pygments-main/tests/examplefiles/rql-queries.rql +0 -34
- data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +0 -11
- data/vendor/pygments-main/tests/examplefiles/rust_example.rs +0 -233
- data/vendor/pygments-main/tests/examplefiles/scilab.sci +0 -30
- data/vendor/pygments-main/tests/examplefiles/scope.cirru +0 -43
- data/vendor/pygments-main/tests/examplefiles/session.dylan-console +0 -9
- data/vendor/pygments-main/tests/examplefiles/sibling.prolog +0 -19
- data/vendor/pygments-main/tests/examplefiles/simple.md +0 -747
- data/vendor/pygments-main/tests/examplefiles/smarty_example.html +0 -209
- data/vendor/pygments-main/tests/examplefiles/source.lgt +0 -343
- data/vendor/pygments-main/tests/examplefiles/sources.list +0 -62
- data/vendor/pygments-main/tests/examplefiles/sparql.rq +0 -23
- data/vendor/pygments-main/tests/examplefiles/sphere.pov +0 -18
- data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +0 -27
- data/vendor/pygments-main/tests/examplefiles/squid.conf +0 -30
- data/vendor/pygments-main/tests/examplefiles/string.jl +0 -1031
- data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +0 -21
- data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +0 -3
- data/vendor/pygments-main/tests/examplefiles/swig_java.swg +0 -1329
- data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +0 -225
- data/vendor/pygments-main/tests/examplefiles/test.R +0 -185
- data/vendor/pygments-main/tests/examplefiles/test.adb +0 -211
- data/vendor/pygments-main/tests/examplefiles/test.agda +0 -102
- data/vendor/pygments-main/tests/examplefiles/test.apl +0 -26
- data/vendor/pygments-main/tests/examplefiles/test.asy +0 -131
- data/vendor/pygments-main/tests/examplefiles/test.awk +0 -121
- data/vendor/pygments-main/tests/examplefiles/test.bb +0 -95
- data/vendor/pygments-main/tests/examplefiles/test.bmx +0 -145
- data/vendor/pygments-main/tests/examplefiles/test.boo +0 -39
- data/vendor/pygments-main/tests/examplefiles/test.bro +0 -250
- data/vendor/pygments-main/tests/examplefiles/test.cs +0 -374
- data/vendor/pygments-main/tests/examplefiles/test.css +0 -54
- data/vendor/pygments-main/tests/examplefiles/test.cu +0 -36
- data/vendor/pygments-main/tests/examplefiles/test.cyp +0 -123
- data/vendor/pygments-main/tests/examplefiles/test.d +0 -135
- data/vendor/pygments-main/tests/examplefiles/test.dart +0 -23
- data/vendor/pygments-main/tests/examplefiles/test.dtd +0 -89
- data/vendor/pygments-main/tests/examplefiles/test.ebnf +0 -31
- data/vendor/pygments-main/tests/examplefiles/test.ec +0 -605
- data/vendor/pygments-main/tests/examplefiles/test.ecl +0 -58
- data/vendor/pygments-main/tests/examplefiles/test.eh +0 -315
- data/vendor/pygments-main/tests/examplefiles/test.erl +0 -169
- data/vendor/pygments-main/tests/examplefiles/test.evoque +0 -33
- data/vendor/pygments-main/tests/examplefiles/test.fan +0 -818
- data/vendor/pygments-main/tests/examplefiles/test.flx +0 -57
- data/vendor/pygments-main/tests/examplefiles/test.gdc +0 -13
- data/vendor/pygments-main/tests/examplefiles/test.groovy +0 -97
- data/vendor/pygments-main/tests/examplefiles/test.html +0 -339
- data/vendor/pygments-main/tests/examplefiles/test.idr +0 -93
- data/vendor/pygments-main/tests/examplefiles/test.ini +0 -10
- data/vendor/pygments-main/tests/examplefiles/test.java +0 -653
- data/vendor/pygments-main/tests/examplefiles/test.jsp +0 -24
- data/vendor/pygments-main/tests/examplefiles/test.maql +0 -45
- data/vendor/pygments-main/tests/examplefiles/test.mask +0 -41
- data/vendor/pygments-main/tests/examplefiles/test.mod +0 -374
- data/vendor/pygments-main/tests/examplefiles/test.moo +0 -51
- data/vendor/pygments-main/tests/examplefiles/test.myt +0 -166
- data/vendor/pygments-main/tests/examplefiles/test.nim +0 -93
- data/vendor/pygments-main/tests/examplefiles/test.opa +0 -10
- data/vendor/pygments-main/tests/examplefiles/test.p6 +0 -252
- data/vendor/pygments-main/tests/examplefiles/test.pan +0 -54
- data/vendor/pygments-main/tests/examplefiles/test.pas +0 -743
- data/vendor/pygments-main/tests/examplefiles/test.php +0 -507
- data/vendor/pygments-main/tests/examplefiles/test.pig +0 -148
- data/vendor/pygments-main/tests/examplefiles/test.plot +0 -333
- data/vendor/pygments-main/tests/examplefiles/test.ps1 +0 -108
- data/vendor/pygments-main/tests/examplefiles/test.pwn +0 -253
- data/vendor/pygments-main/tests/examplefiles/test.pypylog +0 -1839
- data/vendor/pygments-main/tests/examplefiles/test.r3 +0 -114
- data/vendor/pygments-main/tests/examplefiles/test.rb +0 -177
- data/vendor/pygments-main/tests/examplefiles/test.rhtml +0 -43
- data/vendor/pygments-main/tests/examplefiles/test.rsl +0 -111
- data/vendor/pygments-main/tests/examplefiles/test.scaml +0 -8
- data/vendor/pygments-main/tests/examplefiles/test.ssp +0 -12
- data/vendor/pygments-main/tests/examplefiles/test.swift +0 -65
- data/vendor/pygments-main/tests/examplefiles/test.tcsh +0 -830
- data/vendor/pygments-main/tests/examplefiles/test.vb +0 -407
- data/vendor/pygments-main/tests/examplefiles/test.vhdl +0 -161
- data/vendor/pygments-main/tests/examplefiles/test.xqy +0 -138
- data/vendor/pygments-main/tests/examplefiles/test.xsl +0 -23
- data/vendor/pygments-main/tests/examplefiles/test.zep +0 -33
- data/vendor/pygments-main/tests/examplefiles/test2.pypylog +0 -120
- data/vendor/pygments-main/tests/examplefiles/truncated.pytb +0 -15
- data/vendor/pygments-main/tests/examplefiles/type.lisp +0 -1218
- data/vendor/pygments-main/tests/examplefiles/underscore.coffee +0 -603
- data/vendor/pygments-main/tests/examplefiles/unicode.applescript +0 -5
- data/vendor/pygments-main/tests/examplefiles/unicode.go +0 -10
- data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +0 -11
- data/vendor/pygments-main/tests/examplefiles/unix-io.lid +0 -37
- data/vendor/pygments-main/tests/examplefiles/vbnet_test.bas +0 -29
- data/vendor/pygments-main/tests/examplefiles/vctreestatus_hg +0 -4
- data/vendor/pygments-main/tests/examplefiles/vimrc +0 -21
- data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +0 -3
- data/vendor/pygments-main/tests/examplefiles/while.pov +0 -13
- data/vendor/pygments-main/tests/examplefiles/wiki.factor +0 -384
- data/vendor/pygments-main/tests/examplefiles/xml_example +0 -1897
- data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +0 -798
- data/vendor/pygments-main/tests/run.py +0 -44
- data/vendor/pygments-main/tests/string_asserts.py +0 -22
- data/vendor/pygments-main/tests/support.py +0 -15
- data/vendor/pygments-main/tests/support/tags +0 -36
- data/vendor/pygments-main/tests/test_basic_api.py +0 -309
- data/vendor/pygments-main/tests/test_cfm.py +0 -46
- data/vendor/pygments-main/tests/test_clexer.py +0 -236
- data/vendor/pygments-main/tests/test_cmdline.py +0 -106
- data/vendor/pygments-main/tests/test_examplefiles.py +0 -110
- data/vendor/pygments-main/tests/test_html_formatter.py +0 -180
- data/vendor/pygments-main/tests/test_latex_formatter.py +0 -57
- data/vendor/pygments-main/tests/test_lexers_other.py +0 -68
- data/vendor/pygments-main/tests/test_objectiveclexer.py +0 -81
- data/vendor/pygments-main/tests/test_perllexer.py +0 -137
- data/vendor/pygments-main/tests/test_qbasiclexer.py +0 -43
- data/vendor/pygments-main/tests/test_regexlexer.py +0 -54
- data/vendor/pygments-main/tests/test_rtf_formatter.py +0 -109
- data/vendor/pygments-main/tests/test_string_asserts.py +0 -39
- data/vendor/pygments-main/tests/test_token.py +0 -46
- data/vendor/pygments-main/tests/test_using_api.py +0 -40
- data/vendor/pygments-main/tests/test_util.py +0 -135
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Lexers for Inferno os and all the related stuff.
|
7
7
|
|
8
|
-
:copyright: Copyright 2006-
|
8
|
+
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
12
12
|
import re
|
13
13
|
|
14
|
-
from pygments.lexer import RegexLexer, include, bygroups
|
14
|
+
from pygments.lexer import RegexLexer, include, bygroups, default
|
15
15
|
from pygments.token import Punctuation, Text, Comment, Operator, Keyword, \
|
16
16
|
Name, String, Number
|
17
17
|
|
@@ -74,7 +74,7 @@ class LimboLexer(RegexLexer):
|
|
74
74
|
],
|
75
75
|
'root': [
|
76
76
|
include('whitespace'),
|
77
|
-
('
|
77
|
+
default('statement'),
|
78
78
|
],
|
79
79
|
}
|
80
80
|
|
@@ -0,0 +1,322 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.installers
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Lexers for installer/packager DSLs and formats.
|
7
|
+
|
8
|
+
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
|
9
|
+
:license: BSD, see LICENSE for details.
|
10
|
+
"""
|
11
|
+
|
12
|
+
import re
|
13
|
+
|
14
|
+
from pygments.lexer import RegexLexer, include, bygroups, using, this, default
|
15
|
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
16
|
+
Punctuation, Generic, Number, Whitespace
|
17
|
+
|
18
|
+
__all__ = ['NSISLexer', 'RPMSpecLexer', 'SourcesListLexer',
|
19
|
+
'DebianControlLexer']
|
20
|
+
|
21
|
+
|
22
|
+
class NSISLexer(RegexLexer):
|
23
|
+
"""
|
24
|
+
For `NSIS <http://nsis.sourceforge.net/>`_ scripts.
|
25
|
+
|
26
|
+
.. versionadded:: 1.6
|
27
|
+
"""
|
28
|
+
name = 'NSIS'
|
29
|
+
aliases = ['nsis', 'nsi', 'nsh']
|
30
|
+
filenames = ['*.nsi', '*.nsh']
|
31
|
+
mimetypes = ['text/x-nsis']
|
32
|
+
|
33
|
+
flags = re.IGNORECASE
|
34
|
+
|
35
|
+
tokens = {
|
36
|
+
'root': [
|
37
|
+
(r'[;#].*\n', Comment),
|
38
|
+
(r"'.*?'", String.Single),
|
39
|
+
(r'"', String.Double, 'str_double'),
|
40
|
+
(r'`', String.Backtick, 'str_backtick'),
|
41
|
+
include('macro'),
|
42
|
+
include('interpol'),
|
43
|
+
include('basic'),
|
44
|
+
(r'\$\{[a-z_|][\w|]*\}', Keyword.Pseudo),
|
45
|
+
(r'/[a-z_]\w*', Name.Attribute),
|
46
|
+
('.', Text),
|
47
|
+
],
|
48
|
+
'basic': [
|
49
|
+
(r'(\n)(Function)(\s+)([._a-z][.\w]*)\b',
|
50
|
+
bygroups(Text, Keyword, Text, Name.Function)),
|
51
|
+
(r'\b([_a-z]\w*)(::)([a-z][a-z0-9]*)\b',
|
52
|
+
bygroups(Keyword.Namespace, Punctuation, Name.Function)),
|
53
|
+
(r'\b([_a-z]\w*)(:)', bygroups(Name.Label, Punctuation)),
|
54
|
+
(r'(\b[ULS]|\B)([!<>=]?=|\<\>?|\>)\B', Operator),
|
55
|
+
(r'[|+-]', Operator),
|
56
|
+
(r'\\', Punctuation),
|
57
|
+
(r'\b(Abort|Add(?:BrandingImage|Size)|'
|
58
|
+
r'Allow(?:RootDirInstall|SkipFiles)|AutoCloseWindow|'
|
59
|
+
r'BG(?:Font|Gradient)|BrandingText|BringToFront|Call(?:InstDLL)?|'
|
60
|
+
r'(?:Sub)?Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|'
|
61
|
+
r'ComponentText|CopyFiles|CRCCheck|'
|
62
|
+
r'Create(?:Directory|Font|Shortcut)|Delete(?:INI(?:Sec|Str)|'
|
63
|
+
r'Reg(?:Key|Value))?|DetailPrint|DetailsButtonText|'
|
64
|
+
r'Dir(?:Show|Text|Var|Verify)|(?:Disabled|Enabled)Bitmap|'
|
65
|
+
r'EnableWindow|EnumReg(?:Key|Value)|Exch|Exec(?:Shell|Wait)?|'
|
66
|
+
r'ExpandEnvStrings|File(?:BufSize|Close|ErrorText|Open|'
|
67
|
+
r'Read(?:Byte)?|Seek|Write(?:Byte)?)?|'
|
68
|
+
r'Find(?:Close|First|Next|Window)|FlushINI|Function(?:End)?|'
|
69
|
+
r'Get(?:CurInstType|CurrentAddress|DlgItem|DLLVersion(?:Local)?|'
|
70
|
+
r'ErrorLevel|FileTime(?:Local)?|FullPathName|FunctionAddress|'
|
71
|
+
r'InstDirError|LabelAddress|TempFileName)|'
|
72
|
+
r'Goto|HideWindow|Icon|'
|
73
|
+
r'If(?:Abort|Errors|FileExists|RebootFlag|Silent)|'
|
74
|
+
r'InitPluginsDir|Install(?:ButtonText|Colors|Dir(?:RegKey)?)|'
|
75
|
+
r'Inst(?:ProgressFlags|Type(?:[GS]etText)?)|Int(?:CmpU?|Fmt|Op)|'
|
76
|
+
r'IsWindow|LangString(?:UP)?|'
|
77
|
+
r'License(?:BkColor|Data|ForceSelection|LangString|Text)|'
|
78
|
+
r'LoadLanguageFile|LockWindow|Log(?:Set|Text)|MessageBox|'
|
79
|
+
r'MiscButtonText|Name|Nop|OutFile|(?:Uninst)?Page(?:Ex(?:End)?)?|'
|
80
|
+
r'PluginDir|Pop|Push|Quit|Read(?:(?:Env|INI|Reg)Str|RegDWORD)|'
|
81
|
+
r'Reboot|(?:Un)?RegDLL|Rename|RequestExecutionLevel|ReserveFile|'
|
82
|
+
r'Return|RMDir|SearchPath|Section(?:Divider|End|'
|
83
|
+
r'(?:(?:Get|Set)(?:Flags|InstTypes|Size|Text))|Group(?:End)?|In)?|'
|
84
|
+
r'SendMessage|Set(?:AutoClose|BrandingImage|Compress(?:ionLevel|'
|
85
|
+
r'or(?:DictSize)?)?|CtlColors|CurInstType|DatablockOptimize|'
|
86
|
+
r'DateSave|Details(?:Print|View)|Error(?:s|Level)|FileAttributes|'
|
87
|
+
r'Font|OutPath|Overwrite|PluginUnload|RebootFlag|ShellVarContext|'
|
88
|
+
r'Silent|StaticBkColor)|'
|
89
|
+
r'Show(?:(?:I|Uni)nstDetails|Window)|Silent(?:Un)?Install|Sleep|'
|
90
|
+
r'SpaceTexts|Str(?:CmpS?|Cpy|Len)|SubSection(?:End)?|'
|
91
|
+
r'Uninstall(?:ButtonText|(?:Sub)?Caption|EXEName|Icon|Text)|'
|
92
|
+
r'UninstPage|Var|VI(?:AddVersionKey|ProductVersion)|WindowIcon|'
|
93
|
+
r'Write(?:INIStr|Reg(:?Bin|DWORD|(?:Expand)?Str)|Uninstaller)|'
|
94
|
+
r'XPStyle)\b', Keyword),
|
95
|
+
(r'\b(CUR|END|(?:FILE_ATTRIBUTE_)?'
|
96
|
+
r'(?:ARCHIVE|HIDDEN|NORMAL|OFFLINE|READONLY|SYSTEM|TEMPORARY)|'
|
97
|
+
r'HK(CC|CR|CU|DD|LM|PD|U)|'
|
98
|
+
r'HKEY_(?:CLASSES_ROOT|CURRENT_(?:CONFIG|USER)|DYN_DATA|'
|
99
|
+
r'LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|'
|
100
|
+
r'ID(?:ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|'
|
101
|
+
r'MB_(?:ABORTRETRYIGNORE|DEFBUTTON[1-4]|'
|
102
|
+
r'ICON(?:EXCLAMATION|INFORMATION|QUESTION|STOP)|'
|
103
|
+
r'OK(?:CANCEL)?|RETRYCANCEL|RIGHT|SETFOREGROUND|TOPMOST|USERICON|'
|
104
|
+
r'YESNO(?:CANCEL)?)|SET|SHCTX|'
|
105
|
+
r'SW_(?:HIDE|SHOW(?:MAXIMIZED|MINIMIZED|NORMAL))|'
|
106
|
+
r'admin|all|auto|both|bottom|bzip2|checkbox|colored|current|false|'
|
107
|
+
r'force|hide|highest|if(?:diff|newer)|lastused|leave|left|'
|
108
|
+
r'listonly|lzma|nevershow|none|normal|off|on|pop|push|'
|
109
|
+
r'radiobuttons|right|show|silent|silentlog|smooth|textonly|top|'
|
110
|
+
r'true|try|user|zlib)\b', Name.Constant),
|
111
|
+
],
|
112
|
+
'macro': [
|
113
|
+
(r'\!(addincludedir(?:dir)?|addplugindir|appendfile|cd|define|'
|
114
|
+
r'delfilefile|echo(?:message)?|else|endif|error|execute|'
|
115
|
+
r'if(?:macro)?n?(?:def)?|include|insertmacro|macro(?:end)?|packhdr|'
|
116
|
+
r'search(?:parse|replace)|system|tempfilesymbol|undef|verbose|'
|
117
|
+
r'warning)\b', Comment.Preproc),
|
118
|
+
],
|
119
|
+
'interpol': [
|
120
|
+
(r'\$(R?[0-9])', Name.Builtin.Pseudo), # registers
|
121
|
+
(r'\$(ADMINTOOLS|APPDATA|CDBURN_AREA|COOKIES|COMMONFILES(?:32|64)|'
|
122
|
+
r'DESKTOP|DOCUMENTS|EXE(?:DIR|FILE|PATH)|FAVORITES|FONTS|HISTORY|'
|
123
|
+
r'HWNDPARENT|INTERNET_CACHE|LOCALAPPDATA|MUSIC|NETHOOD|PICTURES|'
|
124
|
+
r'PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES(?:32|64)|QUICKLAUNCH|'
|
125
|
+
r'RECENT|RESOURCES(?:_LOCALIZED)?|SENDTO|SM(?:PROGRAMS|STARTUP)|'
|
126
|
+
r'STARTMENU|SYSDIR|TEMP(?:LATES)?|VIDEOS|WINDIR|\{NSISDIR\})',
|
127
|
+
Name.Builtin),
|
128
|
+
(r'\$(CMDLINE|INSTDIR|OUTDIR|LANGUAGE)', Name.Variable.Global),
|
129
|
+
(r'\$[a-z_]\w*', Name.Variable),
|
130
|
+
],
|
131
|
+
'str_double': [
|
132
|
+
(r'"', String, '#pop'),
|
133
|
+
(r'\$(\\[nrt"]|\$)', String.Escape),
|
134
|
+
include('interpol'),
|
135
|
+
(r'.', String.Double),
|
136
|
+
],
|
137
|
+
'str_backtick': [
|
138
|
+
(r'`', String, '#pop'),
|
139
|
+
(r'\$(\\[nrt"]|\$)', String.Escape),
|
140
|
+
include('interpol'),
|
141
|
+
(r'.', String.Double),
|
142
|
+
],
|
143
|
+
}
|
144
|
+
|
145
|
+
|
146
|
+
class RPMSpecLexer(RegexLexer):
|
147
|
+
"""
|
148
|
+
For RPM ``.spec`` files.
|
149
|
+
|
150
|
+
.. versionadded:: 1.6
|
151
|
+
"""
|
152
|
+
|
153
|
+
name = 'RPMSpec'
|
154
|
+
aliases = ['spec']
|
155
|
+
filenames = ['*.spec']
|
156
|
+
mimetypes = ['text/x-rpm-spec']
|
157
|
+
|
158
|
+
_directives = ('(?:package|prep|build|install|clean|check|pre[a-z]*|'
|
159
|
+
'post[a-z]*|trigger[a-z]*|files)')
|
160
|
+
|
161
|
+
tokens = {
|
162
|
+
'root': [
|
163
|
+
(r'#.*\n', Comment),
|
164
|
+
include('basic'),
|
165
|
+
],
|
166
|
+
'description': [
|
167
|
+
(r'^(%' + _directives + ')(.*)$',
|
168
|
+
bygroups(Name.Decorator, Text), '#pop'),
|
169
|
+
(r'\n', Text),
|
170
|
+
(r'.', Text),
|
171
|
+
],
|
172
|
+
'changelog': [
|
173
|
+
(r'\*.*\n', Generic.Subheading),
|
174
|
+
(r'^(%' + _directives + ')(.*)$',
|
175
|
+
bygroups(Name.Decorator, Text), '#pop'),
|
176
|
+
(r'\n', Text),
|
177
|
+
(r'.', Text),
|
178
|
+
],
|
179
|
+
'string': [
|
180
|
+
(r'"', String.Double, '#pop'),
|
181
|
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
182
|
+
include('interpol'),
|
183
|
+
(r'.', String.Double),
|
184
|
+
],
|
185
|
+
'basic': [
|
186
|
+
include('macro'),
|
187
|
+
(r'(?i)^(Name|Version|Release|Epoch|Summary|Group|License|Packager|'
|
188
|
+
r'Vendor|Icon|URL|Distribution|Prefix|Patch[0-9]*|Source[0-9]*|'
|
189
|
+
r'Requires\(?[a-z]*\)?|[a-z]+Req|Obsoletes|Suggests|Provides|Conflicts|'
|
190
|
+
r'Build[a-z]+|[a-z]+Arch|Auto[a-z]+)(:)(.*)$',
|
191
|
+
bygroups(Generic.Heading, Punctuation, using(this))),
|
192
|
+
(r'^%description', Name.Decorator, 'description'),
|
193
|
+
(r'^%changelog', Name.Decorator, 'changelog'),
|
194
|
+
(r'^(%' + _directives + ')(.*)$', bygroups(Name.Decorator, Text)),
|
195
|
+
(r'%(attr|defattr|dir|doc(?:dir)?|setup|config(?:ure)?|'
|
196
|
+
r'make(?:install)|ghost|patch[0-9]+|find_lang|exclude|verify)',
|
197
|
+
Keyword),
|
198
|
+
include('interpol'),
|
199
|
+
(r"'.*?'", String.Single),
|
200
|
+
(r'"', String.Double, 'string'),
|
201
|
+
(r'.', Text),
|
202
|
+
],
|
203
|
+
'macro': [
|
204
|
+
(r'%define.*\n', Comment.Preproc),
|
205
|
+
(r'%\{\!\?.*%define.*\}', Comment.Preproc),
|
206
|
+
(r'(%(?:if(?:n?arch)?|else(?:if)?|endif))(.*)$',
|
207
|
+
bygroups(Comment.Preproc, Text)),
|
208
|
+
],
|
209
|
+
'interpol': [
|
210
|
+
(r'%\{?__[a-z_]+\}?', Name.Function),
|
211
|
+
(r'%\{?_([a-z_]+dir|[a-z_]+path|prefix)\}?', Keyword.Pseudo),
|
212
|
+
(r'%\{\?\w+\}', Name.Variable),
|
213
|
+
(r'\$\{?RPM_[A-Z0-9_]+\}?', Name.Variable.Global),
|
214
|
+
(r'%\{[a-zA-Z]\w+\}', Keyword.Constant),
|
215
|
+
]
|
216
|
+
}
|
217
|
+
|
218
|
+
|
219
|
+
class SourcesListLexer(RegexLexer):
|
220
|
+
"""
|
221
|
+
Lexer that highlights debian sources.list files.
|
222
|
+
|
223
|
+
.. versionadded:: 0.7
|
224
|
+
"""
|
225
|
+
|
226
|
+
name = 'Debian Sourcelist'
|
227
|
+
aliases = ['sourceslist', 'sources.list', 'debsources']
|
228
|
+
filenames = ['sources.list']
|
229
|
+
mimetype = ['application/x-debian-sourceslist']
|
230
|
+
|
231
|
+
tokens = {
|
232
|
+
'root': [
|
233
|
+
(r'\s+', Text),
|
234
|
+
(r'#.*?$', Comment),
|
235
|
+
(r'^(deb(?:-src)?)(\s+)',
|
236
|
+
bygroups(Keyword, Text), 'distribution')
|
237
|
+
],
|
238
|
+
'distribution': [
|
239
|
+
(r'#.*?$', Comment, '#pop'),
|
240
|
+
(r'\$\(ARCH\)', Name.Variable),
|
241
|
+
(r'[^\s$[]+', String),
|
242
|
+
(r'\[', String.Other, 'escaped-distribution'),
|
243
|
+
(r'\$', String),
|
244
|
+
(r'\s+', Text, 'components')
|
245
|
+
],
|
246
|
+
'escaped-distribution': [
|
247
|
+
(r'\]', String.Other, '#pop'),
|
248
|
+
(r'\$\(ARCH\)', Name.Variable),
|
249
|
+
(r'[^\]$]+', String.Other),
|
250
|
+
(r'\$', String.Other)
|
251
|
+
],
|
252
|
+
'components': [
|
253
|
+
(r'#.*?$', Comment, '#pop:2'),
|
254
|
+
(r'$', Text, '#pop:2'),
|
255
|
+
(r'\s+', Text),
|
256
|
+
(r'\S+', Keyword.Pseudo),
|
257
|
+
]
|
258
|
+
}
|
259
|
+
|
260
|
+
def analyse_text(text):
|
261
|
+
for line in text.splitlines():
|
262
|
+
line = line.strip()
|
263
|
+
if line.startswith('deb ') or line.startswith('deb-src '):
|
264
|
+
return True
|
265
|
+
|
266
|
+
|
267
|
+
class DebianControlLexer(RegexLexer):
|
268
|
+
"""
|
269
|
+
Lexer for Debian ``control`` files and ``apt-cache show <pkg>`` outputs.
|
270
|
+
|
271
|
+
.. versionadded:: 0.9
|
272
|
+
"""
|
273
|
+
name = 'Debian Control file'
|
274
|
+
aliases = ['control', 'debcontrol']
|
275
|
+
filenames = ['control']
|
276
|
+
|
277
|
+
tokens = {
|
278
|
+
'root': [
|
279
|
+
(r'^(Description)', Keyword, 'description'),
|
280
|
+
(r'^(Maintainer)(:\s*)', bygroups(Keyword, Text), 'maintainer'),
|
281
|
+
(r'^((Build-)?Depends)', Keyword, 'depends'),
|
282
|
+
(r'^((?:Python-)?Version)(:\s*)(\S+)$',
|
283
|
+
bygroups(Keyword, Text, Number)),
|
284
|
+
(r'^((?:Installed-)?Size)(:\s*)(\S+)$',
|
285
|
+
bygroups(Keyword, Text, Number)),
|
286
|
+
(r'^(MD5Sum|SHA1|SHA256)(:\s*)(\S+)$',
|
287
|
+
bygroups(Keyword, Text, Number)),
|
288
|
+
(r'^([a-zA-Z\-0-9\.]*?)(:\s*)(.*?)$',
|
289
|
+
bygroups(Keyword, Whitespace, String)),
|
290
|
+
],
|
291
|
+
'maintainer': [
|
292
|
+
(r'<[^>]+>', Generic.Strong),
|
293
|
+
(r'<[^>]+>$', Generic.Strong, '#pop'),
|
294
|
+
(r',\n?', Text),
|
295
|
+
(r'.', Text),
|
296
|
+
],
|
297
|
+
'description': [
|
298
|
+
(r'(.*)(Homepage)(: )(\S+)',
|
299
|
+
bygroups(Text, String, Name, Name.Class)),
|
300
|
+
(r':.*\n', Generic.Strong),
|
301
|
+
(r' .*\n', Text),
|
302
|
+
default('#pop'),
|
303
|
+
],
|
304
|
+
'depends': [
|
305
|
+
(r':\s*', Text),
|
306
|
+
(r'(\$)(\{)(\w+\s*:\s*\w+)', bygroups(Operator, Text, Name.Entity)),
|
307
|
+
(r'\(', Text, 'depend_vers'),
|
308
|
+
(r',', Text),
|
309
|
+
(r'\|', Operator),
|
310
|
+
(r'[\s]+', Text),
|
311
|
+
(r'[})]\s*$', Text, '#pop'),
|
312
|
+
(r'\}', Text),
|
313
|
+
(r'[^,]$', Name.Function, '#pop'),
|
314
|
+
(r'([+.a-zA-Z0-9-])(\s*)', bygroups(Name.Function, Text)),
|
315
|
+
(r'\[.*?\]', Name.Entity),
|
316
|
+
],
|
317
|
+
'depend_vers': [
|
318
|
+
(r'\),', Text, '#pop'),
|
319
|
+
(r'\)[^,]', Text, '#pop:2'),
|
320
|
+
(r'([><=]+)(\s*)([^)]+)', bygroups(Operator, Text, Number))
|
321
|
+
]
|
322
|
+
}
|
@@ -0,0 +1,1343 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.int_fiction
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Lexers for interactive fiction languages.
|
7
|
+
|
8
|
+
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
|
9
|
+
:license: BSD, see LICENSE for details.
|
10
|
+
"""
|
11
|
+
|
12
|
+
import re
|
13
|
+
|
14
|
+
from pygments.lexer import RegexLexer, include, bygroups, using, \
|
15
|
+
this, default, words
|
16
|
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
17
|
+
Number, Punctuation, Error, Generic
|
18
|
+
|
19
|
+
__all__ = ['Inform6Lexer', 'Inform6TemplateLexer', 'Inform7Lexer',
|
20
|
+
'Tads3Lexer']
|
21
|
+
|
22
|
+
|
23
|
+
class Inform6Lexer(RegexLexer):
|
24
|
+
"""
|
25
|
+
For `Inform 6 <http://inform-fiction.org/>`_ source code.
|
26
|
+
|
27
|
+
.. versionadded:: 2.0
|
28
|
+
"""
|
29
|
+
|
30
|
+
name = 'Inform 6'
|
31
|
+
aliases = ['inform6', 'i6']
|
32
|
+
filenames = ['*.inf']
|
33
|
+
|
34
|
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
35
|
+
|
36
|
+
_name = r'[a-zA-Z_]\w*'
|
37
|
+
|
38
|
+
# Inform 7 maps these four character classes to their ASCII
|
39
|
+
# equivalents. To support Inform 6 inclusions within Inform 7,
|
40
|
+
# Inform6Lexer maps them too.
|
41
|
+
_dash = u'\\-\u2010-\u2014'
|
42
|
+
_dquote = u'"\u201c\u201d'
|
43
|
+
_squote = u"'\u2018\u2019"
|
44
|
+
_newline = u'\\n\u0085\u2028\u2029'
|
45
|
+
|
46
|
+
tokens = {
|
47
|
+
'root': [
|
48
|
+
(r'\A(!%%[^%s]*[%s])+' % (_newline, _newline), Comment.Preproc,
|
49
|
+
'directive'),
|
50
|
+
default('directive')
|
51
|
+
],
|
52
|
+
'_whitespace': [
|
53
|
+
(r'\s+', Text),
|
54
|
+
(r'![^%s]*' % _newline, Comment.Single)
|
55
|
+
],
|
56
|
+
'default': [
|
57
|
+
include('_whitespace'),
|
58
|
+
(r'\[', Punctuation, 'many-values'), # Array initialization
|
59
|
+
(r':|(?=;)', Punctuation, '#pop'),
|
60
|
+
(r'<', Punctuation), # Second angle bracket in an action statement
|
61
|
+
default(('expression', '_expression'))
|
62
|
+
],
|
63
|
+
|
64
|
+
# Expressions
|
65
|
+
'_expression': [
|
66
|
+
include('_whitespace'),
|
67
|
+
(r'(?=sp\b)', Text, '#pop'),
|
68
|
+
(r'(?=[%s%s$0-9#a-zA-Z_])' % (_dquote, _squote), Text,
|
69
|
+
('#pop', 'value')),
|
70
|
+
(r'\+\+|[%s]{1,2}(?!>)|~~?' % _dash, Operator),
|
71
|
+
(r'(?=[()\[%s,?@{:;])' % _dash, Text, '#pop')
|
72
|
+
],
|
73
|
+
'expression': [
|
74
|
+
include('_whitespace'),
|
75
|
+
(r'\(', Punctuation, ('expression', '_expression')),
|
76
|
+
(r'\)', Punctuation, '#pop'),
|
77
|
+
(r'\[', Punctuation, ('#pop', 'statements', 'locals')),
|
78
|
+
(r'>(?=(\s+|(![^%s]*))*[>;])' % _newline, Punctuation),
|
79
|
+
(r'\+\+|[%s]{2}(?!>)' % _dash, Operator),
|
80
|
+
(r',', Punctuation, '_expression'),
|
81
|
+
(r'&&?|\|\|?|[=~><]?=|[%s]{1,2}>?|\.\.?[&#]?|::|[<>+*/%%]' % _dash,
|
82
|
+
Operator, '_expression'),
|
83
|
+
(r'(has|hasnt|in|notin|ofclass|or|provides)\b', Operator.Word,
|
84
|
+
'_expression'),
|
85
|
+
(r'sp\b', Name),
|
86
|
+
(r'\?~?', Name.Label, 'label?'),
|
87
|
+
(r'[@{]', Error),
|
88
|
+
default('#pop')
|
89
|
+
],
|
90
|
+
'_assembly-expression': [
|
91
|
+
(r'\(', Punctuation, ('#push', '_expression')),
|
92
|
+
(r'[\[\]]', Punctuation),
|
93
|
+
(r'[%s]>' % _dash, Punctuation, '_expression'),
|
94
|
+
(r'sp\b', Keyword.Pseudo),
|
95
|
+
(r';', Punctuation, '#pop:3'),
|
96
|
+
include('expression')
|
97
|
+
],
|
98
|
+
'_for-expression': [
|
99
|
+
(r'\)', Punctuation, '#pop:2'),
|
100
|
+
(r':', Punctuation, '#pop'),
|
101
|
+
include('expression')
|
102
|
+
],
|
103
|
+
'_keyword-expression': [
|
104
|
+
(r'(from|near|to)\b', Keyword, '_expression'),
|
105
|
+
include('expression')
|
106
|
+
],
|
107
|
+
'_list-expression': [
|
108
|
+
(r',', Punctuation, '#pop'),
|
109
|
+
include('expression')
|
110
|
+
],
|
111
|
+
'_object-expression': [
|
112
|
+
(r'has\b', Keyword.Declaration, '#pop'),
|
113
|
+
include('_list-expression')
|
114
|
+
],
|
115
|
+
|
116
|
+
# Values
|
117
|
+
'value': [
|
118
|
+
include('_whitespace'),
|
119
|
+
# Strings
|
120
|
+
(r'[%s][^@][%s]' % (_squote, _squote), String.Char, '#pop'),
|
121
|
+
(r'([%s])(@\{[0-9a-fA-F]{1,4}\})([%s])' % (_squote, _squote),
|
122
|
+
bygroups(String.Char, String.Escape, String.Char), '#pop'),
|
123
|
+
(r'([%s])(@.{2})([%s])' % (_squote, _squote),
|
124
|
+
bygroups(String.Char, String.Escape, String.Char), '#pop'),
|
125
|
+
(r'[%s]' % _squote, String.Single, ('#pop', 'dictionary-word')),
|
126
|
+
(r'[%s]' % _dquote, String.Double, ('#pop', 'string')),
|
127
|
+
# Numbers
|
128
|
+
(r'\$[+%s][0-9]*\.?[0-9]*([eE][+%s]?[0-9]+)?' % (_dash, _dash),
|
129
|
+
Number.Float, '#pop'),
|
130
|
+
(r'\$[0-9a-fA-F]+', Number.Hex, '#pop'),
|
131
|
+
(r'\$\$[01]+', Number.Bin, '#pop'),
|
132
|
+
(r'[0-9]+', Number.Integer, '#pop'),
|
133
|
+
# Values prefixed by hashes
|
134
|
+
(r'(##|#a\$)(%s)' % _name, bygroups(Operator, Name), '#pop'),
|
135
|
+
(r'(#g\$)(%s)' % _name,
|
136
|
+
bygroups(Operator, Name.Variable.Global), '#pop'),
|
137
|
+
(r'#[nw]\$', Operator, ('#pop', 'obsolete-dictionary-word')),
|
138
|
+
(r'(#r\$)(%s)' % _name, bygroups(Operator, Name.Function), '#pop'),
|
139
|
+
(r'#', Name.Builtin, ('#pop', 'system-constant')),
|
140
|
+
# System functions
|
141
|
+
(words((
|
142
|
+
'child', 'children', 'elder', 'eldest', 'glk', 'indirect', 'metaclass',
|
143
|
+
'parent', 'random', 'sibling', 'younger', 'youngest'), suffix=r'\b'),
|
144
|
+
Name.Builtin, '#pop'),
|
145
|
+
# Metaclasses
|
146
|
+
(r'(?i)(Class|Object|Routine|String)\b', Name.Builtin, '#pop'),
|
147
|
+
# Veneer routines
|
148
|
+
(words((
|
149
|
+
'Box__Routine', 'CA__Pr', 'CDefArt', 'CInDefArt', 'Cl__Ms',
|
150
|
+
'Copy__Primitive', 'CP__Tab', 'DA__Pr', 'DB__Pr', 'DefArt', 'Dynam__String',
|
151
|
+
'EnglishNumber', 'Glk__Wrap', 'IA__Pr', 'IB__Pr', 'InDefArt', 'Main__',
|
152
|
+
'Meta__class', 'OB__Move', 'OB__Remove', 'OC__Cl', 'OP__Pr', 'Print__Addr',
|
153
|
+
'Print__PName', 'PrintShortName', 'RA__Pr', 'RA__Sc', 'RL__Pr', 'R_Process',
|
154
|
+
'RT__ChG', 'RT__ChGt', 'RT__ChLDB', 'RT__ChLDW', 'RT__ChPR', 'RT__ChPrintA',
|
155
|
+
'RT__ChPrintC', 'RT__ChPrintO', 'RT__ChPrintS', 'RT__ChPS', 'RT__ChR',
|
156
|
+
'RT__ChSTB', 'RT__ChSTW', 'RT__ChT', 'RT__Err', 'RT__TrPS', 'RV__Pr',
|
157
|
+
'Symb__Tab', 'Unsigned__Compare', 'WV__Pr', 'Z__Region'),
|
158
|
+
prefix='(?i)', suffix=r'\b'),
|
159
|
+
Name.Builtin, '#pop'),
|
160
|
+
# Other built-in symbols
|
161
|
+
(words((
|
162
|
+
'call', 'copy', 'create', 'DEBUG', 'destroy', 'DICT_CHAR_SIZE',
|
163
|
+
'DICT_ENTRY_BYTES', 'DICT_IS_UNICODE', 'DICT_WORD_SIZE', 'false',
|
164
|
+
'FLOAT_INFINITY', 'FLOAT_NAN', 'FLOAT_NINFINITY', 'GOBJFIELD_CHAIN',
|
165
|
+
'GOBJFIELD_CHILD', 'GOBJFIELD_NAME', 'GOBJFIELD_PARENT',
|
166
|
+
'GOBJFIELD_PROPTAB', 'GOBJFIELD_SIBLING', 'GOBJ_EXT_START',
|
167
|
+
'GOBJ_TOTAL_LENGTH', 'Grammar__Version', 'INDIV_PROP_START', 'INFIX',
|
168
|
+
'infix__watching', 'MODULE_MODE', 'name', 'nothing', 'NUM_ATTR_BYTES', 'print',
|
169
|
+
'print_to_array', 'recreate', 'remaining', 'self', 'sender', 'STRICT_MODE',
|
170
|
+
'sw__var', 'sys__glob0', 'sys__glob1', 'sys__glob2', 'sys_statusline_flag',
|
171
|
+
'TARGET_GLULX', 'TARGET_ZCODE', 'temp__global2', 'temp__global3',
|
172
|
+
'temp__global4', 'temp_global', 'true', 'USE_MODULES', 'WORDSIZE'),
|
173
|
+
prefix='(?i)', suffix=r'\b'),
|
174
|
+
Name.Builtin, '#pop'),
|
175
|
+
# Other values
|
176
|
+
(_name, Name, '#pop')
|
177
|
+
],
|
178
|
+
# Strings
|
179
|
+
'dictionary-word': [
|
180
|
+
(r'[~^]+', String.Escape),
|
181
|
+
(r'[^~^\\@({%s]+' % _squote, String.Single),
|
182
|
+
(r'[({]', String.Single),
|
183
|
+
(r'@\{[0-9a-fA-F]{,4}\}', String.Escape),
|
184
|
+
(r'@.{2}', String.Escape),
|
185
|
+
(r'[%s]' % _squote, String.Single, '#pop')
|
186
|
+
],
|
187
|
+
'string': [
|
188
|
+
(r'[~^]+', String.Escape),
|
189
|
+
(r'[^~^\\@({%s]+' % _dquote, String.Double),
|
190
|
+
(r'[({]', String.Double),
|
191
|
+
(r'\\', String.Escape),
|
192
|
+
(r'@(\\\s*[%s]\s*)*@((\\\s*[%s]\s*)*[0-9])*' %
|
193
|
+
(_newline, _newline), String.Escape),
|
194
|
+
(r'@(\\\s*[%s]\s*)*\{((\\\s*[%s]\s*)*[0-9a-fA-F]){,4}'
|
195
|
+
r'(\\\s*[%s]\s*)*\}' % (_newline, _newline, _newline),
|
196
|
+
String.Escape),
|
197
|
+
(r'@(\\\s*[%s]\s*)*.(\\\s*[%s]\s*)*.' % (_newline, _newline),
|
198
|
+
String.Escape),
|
199
|
+
(r'[%s]' % _dquote, String.Double, '#pop')
|
200
|
+
],
|
201
|
+
'plain-string': [
|
202
|
+
(r'[^~^\\({\[\]%s]+' % _dquote, String.Double),
|
203
|
+
(r'[~^({\[\]]', String.Double),
|
204
|
+
(r'\\', String.Escape),
|
205
|
+
(r'[%s]' % _dquote, String.Double, '#pop')
|
206
|
+
],
|
207
|
+
# Names
|
208
|
+
'_constant': [
|
209
|
+
include('_whitespace'),
|
210
|
+
(_name, Name.Constant, '#pop'),
|
211
|
+
include('value')
|
212
|
+
],
|
213
|
+
'_global': [
|
214
|
+
include('_whitespace'),
|
215
|
+
(_name, Name.Variable.Global, '#pop'),
|
216
|
+
include('value')
|
217
|
+
],
|
218
|
+
'label?': [
|
219
|
+
include('_whitespace'),
|
220
|
+
(_name, Name.Label, '#pop'),
|
221
|
+
default('#pop')
|
222
|
+
],
|
223
|
+
'variable?': [
|
224
|
+
include('_whitespace'),
|
225
|
+
(_name, Name.Variable, '#pop'),
|
226
|
+
default('#pop')
|
227
|
+
],
|
228
|
+
# Values after hashes
|
229
|
+
'obsolete-dictionary-word': [
|
230
|
+
(r'\S\w*', String.Other, '#pop')
|
231
|
+
],
|
232
|
+
'system-constant': [
|
233
|
+
include('_whitespace'),
|
234
|
+
(_name, Name.Builtin, '#pop')
|
235
|
+
],
|
236
|
+
|
237
|
+
# Directives
|
238
|
+
'directive': [
|
239
|
+
include('_whitespace'),
|
240
|
+
(r'#', Punctuation),
|
241
|
+
(r';', Punctuation, '#pop'),
|
242
|
+
(r'\[', Punctuation,
|
243
|
+
('default', 'statements', 'locals', 'routine-name?')),
|
244
|
+
(words((
|
245
|
+
'abbreviate', 'endif', 'dictionary', 'ifdef', 'iffalse', 'ifndef', 'ifnot',
|
246
|
+
'iftrue', 'ifv3', 'ifv5', 'release', 'serial', 'switches', 'system_file',
|
247
|
+
'version'), prefix='(?i)', suffix=r'\b'),
|
248
|
+
Keyword, 'default'),
|
249
|
+
(r'(?i)(array|global)\b', Keyword,
|
250
|
+
('default', 'directive-keyword?', '_global')),
|
251
|
+
(r'(?i)attribute\b', Keyword, ('default', 'alias?', '_constant')),
|
252
|
+
(r'(?i)class\b', Keyword,
|
253
|
+
('object-body', 'duplicates', 'class-name')),
|
254
|
+
(r'(?i)(constant|default)\b', Keyword,
|
255
|
+
('default', 'expression', '_constant')),
|
256
|
+
(r'(?i)(end\b)(.*)', bygroups(Keyword, Text)),
|
257
|
+
(r'(?i)(extend|verb)\b', Keyword, 'grammar'),
|
258
|
+
(r'(?i)fake_action\b', Keyword, ('default', '_constant')),
|
259
|
+
(r'(?i)import\b', Keyword, 'manifest'),
|
260
|
+
(r'(?i)(include|link)\b', Keyword,
|
261
|
+
('default', 'before-plain-string')),
|
262
|
+
(r'(?i)(lowstring|undef)\b', Keyword, ('default', '_constant')),
|
263
|
+
(r'(?i)message\b', Keyword, ('default', 'diagnostic')),
|
264
|
+
(r'(?i)(nearby|object)\b', Keyword,
|
265
|
+
('object-body', '_object-head')),
|
266
|
+
(r'(?i)property\b', Keyword,
|
267
|
+
('default', 'alias?', '_constant', 'property-keyword*')),
|
268
|
+
(r'(?i)replace\b', Keyword,
|
269
|
+
('default', 'routine-name?', 'routine-name?')),
|
270
|
+
(r'(?i)statusline\b', Keyword, ('default', 'directive-keyword?')),
|
271
|
+
(r'(?i)stub\b', Keyword, ('default', 'routine-name?')),
|
272
|
+
(r'(?i)trace\b', Keyword,
|
273
|
+
('default', 'trace-keyword?', 'trace-keyword?')),
|
274
|
+
(r'(?i)zcharacter\b', Keyword,
|
275
|
+
('default', 'directive-keyword?', 'directive-keyword?')),
|
276
|
+
(_name, Name.Class, ('object-body', '_object-head'))
|
277
|
+
],
|
278
|
+
# [, Replace, Stub
|
279
|
+
'routine-name?': [
|
280
|
+
include('_whitespace'),
|
281
|
+
(_name, Name.Function, '#pop'),
|
282
|
+
default('#pop')
|
283
|
+
],
|
284
|
+
'locals': [
|
285
|
+
include('_whitespace'),
|
286
|
+
(r';', Punctuation, '#pop'),
|
287
|
+
(r'\*', Punctuation),
|
288
|
+
(r'"', String.Double, 'plain-string'),
|
289
|
+
(_name, Name.Variable)
|
290
|
+
],
|
291
|
+
# Array
|
292
|
+
'many-values': [
|
293
|
+
include('_whitespace'),
|
294
|
+
(r';', Punctuation),
|
295
|
+
(r'\]', Punctuation, '#pop'),
|
296
|
+
(r':', Error),
|
297
|
+
default(('expression', '_expression'))
|
298
|
+
],
|
299
|
+
# Attribute, Property
|
300
|
+
'alias?': [
|
301
|
+
include('_whitespace'),
|
302
|
+
(r'alias\b', Keyword, ('#pop', '_constant')),
|
303
|
+
default('#pop')
|
304
|
+
],
|
305
|
+
# Class, Object, Nearby
|
306
|
+
'class-name': [
|
307
|
+
include('_whitespace'),
|
308
|
+
(r'(?=[,;]|(class|has|private|with)\b)', Text, '#pop'),
|
309
|
+
(_name, Name.Class, '#pop')
|
310
|
+
],
|
311
|
+
'duplicates': [
|
312
|
+
include('_whitespace'),
|
313
|
+
(r'\(', Punctuation, ('#pop', 'expression', '_expression')),
|
314
|
+
default('#pop')
|
315
|
+
],
|
316
|
+
'_object-head': [
|
317
|
+
(r'[%s]>' % _dash, Punctuation),
|
318
|
+
(r'(class|has|private|with)\b', Keyword.Declaration, '#pop'),
|
319
|
+
include('_global')
|
320
|
+
],
|
321
|
+
'object-body': [
|
322
|
+
include('_whitespace'),
|
323
|
+
(r';', Punctuation, '#pop:2'),
|
324
|
+
(r',', Punctuation),
|
325
|
+
(r'class\b', Keyword.Declaration, 'class-segment'),
|
326
|
+
(r'(has|private|with)\b', Keyword.Declaration),
|
327
|
+
(r':', Error),
|
328
|
+
default(('_object-expression', '_expression'))
|
329
|
+
],
|
330
|
+
'class-segment': [
|
331
|
+
include('_whitespace'),
|
332
|
+
(r'(?=[,;]|(class|has|private|with)\b)', Text, '#pop'),
|
333
|
+
(_name, Name.Class),
|
334
|
+
default('value')
|
335
|
+
],
|
336
|
+
# Extend, Verb
|
337
|
+
'grammar': [
|
338
|
+
include('_whitespace'),
|
339
|
+
(r'=', Punctuation, ('#pop', 'default')),
|
340
|
+
(r'\*', Punctuation, ('#pop', 'grammar-line')),
|
341
|
+
default('_directive-keyword')
|
342
|
+
],
|
343
|
+
'grammar-line': [
|
344
|
+
include('_whitespace'),
|
345
|
+
(r';', Punctuation, '#pop'),
|
346
|
+
(r'[/*]', Punctuation),
|
347
|
+
(r'[%s]>' % _dash, Punctuation, 'value'),
|
348
|
+
(r'(noun|scope)\b', Keyword, '=routine'),
|
349
|
+
default('_directive-keyword')
|
350
|
+
],
|
351
|
+
'=routine': [
|
352
|
+
include('_whitespace'),
|
353
|
+
(r'=', Punctuation, 'routine-name?'),
|
354
|
+
default('#pop')
|
355
|
+
],
|
356
|
+
# Import
|
357
|
+
'manifest': [
|
358
|
+
include('_whitespace'),
|
359
|
+
(r';', Punctuation, '#pop'),
|
360
|
+
(r',', Punctuation),
|
361
|
+
(r'(?i)global\b', Keyword, '_global'),
|
362
|
+
default('_global')
|
363
|
+
],
|
364
|
+
# Include, Link, Message
|
365
|
+
'diagnostic': [
|
366
|
+
include('_whitespace'),
|
367
|
+
(r'[%s]' % _dquote, String.Double, ('#pop', 'message-string')),
|
368
|
+
default(('#pop', 'before-plain-string', 'directive-keyword?'))
|
369
|
+
],
|
370
|
+
'before-plain-string': [
|
371
|
+
include('_whitespace'),
|
372
|
+
(r'[%s]' % _dquote, String.Double, ('#pop', 'plain-string'))
|
373
|
+
],
|
374
|
+
'message-string': [
|
375
|
+
(r'[~^]+', String.Escape),
|
376
|
+
include('plain-string')
|
377
|
+
],
|
378
|
+
|
379
|
+
# Keywords used in directives
|
380
|
+
'_directive-keyword!': [
|
381
|
+
include('_whitespace'),
|
382
|
+
(words((
|
383
|
+
'additive', 'alias', 'buffer', 'class', 'creature', 'data', 'error', 'fatalerror',
|
384
|
+
'first', 'has', 'held', 'initial', 'initstr', 'last', 'long', 'meta', 'multi',
|
385
|
+
'multiexcept', 'multiheld', 'multiinside', 'noun', 'number', 'only', 'private',
|
386
|
+
'replace', 'reverse', 'scope', 'score', 'special', 'string', 'table', 'terminating',
|
387
|
+
'time', 'topic', 'warning', 'with'), suffix=r'\b'),
|
388
|
+
Keyword, '#pop'),
|
389
|
+
(r'[%s]{1,2}>|[+=]' % _dash, Punctuation, '#pop')
|
390
|
+
],
|
391
|
+
'_directive-keyword': [
|
392
|
+
include('_directive-keyword!'),
|
393
|
+
include('value')
|
394
|
+
],
|
395
|
+
'directive-keyword?': [
|
396
|
+
include('_directive-keyword!'),
|
397
|
+
default('#pop')
|
398
|
+
],
|
399
|
+
'property-keyword*': [
|
400
|
+
include('_whitespace'),
|
401
|
+
(r'(additive|long)\b', Keyword),
|
402
|
+
default('#pop')
|
403
|
+
],
|
404
|
+
'trace-keyword?': [
|
405
|
+
include('_whitespace'),
|
406
|
+
(words((
|
407
|
+
'assembly', 'dictionary', 'expressions', 'lines', 'linker',
|
408
|
+
'objects', 'off', 'on', 'symbols', 'tokens', 'verbs'), suffix=r'\b'),
|
409
|
+
Keyword, '#pop'),
|
410
|
+
default('#pop')
|
411
|
+
],
|
412
|
+
|
413
|
+
# Statements
|
414
|
+
'statements': [
|
415
|
+
include('_whitespace'),
|
416
|
+
(r'\]', Punctuation, '#pop'),
|
417
|
+
(r'[;{}]', Punctuation),
|
418
|
+
(words((
|
419
|
+
'box', 'break', 'continue', 'default', 'give', 'inversion',
|
420
|
+
'new_line', 'quit', 'read', 'remove', 'return', 'rfalse', 'rtrue',
|
421
|
+
'spaces', 'string', 'until'), suffix=r'\b'),
|
422
|
+
Keyword, 'default'),
|
423
|
+
(r'(do|else)\b', Keyword),
|
424
|
+
(r'(font|style)\b', Keyword,
|
425
|
+
('default', 'miscellaneous-keyword?')),
|
426
|
+
(r'for\b', Keyword, ('for', '(?')),
|
427
|
+
(r'(if|switch|while)', Keyword,
|
428
|
+
('expression', '_expression', '(?')),
|
429
|
+
(r'(jump|save|restore)\b', Keyword, ('default', 'label?')),
|
430
|
+
(r'objectloop\b', Keyword,
|
431
|
+
('_keyword-expression', 'variable?', '(?')),
|
432
|
+
(r'print(_ret)?\b|(?=[%s])' % _dquote, Keyword, 'print-list'),
|
433
|
+
(r'\.', Name.Label, 'label?'),
|
434
|
+
(r'@', Keyword, 'opcode'),
|
435
|
+
(r'#(?![agrnw]\$|#)', Punctuation, 'directive'),
|
436
|
+
(r'<', Punctuation, 'default'),
|
437
|
+
(r'move\b', Keyword,
|
438
|
+
('default', '_keyword-expression', '_expression')),
|
439
|
+
default(('default', '_keyword-expression', '_expression'))
|
440
|
+
],
|
441
|
+
'miscellaneous-keyword?': [
|
442
|
+
include('_whitespace'),
|
443
|
+
(r'(bold|fixed|from|near|off|on|reverse|roman|to|underline)\b',
|
444
|
+
Keyword, '#pop'),
|
445
|
+
(r'(a|A|an|address|char|name|number|object|property|string|the|'
|
446
|
+
r'The)\b(?=(\s+|(![^%s]*))*\))' % _newline, Keyword.Pseudo,
|
447
|
+
'#pop'),
|
448
|
+
(r'%s(?=(\s+|(![^%s]*))*\))' % (_name, _newline), Name.Function,
|
449
|
+
'#pop'),
|
450
|
+
default('#pop')
|
451
|
+
],
|
452
|
+
'(?': [
|
453
|
+
include('_whitespace'),
|
454
|
+
(r'\(', Punctuation, '#pop'),
|
455
|
+
default('#pop')
|
456
|
+
],
|
457
|
+
'for': [
|
458
|
+
include('_whitespace'),
|
459
|
+
(r';', Punctuation, ('_for-expression', '_expression')),
|
460
|
+
default(('_for-expression', '_expression'))
|
461
|
+
],
|
462
|
+
'print-list': [
|
463
|
+
include('_whitespace'),
|
464
|
+
(r';', Punctuation, '#pop'),
|
465
|
+
(r':', Error),
|
466
|
+
default(('_list-expression', '_expression', '_list-expression', 'form'))
|
467
|
+
],
|
468
|
+
'form': [
|
469
|
+
include('_whitespace'),
|
470
|
+
(r'\(', Punctuation, ('#pop', 'miscellaneous-keyword?')),
|
471
|
+
default('#pop')
|
472
|
+
],
|
473
|
+
|
474
|
+
# Assembly
|
475
|
+
'opcode': [
|
476
|
+
include('_whitespace'),
|
477
|
+
(r'[%s]' % _dquote, String.Double, ('operands', 'plain-string')),
|
478
|
+
(_name, Keyword, 'operands')
|
479
|
+
],
|
480
|
+
'operands': [
|
481
|
+
(r':', Error),
|
482
|
+
default(('_assembly-expression', '_expression'))
|
483
|
+
]
|
484
|
+
}
|
485
|
+
|
486
|
+
def get_tokens_unprocessed(self, text):
|
487
|
+
# 'in' is either a keyword or an operator.
|
488
|
+
# If the token two tokens after 'in' is ')', 'in' is a keyword:
|
489
|
+
# objectloop(a in b)
|
490
|
+
# Otherwise, it is an operator:
|
491
|
+
# objectloop(a in b && true)
|
492
|
+
objectloop_queue = []
|
493
|
+
objectloop_token_count = -1
|
494
|
+
previous_token = None
|
495
|
+
for index, token, value in RegexLexer.get_tokens_unprocessed(self,
|
496
|
+
text):
|
497
|
+
if previous_token is Name.Variable and value == 'in':
|
498
|
+
objectloop_queue = [[index, token, value]]
|
499
|
+
objectloop_token_count = 2
|
500
|
+
elif objectloop_token_count > 0:
|
501
|
+
if token not in Comment and token not in Text:
|
502
|
+
objectloop_token_count -= 1
|
503
|
+
objectloop_queue.append((index, token, value))
|
504
|
+
else:
|
505
|
+
if objectloop_token_count == 0:
|
506
|
+
if objectloop_queue[-1][2] == ')':
|
507
|
+
objectloop_queue[0][1] = Keyword
|
508
|
+
while objectloop_queue:
|
509
|
+
yield objectloop_queue.pop(0)
|
510
|
+
objectloop_token_count = -1
|
511
|
+
yield index, token, value
|
512
|
+
if token not in Comment and token not in Text:
|
513
|
+
previous_token = token
|
514
|
+
while objectloop_queue:
|
515
|
+
yield objectloop_queue.pop(0)
|
516
|
+
|
517
|
+
|
518
|
+
class Inform7Lexer(RegexLexer):
|
519
|
+
"""
|
520
|
+
For `Inform 7 <http://inform7.com/>`_ source code.
|
521
|
+
|
522
|
+
.. versionadded:: 2.0
|
523
|
+
"""
|
524
|
+
|
525
|
+
name = 'Inform 7'
|
526
|
+
aliases = ['inform7', 'i7']
|
527
|
+
filenames = ['*.ni', '*.i7x']
|
528
|
+
|
529
|
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
530
|
+
|
531
|
+
_dash = Inform6Lexer._dash
|
532
|
+
_dquote = Inform6Lexer._dquote
|
533
|
+
_newline = Inform6Lexer._newline
|
534
|
+
_start = r'\A|(?<=[%s])' % _newline
|
535
|
+
|
536
|
+
# There are three variants of Inform 7, differing in how to
|
537
|
+
# interpret at signs and braces in I6T. In top-level inclusions, at
|
538
|
+
# signs in the first column are inweb syntax. In phrase definitions
|
539
|
+
# and use options, tokens in braces are treated as I7. Use options
|
540
|
+
# also interpret "{N}".
|
541
|
+
tokens = {}
|
542
|
+
token_variants = ['+i6t-not-inline', '+i6t-inline', '+i6t-use-option']
|
543
|
+
|
544
|
+
for level in token_variants:
|
545
|
+
tokens[level] = {
|
546
|
+
'+i6-root': list(Inform6Lexer.tokens['root']),
|
547
|
+
'+i6t-root': [ # For Inform6TemplateLexer
|
548
|
+
(r'[^%s]*' % Inform6Lexer._newline, Comment.Preproc,
|
549
|
+
('directive', '+p'))
|
550
|
+
],
|
551
|
+
'root': [
|
552
|
+
(r'(\|?\s)+', Text),
|
553
|
+
(r'\[', Comment.Multiline, '+comment'),
|
554
|
+
(r'[%s]' % _dquote, Generic.Heading,
|
555
|
+
('+main', '+titling', '+titling-string')),
|
556
|
+
default(('+main', '+heading?'))
|
557
|
+
],
|
558
|
+
'+titling-string': [
|
559
|
+
(r'[^%s]+' % _dquote, Generic.Heading),
|
560
|
+
(r'[%s]' % _dquote, Generic.Heading, '#pop')
|
561
|
+
],
|
562
|
+
'+titling': [
|
563
|
+
(r'\[', Comment.Multiline, '+comment'),
|
564
|
+
(r'[^%s.;:|%s]+' % (_dquote, _newline), Generic.Heading),
|
565
|
+
(r'[%s]' % _dquote, Generic.Heading, '+titling-string'),
|
566
|
+
(r'[%s]{2}|(?<=[\s%s])\|[\s%s]' % (_newline, _dquote, _dquote),
|
567
|
+
Text, ('#pop', '+heading?')),
|
568
|
+
(r'[.;:]|(?<=[\s%s])\|' % _dquote, Text, '#pop'),
|
569
|
+
(r'[|%s]' % _newline, Generic.Heading)
|
570
|
+
],
|
571
|
+
'+main': [
|
572
|
+
(r'(?i)[^%s:a\[(|%s]+' % (_dquote, _newline), Text),
|
573
|
+
(r'[%s]' % _dquote, String.Double, '+text'),
|
574
|
+
(r':', Text, '+phrase-definition'),
|
575
|
+
(r'(?i)\bas\b', Text, '+use-option'),
|
576
|
+
(r'\[', Comment.Multiline, '+comment'),
|
577
|
+
(r'(\([%s])(.*?)([%s]\))' % (_dash, _dash),
|
578
|
+
bygroups(Punctuation,
|
579
|
+
using(this, state=('+i6-root', 'directive'),
|
580
|
+
i6t='+i6t-not-inline'), Punctuation)),
|
581
|
+
(r'(%s|(?<=[\s;:.%s]))\|\s|[%s]{2,}' %
|
582
|
+
(_start, _dquote, _newline), Text, '+heading?'),
|
583
|
+
(r'(?i)[a(|%s]' % _newline, Text)
|
584
|
+
],
|
585
|
+
'+phrase-definition': [
|
586
|
+
(r'\s+', Text),
|
587
|
+
(r'\[', Comment.Multiline, '+comment'),
|
588
|
+
(r'(\([%s])(.*?)([%s]\))' % (_dash, _dash),
|
589
|
+
bygroups(Punctuation,
|
590
|
+
using(this, state=('+i6-root', 'directive',
|
591
|
+
'default', 'statements'),
|
592
|
+
i6t='+i6t-inline'), Punctuation), '#pop'),
|
593
|
+
default('#pop')
|
594
|
+
],
|
595
|
+
'+use-option': [
|
596
|
+
(r'\s+', Text),
|
597
|
+
(r'\[', Comment.Multiline, '+comment'),
|
598
|
+
(r'(\([%s])(.*?)([%s]\))' % (_dash, _dash),
|
599
|
+
bygroups(Punctuation,
|
600
|
+
using(this, state=('+i6-root', 'directive'),
|
601
|
+
i6t='+i6t-use-option'), Punctuation), '#pop'),
|
602
|
+
default('#pop')
|
603
|
+
],
|
604
|
+
'+comment': [
|
605
|
+
(r'[^\[\]]+', Comment.Multiline),
|
606
|
+
(r'\[', Comment.Multiline, '#push'),
|
607
|
+
(r'\]', Comment.Multiline, '#pop')
|
608
|
+
],
|
609
|
+
'+text': [
|
610
|
+
(r'[^\[%s]+' % _dquote, String.Double),
|
611
|
+
(r'\[.*?\]', String.Interpol),
|
612
|
+
(r'[%s]' % _dquote, String.Double, '#pop')
|
613
|
+
],
|
614
|
+
'+heading?': [
|
615
|
+
(r'(\|?\s)+', Text),
|
616
|
+
(r'\[', Comment.Multiline, '+comment'),
|
617
|
+
(r'[%s]{4}\s+' % _dash, Text, '+documentation-heading'),
|
618
|
+
(r'[%s]{1,3}' % _dash, Text),
|
619
|
+
(r'(?i)(volume|book|part|chapter|section)\b[^%s]*' % _newline,
|
620
|
+
Generic.Heading, '#pop'),
|
621
|
+
default('#pop')
|
622
|
+
],
|
623
|
+
'+documentation-heading': [
|
624
|
+
(r'\s+', Text),
|
625
|
+
(r'\[', Comment.Multiline, '+comment'),
|
626
|
+
(r'(?i)documentation\s+', Text, '+documentation-heading2'),
|
627
|
+
default('#pop')
|
628
|
+
],
|
629
|
+
'+documentation-heading2': [
|
630
|
+
(r'\s+', Text),
|
631
|
+
(r'\[', Comment.Multiline, '+comment'),
|
632
|
+
(r'[%s]{4}\s' % _dash, Text, '+documentation'),
|
633
|
+
default('#pop:2')
|
634
|
+
],
|
635
|
+
'+documentation': [
|
636
|
+
(r'(?i)(%s)\s*(chapter|example)\s*:[^%s]*' %
|
637
|
+
(_start, _newline), Generic.Heading),
|
638
|
+
(r'(?i)(%s)\s*section\s*:[^%s]*' % (_start, _newline),
|
639
|
+
Generic.Subheading),
|
640
|
+
(r'((%s)\t.*?[%s])+' % (_start, _newline),
|
641
|
+
using(this, state='+main')),
|
642
|
+
(r'[^%s\[]+|[%s\[]' % (_newline, _newline), Text),
|
643
|
+
(r'\[', Comment.Multiline, '+comment'),
|
644
|
+
],
|
645
|
+
'+i6t-not-inline': [
|
646
|
+
(r'(%s)@c( .*?)?([%s]|\Z)' % (_start, _newline),
|
647
|
+
Comment.Preproc),
|
648
|
+
(r'(%s)@([%s]+|Purpose:)[^%s]*' % (_start, _dash, _newline),
|
649
|
+
Comment.Preproc),
|
650
|
+
(r'(%s)@p( .*?)?([%s]|\Z)' % (_start, _newline),
|
651
|
+
Generic.Heading, '+p')
|
652
|
+
],
|
653
|
+
'+i6t-use-option': [
|
654
|
+
include('+i6t-not-inline'),
|
655
|
+
(r'(\{)(N)(\})', bygroups(Punctuation, Text, Punctuation))
|
656
|
+
],
|
657
|
+
'+i6t-inline': [
|
658
|
+
(r'(\{)(\S[^}]*)?(\})',
|
659
|
+
bygroups(Punctuation, using(this, state='+main'),
|
660
|
+
Punctuation))
|
661
|
+
],
|
662
|
+
'+i6t': [
|
663
|
+
(r'(\{[%s])(![^}]*)(\}?)' % _dash,
|
664
|
+
bygroups(Punctuation, Comment.Single, Punctuation)),
|
665
|
+
(r'(\{[%s])(lines)(:)([^}]*)(\}?)' % _dash,
|
666
|
+
bygroups(Punctuation, Keyword, Punctuation, Text,
|
667
|
+
Punctuation), '+lines'),
|
668
|
+
(r'(\{[%s])([^:}]*)(:?)([^}]*)(\}?)' % _dash,
|
669
|
+
bygroups(Punctuation, Keyword, Punctuation, Text,
|
670
|
+
Punctuation)),
|
671
|
+
(r'(\(\+)(.*?)(\+\)|\Z)',
|
672
|
+
bygroups(Punctuation, using(this, state='+main'),
|
673
|
+
Punctuation))
|
674
|
+
],
|
675
|
+
'+p': [
|
676
|
+
(r'[^@]+', Comment.Preproc),
|
677
|
+
(r'(%s)@c( .*?)?([%s]|\Z)' % (_start, _newline),
|
678
|
+
Comment.Preproc, '#pop'),
|
679
|
+
(r'(%s)@([%s]|Purpose:)' % (_start, _dash), Comment.Preproc),
|
680
|
+
(r'(%s)@p( .*?)?([%s]|\Z)' % (_start, _newline),
|
681
|
+
Generic.Heading),
|
682
|
+
(r'@', Comment.Preproc)
|
683
|
+
],
|
684
|
+
'+lines': [
|
685
|
+
(r'(%s)@c( .*?)?([%s]|\Z)' % (_start, _newline),
|
686
|
+
Comment.Preproc),
|
687
|
+
(r'(%s)@([%s]|Purpose:)[^%s]*' % (_start, _dash, _newline),
|
688
|
+
Comment.Preproc),
|
689
|
+
(r'(%s)@p( .*?)?([%s]|\Z)' % (_start, _newline),
|
690
|
+
Generic.Heading, '+p'),
|
691
|
+
(r'(%s)@\w*[ %s]' % (_start, _newline), Keyword),
|
692
|
+
(r'![^%s]*' % _newline, Comment.Single),
|
693
|
+
(r'(\{)([%s]endlines)(\})' % _dash,
|
694
|
+
bygroups(Punctuation, Keyword, Punctuation), '#pop'),
|
695
|
+
(r'[^@!{]+?([%s]|\Z)|.' % _newline, Text)
|
696
|
+
]
|
697
|
+
}
|
698
|
+
# Inform 7 can include snippets of Inform 6 template language,
|
699
|
+
# so all of Inform6Lexer's states are copied here, with
|
700
|
+
# modifications to account for template syntax. Inform7Lexer's
|
701
|
+
# own states begin with '+' to avoid name conflicts. Some of
|
702
|
+
# Inform6Lexer's states begin with '_': these are not modified.
|
703
|
+
# They deal with template syntax either by including modified
|
704
|
+
# states, or by matching r'' then pushing to modified states.
|
705
|
+
for token in Inform6Lexer.tokens:
|
706
|
+
if token == 'root':
|
707
|
+
continue
|
708
|
+
tokens[level][token] = list(Inform6Lexer.tokens[token])
|
709
|
+
if not token.startswith('_'):
|
710
|
+
tokens[level][token][:0] = [include('+i6t'), include(level)]
|
711
|
+
|
712
|
+
def __init__(self, **options):
|
713
|
+
level = options.get('i6t', '+i6t-not-inline')
|
714
|
+
if level not in self._all_tokens:
|
715
|
+
self._tokens = self.__class__.process_tokendef(level)
|
716
|
+
else:
|
717
|
+
self._tokens = self._all_tokens[level]
|
718
|
+
RegexLexer.__init__(self, **options)
|
719
|
+
|
720
|
+
|
721
|
+
class Inform6TemplateLexer(Inform7Lexer):
|
722
|
+
"""
|
723
|
+
For `Inform 6 template
|
724
|
+
<http://inform7.com/sources/src/i6template/Woven/index.html>`_ code.
|
725
|
+
|
726
|
+
.. versionadded:: 2.0
|
727
|
+
"""
|
728
|
+
|
729
|
+
name = 'Inform 6 template'
|
730
|
+
aliases = ['i6t']
|
731
|
+
filenames = ['*.i6t']
|
732
|
+
|
733
|
+
def get_tokens_unprocessed(self, text, stack=('+i6t-root',)):
|
734
|
+
return Inform7Lexer.get_tokens_unprocessed(self, text, stack)
|
735
|
+
|
736
|
+
|
737
|
+
class Tads3Lexer(RegexLexer):
|
738
|
+
"""
|
739
|
+
For `TADS 3 <http://www.tads.org/>`_ source code.
|
740
|
+
"""
|
741
|
+
|
742
|
+
name = 'TADS 3'
|
743
|
+
aliases = ['tads3']
|
744
|
+
filenames = ['*.t']
|
745
|
+
|
746
|
+
flags = re.DOTALL | re.MULTILINE
|
747
|
+
|
748
|
+
_comment_single = r'(?://(?:[^\\\n]|\\+[\w\W])*$)'
|
749
|
+
_comment_multiline = r'(?:/\*(?:[^*]|\*(?!/))*\*/)'
|
750
|
+
_escape = (r'(?:\\(?:[\n\\<>"\'^v bnrt]|u[\da-fA-F]{,4}|x[\da-fA-F]{,2}|'
|
751
|
+
r'[0-3]?[0-7]{1,2}))')
|
752
|
+
_name = r'(?:[_a-zA-Z]\w*)'
|
753
|
+
_no_quote = r'(?=\s|\\?>)'
|
754
|
+
_operator = (r'(?:&&|\|\||\+\+|--|\?\?|::|[.,@\[\]~]|'
|
755
|
+
r'(?:[=+\-*/%!&|^]|<<?|>>?>?)=?)')
|
756
|
+
_ws = r'(?:\\|\s|%s|%s)' % (_comment_single, _comment_multiline)
|
757
|
+
_ws_pp = r'(?:\\\n|[^\S\n]|%s|%s)' % (_comment_single, _comment_multiline)
|
758
|
+
|
759
|
+
def _make_string_state(triple, double, verbatim=None, _escape=_escape):
|
760
|
+
if verbatim:
|
761
|
+
verbatim = ''.join(['(?:%s|%s)' % (re.escape(c.lower()),
|
762
|
+
re.escape(c.upper()))
|
763
|
+
for c in verbatim])
|
764
|
+
char = r'"' if double else r"'"
|
765
|
+
token = String.Double if double else String.Single
|
766
|
+
escaped_quotes = r'+|%s(?!%s{2})' % (char, char) if triple else r''
|
767
|
+
prefix = '%s%s' % ('t' if triple else '', 'd' if double else 's')
|
768
|
+
tag_state_name = '%sqt' % prefix
|
769
|
+
state = []
|
770
|
+
if triple:
|
771
|
+
state += [
|
772
|
+
(r'%s{3,}' % char, token, '#pop'),
|
773
|
+
(r'\\%s+' % char, String.Escape),
|
774
|
+
(char, token)
|
775
|
+
]
|
776
|
+
else:
|
777
|
+
state.append((char, token, '#pop'))
|
778
|
+
state += [
|
779
|
+
include('s/verbatim'),
|
780
|
+
(r'[^\\<&{}%s]+' % char, token)
|
781
|
+
]
|
782
|
+
if verbatim:
|
783
|
+
# This regex can't use `(?i)` because escape sequences are
|
784
|
+
# case-sensitive. `<\XMP>` works; `<\xmp>` doesn't.
|
785
|
+
state.append((r'\\?<(/|\\\\|(?!%s)\\)%s(?=[\s=>])' %
|
786
|
+
(_escape, verbatim),
|
787
|
+
Name.Tag, ('#pop', '%sqs' % prefix, tag_state_name)))
|
788
|
+
else:
|
789
|
+
state += [
|
790
|
+
(r'\\?<!([^><\\%s]|<(?!<)|\\%s%s|%s|\\.)*>?' %
|
791
|
+
(char, char, escaped_quotes, _escape), Comment.Multiline),
|
792
|
+
(r'(?i)\\?<listing(?=[\s=>]|\\>)', Name.Tag,
|
793
|
+
('#pop', '%sqs/listing' % prefix, tag_state_name)),
|
794
|
+
(r'(?i)\\?<xmp(?=[\s=>]|\\>)', Name.Tag,
|
795
|
+
('#pop', '%sqs/xmp' % prefix, tag_state_name)),
|
796
|
+
(r'\\?<([^\s=><\\%s]|<(?!<)|\\%s%s|%s|\\.)*' %
|
797
|
+
(char, char, escaped_quotes, _escape), Name.Tag,
|
798
|
+
tag_state_name),
|
799
|
+
include('s/entity')
|
800
|
+
]
|
801
|
+
state += [
|
802
|
+
include('s/escape'),
|
803
|
+
(r'\{([^}<\\%s]|<(?!<)|\\%s%s|%s|\\.)*\}' %
|
804
|
+
(char, char, escaped_quotes, _escape), String.Interpol),
|
805
|
+
(r'[\\&{}<]', token)
|
806
|
+
]
|
807
|
+
return state
|
808
|
+
|
809
|
+
def _make_tag_state(triple, double, _escape=_escape):
|
810
|
+
char = r'"' if double else r"'"
|
811
|
+
quantifier = r'{3,}' if triple else r''
|
812
|
+
state_name = '%s%sqt' % ('t' if triple else '', 'd' if double else 's')
|
813
|
+
token = String.Double if double else String.Single
|
814
|
+
escaped_quotes = r'+|%s(?!%s{2})' % (char, char) if triple else r''
|
815
|
+
return [
|
816
|
+
(r'%s%s' % (char, quantifier), token, '#pop:2'),
|
817
|
+
(r'(\s|\\\n)+', Text),
|
818
|
+
(r'(=)(\\?")', bygroups(Punctuation, String.Double),
|
819
|
+
'dqs/%s' % state_name),
|
820
|
+
(r"(=)(\\?')", bygroups(Punctuation, String.Single),
|
821
|
+
'sqs/%s' % state_name),
|
822
|
+
(r'=', Punctuation, 'uqs/%s' % state_name),
|
823
|
+
(r'\\?>', Name.Tag, '#pop'),
|
824
|
+
(r'\{([^}<\\%s]|<(?!<)|\\%s%s|%s|\\.)*\}' %
|
825
|
+
(char, char, escaped_quotes, _escape), String.Interpol),
|
826
|
+
(r'([^\s=><\\%s]|<(?!<)|\\%s%s|%s|\\.)+' %
|
827
|
+
(char, char, escaped_quotes, _escape), Name.Attribute),
|
828
|
+
include('s/escape'),
|
829
|
+
include('s/verbatim'),
|
830
|
+
include('s/entity'),
|
831
|
+
(r'[\\{}&]', Name.Attribute)
|
832
|
+
]
|
833
|
+
|
834
|
+
def _make_attribute_value_state(terminator, host_triple, host_double,
|
835
|
+
_escape=_escape):
|
836
|
+
token = (String.Double if terminator == r'"' else
|
837
|
+
String.Single if terminator == r"'" else String.Other)
|
838
|
+
host_char = r'"' if host_double else r"'"
|
839
|
+
host_quantifier = r'{3,}' if host_triple else r''
|
840
|
+
host_token = String.Double if host_double else String.Single
|
841
|
+
escaped_quotes = (r'+|%s(?!%s{2})' % (host_char, host_char)
|
842
|
+
if host_triple else r'')
|
843
|
+
return [
|
844
|
+
(r'%s%s' % (host_char, host_quantifier), host_token, '#pop:3'),
|
845
|
+
(r'%s%s' % (r'' if token is String.Other else r'\\?', terminator),
|
846
|
+
token, '#pop'),
|
847
|
+
include('s/verbatim'),
|
848
|
+
include('s/entity'),
|
849
|
+
(r'\{([^}<\\%s]|<(?!<)|\\%s%s|%s|\\.)*\}' %
|
850
|
+
(host_char, host_char, escaped_quotes, _escape), String.Interpol),
|
851
|
+
(r'([^\s"\'<%s{}\\&])+' % (r'>' if token is String.Other else r''),
|
852
|
+
token),
|
853
|
+
include('s/escape'),
|
854
|
+
(r'["\'\s&{<}\\]', token)
|
855
|
+
]
|
856
|
+
|
857
|
+
tokens = {
|
858
|
+
'root': [
|
859
|
+
(u'\ufeff', Text),
|
860
|
+
(r'\{', Punctuation, 'object-body'),
|
861
|
+
(r';+', Punctuation),
|
862
|
+
(r'(?=(argcount|break|case|catch|continue|default|definingobj|'
|
863
|
+
r'delegated|do|else|for|foreach|finally|goto|if|inherited|'
|
864
|
+
r'invokee|local|nil|new|operator|replaced|return|self|switch|'
|
865
|
+
r'targetobj|targetprop|throw|true|try|while)\b)', Text, 'block'),
|
866
|
+
(r'(%s)(%s*)(\()' % (_name, _ws),
|
867
|
+
bygroups(Name.Function, using(this, state='whitespace'),
|
868
|
+
Punctuation),
|
869
|
+
('block?/root', 'more/parameters', 'main/parameters')),
|
870
|
+
include('whitespace'),
|
871
|
+
(r'\++', Punctuation),
|
872
|
+
(r'[^\s!"%-(*->@-_a-z{-~]+', Error), # Averts an infinite loop
|
873
|
+
(r'(?!\Z)', Text, 'main/root')
|
874
|
+
],
|
875
|
+
'main/root': [
|
876
|
+
include('main/basic'),
|
877
|
+
default(('#pop', 'object-body/no-braces', 'classes', 'class'))
|
878
|
+
],
|
879
|
+
'object-body/no-braces': [
|
880
|
+
(r';', Punctuation, '#pop'),
|
881
|
+
(r'\{', Punctuation, ('#pop', 'object-body')),
|
882
|
+
include('object-body')
|
883
|
+
],
|
884
|
+
'object-body': [
|
885
|
+
(r';', Punctuation),
|
886
|
+
(r'\{', Punctuation, '#push'),
|
887
|
+
(r'\}', Punctuation, '#pop'),
|
888
|
+
(r':', Punctuation, ('classes', 'class')),
|
889
|
+
(r'(%s?)(%s*)(\()' % (_name, _ws),
|
890
|
+
bygroups(Name.Function, using(this, state='whitespace'),
|
891
|
+
Punctuation),
|
892
|
+
('block?', 'more/parameters', 'main/parameters')),
|
893
|
+
(r'(%s)(%s*)(\{)' % (_name, _ws),
|
894
|
+
bygroups(Name.Function, using(this, state='whitespace'),
|
895
|
+
Punctuation), 'block'),
|
896
|
+
(r'(%s)(%s*)(:)' % (_name, _ws),
|
897
|
+
bygroups(Name.Variable, using(this, state='whitespace'),
|
898
|
+
Punctuation),
|
899
|
+
('object-body/no-braces', 'classes', 'class')),
|
900
|
+
include('whitespace'),
|
901
|
+
(r'->|%s' % _operator, Punctuation, 'main'),
|
902
|
+
default('main/object-body')
|
903
|
+
],
|
904
|
+
'main/object-body': [
|
905
|
+
include('main/basic'),
|
906
|
+
(r'(%s)(%s*)(=?)' % (_name, _ws),
|
907
|
+
bygroups(Name.Variable, using(this, state='whitespace'),
|
908
|
+
Punctuation), ('#pop', 'more', 'main')),
|
909
|
+
default('#pop:2')
|
910
|
+
],
|
911
|
+
'block?/root': [
|
912
|
+
(r'\{', Punctuation, ('#pop', 'block')),
|
913
|
+
include('whitespace'),
|
914
|
+
(r'(?=[[\'"<(:])', Text, # It might be a VerbRule macro.
|
915
|
+
('#pop', 'object-body/no-braces', 'grammar', 'grammar-rules')),
|
916
|
+
# It might be a macro like DefineAction.
|
917
|
+
default(('#pop', 'object-body/no-braces'))
|
918
|
+
],
|
919
|
+
'block?': [
|
920
|
+
(r'\{', Punctuation, ('#pop', 'block')),
|
921
|
+
include('whitespace'),
|
922
|
+
default('#pop')
|
923
|
+
],
|
924
|
+
'block/basic': [
|
925
|
+
(r'[;:]+', Punctuation),
|
926
|
+
(r'\{', Punctuation, '#push'),
|
927
|
+
(r'\}', Punctuation, '#pop'),
|
928
|
+
(r'default\b', Keyword.Reserved),
|
929
|
+
(r'(%s)(%s*)(:)' % (_name, _ws),
|
930
|
+
bygroups(Name.Label, using(this, state='whitespace'),
|
931
|
+
Punctuation)),
|
932
|
+
include('whitespace')
|
933
|
+
],
|
934
|
+
'block': [
|
935
|
+
include('block/basic'),
|
936
|
+
(r'(?!\Z)', Text, ('more', 'main'))
|
937
|
+
],
|
938
|
+
'block/embed': [
|
939
|
+
(r'>>', String.Interpol, '#pop'),
|
940
|
+
include('block/basic'),
|
941
|
+
(r'(?!\Z)', Text, ('more/embed', 'main'))
|
942
|
+
],
|
943
|
+
'main/basic': [
|
944
|
+
include('whitespace'),
|
945
|
+
(r'\(', Punctuation, ('#pop', 'more', 'main')),
|
946
|
+
(r'\[', Punctuation, ('#pop', 'more/list', 'main')),
|
947
|
+
(r'\{', Punctuation, ('#pop', 'more/inner', 'main/inner',
|
948
|
+
'more/parameters', 'main/parameters')),
|
949
|
+
(r'\*|\.{3}', Punctuation, '#pop'),
|
950
|
+
(r'(?i)0x[\da-f]+', Number.Hex, '#pop'),
|
951
|
+
(r'(\d+\.(?!\.)\d*|\.\d+)([eE][-+]?\d+)?|\d+[eE][-+]?\d+',
|
952
|
+
Number.Float, '#pop'),
|
953
|
+
(r'0[0-7]+', Number.Oct, '#pop'),
|
954
|
+
(r'\d+', Number.Integer, '#pop'),
|
955
|
+
(r'"""', String.Double, ('#pop', 'tdqs')),
|
956
|
+
(r"'''", String.Single, ('#pop', 'tsqs')),
|
957
|
+
(r'"', String.Double, ('#pop', 'dqs')),
|
958
|
+
(r"'", String.Single, ('#pop', 'sqs')),
|
959
|
+
(r'R"""', String.Regex, ('#pop', 'tdqr')),
|
960
|
+
(r"R'''", String.Regex, ('#pop', 'tsqr')),
|
961
|
+
(r'R"', String.Regex, ('#pop', 'dqr')),
|
962
|
+
(r"R'", String.Regex, ('#pop', 'sqr')),
|
963
|
+
# Two-token keywords
|
964
|
+
(r'(extern)(%s+)(object\b)' % _ws,
|
965
|
+
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
966
|
+
Keyword.Reserved)),
|
967
|
+
(r'(function|method)(%s*)(\()' % _ws,
|
968
|
+
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
969
|
+
Punctuation),
|
970
|
+
('#pop', 'block?', 'more/parameters', 'main/parameters')),
|
971
|
+
(r'(modify)(%s+)(grammar\b)' % _ws,
|
972
|
+
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
973
|
+
Keyword.Reserved),
|
974
|
+
('#pop', 'object-body/no-braces', ':', 'grammar')),
|
975
|
+
(r'(new)(%s+(?=(?:function|method)\b))' % _ws,
|
976
|
+
bygroups(Keyword.Reserved, using(this, state='whitespace'))),
|
977
|
+
(r'(object)(%s+)(template\b)' % _ws,
|
978
|
+
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
979
|
+
Keyword.Reserved), ('#pop', 'template')),
|
980
|
+
(r'(string)(%s+)(template\b)' % _ws,
|
981
|
+
bygroups(Keyword, using(this, state='whitespace'),
|
982
|
+
Keyword.Reserved), ('#pop', 'function-name')),
|
983
|
+
# Keywords
|
984
|
+
(r'(argcount|definingobj|invokee|replaced|targetobj|targetprop)\b',
|
985
|
+
Name.Builtin, '#pop'),
|
986
|
+
(r'(break|continue|goto)\b', Keyword.Reserved, ('#pop', 'label')),
|
987
|
+
(r'(case|extern|if|intrinsic|return|static|while)\b',
|
988
|
+
Keyword.Reserved),
|
989
|
+
(r'catch\b', Keyword.Reserved, ('#pop', 'catch')),
|
990
|
+
(r'class\b', Keyword.Reserved,
|
991
|
+
('#pop', 'object-body/no-braces', 'class')),
|
992
|
+
(r'(default|do|else|finally|try)\b', Keyword.Reserved, '#pop'),
|
993
|
+
(r'(dictionary|property)\b', Keyword.Reserved,
|
994
|
+
('#pop', 'constants')),
|
995
|
+
(r'enum\b', Keyword.Reserved, ('#pop', 'enum')),
|
996
|
+
(r'export\b', Keyword.Reserved, ('#pop', 'main')),
|
997
|
+
(r'(for|foreach)\b', Keyword.Reserved,
|
998
|
+
('#pop', 'more/inner', 'main/inner')),
|
999
|
+
(r'(function|method)\b', Keyword.Reserved,
|
1000
|
+
('#pop', 'block?', 'function-name')),
|
1001
|
+
(r'grammar\b', Keyword.Reserved,
|
1002
|
+
('#pop', 'object-body/no-braces', 'grammar')),
|
1003
|
+
(r'inherited\b', Keyword.Reserved, ('#pop', 'inherited')),
|
1004
|
+
(r'local\b', Keyword.Reserved,
|
1005
|
+
('#pop', 'more/local', 'main/local')),
|
1006
|
+
(r'(modify|replace|switch|throw|transient)\b', Keyword.Reserved,
|
1007
|
+
'#pop'),
|
1008
|
+
(r'new\b', Keyword.Reserved, ('#pop', 'class')),
|
1009
|
+
(r'(nil|true)\b', Keyword.Constant, '#pop'),
|
1010
|
+
(r'object\b', Keyword.Reserved, ('#pop', 'object-body/no-braces')),
|
1011
|
+
(r'operator\b', Keyword.Reserved, ('#pop', 'operator')),
|
1012
|
+
(r'propertyset\b', Keyword.Reserved,
|
1013
|
+
('#pop', 'propertyset', 'main')),
|
1014
|
+
(r'self\b', Name.Builtin.Pseudo, '#pop'),
|
1015
|
+
(r'template\b', Keyword.Reserved, ('#pop', 'template')),
|
1016
|
+
# Operators
|
1017
|
+
(r'(__objref|defined)(%s*)(\()' % _ws,
|
1018
|
+
bygroups(Operator.Word, using(this, state='whitespace'),
|
1019
|
+
Operator), ('#pop', 'more/__objref', 'main')),
|
1020
|
+
(r'delegated\b', Operator.Word),
|
1021
|
+
# Compiler-defined macros and built-in properties
|
1022
|
+
(r'(__DATE__|__DEBUG|__LINE__|__FILE__|'
|
1023
|
+
r'__TADS_MACRO_FORMAT_VERSION|__TADS_SYS_\w*|__TADS_SYSTEM_NAME|'
|
1024
|
+
r'__TADS_VERSION_MAJOR|__TADS_VERSION_MINOR|__TADS3|__TIME__|'
|
1025
|
+
r'construct|finalize|grammarInfo|grammarTag|lexicalParent|'
|
1026
|
+
r'miscVocab|sourceTextGroup|sourceTextGroupName|'
|
1027
|
+
r'sourceTextGroupOrder|sourceTextOrder)\b', Name.Builtin, '#pop')
|
1028
|
+
],
|
1029
|
+
'main': [
|
1030
|
+
include('main/basic'),
|
1031
|
+
(_name, Name, '#pop'),
|
1032
|
+
default('#pop')
|
1033
|
+
],
|
1034
|
+
'more/basic': [
|
1035
|
+
(r'\(', Punctuation, ('more/list', 'main')),
|
1036
|
+
(r'\[', Punctuation, ('more', 'main')),
|
1037
|
+
(r'\.{3}', Punctuation),
|
1038
|
+
(r'->|\.\.', Punctuation, 'main'),
|
1039
|
+
(r'(?=;)|[:)\]]', Punctuation, '#pop'),
|
1040
|
+
include('whitespace'),
|
1041
|
+
(_operator, Operator, 'main'),
|
1042
|
+
(r'\?', Operator, ('main', 'more/conditional', 'main')),
|
1043
|
+
(r'(is|not)(%s+)(in\b)' % _ws,
|
1044
|
+
bygroups(Operator.Word, using(this, state='whitespace'),
|
1045
|
+
Operator.Word)),
|
1046
|
+
(r'[^\s!"%-_a-z{-~]+', Error) # Averts an infinite loop
|
1047
|
+
],
|
1048
|
+
'more': [
|
1049
|
+
include('more/basic'),
|
1050
|
+
default('#pop')
|
1051
|
+
],
|
1052
|
+
# Then expression (conditional operator)
|
1053
|
+
'more/conditional': [
|
1054
|
+
(r':(?!:)', Operator, '#pop'),
|
1055
|
+
include('more')
|
1056
|
+
],
|
1057
|
+
# Embedded expressions
|
1058
|
+
'more/embed': [
|
1059
|
+
(r'>>', String.Interpol, '#pop:2'),
|
1060
|
+
include('more')
|
1061
|
+
],
|
1062
|
+
# For/foreach loop initializer or short-form anonymous function
|
1063
|
+
'main/inner': [
|
1064
|
+
(r'\(', Punctuation, ('#pop', 'more/inner', 'main/inner')),
|
1065
|
+
(r'local\b', Keyword.Reserved, ('#pop', 'main/local')),
|
1066
|
+
include('main')
|
1067
|
+
],
|
1068
|
+
'more/inner': [
|
1069
|
+
(r'\}', Punctuation, '#pop'),
|
1070
|
+
(r',', Punctuation, 'main/inner'),
|
1071
|
+
(r'(in|step)\b', Keyword, 'main/inner'),
|
1072
|
+
include('more')
|
1073
|
+
],
|
1074
|
+
# Local
|
1075
|
+
'main/local': [
|
1076
|
+
(_name, Name.Variable, '#pop'),
|
1077
|
+
include('whitespace')
|
1078
|
+
],
|
1079
|
+
'more/local': [
|
1080
|
+
(r',', Punctuation, 'main/local'),
|
1081
|
+
include('more')
|
1082
|
+
],
|
1083
|
+
# List
|
1084
|
+
'more/list': [
|
1085
|
+
(r'[,:]', Punctuation, 'main'),
|
1086
|
+
include('more')
|
1087
|
+
],
|
1088
|
+
# Parameter list
|
1089
|
+
'main/parameters': [
|
1090
|
+
(r'(%s)(%s*)(?=:)' % (_name, _ws),
|
1091
|
+
bygroups(Name.Variable, using(this, state='whitespace')), '#pop'),
|
1092
|
+
(r'(%s)(%s+)(%s)' % (_name, _ws, _name),
|
1093
|
+
bygroups(Name.Class, using(this, state='whitespace'),
|
1094
|
+
Name.Variable), '#pop'),
|
1095
|
+
(r'\[+', Punctuation),
|
1096
|
+
include('main/basic'),
|
1097
|
+
(_name, Name.Variable, '#pop'),
|
1098
|
+
default('#pop')
|
1099
|
+
],
|
1100
|
+
'more/parameters': [
|
1101
|
+
(r'(:)(%s*(?=[?=,:)]))' % _ws,
|
1102
|
+
bygroups(Punctuation, using(this, state='whitespace'))),
|
1103
|
+
(r'[?\]]+', Punctuation),
|
1104
|
+
(r'[:)]', Punctuation, ('#pop', 'multimethod?')),
|
1105
|
+
(r',', Punctuation, 'main/parameters'),
|
1106
|
+
(r'=', Punctuation, ('more/parameter', 'main')),
|
1107
|
+
include('more')
|
1108
|
+
],
|
1109
|
+
'more/parameter': [
|
1110
|
+
(r'(?=[,)])', Text, '#pop'),
|
1111
|
+
include('more')
|
1112
|
+
],
|
1113
|
+
'multimethod?': [
|
1114
|
+
(r'multimethod\b', Keyword, '#pop'),
|
1115
|
+
include('whitespace'),
|
1116
|
+
default('#pop')
|
1117
|
+
],
|
1118
|
+
|
1119
|
+
# Statements and expressions
|
1120
|
+
'more/__objref': [
|
1121
|
+
(r',', Punctuation, 'mode'),
|
1122
|
+
(r'\)', Operator, '#pop'),
|
1123
|
+
include('more')
|
1124
|
+
],
|
1125
|
+
'mode': [
|
1126
|
+
(r'(error|warn)\b', Keyword, '#pop'),
|
1127
|
+
include('whitespace')
|
1128
|
+
],
|
1129
|
+
'catch': [
|
1130
|
+
(r'\(+', Punctuation),
|
1131
|
+
(_name, Name.Exception, ('#pop', 'variables')),
|
1132
|
+
include('whitespace')
|
1133
|
+
],
|
1134
|
+
'enum': [
|
1135
|
+
include('whitespace'),
|
1136
|
+
(r'token\b', Keyword, ('#pop', 'constants')),
|
1137
|
+
default(('#pop', 'constants'))
|
1138
|
+
],
|
1139
|
+
'grammar': [
|
1140
|
+
(r'\)+', Punctuation),
|
1141
|
+
(r'\(', Punctuation, 'grammar-tag'),
|
1142
|
+
(r':', Punctuation, 'grammar-rules'),
|
1143
|
+
(_name, Name.Class),
|
1144
|
+
include('whitespace')
|
1145
|
+
],
|
1146
|
+
'grammar-tag': [
|
1147
|
+
include('whitespace'),
|
1148
|
+
(r'"""([^\\"<]|""?(?!")|\\"+|\\.|<(?!<))+("{3,}|<<)|'
|
1149
|
+
r'R"""([^\\"]|""?(?!")|\\"+|\\.)+"{3,}|'
|
1150
|
+
r"'''([^\\'<]|''?(?!')|\\'+|\\.|<(?!<))+('{3,}|<<)|"
|
1151
|
+
r"R'''([^\\']|''?(?!')|\\'+|\\.)+'{3,}|"
|
1152
|
+
r'"([^\\"<]|\\.|<(?!<))+("|<<)|R"([^\\"]|\\.)+"|'
|
1153
|
+
r"'([^\\'<]|\\.|<(?!<))+('|<<)|R'([^\\']|\\.)+'|"
|
1154
|
+
r"([^)\s\\/]|/(?![/*]))+|\)", String.Other, '#pop')
|
1155
|
+
],
|
1156
|
+
'grammar-rules': [
|
1157
|
+
include('string'),
|
1158
|
+
include('whitespace'),
|
1159
|
+
(r'(\[)(%s*)(badness)' % _ws,
|
1160
|
+
bygroups(Punctuation, using(this, state='whitespace'), Keyword),
|
1161
|
+
'main'),
|
1162
|
+
(r'->|%s|[()]' % _operator, Punctuation),
|
1163
|
+
(_name, Name.Constant),
|
1164
|
+
default('#pop:2')
|
1165
|
+
],
|
1166
|
+
':': [
|
1167
|
+
(r':', Punctuation, '#pop')
|
1168
|
+
],
|
1169
|
+
'function-name': [
|
1170
|
+
(r'(<<([^>]|>>>|>(?!>))*>>)+', String.Interpol),
|
1171
|
+
(r'(?=%s?%s*[({])' % (_name, _ws), Text, '#pop'),
|
1172
|
+
(_name, Name.Function, '#pop'),
|
1173
|
+
include('whitespace')
|
1174
|
+
],
|
1175
|
+
'inherited': [
|
1176
|
+
(r'<', Punctuation, ('#pop', 'classes', 'class')),
|
1177
|
+
include('whitespace'),
|
1178
|
+
(_name, Name.Class, '#pop'),
|
1179
|
+
default('#pop')
|
1180
|
+
],
|
1181
|
+
'operator': [
|
1182
|
+
(r'negate\b', Operator.Word, '#pop'),
|
1183
|
+
include('whitespace'),
|
1184
|
+
(_operator, Operator),
|
1185
|
+
default('#pop')
|
1186
|
+
],
|
1187
|
+
'propertyset': [
|
1188
|
+
(r'\(', Punctuation, ('more/parameters', 'main/parameters')),
|
1189
|
+
(r'\{', Punctuation, ('#pop', 'object-body')),
|
1190
|
+
include('whitespace')
|
1191
|
+
],
|
1192
|
+
'template': [
|
1193
|
+
(r'(?=;)', Text, '#pop'),
|
1194
|
+
include('string'),
|
1195
|
+
(r'inherited\b', Keyword.Reserved),
|
1196
|
+
include('whitespace'),
|
1197
|
+
(r'->|\?|%s' % _operator, Punctuation),
|
1198
|
+
(_name, Name.Variable)
|
1199
|
+
],
|
1200
|
+
|
1201
|
+
# Identifiers
|
1202
|
+
'class': [
|
1203
|
+
(r'\*|\.{3}', Punctuation, '#pop'),
|
1204
|
+
(r'object\b', Keyword.Reserved, '#pop'),
|
1205
|
+
(r'transient\b', Keyword.Reserved),
|
1206
|
+
(_name, Name.Class, '#pop'),
|
1207
|
+
include('whitespace'),
|
1208
|
+
default('#pop')
|
1209
|
+
],
|
1210
|
+
'classes': [
|
1211
|
+
(r'[:,]', Punctuation, 'class'),
|
1212
|
+
include('whitespace'),
|
1213
|
+
(r'>', Punctuation, '#pop'),
|
1214
|
+
default('#pop')
|
1215
|
+
],
|
1216
|
+
'constants': [
|
1217
|
+
(r',+', Punctuation),
|
1218
|
+
(r';', Punctuation, '#pop'),
|
1219
|
+
(r'property\b', Keyword.Reserved),
|
1220
|
+
(_name, Name.Constant),
|
1221
|
+
include('whitespace')
|
1222
|
+
],
|
1223
|
+
'label': [
|
1224
|
+
(_name, Name.Label, '#pop'),
|
1225
|
+
include('whitespace'),
|
1226
|
+
default('#pop')
|
1227
|
+
],
|
1228
|
+
'variables': [
|
1229
|
+
(r',+', Punctuation),
|
1230
|
+
(r'\)', Punctuation, '#pop'),
|
1231
|
+
include('whitespace'),
|
1232
|
+
(_name, Name.Variable)
|
1233
|
+
],
|
1234
|
+
|
1235
|
+
# Whitespace and comments
|
1236
|
+
'whitespace': [
|
1237
|
+
(r'^%s*#(%s|[^\n]|(?<=\\)\n)*\n?' % (_ws_pp, _comment_multiline),
|
1238
|
+
Comment.Preproc),
|
1239
|
+
(_comment_single, Comment.Single),
|
1240
|
+
(_comment_multiline, Comment.Multiline),
|
1241
|
+
(r'\\+\n+%s*#?|\n+|([^\S\n]|\\)+' % _ws_pp, Text)
|
1242
|
+
],
|
1243
|
+
|
1244
|
+
# Strings
|
1245
|
+
'string': [
|
1246
|
+
(r'"""', String.Double, 'tdqs'),
|
1247
|
+
(r"'''", String.Single, 'tsqs'),
|
1248
|
+
(r'"', String.Double, 'dqs'),
|
1249
|
+
(r"'", String.Single, 'sqs')
|
1250
|
+
],
|
1251
|
+
's/escape': [
|
1252
|
+
(r'\{\{|\}\}|%s' % _escape, String.Escape)
|
1253
|
+
],
|
1254
|
+
's/verbatim': [
|
1255
|
+
(r'<<\s*(as\s+decreasingly\s+likely\s+outcomes|cycling|else|end|'
|
1256
|
+
r'first\s+time|one\s+of|only|or|otherwise|'
|
1257
|
+
r'(sticky|(then\s+)?(purely\s+)?at)\s+random|stopping|'
|
1258
|
+
r'(then\s+)?(half\s+)?shuffled|\|\|)\s*>>', String.Interpol),
|
1259
|
+
(r'<<(%%(_(%s|\\?.)|[\-+ ,#]|\[\d*\]?)*\d*\.?\d*(%s|\\?.)|'
|
1260
|
+
r'\s*((else|otherwise)\s+)?(if|unless)\b)?' % (_escape, _escape),
|
1261
|
+
String.Interpol, ('block/embed', 'more/embed', 'main'))
|
1262
|
+
],
|
1263
|
+
's/entity': [
|
1264
|
+
(r'(?i)&(#(x[\da-f]+|\d+)|[a-z][\da-z]*);?', Name.Entity)
|
1265
|
+
],
|
1266
|
+
'tdqs': _make_string_state(True, True),
|
1267
|
+
'tsqs': _make_string_state(True, False),
|
1268
|
+
'dqs': _make_string_state(False, True),
|
1269
|
+
'sqs': _make_string_state(False, False),
|
1270
|
+
'tdqs/listing': _make_string_state(True, True, 'listing'),
|
1271
|
+
'tsqs/listing': _make_string_state(True, False, 'listing'),
|
1272
|
+
'dqs/listing': _make_string_state(False, True, 'listing'),
|
1273
|
+
'sqs/listing': _make_string_state(False, False, 'listing'),
|
1274
|
+
'tdqs/xmp': _make_string_state(True, True, 'xmp'),
|
1275
|
+
'tsqs/xmp': _make_string_state(True, False, 'xmp'),
|
1276
|
+
'dqs/xmp': _make_string_state(False, True, 'xmp'),
|
1277
|
+
'sqs/xmp': _make_string_state(False, False, 'xmp'),
|
1278
|
+
|
1279
|
+
# Tags
|
1280
|
+
'tdqt': _make_tag_state(True, True),
|
1281
|
+
'tsqt': _make_tag_state(True, False),
|
1282
|
+
'dqt': _make_tag_state(False, True),
|
1283
|
+
'sqt': _make_tag_state(False, False),
|
1284
|
+
'dqs/tdqt': _make_attribute_value_state(r'"', True, True),
|
1285
|
+
'dqs/tsqt': _make_attribute_value_state(r'"', True, False),
|
1286
|
+
'dqs/dqt': _make_attribute_value_state(r'"', False, True),
|
1287
|
+
'dqs/sqt': _make_attribute_value_state(r'"', False, False),
|
1288
|
+
'sqs/tdqt': _make_attribute_value_state(r"'", True, True),
|
1289
|
+
'sqs/tsqt': _make_attribute_value_state(r"'", True, False),
|
1290
|
+
'sqs/dqt': _make_attribute_value_state(r"'", False, True),
|
1291
|
+
'sqs/sqt': _make_attribute_value_state(r"'", False, False),
|
1292
|
+
'uqs/tdqt': _make_attribute_value_state(_no_quote, True, True),
|
1293
|
+
'uqs/tsqt': _make_attribute_value_state(_no_quote, True, False),
|
1294
|
+
'uqs/dqt': _make_attribute_value_state(_no_quote, False, True),
|
1295
|
+
'uqs/sqt': _make_attribute_value_state(_no_quote, False, False),
|
1296
|
+
|
1297
|
+
# Regular expressions
|
1298
|
+
'tdqr': [
|
1299
|
+
(r'[^\\"]+', String.Regex),
|
1300
|
+
(r'\\"*', String.Regex),
|
1301
|
+
(r'"{3,}', String.Regex, '#pop'),
|
1302
|
+
(r'"', String.Regex)
|
1303
|
+
],
|
1304
|
+
'tsqr': [
|
1305
|
+
(r"[^\\']+", String.Regex),
|
1306
|
+
(r"\\'*", String.Regex),
|
1307
|
+
(r"'{3,}", String.Regex, '#pop'),
|
1308
|
+
(r"'", String.Regex)
|
1309
|
+
],
|
1310
|
+
'dqr': [
|
1311
|
+
(r'[^\\"]+', String.Regex),
|
1312
|
+
(r'\\"?', String.Regex),
|
1313
|
+
(r'"', String.Regex, '#pop')
|
1314
|
+
],
|
1315
|
+
'sqr': [
|
1316
|
+
(r"[^\\']+", String.Regex),
|
1317
|
+
(r"\\'?", String.Regex),
|
1318
|
+
(r"'", String.Regex, '#pop')
|
1319
|
+
]
|
1320
|
+
}
|
1321
|
+
|
1322
|
+
def get_tokens_unprocessed(self, text, **kwargs):
|
1323
|
+
pp = r'^%s*#%s*' % (self._ws_pp, self._ws_pp)
|
1324
|
+
if_false_level = 0
|
1325
|
+
for index, token, value in (
|
1326
|
+
RegexLexer.get_tokens_unprocessed(self, text, **kwargs)):
|
1327
|
+
if if_false_level == 0: # Not in a false #if
|
1328
|
+
if (token is Comment.Preproc and
|
1329
|
+
re.match(r'%sif%s+(0|nil)%s*$\n?' %
|
1330
|
+
(pp, self._ws_pp, self._ws_pp), value)):
|
1331
|
+
if_false_level = 1
|
1332
|
+
else: # In a false #if
|
1333
|
+
if token is Comment.Preproc:
|
1334
|
+
if (if_false_level == 1 and
|
1335
|
+
re.match(r'%sel(if|se)\b' % pp, value)):
|
1336
|
+
if_false_level = 0
|
1337
|
+
elif re.match(r'%sif' % pp, value):
|
1338
|
+
if_false_level += 1
|
1339
|
+
elif re.match(r'%sendif\b' % pp, value):
|
1340
|
+
if_false_level -= 1
|
1341
|
+
else:
|
1342
|
+
token = Comment
|
1343
|
+
yield index, token, value
|