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
@@ -0,0 +1,111 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.verification
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Lexer for Intermediate Verification Languages (IVLs).
|
7
|
+
|
8
|
+
:copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS.
|
9
|
+
:license: BSD, see LICENSE for details.
|
10
|
+
"""
|
11
|
+
|
12
|
+
from pygments.lexer import RegexLexer, include, words
|
13
|
+
from pygments.token import Comment, Operator, Keyword, Name, Number, \
|
14
|
+
Punctuation, Whitespace
|
15
|
+
|
16
|
+
__all__ = ['BoogieLexer', 'SilverLexer']
|
17
|
+
|
18
|
+
|
19
|
+
class BoogieLexer(RegexLexer):
|
20
|
+
"""
|
21
|
+
For `Boogie <https://boogie.codeplex.com/>`_ source code.
|
22
|
+
|
23
|
+
.. versionadded:: 2.1
|
24
|
+
"""
|
25
|
+
name = 'Boogie'
|
26
|
+
aliases = ['boogie']
|
27
|
+
filenames = ['*.bpl']
|
28
|
+
|
29
|
+
tokens = {
|
30
|
+
'root': [
|
31
|
+
# Whitespace and Comments
|
32
|
+
(r'\n', Whitespace),
|
33
|
+
(r'\s+', Whitespace),
|
34
|
+
(r'//[/!](.*?)\n', Comment.Doc),
|
35
|
+
(r'//(.*?)\n', Comment.Single),
|
36
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
37
|
+
|
38
|
+
(words((
|
39
|
+
'axiom', 'break', 'call', 'ensures', 'else', 'exists', 'function',
|
40
|
+
'forall', 'if', 'invariant', 'modifies', 'procedure', 'requires',
|
41
|
+
'then', 'var', 'while'),
|
42
|
+
suffix=r'\b'), Keyword),
|
43
|
+
(words(('const',), suffix=r'\b'), Keyword.Reserved),
|
44
|
+
|
45
|
+
(words(('bool', 'int', 'ref'), suffix=r'\b'), Keyword.Type),
|
46
|
+
include('numbers'),
|
47
|
+
(r"(>=|<=|:=|!=|==>|&&|\|\||[+/\-=>*<\[\]])", Operator),
|
48
|
+
(r"([{}():;,.])", Punctuation),
|
49
|
+
# Identifier
|
50
|
+
(r'[a-zA-Z_]\w*', Name),
|
51
|
+
],
|
52
|
+
'comment': [
|
53
|
+
(r'[^*/]+', Comment.Multiline),
|
54
|
+
(r'/\*', Comment.Multiline, '#push'),
|
55
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
56
|
+
(r'[*/]', Comment.Multiline),
|
57
|
+
],
|
58
|
+
'numbers': [
|
59
|
+
(r'[0-9]+', Number.Integer),
|
60
|
+
],
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
class SilverLexer(RegexLexer):
|
65
|
+
"""
|
66
|
+
For `Silver <https://bitbucket.org/viperproject/silver>`_ source code.
|
67
|
+
|
68
|
+
.. versionadded:: 2.2
|
69
|
+
"""
|
70
|
+
name = 'Silver'
|
71
|
+
aliases = ['silver']
|
72
|
+
filenames = ['*.sil']
|
73
|
+
|
74
|
+
tokens = {
|
75
|
+
'root': [
|
76
|
+
# Whitespace and Comments
|
77
|
+
(r'\n', Whitespace),
|
78
|
+
(r'\s+', Whitespace),
|
79
|
+
(r'//[/!](.*?)\n', Comment.Doc),
|
80
|
+
(r'//(.*?)\n', Comment.Single),
|
81
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
82
|
+
|
83
|
+
(words((
|
84
|
+
'result', 'true', 'false', 'null', 'method', 'function',
|
85
|
+
'predicate', 'program', 'domain', 'axiom', 'var', 'returns',
|
86
|
+
'field', 'define', 'requires', 'ensures', 'invariant',
|
87
|
+
'fold', 'unfold', 'inhale', 'exhale', 'new', 'assert',
|
88
|
+
'assume', 'goto', 'while', 'if', 'elseif', 'else', 'fresh',
|
89
|
+
'constraining', 'Seq', 'Set', 'Multiset', 'union', 'intersection',
|
90
|
+
'setminus', 'subset', 'unfolding', 'in', 'old', 'forall', 'exists',
|
91
|
+
'acc', 'wildcard', 'write', 'none', 'epsilon', 'perm', 'unique',
|
92
|
+
'apply', 'package', 'folding', 'label'),
|
93
|
+
suffix=r'\b'), Keyword),
|
94
|
+
(words(('Int', 'Perm', 'Bool', 'Ref'), suffix=r'\b'), Keyword.Type),
|
95
|
+
include('numbers'),
|
96
|
+
|
97
|
+
(r'[!%&*+=|?:<>/\-\[\]]', Operator),
|
98
|
+
(r'([{}():;,.])', Punctuation),
|
99
|
+
# Identifier
|
100
|
+
(r'[\w$]\w*', Name),
|
101
|
+
],
|
102
|
+
'comment': [
|
103
|
+
(r'[^*/]+', Comment.Multiline),
|
104
|
+
(r'/\*', Comment.Multiline, '#push'),
|
105
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
106
|
+
(r'[*/]', Comment.Multiline),
|
107
|
+
],
|
108
|
+
'numbers': [
|
109
|
+
(r'[0-9]+', Number.Integer),
|
110
|
+
],
|
111
|
+
}
|
@@ -3,4508 +3,22 @@
|
|
3
3
|
pygments.lexers.web
|
4
4
|
~~~~~~~~~~~~~~~~~~~
|
5
5
|
|
6
|
-
|
6
|
+
Just export previously exported lexers.
|
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
|
-
import
|
13
|
-
|
14
|
-
|
15
|
-
from pygments.
|
16
|
-
|
17
|
-
from pygments.
|
18
|
-
|
19
|
-
from pygments.
|
20
|
-
|
21
|
-
from pygments.lexers.
|
22
|
-
from pygments.lexers.compiled import ScalaLexer
|
23
|
-
|
24
|
-
|
25
|
-
__all__ = ['HtmlLexer', 'XmlLexer', 'JavascriptLexer', 'JsonLexer', 'CssLexer',
|
26
|
-
'PhpLexer', 'ActionScriptLexer', 'XsltLexer', 'ActionScript3Lexer',
|
27
|
-
'MxmlLexer', 'HaxeLexer', 'HamlLexer', 'SassLexer', 'ScssLexer',
|
28
|
-
'ObjectiveJLexer', 'CoffeeScriptLexer', 'LiveScriptLexer',
|
29
|
-
'DuelLexer', 'ScamlLexer', 'JadeLexer', 'XQueryLexer',
|
30
|
-
'DtdLexer', 'DartLexer', 'LassoLexer', 'QmlLexer', 'TypeScriptLexer',
|
31
|
-
'KalLexer', 'CirruLexer', 'MaskLexer', 'ZephirLexer', 'SlimLexer']
|
32
|
-
|
33
|
-
|
34
|
-
class JavascriptLexer(RegexLexer):
|
35
|
-
"""
|
36
|
-
For JavaScript source code.
|
37
|
-
"""
|
38
|
-
|
39
|
-
name = 'JavaScript'
|
40
|
-
aliases = ['js', 'javascript']
|
41
|
-
filenames = ['*.js', ]
|
42
|
-
mimetypes = ['application/javascript', 'application/x-javascript',
|
43
|
-
'text/x-javascript', 'text/javascript', ]
|
44
|
-
|
45
|
-
flags = re.DOTALL
|
46
|
-
tokens = {
|
47
|
-
'commentsandwhitespace': [
|
48
|
-
(r'\s+', Text),
|
49
|
-
(r'<!--', Comment),
|
50
|
-
(r'//.*?\n', Comment.Single),
|
51
|
-
(r'/\*.*?\*/', Comment.Multiline)
|
52
|
-
],
|
53
|
-
'slashstartsregex': [
|
54
|
-
include('commentsandwhitespace'),
|
55
|
-
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
56
|
-
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
57
|
-
(r'(?=/)', Text, ('#pop', 'badregex')),
|
58
|
-
default('#pop')
|
59
|
-
],
|
60
|
-
'badregex': [
|
61
|
-
(r'\n', Text, '#pop')
|
62
|
-
],
|
63
|
-
'root': [
|
64
|
-
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
65
|
-
include('commentsandwhitespace'),
|
66
|
-
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
67
|
-
r'(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'),
|
68
|
-
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
69
|
-
(r'[})\].]', Punctuation),
|
70
|
-
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
|
71
|
-
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|yield|'
|
72
|
-
r'this)\b', Keyword, 'slashstartsregex'),
|
73
|
-
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
74
|
-
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
|
75
|
-
r'extends|final|float|goto|implements|import|int|interface|long|native|'
|
76
|
-
r'package|private|protected|public|short|static|super|synchronized|throws|'
|
77
|
-
r'transient|volatile)\b', Keyword.Reserved),
|
78
|
-
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
|
79
|
-
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
80
|
-
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
81
|
-
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
82
|
-
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
83
|
-
r'window)\b', Name.Builtin),
|
84
|
-
(r'[$a-zA-Z_]\w*', Name.Other),
|
85
|
-
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
86
|
-
(r'0x[0-9a-fA-F]+', Number.Hex),
|
87
|
-
(r'[0-9]+', Number.Integer),
|
88
|
-
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
89
|
-
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
90
|
-
]
|
91
|
-
}
|
92
|
-
|
93
|
-
|
94
|
-
class JsonLexer(RegexLexer):
|
95
|
-
"""
|
96
|
-
For JSON data structures.
|
97
|
-
|
98
|
-
.. versionadded:: 1.5
|
99
|
-
"""
|
100
|
-
|
101
|
-
name = 'JSON'
|
102
|
-
aliases = ['json']
|
103
|
-
filenames = ['*.json']
|
104
|
-
mimetypes = [ 'application/json', ]
|
105
|
-
|
106
|
-
# integer part of a number
|
107
|
-
int_part = r'-?(0|[1-9]\d*)'
|
108
|
-
|
109
|
-
# fractional part of a number
|
110
|
-
frac_part = r'\.\d+'
|
111
|
-
|
112
|
-
# exponential part of a number
|
113
|
-
exp_part = r'[eE](\+|-)?\d+'
|
114
|
-
|
115
|
-
|
116
|
-
flags = re.DOTALL
|
117
|
-
tokens = {
|
118
|
-
'whitespace': [
|
119
|
-
(r'\s+', Text),
|
120
|
-
],
|
121
|
-
|
122
|
-
# represents a simple terminal value
|
123
|
-
'simplevalue': [
|
124
|
-
(r'(true|false|null)\b', Keyword.Constant),
|
125
|
-
(('%(int_part)s(%(frac_part)s%(exp_part)s|'
|
126
|
-
'%(exp_part)s|%(frac_part)s)') % vars(),
|
127
|
-
Number.Float),
|
128
|
-
(int_part, Number.Integer),
|
129
|
-
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
130
|
-
],
|
131
|
-
|
132
|
-
|
133
|
-
# the right hand side of an object, after the attribute name
|
134
|
-
'objectattribute': [
|
135
|
-
include('value'),
|
136
|
-
(r':', Punctuation),
|
137
|
-
# comma terminates the attribute but expects more
|
138
|
-
(r',', Punctuation, '#pop'),
|
139
|
-
# a closing bracket terminates the entire object, so pop twice
|
140
|
-
(r'}', Punctuation, ('#pop', '#pop')),
|
141
|
-
],
|
142
|
-
|
143
|
-
# a json object - { attr, attr, ... }
|
144
|
-
'objectvalue': [
|
145
|
-
include('whitespace'),
|
146
|
-
(r'"(\\\\|\\"|[^"])*"', Name.Tag, 'objectattribute'),
|
147
|
-
(r'}', Punctuation, '#pop'),
|
148
|
-
],
|
149
|
-
|
150
|
-
# json array - [ value, value, ... }
|
151
|
-
'arrayvalue': [
|
152
|
-
include('whitespace'),
|
153
|
-
include('value'),
|
154
|
-
(r',', Punctuation),
|
155
|
-
(r']', Punctuation, '#pop'),
|
156
|
-
],
|
157
|
-
|
158
|
-
# a json value - either a simple value or a complex value (object or array)
|
159
|
-
'value': [
|
160
|
-
include('whitespace'),
|
161
|
-
include('simplevalue'),
|
162
|
-
(r'{', Punctuation, 'objectvalue'),
|
163
|
-
(r'\[', Punctuation, 'arrayvalue'),
|
164
|
-
],
|
165
|
-
|
166
|
-
|
167
|
-
# the root of a json document whould be a value
|
168
|
-
'root': [
|
169
|
-
include('value'),
|
170
|
-
],
|
171
|
-
|
172
|
-
}
|
173
|
-
|
12
|
+
from pygments.lexers.html import HtmlLexer, DtdLexer, XmlLexer, XsltLexer, \
|
13
|
+
HamlLexer, ScamlLexer, JadeLexer
|
14
|
+
from pygments.lexers.css import CssLexer, SassLexer, ScssLexer
|
15
|
+
from pygments.lexers.javascript import JavascriptLexer, LiveScriptLexer, \
|
16
|
+
DartLexer, TypeScriptLexer, LassoLexer, ObjectiveJLexer, CoffeeScriptLexer
|
17
|
+
from pygments.lexers.actionscript import ActionScriptLexer, \
|
18
|
+
ActionScript3Lexer, MxmlLexer
|
19
|
+
from pygments.lexers.php import PhpLexer
|
20
|
+
from pygments.lexers.webmisc import DuelLexer, XQueryLexer, SlimLexer, QmlLexer
|
21
|
+
from pygments.lexers.data import JsonLexer
|
174
22
|
JSONLexer = JsonLexer # for backwards compatibility with Pygments 1.5
|
175
23
|
|
176
|
-
|
177
|
-
class ActionScriptLexer(RegexLexer):
|
178
|
-
"""
|
179
|
-
For ActionScript source code.
|
180
|
-
|
181
|
-
.. versionadded:: 0.9
|
182
|
-
"""
|
183
|
-
|
184
|
-
name = 'ActionScript'
|
185
|
-
aliases = ['as', 'actionscript']
|
186
|
-
filenames = ['*.as']
|
187
|
-
mimetypes = ['application/x-actionscript', 'text/x-actionscript',
|
188
|
-
'text/actionscript']
|
189
|
-
|
190
|
-
flags = re.DOTALL
|
191
|
-
tokens = {
|
192
|
-
'root': [
|
193
|
-
(r'\s+', Text),
|
194
|
-
(r'//.*?\n', Comment.Single),
|
195
|
-
(r'/\*.*?\*/', Comment.Multiline),
|
196
|
-
(r'/(\\\\|\\/|[^/\n])*/[gim]*', String.Regex),
|
197
|
-
(r'[~\^\*!%&<>\|+=:;,/?\\-]+', Operator),
|
198
|
-
(r'[{}\[\]();.]+', Punctuation),
|
199
|
-
(r'(case|default|for|each|in|while|do|break|return|continue|if|else|'
|
200
|
-
r'throw|try|catch|var|with|new|typeof|arguments|instanceof|this|'
|
201
|
-
r'switch)\b', Keyword),
|
202
|
-
(r'(class|public|final|internal|native|override|private|protected|'
|
203
|
-
r'static|import|extends|implements|interface|intrinsic|return|super|'
|
204
|
-
r'dynamic|function|const|get|namespace|package|set)\b',
|
205
|
-
Keyword.Declaration),
|
206
|
-
(r'(true|false|null|NaN|Infinity|-Infinity|undefined|Void)\b',
|
207
|
-
Keyword.Constant),
|
208
|
-
(r'(Accessibility|AccessibilityProperties|ActionScriptVersion|'
|
209
|
-
r'ActivityEvent|AntiAliasType|ApplicationDomain|AsBroadcaster|Array|'
|
210
|
-
r'AsyncErrorEvent|AVM1Movie|BevelFilter|Bitmap|BitmapData|'
|
211
|
-
r'BitmapDataChannel|BitmapFilter|BitmapFilterQuality|BitmapFilterType|'
|
212
|
-
r'BlendMode|BlurFilter|Boolean|ByteArray|Camera|Capabilities|CapsStyle|'
|
213
|
-
r'Class|Color|ColorMatrixFilter|ColorTransform|ContextMenu|'
|
214
|
-
r'ContextMenuBuiltInItems|ContextMenuEvent|ContextMenuItem|'
|
215
|
-
r'ConvultionFilter|CSMSettings|DataEvent|Date|DefinitionError|'
|
216
|
-
r'DeleteObjectSample|Dictionary|DisplacmentMapFilter|DisplayObject|'
|
217
|
-
r'DisplacmentMapFilterMode|DisplayObjectContainer|DropShadowFilter|'
|
218
|
-
r'Endian|EOFError|Error|ErrorEvent|EvalError|Event|EventDispatcher|'
|
219
|
-
r'EventPhase|ExternalInterface|FileFilter|FileReference|'
|
220
|
-
r'FileReferenceList|FocusDirection|FocusEvent|Font|FontStyle|FontType|'
|
221
|
-
r'FrameLabel|FullScreenEvent|Function|GlowFilter|GradientBevelFilter|'
|
222
|
-
r'GradientGlowFilter|GradientType|Graphics|GridFitType|HTTPStatusEvent|'
|
223
|
-
r'IBitmapDrawable|ID3Info|IDataInput|IDataOutput|IDynamicPropertyOutput'
|
224
|
-
r'IDynamicPropertyWriter|IEventDispatcher|IExternalizable|'
|
225
|
-
r'IllegalOperationError|IME|IMEConversionMode|IMEEvent|int|'
|
226
|
-
r'InteractiveObject|InterpolationMethod|InvalidSWFError|InvokeEvent|'
|
227
|
-
r'IOError|IOErrorEvent|JointStyle|Key|Keyboard|KeyboardEvent|KeyLocation|'
|
228
|
-
r'LineScaleMode|Loader|LoaderContext|LoaderInfo|LoadVars|LocalConnection|'
|
229
|
-
r'Locale|Math|Matrix|MemoryError|Microphone|MorphShape|Mouse|MouseEvent|'
|
230
|
-
r'MovieClip|MovieClipLoader|Namespace|NetConnection|NetStatusEvent|'
|
231
|
-
r'NetStream|NewObjectSample|Number|Object|ObjectEncoding|PixelSnapping|'
|
232
|
-
r'Point|PrintJob|PrintJobOptions|PrintJobOrientation|ProgressEvent|Proxy|'
|
233
|
-
r'QName|RangeError|Rectangle|ReferenceError|RegExp|Responder|Sample|Scene|'
|
234
|
-
r'ScriptTimeoutError|Security|SecurityDomain|SecurityError|'
|
235
|
-
r'SecurityErrorEvent|SecurityPanel|Selection|Shape|SharedObject|'
|
236
|
-
r'SharedObjectFlushStatus|SimpleButton|Socket|Sound|SoundChannel|'
|
237
|
-
r'SoundLoaderContext|SoundMixer|SoundTransform|SpreadMethod|Sprite|'
|
238
|
-
r'StackFrame|StackOverflowError|Stage|StageAlign|StageDisplayState|'
|
239
|
-
r'StageQuality|StageScaleMode|StaticText|StatusEvent|String|StyleSheet|'
|
240
|
-
r'SWFVersion|SyncEvent|SyntaxError|System|TextColorType|TextField|'
|
241
|
-
r'TextFieldAutoSize|TextFieldType|TextFormat|TextFormatAlign|'
|
242
|
-
r'TextLineMetrics|TextRenderer|TextSnapshot|Timer|TimerEvent|Transform|'
|
243
|
-
r'TypeError|uint|URIError|URLLoader|URLLoaderDataFormat|URLRequest|'
|
244
|
-
r'URLRequestHeader|URLRequestMethod|URLStream|URLVariabeles|VerifyError|'
|
245
|
-
r'Video|XML|XMLDocument|XMLList|XMLNode|XMLNodeType|XMLSocket|XMLUI)\b',
|
246
|
-
Name.Builtin),
|
247
|
-
(r'(decodeURI|decodeURIComponent|encodeURI|escape|eval|isFinite|isNaN|'
|
248
|
-
r'isXMLName|clearInterval|fscommand|getTimer|getURL|getVersion|'
|
249
|
-
r'isFinite|parseFloat|parseInt|setInterval|trace|updateAfterEvent|'
|
250
|
-
r'unescape)\b',Name.Function),
|
251
|
-
(r'[$a-zA-Z_]\w*', Name.Other),
|
252
|
-
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
253
|
-
(r'0x[0-9a-f]+', Number.Hex),
|
254
|
-
(r'[0-9]+', Number.Integer),
|
255
|
-
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
256
|
-
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
257
|
-
]
|
258
|
-
}
|
259
|
-
|
260
|
-
|
261
|
-
class ActionScript3Lexer(RegexLexer):
|
262
|
-
"""
|
263
|
-
For ActionScript 3 source code.
|
264
|
-
|
265
|
-
.. versionadded:: 0.11
|
266
|
-
"""
|
267
|
-
|
268
|
-
name = 'ActionScript 3'
|
269
|
-
aliases = ['as3', 'actionscript3']
|
270
|
-
filenames = ['*.as']
|
271
|
-
mimetypes = ['application/x-actionscript3', 'text/x-actionscript3',
|
272
|
-
'text/actionscript3']
|
273
|
-
|
274
|
-
identifier = r'[$a-zA-Z_]\w*'
|
275
|
-
typeidentifier = identifier + '(?:\.<\w+>)?'
|
276
|
-
|
277
|
-
flags = re.DOTALL | re.MULTILINE
|
278
|
-
tokens = {
|
279
|
-
'root': [
|
280
|
-
(r'\s+', Text),
|
281
|
-
(r'(function\s+)(' + identifier + r')(\s*)(\()',
|
282
|
-
bygroups(Keyword.Declaration, Name.Function, Text, Operator),
|
283
|
-
'funcparams'),
|
284
|
-
(r'(var|const)(\s+)(' + identifier + r')(\s*)(:)(\s*)(' +
|
285
|
-
typeidentifier + r')',
|
286
|
-
bygroups(Keyword.Declaration, Text, Name, Text, Punctuation, Text,
|
287
|
-
Keyword.Type)),
|
288
|
-
(r'(import|package)(\s+)((?:' + identifier + r'|\.)+)(\s*)',
|
289
|
-
bygroups(Keyword, Text, Name.Namespace, Text)),
|
290
|
-
(r'(new)(\s+)(' + typeidentifier + r')(\s*)(\()',
|
291
|
-
bygroups(Keyword, Text, Keyword.Type, Text, Operator)),
|
292
|
-
(r'//.*?\n', Comment.Single),
|
293
|
-
(r'/\*.*?\*/', Comment.Multiline),
|
294
|
-
(r'/(\\\\|\\/|[^\n])*/[gisx]*', String.Regex),
|
295
|
-
(r'(\.)(' + identifier + r')', bygroups(Operator, Name.Attribute)),
|
296
|
-
(r'(case|default|for|each|in|while|do|break|return|continue|if|else|'
|
297
|
-
r'throw|try|catch|with|new|typeof|arguments|instanceof|this|'
|
298
|
-
r'switch|import|include|as|is)\b',
|
299
|
-
Keyword),
|
300
|
-
(r'(class|public|final|internal|native|override|private|protected|'
|
301
|
-
r'static|import|extends|implements|interface|intrinsic|return|super|'
|
302
|
-
r'dynamic|function|const|get|namespace|package|set)\b',
|
303
|
-
Keyword.Declaration),
|
304
|
-
(r'(true|false|null|NaN|Infinity|-Infinity|undefined|void)\b',
|
305
|
-
Keyword.Constant),
|
306
|
-
(r'(decodeURI|decodeURIComponent|encodeURI|escape|eval|isFinite|isNaN|'
|
307
|
-
r'isXMLName|clearInterval|fscommand|getTimer|getURL|getVersion|'
|
308
|
-
r'isFinite|parseFloat|parseInt|setInterval|trace|updateAfterEvent|'
|
309
|
-
r'unescape)\b', Name.Function),
|
310
|
-
(identifier, Name),
|
311
|
-
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
312
|
-
(r'0x[0-9a-f]+', Number.Hex),
|
313
|
-
(r'[0-9]+', Number.Integer),
|
314
|
-
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
315
|
-
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
316
|
-
(r'[~\^\*!%&<>\|+=:;,/?\\{}\[\]().-]+', Operator),
|
317
|
-
],
|
318
|
-
'funcparams': [
|
319
|
-
(r'\s+', Text),
|
320
|
-
(r'(\s*)(\.\.\.)?(' + identifier + r')(\s*)(:)(\s*)(' +
|
321
|
-
typeidentifier + r'|\*)(\s*)',
|
322
|
-
bygroups(Text, Punctuation, Name, Text, Operator, Text,
|
323
|
-
Keyword.Type, Text), 'defval'),
|
324
|
-
(r'\)', Operator, 'type')
|
325
|
-
],
|
326
|
-
'type': [
|
327
|
-
(r'(\s*)(:)(\s*)(' + typeidentifier + r'|\*)',
|
328
|
-
bygroups(Text, Operator, Text, Keyword.Type), '#pop:2'),
|
329
|
-
(r'\s*', Text, '#pop:2')
|
330
|
-
],
|
331
|
-
'defval': [
|
332
|
-
(r'(=)(\s*)([^(),]+)(\s*)(,?)',
|
333
|
-
bygroups(Operator, Text, using(this), Text, Operator), '#pop'),
|
334
|
-
(r',?', Operator, '#pop')
|
335
|
-
]
|
336
|
-
}
|
337
|
-
|
338
|
-
def analyse_text(text):
|
339
|
-
if re.match(r'\w+\s*:\s*\w', text):
|
340
|
-
return 0.3
|
341
|
-
return 0
|
342
|
-
|
343
|
-
|
344
|
-
class CssLexer(RegexLexer):
|
345
|
-
"""
|
346
|
-
For CSS (Cascading Style Sheets).
|
347
|
-
"""
|
348
|
-
|
349
|
-
name = 'CSS'
|
350
|
-
aliases = ['css']
|
351
|
-
filenames = ['*.css']
|
352
|
-
mimetypes = ['text/css']
|
353
|
-
|
354
|
-
tokens = {
|
355
|
-
'root': [
|
356
|
-
include('basics'),
|
357
|
-
],
|
358
|
-
'basics': [
|
359
|
-
(r'\s+', Text),
|
360
|
-
(r'/\*(?:.|\n)*?\*/', Comment),
|
361
|
-
(r'{', Punctuation, 'content'),
|
362
|
-
(r'\:[\w-]+', Name.Decorator),
|
363
|
-
(r'\.[\w-]+', Name.Class),
|
364
|
-
(r'\#[\w-]+', Name.Function),
|
365
|
-
(r'@[\w-]+', Keyword, 'atrule'),
|
366
|
-
(r'[\w-]+', Name.Tag),
|
367
|
-
(r'[~\^\*!%&$\[\]\(\)<>\|+=@:;,./?-]', Operator),
|
368
|
-
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
369
|
-
(r"'(\\\\|\\'|[^'])*'", String.Single)
|
370
|
-
],
|
371
|
-
'atrule': [
|
372
|
-
(r'{', Punctuation, 'atcontent'),
|
373
|
-
(r';', Punctuation, '#pop'),
|
374
|
-
include('basics'),
|
375
|
-
],
|
376
|
-
'atcontent': [
|
377
|
-
include('basics'),
|
378
|
-
(r'}', Punctuation, '#pop:2'),
|
379
|
-
],
|
380
|
-
'content': [
|
381
|
-
(r'\s+', Text),
|
382
|
-
(r'}', Punctuation, '#pop'),
|
383
|
-
(r'url\(.*?\)', String.Other),
|
384
|
-
(r'^@.*?$', Comment.Preproc),
|
385
|
-
(r'(azimuth|background-attachment|background-color|'
|
386
|
-
r'background-image|background-position|background-repeat|'
|
387
|
-
r'background|border-bottom-color|border-bottom-style|'
|
388
|
-
r'border-bottom-width|border-left-color|border-left-style|'
|
389
|
-
r'border-left-width|border-right|border-right-color|'
|
390
|
-
r'border-right-style|border-right-width|border-top-color|'
|
391
|
-
r'border-top-style|border-top-width|border-bottom|'
|
392
|
-
r'border-collapse|border-left|border-width|border-color|'
|
393
|
-
r'border-spacing|border-style|border-top|border|caption-side|'
|
394
|
-
r'clear|clip|color|content|counter-increment|counter-reset|'
|
395
|
-
r'cue-after|cue-before|cue|cursor|direction|display|'
|
396
|
-
r'elevation|empty-cells|float|font-family|font-size|'
|
397
|
-
r'font-size-adjust|font-stretch|font-style|font-variant|'
|
398
|
-
r'font-weight|font|height|letter-spacing|line-height|'
|
399
|
-
r'list-style-type|list-style-image|list-style-position|'
|
400
|
-
r'list-style|margin-bottom|margin-left|margin-right|'
|
401
|
-
r'margin-top|margin|marker-offset|marks|max-height|max-width|'
|
402
|
-
r'min-height|min-width|opacity|orphans|outline-color|'
|
403
|
-
r'outline-style|outline-width|outline|overflow(?:-x|-y)?|padding-bottom|'
|
404
|
-
r'padding-left|padding-right|padding-top|padding|page|'
|
405
|
-
r'page-break-after|page-break-before|page-break-inside|'
|
406
|
-
r'pause-after|pause-before|pause|pitch-range|pitch|'
|
407
|
-
r'play-during|position|quotes|richness|right|size|'
|
408
|
-
r'speak-header|speak-numeral|speak-punctuation|speak|'
|
409
|
-
r'speech-rate|stress|table-layout|text-align|text-decoration|'
|
410
|
-
r'text-indent|text-shadow|text-transform|top|unicode-bidi|'
|
411
|
-
r'vertical-align|visibility|voice-family|volume|white-space|'
|
412
|
-
r'widows|width|word-spacing|z-index|bottom|'
|
413
|
-
r'above|absolute|always|armenian|aural|auto|avoid|baseline|'
|
414
|
-
r'behind|below|bidi-override|blink|block|bolder|bold|both|'
|
415
|
-
r'capitalize|center-left|center-right|center|circle|'
|
416
|
-
r'cjk-ideographic|close-quote|collapse|condensed|continuous|'
|
417
|
-
r'crop|crosshair|cross|cursive|dashed|decimal-leading-zero|'
|
418
|
-
r'decimal|default|digits|disc|dotted|double|e-resize|embed|'
|
419
|
-
r'extra-condensed|extra-expanded|expanded|fantasy|far-left|'
|
420
|
-
r'far-right|faster|fast|fixed|georgian|groove|hebrew|help|'
|
421
|
-
r'hidden|hide|higher|high|hiragana-iroha|hiragana|icon|'
|
422
|
-
r'inherit|inline-table|inline|inset|inside|invert|italic|'
|
423
|
-
r'justify|katakana-iroha|katakana|landscape|larger|large|'
|
424
|
-
r'left-side|leftwards|left|level|lighter|line-through|list-item|'
|
425
|
-
r'loud|lower-alpha|lower-greek|lower-roman|lowercase|ltr|'
|
426
|
-
r'lower|low|medium|message-box|middle|mix|monospace|'
|
427
|
-
r'n-resize|narrower|ne-resize|no-close-quote|no-open-quote|'
|
428
|
-
r'no-repeat|none|normal|nowrap|nw-resize|oblique|once|'
|
429
|
-
r'open-quote|outset|outside|overline|pointer|portrait|px|'
|
430
|
-
r'relative|repeat-x|repeat-y|repeat|rgb|ridge|right-side|'
|
431
|
-
r'rightwards|s-resize|sans-serif|scroll|se-resize|'
|
432
|
-
r'semi-condensed|semi-expanded|separate|serif|show|silent|'
|
433
|
-
r'slower|slow|small-caps|small-caption|smaller|soft|solid|'
|
434
|
-
r'spell-out|square|static|status-bar|super|sw-resize|'
|
435
|
-
r'table-caption|table-cell|table-column|table-column-group|'
|
436
|
-
r'table-footer-group|table-header-group|table-row|'
|
437
|
-
r'table-row-group|text-bottom|text-top|text|thick|thin|'
|
438
|
-
r'transparent|ultra-condensed|ultra-expanded|underline|'
|
439
|
-
r'upper-alpha|upper-latin|upper-roman|uppercase|url|'
|
440
|
-
r'visible|w-resize|wait|wider|x-fast|x-high|x-large|x-loud|'
|
441
|
-
r'x-low|x-small|x-soft|xx-large|xx-small|yes)\b', Keyword),
|
442
|
-
(r'(indigo|gold|firebrick|indianred|yellow|darkolivegreen|'
|
443
|
-
r'darkseagreen|mediumvioletred|mediumorchid|chartreuse|'
|
444
|
-
r'mediumslateblue|black|springgreen|crimson|lightsalmon|brown|'
|
445
|
-
r'turquoise|olivedrab|cyan|silver|skyblue|gray|darkturquoise|'
|
446
|
-
r'goldenrod|darkgreen|darkviolet|darkgray|lightpink|teal|'
|
447
|
-
r'darkmagenta|lightgoldenrodyellow|lavender|yellowgreen|thistle|'
|
448
|
-
r'violet|navy|orchid|blue|ghostwhite|honeydew|cornflowerblue|'
|
449
|
-
r'darkblue|darkkhaki|mediumpurple|cornsilk|red|bisque|slategray|'
|
450
|
-
r'darkcyan|khaki|wheat|deepskyblue|darkred|steelblue|aliceblue|'
|
451
|
-
r'gainsboro|mediumturquoise|floralwhite|coral|purple|lightgrey|'
|
452
|
-
r'lightcyan|darksalmon|beige|azure|lightsteelblue|oldlace|'
|
453
|
-
r'greenyellow|royalblue|lightseagreen|mistyrose|sienna|'
|
454
|
-
r'lightcoral|orangered|navajowhite|lime|palegreen|burlywood|'
|
455
|
-
r'seashell|mediumspringgreen|fuchsia|papayawhip|blanchedalmond|'
|
456
|
-
r'peru|aquamarine|white|darkslategray|ivory|dodgerblue|'
|
457
|
-
r'lemonchiffon|chocolate|orange|forestgreen|slateblue|olive|'
|
458
|
-
r'mintcream|antiquewhite|darkorange|cadetblue|moccasin|'
|
459
|
-
r'limegreen|saddlebrown|darkslateblue|lightskyblue|deeppink|'
|
460
|
-
r'plum|aqua|darkgoldenrod|maroon|sandybrown|magenta|tan|'
|
461
|
-
r'rosybrown|pink|lightblue|palevioletred|mediumseagreen|'
|
462
|
-
r'dimgray|powderblue|seagreen|snow|mediumblue|midnightblue|'
|
463
|
-
r'paleturquoise|palegoldenrod|whitesmoke|darkorchid|salmon|'
|
464
|
-
r'lightslategray|lawngreen|lightgreen|tomato|hotpink|'
|
465
|
-
r'lightyellow|lavenderblush|linen|mediumaquamarine|green|'
|
466
|
-
r'blueviolet|peachpuff)\b', Name.Builtin),
|
467
|
-
(r'\!important', Comment.Preproc),
|
468
|
-
(r'/\*(?:.|\n)*?\*/', Comment),
|
469
|
-
(r'\#[a-zA-Z0-9]{1,6}', Number),
|
470
|
-
(r'[\.-]?[0-9]*[\.]?[0-9]+(em|px|pt|pc|in|mm|cm|ex|s)\b', Number),
|
471
|
-
# Separate regex for percentages, as can't do word boundaries with %
|
472
|
-
(r'[\.-]?[0-9]*[\.]?[0-9]+%', Number),
|
473
|
-
(r'-?[0-9]+', Number),
|
474
|
-
(r'[~\^\*!%&<>\|+=@:,./?-]+', Operator),
|
475
|
-
(r'[\[\]();]+', Punctuation),
|
476
|
-
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
477
|
-
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
478
|
-
(r'[a-zA-Z_]\w*', Name)
|
479
|
-
]
|
480
|
-
}
|
481
|
-
|
482
|
-
|
483
|
-
class ObjectiveJLexer(RegexLexer):
|
484
|
-
"""
|
485
|
-
For Objective-J source code with preprocessor directives.
|
486
|
-
|
487
|
-
.. versionadded:: 1.3
|
488
|
-
"""
|
489
|
-
|
490
|
-
name = 'Objective-J'
|
491
|
-
aliases = ['objective-j', 'objectivej', 'obj-j', 'objj']
|
492
|
-
filenames = ['*.j']
|
493
|
-
mimetypes = ['text/x-objective-j']
|
494
|
-
|
495
|
-
#: optional Comment or Whitespace
|
496
|
-
_ws = r'(?:\s|//.*?\n|/[*].*?[*]/)*'
|
497
|
-
|
498
|
-
flags = re.DOTALL | re.MULTILINE
|
499
|
-
|
500
|
-
tokens = {
|
501
|
-
'root': [
|
502
|
-
include('whitespace'),
|
503
|
-
|
504
|
-
# function definition
|
505
|
-
(r'^(' + _ws + r'[\+-]' + _ws + r')([\(a-zA-Z_].*?[^\(])(' + _ws + '{)',
|
506
|
-
bygroups(using(this), using(this, state='function_signature'),
|
507
|
-
using(this))),
|
508
|
-
|
509
|
-
# class definition
|
510
|
-
(r'(@interface|@implementation)(\s+)', bygroups(Keyword, Text),
|
511
|
-
'classname'),
|
512
|
-
(r'(@class|@protocol)(\s*)', bygroups(Keyword, Text),
|
513
|
-
'forward_classname'),
|
514
|
-
(r'(\s*)(@end)(\s*)', bygroups(Text, Keyword, Text)),
|
515
|
-
|
516
|
-
include('statements'),
|
517
|
-
('[{\(\)}]', Punctuation),
|
518
|
-
(';', Punctuation),
|
519
|
-
],
|
520
|
-
'whitespace': [
|
521
|
-
(r'(@import)(\s+)("(?:\\\\|\\"|[^"])*")',
|
522
|
-
bygroups(Comment.Preproc, Text, String.Double)),
|
523
|
-
(r'(@import)(\s+)(<(?:\\\\|\\>|[^>])*>)',
|
524
|
-
bygroups(Comment.Preproc, Text, String.Double)),
|
525
|
-
(r'(#(?:include|import))(\s+)("(?:\\\\|\\"|[^"])*")',
|
526
|
-
bygroups(Comment.Preproc, Text, String.Double)),
|
527
|
-
(r'(#(?:include|import))(\s+)(<(?:\\\\|\\>|[^>])*>)',
|
528
|
-
bygroups(Comment.Preproc, Text, String.Double)),
|
529
|
-
|
530
|
-
(r'#if\s+0', Comment.Preproc, 'if0'),
|
531
|
-
(r'#', Comment.Preproc, 'macro'),
|
532
|
-
|
533
|
-
(r'\n', Text),
|
534
|
-
(r'\s+', Text),
|
535
|
-
(r'\\\n', Text), # line continuation
|
536
|
-
(r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
537
|
-
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
538
|
-
(r'<!--', Comment),
|
539
|
-
],
|
540
|
-
'slashstartsregex': [
|
541
|
-
include('whitespace'),
|
542
|
-
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
543
|
-
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
544
|
-
(r'(?=/)', Text, ('#pop', 'badregex')),
|
545
|
-
default('#pop'),
|
546
|
-
],
|
547
|
-
'badregex': [
|
548
|
-
(r'\n', Text, '#pop'),
|
549
|
-
],
|
550
|
-
'statements': [
|
551
|
-
(r'(L|@)?"', String, 'string'),
|
552
|
-
(r"(L|@)?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",
|
553
|
-
String.Char),
|
554
|
-
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
555
|
-
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
556
|
-
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
|
557
|
-
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
558
|
-
(r'0x[0-9a-fA-F]+[Ll]?', Number.Hex),
|
559
|
-
(r'0[0-7]+[Ll]?', Number.Oct),
|
560
|
-
(r'\d+[Ll]?', Number.Integer),
|
561
|
-
|
562
|
-
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
563
|
-
|
564
|
-
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
565
|
-
r'(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?',
|
566
|
-
Operator, 'slashstartsregex'),
|
567
|
-
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
568
|
-
(r'[})\].]', Punctuation),
|
569
|
-
|
570
|
-
(r'(for|in|while|do|break|return|continue|switch|case|default|if|'
|
571
|
-
r'else|throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
572
|
-
r'prototype|__proto__)\b', Keyword, 'slashstartsregex'),
|
573
|
-
|
574
|
-
(r'(var|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
575
|
-
|
576
|
-
(r'(@selector|@private|@protected|@public|@encode|'
|
577
|
-
r'@synchronized|@try|@throw|@catch|@finally|@end|@property|'
|
578
|
-
r'@synthesize|@dynamic|@for|@accessors|new)\b', Keyword),
|
579
|
-
|
580
|
-
(r'(int|long|float|short|double|char|unsigned|signed|void|'
|
581
|
-
r'id|BOOL|bool|boolean|IBOutlet|IBAction|SEL|@outlet|@action)\b',
|
582
|
-
Keyword.Type),
|
583
|
-
|
584
|
-
(r'(self|super)\b', Name.Builtin),
|
585
|
-
|
586
|
-
(r'(TRUE|YES|FALSE|NO|Nil|nil|NULL)\b', Keyword.Constant),
|
587
|
-
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
|
588
|
-
(r'(ABS|ASIN|ACOS|ATAN|ATAN2|SIN|COS|TAN|EXP|POW|CEIL|FLOOR|ROUND|'
|
589
|
-
r'MIN|MAX|RAND|SQRT|E|LN2|LN10|LOG2E|LOG10E|PI|PI2|PI_2|SQRT1_2|'
|
590
|
-
r'SQRT2)\b', Keyword.Constant),
|
591
|
-
|
592
|
-
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
593
|
-
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
594
|
-
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
595
|
-
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
596
|
-
r'window)\b', Name.Builtin),
|
597
|
-
|
598
|
-
(r'([$a-zA-Z_]\w*)(' + _ws + r')(?=\()',
|
599
|
-
bygroups(Name.Function, using(this))),
|
600
|
-
|
601
|
-
(r'[$a-zA-Z_]\w*', Name),
|
602
|
-
],
|
603
|
-
'classname' : [
|
604
|
-
# interface definition that inherits
|
605
|
-
(r'([a-zA-Z_]\w*)(' + _ws + r':' + _ws +
|
606
|
-
r')([a-zA-Z_]\w*)?',
|
607
|
-
bygroups(Name.Class, using(this), Name.Class), '#pop'),
|
608
|
-
# interface definition for a category
|
609
|
-
(r'([a-zA-Z_]\w*)(' + _ws + r'\()([a-zA-Z_]\w*)(\))',
|
610
|
-
bygroups(Name.Class, using(this), Name.Label, Text), '#pop'),
|
611
|
-
# simple interface / implementation
|
612
|
-
(r'([a-zA-Z_]\w*)', Name.Class, '#pop'),
|
613
|
-
],
|
614
|
-
'forward_classname' : [
|
615
|
-
(r'([a-zA-Z_]\w*)(\s*,\s*)',
|
616
|
-
bygroups(Name.Class, Text), '#push'),
|
617
|
-
(r'([a-zA-Z_]\w*)(\s*;?)',
|
618
|
-
bygroups(Name.Class, Text), '#pop'),
|
619
|
-
],
|
620
|
-
'function_signature': [
|
621
|
-
include('whitespace'),
|
622
|
-
|
623
|
-
# start of a selector w/ parameters
|
624
|
-
(r'(\(' + _ws + r')' # open paren
|
625
|
-
r'([a-zA-Z_]\w+)' # return type
|
626
|
-
r'(' + _ws + r'\)' + _ws + r')' # close paren
|
627
|
-
r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
|
628
|
-
bygroups(using(this), Keyword.Type, using(this),
|
629
|
-
Name.Function), 'function_parameters'),
|
630
|
-
|
631
|
-
# no-param function
|
632
|
-
(r'(\(' + _ws + r')' # open paren
|
633
|
-
r'([a-zA-Z_]\w+)' # return type
|
634
|
-
r'(' + _ws + r'\)' + _ws + r')' # close paren
|
635
|
-
r'([$a-zA-Z_]\w+)', # function name
|
636
|
-
bygroups(using(this), Keyword.Type, using(this),
|
637
|
-
Name.Function), "#pop"),
|
638
|
-
|
639
|
-
# no return type given, start of a selector w/ parameters
|
640
|
-
(r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
|
641
|
-
bygroups (Name.Function), 'function_parameters'),
|
642
|
-
|
643
|
-
# no return type given, no-param function
|
644
|
-
(r'([$a-zA-Z_]\w+)', # function name
|
645
|
-
bygroups(Name.Function), "#pop"),
|
646
|
-
|
647
|
-
('', Text, '#pop'),
|
648
|
-
],
|
649
|
-
'function_parameters': [
|
650
|
-
include('whitespace'),
|
651
|
-
|
652
|
-
# parameters
|
653
|
-
(r'(\(' + _ws + ')' # open paren
|
654
|
-
r'([^\)]+)' # type
|
655
|
-
r'(' + _ws + r'\)' + _ws + r')' # close paren
|
656
|
-
r'([$a-zA-Z_]\w+)', # param name
|
657
|
-
bygroups(using(this), Keyword.Type, using(this), Text)),
|
658
|
-
|
659
|
-
# one piece of a selector name
|
660
|
-
(r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
|
661
|
-
Name.Function),
|
662
|
-
|
663
|
-
# smallest possible selector piece
|
664
|
-
(r'(:)', Name.Function),
|
665
|
-
|
666
|
-
# var args
|
667
|
-
(r'(,' + _ws + r'\.\.\.)', using(this)),
|
668
|
-
|
669
|
-
# param name
|
670
|
-
(r'([$a-zA-Z_]\w+)', Text),
|
671
|
-
],
|
672
|
-
'expression' : [
|
673
|
-
(r'([$a-zA-Z_]\w*)(\()', bygroups(Name.Function,
|
674
|
-
Punctuation)),
|
675
|
-
(r'(\))', Punctuation, "#pop"),
|
676
|
-
],
|
677
|
-
'string': [
|
678
|
-
(r'"', String, '#pop'),
|
679
|
-
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
680
|
-
(r'[^\\"\n]+', String), # all other characters
|
681
|
-
(r'\\\n', String), # line continuation
|
682
|
-
(r'\\', String), # stray backslash
|
683
|
-
],
|
684
|
-
'macro': [
|
685
|
-
(r'[^/\n]+', Comment.Preproc),
|
686
|
-
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
|
687
|
-
(r'//.*?\n', Comment.Single, '#pop'),
|
688
|
-
(r'/', Comment.Preproc),
|
689
|
-
(r'(?<=\\)\n', Comment.Preproc),
|
690
|
-
(r'\n', Comment.Preproc, '#pop'),
|
691
|
-
],
|
692
|
-
'if0': [
|
693
|
-
(r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
|
694
|
-
(r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
|
695
|
-
(r'.*?\n', Comment),
|
696
|
-
]
|
697
|
-
}
|
698
|
-
|
699
|
-
def analyse_text(text):
|
700
|
-
if re.search('^\s*@import\s+[<"]', text, re.MULTILINE):
|
701
|
-
# special directive found in most Objective-J files
|
702
|
-
return True
|
703
|
-
return False
|
704
|
-
|
705
|
-
|
706
|
-
class HtmlLexer(RegexLexer):
|
707
|
-
"""
|
708
|
-
For HTML 4 and XHTML 1 markup. Nested JavaScript and CSS is highlighted
|
709
|
-
by the appropriate lexer.
|
710
|
-
"""
|
711
|
-
|
712
|
-
name = 'HTML'
|
713
|
-
aliases = ['html']
|
714
|
-
filenames = ['*.html', '*.htm', '*.xhtml', '*.xslt']
|
715
|
-
mimetypes = ['text/html', 'application/xhtml+xml']
|
716
|
-
|
717
|
-
flags = re.IGNORECASE | re.DOTALL
|
718
|
-
tokens = {
|
719
|
-
'root': [
|
720
|
-
('[^<&]+', Text),
|
721
|
-
(r'&\S*?;', Name.Entity),
|
722
|
-
(r'\<\!\[CDATA\[.*?\]\]\>', Comment.Preproc),
|
723
|
-
('<!--', Comment, 'comment'),
|
724
|
-
(r'<\?.*?\?>', Comment.Preproc),
|
725
|
-
('<![^>]*>', Comment.Preproc),
|
726
|
-
(r'<\s*script\s*', Name.Tag, ('script-content', 'tag')),
|
727
|
-
(r'<\s*style\s*', Name.Tag, ('style-content', 'tag')),
|
728
|
-
# note: this allows tag names not used in HTML like <x:with-dash>,
|
729
|
-
# this is to support yet-unknown template engines and the like
|
730
|
-
(r'<\s*[\w:.-]+', Name.Tag, 'tag'),
|
731
|
-
(r'<\s*/\s*[\w:.-]+\s*>', Name.Tag),
|
732
|
-
],
|
733
|
-
'comment': [
|
734
|
-
('[^-]+', Comment),
|
735
|
-
('-->', Comment, '#pop'),
|
736
|
-
('-', Comment),
|
737
|
-
],
|
738
|
-
'tag': [
|
739
|
-
(r'\s+', Text),
|
740
|
-
(r'[\w:-]+\s*=', Name.Attribute, 'attr'),
|
741
|
-
(r'[\w:-]+', Name.Attribute),
|
742
|
-
(r'/?\s*>', Name.Tag, '#pop'),
|
743
|
-
],
|
744
|
-
'script-content': [
|
745
|
-
(r'<\s*/\s*script\s*>', Name.Tag, '#pop'),
|
746
|
-
(r'.+?(?=<\s*/\s*script\s*>)', using(JavascriptLexer)),
|
747
|
-
],
|
748
|
-
'style-content': [
|
749
|
-
(r'<\s*/\s*style\s*>', Name.Tag, '#pop'),
|
750
|
-
(r'.+?(?=<\s*/\s*style\s*>)', using(CssLexer)),
|
751
|
-
],
|
752
|
-
'attr': [
|
753
|
-
('".*?"', String, '#pop'),
|
754
|
-
("'.*?'", String, '#pop'),
|
755
|
-
(r'[^\s>]+', String, '#pop'),
|
756
|
-
],
|
757
|
-
}
|
758
|
-
|
759
|
-
def analyse_text(text):
|
760
|
-
if html_doctype_matches(text):
|
761
|
-
return 0.5
|
762
|
-
|
763
|
-
|
764
|
-
class PhpLexer(RegexLexer):
|
765
|
-
"""
|
766
|
-
For `PHP <http://www.php.net/>`_ source code.
|
767
|
-
For PHP embedded in HTML, use the `HtmlPhpLexer`.
|
768
|
-
|
769
|
-
Additional options accepted:
|
770
|
-
|
771
|
-
`startinline`
|
772
|
-
If given and ``True`` the lexer starts highlighting with
|
773
|
-
php code (i.e.: no starting ``<?php`` required). The default
|
774
|
-
is ``False``.
|
775
|
-
`funcnamehighlighting`
|
776
|
-
If given and ``True``, highlight builtin function names
|
777
|
-
(default: ``True``).
|
778
|
-
`disabledmodules`
|
779
|
-
If given, must be a list of module names whose function names
|
780
|
-
should not be highlighted. By default all modules are highlighted
|
781
|
-
except the special ``'unknown'`` module that includes functions
|
782
|
-
that are known to php but are undocumented.
|
783
|
-
|
784
|
-
To get a list of allowed modules have a look into the
|
785
|
-
`_phpbuiltins` module:
|
786
|
-
|
787
|
-
.. sourcecode:: pycon
|
788
|
-
|
789
|
-
>>> from pygments.lexers._phpbuiltins import MODULES
|
790
|
-
>>> MODULES.keys()
|
791
|
-
['PHP Options/Info', 'Zip', 'dba', ...]
|
792
|
-
|
793
|
-
In fact the names of those modules match the module names from
|
794
|
-
the php documentation.
|
795
|
-
"""
|
796
|
-
|
797
|
-
name = 'PHP'
|
798
|
-
aliases = ['php', 'php3', 'php4', 'php5']
|
799
|
-
filenames = ['*.php', '*.php[345]', '*.inc']
|
800
|
-
mimetypes = ['text/x-php']
|
801
|
-
|
802
|
-
# Note that a backslash is included in the following two patterns
|
803
|
-
# PHP uses a backslash as a namespace separator
|
804
|
-
_ident_char = r'[\\\w]|[^\x00-\x7f]'
|
805
|
-
_ident_begin = r'(?:[\\_a-z]|[^\x00-\x7f])'
|
806
|
-
_ident_end = r'(?:' + _ident_char + ')*'
|
807
|
-
_ident_inner = _ident_begin + _ident_end
|
808
|
-
|
809
|
-
flags = re.IGNORECASE | re.DOTALL | re.MULTILINE
|
810
|
-
tokens = {
|
811
|
-
'root': [
|
812
|
-
(r'<\?(php)?', Comment.Preproc, 'php'),
|
813
|
-
(r'[^<]+', Other),
|
814
|
-
(r'<', Other)
|
815
|
-
],
|
816
|
-
'php': [
|
817
|
-
(r'\?>', Comment.Preproc, '#pop'),
|
818
|
-
(r'<<<(\'?)(' + _ident_inner + ')\1\n.*?\n\2\;?\n', String),
|
819
|
-
(r'\s+', Text),
|
820
|
-
(r'#.*?\n', Comment.Single),
|
821
|
-
(r'//.*?\n', Comment.Single),
|
822
|
-
# put the empty comment here, it is otherwise seen as
|
823
|
-
# the start of a docstring
|
824
|
-
(r'/\*\*/', Comment.Multiline),
|
825
|
-
(r'/\*\*.*?\*/', String.Doc),
|
826
|
-
(r'/\*.*?\*/', Comment.Multiline),
|
827
|
-
(r'(->|::)(\s*)(' + _ident_inner + ')',
|
828
|
-
bygroups(Operator, Text, Name.Attribute)),
|
829
|
-
(r'[~!%^&*+=|:.<>/?@-]+', Operator),
|
830
|
-
(r'[\[\]{}();,]+', Punctuation),
|
831
|
-
(r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
|
832
|
-
(r'(function)(\s*)(?=\()', bygroups(Keyword, Text)),
|
833
|
-
(r'(function)(\s+)(&?)(\s*)',
|
834
|
-
bygroups(Keyword, Text, Operator, Text), 'functionname'),
|
835
|
-
(r'(const)(\s+)(' + _ident_inner + ')',
|
836
|
-
bygroups(Keyword, Text, Name.Constant)),
|
837
|
-
(r'(and|E_PARSE|old_function|E_ERROR|or|as|E_WARNING|parent|'
|
838
|
-
r'eval|PHP_OS|break|exit|case|extends|PHP_VERSION|cfunction|'
|
839
|
-
r'FALSE|print|for|require|continue|foreach|require_once|'
|
840
|
-
r'declare|return|default|static|do|switch|die|stdClass|'
|
841
|
-
r'echo|else|TRUE|elseif|var|empty|if|xor|enddeclare|include|'
|
842
|
-
r'virtual|endfor|include_once|while|endforeach|global|__FILE__|'
|
843
|
-
r'endif|list|__LINE__|endswitch|new|__sleep|endwhile|not|'
|
844
|
-
r'array|__wakeup|E_ALL|NULL|final|php_user_filter|interface|'
|
845
|
-
r'implements|public|private|protected|abstract|clone|try|'
|
846
|
-
r'catch|throw|this|use|namespace|trait|yield|'
|
847
|
-
r'finally)\b', Keyword),
|
848
|
-
(r'(true|false|null)\b', Keyword.Constant),
|
849
|
-
(r'\$\{\$+' + _ident_inner + '\}', Name.Variable),
|
850
|
-
(r'\$+' + _ident_inner, Name.Variable),
|
851
|
-
(_ident_inner, Name.Other),
|
852
|
-
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
853
|
-
(r'\d+[eE][+-]?[0-9]+', Number.Float),
|
854
|
-
(r'0[0-7]+', Number.Oct),
|
855
|
-
(r'0[xX][a-f0-9]+', Number.Hex),
|
856
|
-
(r'\d+', Number.Integer),
|
857
|
-
(r'0b[01]+', Number.Bin),
|
858
|
-
(r"'([^'\\]*(?:\\.[^'\\]*)*)'", String.Single),
|
859
|
-
(r'`([^`\\]*(?:\\.[^`\\]*)*)`', String.Backtick),
|
860
|
-
(r'"', String.Double, 'string'),
|
861
|
-
],
|
862
|
-
'classname': [
|
863
|
-
(_ident_inner, Name.Class, '#pop')
|
864
|
-
],
|
865
|
-
'functionname': [
|
866
|
-
(_ident_inner, Name.Function, '#pop')
|
867
|
-
],
|
868
|
-
'string': [
|
869
|
-
(r'"', String.Double, '#pop'),
|
870
|
-
(r'[^{$"\\]+', String.Double),
|
871
|
-
(r'\\([nrt\"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})', String.Escape),
|
872
|
-
(r'\$' + _ident_inner + '(\[\S+?\]|->' + _ident_inner + ')?',
|
873
|
-
String.Interpol),
|
874
|
-
(r'(\{\$\{)(.*?)(\}\})',
|
875
|
-
bygroups(String.Interpol, using(this, _startinline=True),
|
876
|
-
String.Interpol)),
|
877
|
-
(r'(\{)(\$.*?)(\})',
|
878
|
-
bygroups(String.Interpol, using(this, _startinline=True),
|
879
|
-
String.Interpol)),
|
880
|
-
(r'(\$\{)(\S+)(\})',
|
881
|
-
bygroups(String.Interpol, Name.Variable, String.Interpol)),
|
882
|
-
(r'[${\\]+', String.Double)
|
883
|
-
],
|
884
|
-
}
|
885
|
-
|
886
|
-
def __init__(self, **options):
|
887
|
-
self.funcnamehighlighting = get_bool_opt(
|
888
|
-
options, 'funcnamehighlighting', True)
|
889
|
-
self.disabledmodules = get_list_opt(
|
890
|
-
options, 'disabledmodules', ['unknown'])
|
891
|
-
self.startinline = get_bool_opt(options, 'startinline', False)
|
892
|
-
|
893
|
-
# private option argument for the lexer itself
|
894
|
-
if '_startinline' in options:
|
895
|
-
self.startinline = options.pop('_startinline')
|
896
|
-
|
897
|
-
# collect activated functions in a set
|
898
|
-
self._functions = set()
|
899
|
-
if self.funcnamehighlighting:
|
900
|
-
from pygments.lexers._phpbuiltins import MODULES
|
901
|
-
for key, value in iteritems(MODULES):
|
902
|
-
if key not in self.disabledmodules:
|
903
|
-
self._functions.update(value)
|
904
|
-
RegexLexer.__init__(self, **options)
|
905
|
-
|
906
|
-
def get_tokens_unprocessed(self, text):
|
907
|
-
stack = ['root']
|
908
|
-
if self.startinline:
|
909
|
-
stack.append('php')
|
910
|
-
for index, token, value in \
|
911
|
-
RegexLexer.get_tokens_unprocessed(self, text, stack):
|
912
|
-
if token is Name.Other:
|
913
|
-
if value in self._functions:
|
914
|
-
yield index, Name.Builtin, value
|
915
|
-
continue
|
916
|
-
yield index, token, value
|
917
|
-
|
918
|
-
def analyse_text(text):
|
919
|
-
rv = 0.0
|
920
|
-
if re.search(r'<\?(?!xml)', text):
|
921
|
-
rv += 0.3
|
922
|
-
if '?>' in text:
|
923
|
-
rv += 0.1
|
924
|
-
return rv
|
925
|
-
|
926
|
-
|
927
|
-
class DtdLexer(RegexLexer):
|
928
|
-
"""
|
929
|
-
A lexer for DTDs (Document Type Definitions).
|
930
|
-
|
931
|
-
.. versionadded:: 1.5
|
932
|
-
"""
|
933
|
-
|
934
|
-
flags = re.MULTILINE | re.DOTALL
|
935
|
-
|
936
|
-
name = 'DTD'
|
937
|
-
aliases = ['dtd']
|
938
|
-
filenames = ['*.dtd']
|
939
|
-
mimetypes = ['application/xml-dtd']
|
940
|
-
|
941
|
-
tokens = {
|
942
|
-
'root': [
|
943
|
-
include('common'),
|
944
|
-
|
945
|
-
(r'(<!ELEMENT)(\s+)(\S+)',
|
946
|
-
bygroups(Keyword, Text, Name.Tag), 'element'),
|
947
|
-
(r'(<!ATTLIST)(\s+)(\S+)',
|
948
|
-
bygroups(Keyword, Text, Name.Tag), 'attlist'),
|
949
|
-
(r'(<!ENTITY)(\s+)(\S+)',
|
950
|
-
bygroups(Keyword, Text, Name.Entity), 'entity'),
|
951
|
-
(r'(<!NOTATION)(\s+)(\S+)',
|
952
|
-
bygroups(Keyword, Text, Name.Tag), 'notation'),
|
953
|
-
(r'(<!\[)([^\[\s]+)(\s*)(\[)', # conditional sections
|
954
|
-
bygroups(Keyword, Name.Entity, Text, Keyword)),
|
955
|
-
|
956
|
-
(r'(<!DOCTYPE)(\s+)([^>\s]+)',
|
957
|
-
bygroups(Keyword, Text, Name.Tag)),
|
958
|
-
(r'PUBLIC|SYSTEM', Keyword.Constant),
|
959
|
-
(r'[\[\]>]', Keyword),
|
960
|
-
],
|
961
|
-
|
962
|
-
'common': [
|
963
|
-
(r'\s+', Text),
|
964
|
-
(r'(%|&)[^;]*;', Name.Entity),
|
965
|
-
('<!--', Comment, 'comment'),
|
966
|
-
(r'[(|)*,?+]', Operator),
|
967
|
-
(r'"[^"]*"', String.Double),
|
968
|
-
(r'\'[^\']*\'', String.Single),
|
969
|
-
],
|
970
|
-
|
971
|
-
'comment': [
|
972
|
-
('[^-]+', Comment),
|
973
|
-
('-->', Comment, '#pop'),
|
974
|
-
('-', Comment),
|
975
|
-
],
|
976
|
-
|
977
|
-
'element': [
|
978
|
-
include('common'),
|
979
|
-
(r'EMPTY|ANY|#PCDATA', Keyword.Constant),
|
980
|
-
(r'[^>\s\|()?+*,]+', Name.Tag),
|
981
|
-
(r'>', Keyword, '#pop'),
|
982
|
-
],
|
983
|
-
|
984
|
-
'attlist': [
|
985
|
-
include('common'),
|
986
|
-
(r'CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITIES|ENTITY|NOTATION',
|
987
|
-
Keyword.Constant),
|
988
|
-
(r'#REQUIRED|#IMPLIED|#FIXED', Keyword.Constant),
|
989
|
-
(r'xml:space|xml:lang', Keyword.Reserved),
|
990
|
-
(r'[^>\s\|()?+*,]+', Name.Attribute),
|
991
|
-
(r'>', Keyword, '#pop'),
|
992
|
-
],
|
993
|
-
|
994
|
-
'entity': [
|
995
|
-
include('common'),
|
996
|
-
(r'SYSTEM|PUBLIC|NDATA', Keyword.Constant),
|
997
|
-
(r'[^>\s\|()?+*,]+', Name.Entity),
|
998
|
-
(r'>', Keyword, '#pop'),
|
999
|
-
],
|
1000
|
-
|
1001
|
-
'notation': [
|
1002
|
-
include('common'),
|
1003
|
-
(r'SYSTEM|PUBLIC', Keyword.Constant),
|
1004
|
-
(r'[^>\s\|()?+*,]+', Name.Attribute),
|
1005
|
-
(r'>', Keyword, '#pop'),
|
1006
|
-
],
|
1007
|
-
}
|
1008
|
-
|
1009
|
-
def analyse_text(text):
|
1010
|
-
if not looks_like_xml(text) and \
|
1011
|
-
('<!ELEMENT' in text or '<!ATTLIST' in text or '<!ENTITY' in text):
|
1012
|
-
return 0.8
|
1013
|
-
|
1014
|
-
class XmlLexer(RegexLexer):
|
1015
|
-
"""
|
1016
|
-
Generic lexer for XML (eXtensible Markup Language).
|
1017
|
-
"""
|
1018
|
-
|
1019
|
-
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
1020
|
-
|
1021
|
-
name = 'XML'
|
1022
|
-
aliases = ['xml']
|
1023
|
-
filenames = ['*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd',
|
1024
|
-
'*.wsdl', '*.wsf']
|
1025
|
-
mimetypes = ['text/xml', 'application/xml', 'image/svg+xml',
|
1026
|
-
'application/rss+xml', 'application/atom+xml']
|
1027
|
-
|
1028
|
-
tokens = {
|
1029
|
-
'root': [
|
1030
|
-
('[^<&]+', Text),
|
1031
|
-
(r'&\S*?;', Name.Entity),
|
1032
|
-
(r'\<\!\[CDATA\[.*?\]\]\>', Comment.Preproc),
|
1033
|
-
('<!--', Comment, 'comment'),
|
1034
|
-
(r'<\?.*?\?>', Comment.Preproc),
|
1035
|
-
('<![^>]*>', Comment.Preproc),
|
1036
|
-
(r'<\s*[\w:.-]+', Name.Tag, 'tag'),
|
1037
|
-
(r'<\s*/\s*[\w:.-]+\s*>', Name.Tag),
|
1038
|
-
],
|
1039
|
-
'comment': [
|
1040
|
-
('[^-]+', Comment),
|
1041
|
-
('-->', Comment, '#pop'),
|
1042
|
-
('-', Comment),
|
1043
|
-
],
|
1044
|
-
'tag': [
|
1045
|
-
(r'\s+', Text),
|
1046
|
-
(r'[\w.:-]+\s*=', Name.Attribute, 'attr'),
|
1047
|
-
(r'/?\s*>', Name.Tag, '#pop'),
|
1048
|
-
],
|
1049
|
-
'attr': [
|
1050
|
-
('\s+', Text),
|
1051
|
-
('".*?"', String, '#pop'),
|
1052
|
-
("'.*?'", String, '#pop'),
|
1053
|
-
(r'[^\s>]+', String, '#pop'),
|
1054
|
-
],
|
1055
|
-
}
|
1056
|
-
|
1057
|
-
def analyse_text(text):
|
1058
|
-
if looks_like_xml(text):
|
1059
|
-
return 0.5
|
1060
|
-
|
1061
|
-
|
1062
|
-
class XsltLexer(XmlLexer):
|
1063
|
-
'''
|
1064
|
-
A lexer for XSLT.
|
1065
|
-
|
1066
|
-
.. versionadded:: 0.10
|
1067
|
-
'''
|
1068
|
-
|
1069
|
-
name = 'XSLT'
|
1070
|
-
aliases = ['xslt']
|
1071
|
-
filenames = ['*.xsl', '*.xslt', '*.xpl'] # xpl is XProc
|
1072
|
-
mimetypes = ['application/xsl+xml', 'application/xslt+xml']
|
1073
|
-
|
1074
|
-
EXTRA_KEYWORDS = set([
|
1075
|
-
'apply-imports', 'apply-templates', 'attribute',
|
1076
|
-
'attribute-set', 'call-template', 'choose', 'comment',
|
1077
|
-
'copy', 'copy-of', 'decimal-format', 'element', 'fallback',
|
1078
|
-
'for-each', 'if', 'import', 'include', 'key', 'message',
|
1079
|
-
'namespace-alias', 'number', 'otherwise', 'output', 'param',
|
1080
|
-
'preserve-space', 'processing-instruction', 'sort',
|
1081
|
-
'strip-space', 'stylesheet', 'template', 'text', 'transform',
|
1082
|
-
'value-of', 'variable', 'when', 'with-param'
|
1083
|
-
])
|
1084
|
-
|
1085
|
-
def get_tokens_unprocessed(self, text):
|
1086
|
-
for index, token, value in XmlLexer.get_tokens_unprocessed(self, text):
|
1087
|
-
m = re.match('</?xsl:([^>]*)/?>?', value)
|
1088
|
-
|
1089
|
-
if token is Name.Tag and m and m.group(1) in self.EXTRA_KEYWORDS:
|
1090
|
-
yield index, Keyword, value
|
1091
|
-
else:
|
1092
|
-
yield index, token, value
|
1093
|
-
|
1094
|
-
def analyse_text(text):
|
1095
|
-
if looks_like_xml(text) and '<xsl' in text:
|
1096
|
-
return 0.8
|
1097
|
-
|
1098
|
-
|
1099
|
-
class MxmlLexer(RegexLexer):
|
1100
|
-
"""
|
1101
|
-
For MXML markup.
|
1102
|
-
Nested AS3 in <script> tags is highlighted by the appropriate lexer.
|
1103
|
-
|
1104
|
-
.. versionadded:: 1.1
|
1105
|
-
"""
|
1106
|
-
flags = re.MULTILINE | re.DOTALL
|
1107
|
-
name = 'MXML'
|
1108
|
-
aliases = ['mxml']
|
1109
|
-
filenames = ['*.mxml']
|
1110
|
-
mimetimes = ['text/xml', 'application/xml']
|
1111
|
-
|
1112
|
-
tokens = {
|
1113
|
-
'root': [
|
1114
|
-
('[^<&]+', Text),
|
1115
|
-
(r'&\S*?;', Name.Entity),
|
1116
|
-
(r'(\<\!\[CDATA\[)(.*?)(\]\]\>)',
|
1117
|
-
bygroups(String, using(ActionScript3Lexer), String)),
|
1118
|
-
('<!--', Comment, 'comment'),
|
1119
|
-
(r'<\?.*?\?>', Comment.Preproc),
|
1120
|
-
('<![^>]*>', Comment.Preproc),
|
1121
|
-
(r'<\s*[\w:.-]+', Name.Tag, 'tag'),
|
1122
|
-
(r'<\s*/\s*[\w:.-]+\s*>', Name.Tag),
|
1123
|
-
],
|
1124
|
-
'comment': [
|
1125
|
-
('[^-]+', Comment),
|
1126
|
-
('-->', Comment, '#pop'),
|
1127
|
-
('-', Comment),
|
1128
|
-
],
|
1129
|
-
'tag': [
|
1130
|
-
(r'\s+', Text),
|
1131
|
-
(r'[\w.:-]+\s*=', Name.Attribute, 'attr'),
|
1132
|
-
(r'/?\s*>', Name.Tag, '#pop'),
|
1133
|
-
],
|
1134
|
-
'attr': [
|
1135
|
-
('\s+', Text),
|
1136
|
-
('".*?"', String, '#pop'),
|
1137
|
-
("'.*?'", String, '#pop'),
|
1138
|
-
(r'[^\s>]+', String, '#pop'),
|
1139
|
-
],
|
1140
|
-
}
|
1141
|
-
|
1142
|
-
|
1143
|
-
class HaxeLexer(ExtendedRegexLexer):
|
1144
|
-
"""
|
1145
|
-
For Haxe source code (http://haxe.org/).
|
1146
|
-
|
1147
|
-
.. versionadded:: 1.3
|
1148
|
-
"""
|
1149
|
-
|
1150
|
-
name = 'Haxe'
|
1151
|
-
aliases = ['hx', 'haxe', 'hxsl']
|
1152
|
-
filenames = ['*.hx', '*.hxsl']
|
1153
|
-
mimetypes = ['text/haxe', 'text/x-haxe', 'text/x-hx']
|
1154
|
-
|
1155
|
-
# keywords extracted from lexer.mll in the haxe compiler source
|
1156
|
-
keyword = (r'(?:function|class|static|var|if|else|while|do|for|'
|
1157
|
-
r'break|return|continue|extends|implements|import|'
|
1158
|
-
r'switch|case|default|public|private|try|untyped|'
|
1159
|
-
r'catch|new|this|throw|extern|enum|in|interface|'
|
1160
|
-
r'cast|override|dynamic|typedef|package|'
|
1161
|
-
r'inline|using|null|true|false|abstract)\b')
|
1162
|
-
|
1163
|
-
# idtype in lexer.mll
|
1164
|
-
typeid = r'_*[A-Z]\w*'
|
1165
|
-
|
1166
|
-
# combined ident and dollar and idtype
|
1167
|
-
ident = r'(?:_*[a-z]\w*|_+[0-9]\w*|' + typeid + '|_+|\$\w+)'
|
1168
|
-
|
1169
|
-
binop = (r'(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|'
|
1170
|
-
r'!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|'
|
1171
|
-
r'/|\-|=>|=)')
|
1172
|
-
|
1173
|
-
# ident except keywords
|
1174
|
-
ident_no_keyword = r'(?!' + keyword + ')' + ident
|
1175
|
-
|
1176
|
-
flags = re.DOTALL | re.MULTILINE
|
1177
|
-
|
1178
|
-
preproc_stack = []
|
1179
|
-
|
1180
|
-
def preproc_callback(self, match, ctx):
|
1181
|
-
proc = match.group(2)
|
1182
|
-
|
1183
|
-
if proc == 'if':
|
1184
|
-
# store the current stack
|
1185
|
-
self.preproc_stack.append(ctx.stack[:])
|
1186
|
-
elif proc in ['else', 'elseif']:
|
1187
|
-
# restore the stack back to right before #if
|
1188
|
-
if self.preproc_stack: ctx.stack = self.preproc_stack[-1][:]
|
1189
|
-
elif proc == 'end':
|
1190
|
-
# remove the saved stack of previous #if
|
1191
|
-
if self.preproc_stack: self.preproc_stack.pop()
|
1192
|
-
|
1193
|
-
# #if and #elseif should follow by an expr
|
1194
|
-
if proc in ['if', 'elseif']:
|
1195
|
-
ctx.stack.append('preproc-expr')
|
1196
|
-
|
1197
|
-
# #error can be optionally follow by the error msg
|
1198
|
-
if proc in ['error']:
|
1199
|
-
ctx.stack.append('preproc-error')
|
1200
|
-
|
1201
|
-
yield match.start(), Comment.Preproc, '#' + proc
|
1202
|
-
ctx.pos = match.end()
|
1203
|
-
|
1204
|
-
|
1205
|
-
tokens = {
|
1206
|
-
'root': [
|
1207
|
-
include('spaces'),
|
1208
|
-
include('meta'),
|
1209
|
-
(r'(?:package)\b', Keyword.Namespace, ('semicolon', 'package')),
|
1210
|
-
(r'(?:import)\b', Keyword.Namespace, ('semicolon', 'import')),
|
1211
|
-
(r'(?:using)\b', Keyword.Namespace, ('semicolon', 'using')),
|
1212
|
-
(r'(?:extern|private)\b', Keyword.Declaration),
|
1213
|
-
(r'(?:abstract)\b', Keyword.Declaration, 'abstract'),
|
1214
|
-
(r'(?:class|interface)\b', Keyword.Declaration, 'class'),
|
1215
|
-
(r'(?:enum)\b', Keyword.Declaration, 'enum'),
|
1216
|
-
(r'(?:typedef)\b', Keyword.Declaration, 'typedef'),
|
1217
|
-
|
1218
|
-
# top-level expression
|
1219
|
-
# although it is not supported in haxe, but it is common to write
|
1220
|
-
# expression in web pages the positive lookahead here is to prevent
|
1221
|
-
# an infinite loop at the EOF
|
1222
|
-
(r'(?=.)', Text, 'expr-statement'),
|
1223
|
-
],
|
1224
|
-
|
1225
|
-
# space/tab/comment/preproc
|
1226
|
-
'spaces': [
|
1227
|
-
(r'\s+', Text),
|
1228
|
-
(r'//[^\n\r]*', Comment.Single),
|
1229
|
-
(r'/\*.*?\*/', Comment.Multiline),
|
1230
|
-
(r'(#)(if|elseif|else|end|error)\b', preproc_callback),
|
1231
|
-
],
|
1232
|
-
|
1233
|
-
'string-single-interpol': [
|
1234
|
-
(r'\$\{', String.Interpol, ('string-interpol-close', 'expr')),
|
1235
|
-
(r'\$\$', String.Escape),
|
1236
|
-
(r'\$(?=' + ident + ')', String.Interpol, 'ident'),
|
1237
|
-
include('string-single'),
|
1238
|
-
],
|
1239
|
-
|
1240
|
-
'string-single': [
|
1241
|
-
(r"'", String.Single, '#pop'),
|
1242
|
-
(r'\\.', String.Escape),
|
1243
|
-
(r'.', String.Single),
|
1244
|
-
],
|
1245
|
-
|
1246
|
-
'string-double': [
|
1247
|
-
(r'"', String.Double, '#pop'),
|
1248
|
-
(r'\\.', String.Escape),
|
1249
|
-
(r'.', String.Double),
|
1250
|
-
],
|
1251
|
-
|
1252
|
-
'string-interpol-close': [
|
1253
|
-
(r'\$'+ident, String.Interpol),
|
1254
|
-
(r'\}', String.Interpol, '#pop'),
|
1255
|
-
],
|
1256
|
-
|
1257
|
-
'package': [
|
1258
|
-
include('spaces'),
|
1259
|
-
(ident, Name.Namespace),
|
1260
|
-
(r'\.', Punctuation, 'import-ident'),
|
1261
|
-
default('#pop'),
|
1262
|
-
],
|
1263
|
-
|
1264
|
-
'import': [
|
1265
|
-
include('spaces'),
|
1266
|
-
(ident, Name.Namespace),
|
1267
|
-
(r'\*', Keyword), # wildcard import
|
1268
|
-
(r'\.', Punctuation, 'import-ident'),
|
1269
|
-
(r'in', Keyword.Namespace, 'ident'),
|
1270
|
-
default('#pop'),
|
1271
|
-
],
|
1272
|
-
|
1273
|
-
'import-ident': [
|
1274
|
-
include('spaces'),
|
1275
|
-
(r'\*', Keyword, '#pop'), # wildcard import
|
1276
|
-
(ident, Name.Namespace, '#pop'),
|
1277
|
-
],
|
1278
|
-
|
1279
|
-
'using': [
|
1280
|
-
include('spaces'),
|
1281
|
-
(ident, Name.Namespace),
|
1282
|
-
(r'\.', Punctuation, 'import-ident'),
|
1283
|
-
default('#pop'),
|
1284
|
-
],
|
1285
|
-
|
1286
|
-
'preproc-error': [
|
1287
|
-
(r'\s+', Comment.Preproc),
|
1288
|
-
(r"'", String.Single, ('#pop', 'string-single')),
|
1289
|
-
(r'"', String.Double, ('#pop', 'string-double')),
|
1290
|
-
default('#pop'),
|
1291
|
-
],
|
1292
|
-
|
1293
|
-
'preproc-expr': [
|
1294
|
-
(r'\s+', Comment.Preproc),
|
1295
|
-
(r'\!', Comment.Preproc),
|
1296
|
-
(r'\(', Comment.Preproc, ('#pop', 'preproc-parenthesis')),
|
1297
|
-
|
1298
|
-
(ident, Comment.Preproc, '#pop'),
|
1299
|
-
|
1300
|
-
# Float
|
1301
|
-
(r'\.[0-9]+', Number.Float),
|
1302
|
-
(r'[0-9]+[eE][\+\-]?[0-9]+', Number.Float),
|
1303
|
-
(r'[0-9]+\.[0-9]*[eE][\+\-]?[0-9]+', Number.Float),
|
1304
|
-
(r'[0-9]+\.[0-9]+', Number.Float),
|
1305
|
-
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float),
|
1306
|
-
|
1307
|
-
# Int
|
1308
|
-
(r'0x[0-9a-fA-F]+', Number.Hex),
|
1309
|
-
(r'[0-9]+', Number.Integer),
|
1310
|
-
|
1311
|
-
# String
|
1312
|
-
(r"'", String.Single, ('#pop', 'string-single')),
|
1313
|
-
(r'"', String.Double, ('#pop', 'string-double')),
|
1314
|
-
],
|
1315
|
-
|
1316
|
-
'preproc-parenthesis': [
|
1317
|
-
(r'\s+', Comment.Preproc),
|
1318
|
-
(r'\)', Comment.Preproc, '#pop'),
|
1319
|
-
('', Text, 'preproc-expr-in-parenthesis'),
|
1320
|
-
],
|
1321
|
-
|
1322
|
-
'preproc-expr-chain': [
|
1323
|
-
(r'\s+', Comment.Preproc),
|
1324
|
-
(binop, Comment.Preproc, ('#pop', 'preproc-expr-in-parenthesis')),
|
1325
|
-
default('#pop'),
|
1326
|
-
],
|
1327
|
-
|
1328
|
-
# same as 'preproc-expr' but able to chain 'preproc-expr-chain'
|
1329
|
-
'preproc-expr-in-parenthesis': [
|
1330
|
-
(r'\s+', Comment.Preproc),
|
1331
|
-
(r'\!', Comment.Preproc),
|
1332
|
-
(r'\(', Comment.Preproc,
|
1333
|
-
('#pop', 'preproc-expr-chain', 'preproc-parenthesis')),
|
1334
|
-
|
1335
|
-
(ident, Comment.Preproc, ('#pop', 'preproc-expr-chain')),
|
1336
|
-
|
1337
|
-
# Float
|
1338
|
-
(r'\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
1339
|
-
(r'[0-9]+[eE][\+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
1340
|
-
(r'[0-9]+\.[0-9]*[eE][\+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
1341
|
-
(r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
1342
|
-
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, ('#pop', 'preproc-expr-chain')),
|
1343
|
-
|
1344
|
-
# Int
|
1345
|
-
(r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'preproc-expr-chain')),
|
1346
|
-
(r'[0-9]+', Number.Integer, ('#pop', 'preproc-expr-chain')),
|
1347
|
-
|
1348
|
-
# String
|
1349
|
-
(r"'", String.Single,
|
1350
|
-
('#pop', 'preproc-expr-chain', 'string-single')),
|
1351
|
-
(r'"', String.Double,
|
1352
|
-
('#pop', 'preproc-expr-chain', 'string-double')),
|
1353
|
-
],
|
1354
|
-
|
1355
|
-
'abstract' : [
|
1356
|
-
include('spaces'),
|
1357
|
-
default(('#pop', 'abstract-body', 'abstract-relation',
|
1358
|
-
'abstract-opaque', 'type-param-constraint', 'type-name')),
|
1359
|
-
],
|
1360
|
-
|
1361
|
-
'abstract-body' : [
|
1362
|
-
include('spaces'),
|
1363
|
-
(r'\{', Punctuation, ('#pop', 'class-body')),
|
1364
|
-
],
|
1365
|
-
|
1366
|
-
'abstract-opaque' : [
|
1367
|
-
include('spaces'),
|
1368
|
-
(r'\(', Punctuation, ('#pop', 'parenthesis-close', 'type')),
|
1369
|
-
default('#pop'),
|
1370
|
-
],
|
1371
|
-
|
1372
|
-
'abstract-relation': [
|
1373
|
-
include('spaces'),
|
1374
|
-
(r'(?:to|from)', Keyword.Declaration, 'type'),
|
1375
|
-
(r',', Punctuation),
|
1376
|
-
default('#pop'),
|
1377
|
-
],
|
1378
|
-
|
1379
|
-
'meta': [
|
1380
|
-
include('spaces'),
|
1381
|
-
(r'@', Name.Decorator, ('meta-body', 'meta-ident', 'meta-colon')),
|
1382
|
-
],
|
1383
|
-
|
1384
|
-
# optional colon
|
1385
|
-
'meta-colon': [
|
1386
|
-
include('spaces'),
|
1387
|
-
(r':', Name.Decorator, '#pop'),
|
1388
|
-
default('#pop'),
|
1389
|
-
],
|
1390
|
-
|
1391
|
-
# same as 'ident' but set token as Name.Decorator instead of Name
|
1392
|
-
'meta-ident': [
|
1393
|
-
include('spaces'),
|
1394
|
-
(ident, Name.Decorator, '#pop'),
|
1395
|
-
],
|
1396
|
-
|
1397
|
-
'meta-body': [
|
1398
|
-
include('spaces'),
|
1399
|
-
(r'\(', Name.Decorator, ('#pop', 'meta-call')),
|
1400
|
-
default('#pop'),
|
1401
|
-
],
|
1402
|
-
|
1403
|
-
'meta-call': [
|
1404
|
-
include('spaces'),
|
1405
|
-
(r'\)', Name.Decorator, '#pop'),
|
1406
|
-
default(('#pop', 'meta-call-sep', 'expr')),
|
1407
|
-
],
|
1408
|
-
|
1409
|
-
'meta-call-sep': [
|
1410
|
-
include('spaces'),
|
1411
|
-
(r'\)', Name.Decorator, '#pop'),
|
1412
|
-
(r',', Punctuation, ('#pop', 'meta-call')),
|
1413
|
-
],
|
1414
|
-
|
1415
|
-
'typedef': [
|
1416
|
-
include('spaces'),
|
1417
|
-
default(('#pop', 'typedef-body', 'type-param-constraint',
|
1418
|
-
'type-name')),
|
1419
|
-
],
|
1420
|
-
|
1421
|
-
'typedef-body': [
|
1422
|
-
include('spaces'),
|
1423
|
-
(r'=', Operator, ('#pop', 'optional-semicolon', 'type')),
|
1424
|
-
],
|
1425
|
-
|
1426
|
-
'enum': [
|
1427
|
-
include('spaces'),
|
1428
|
-
default(('#pop', 'enum-body', 'bracket-open',
|
1429
|
-
'type-param-constraint', 'type-name')),
|
1430
|
-
],
|
1431
|
-
|
1432
|
-
'enum-body': [
|
1433
|
-
include('spaces'),
|
1434
|
-
include('meta'),
|
1435
|
-
(r'\}', Punctuation, '#pop'),
|
1436
|
-
(ident_no_keyword, Name, ('enum-member', 'type-param-constraint')),
|
1437
|
-
],
|
1438
|
-
|
1439
|
-
'enum-member': [
|
1440
|
-
include('spaces'),
|
1441
|
-
(r'\(', Punctuation,
|
1442
|
-
('#pop', 'semicolon', 'flag', 'function-param')),
|
1443
|
-
default(('#pop', 'semicolon', 'flag')),
|
1444
|
-
],
|
1445
|
-
|
1446
|
-
'class': [
|
1447
|
-
include('spaces'),
|
1448
|
-
default(('#pop', 'class-body', 'bracket-open', 'extends',
|
1449
|
-
'type-param-constraint', 'type-name')),
|
1450
|
-
],
|
1451
|
-
|
1452
|
-
'extends': [
|
1453
|
-
include('spaces'),
|
1454
|
-
(r'(?:extends|implements)\b', Keyword.Declaration, 'type'),
|
1455
|
-
(r',', Punctuation), # the comma is made optional here, since haxe2
|
1456
|
-
# requires the comma but haxe3 does not allow it
|
1457
|
-
default('#pop'),
|
1458
|
-
],
|
1459
|
-
|
1460
|
-
'bracket-open': [
|
1461
|
-
include('spaces'),
|
1462
|
-
(r'\{', Punctuation, '#pop'),
|
1463
|
-
],
|
1464
|
-
|
1465
|
-
'bracket-close': [
|
1466
|
-
include('spaces'),
|
1467
|
-
(r'\}', Punctuation, '#pop'),
|
1468
|
-
],
|
1469
|
-
|
1470
|
-
'class-body': [
|
1471
|
-
include('spaces'),
|
1472
|
-
include('meta'),
|
1473
|
-
(r'\}', Punctuation, '#pop'),
|
1474
|
-
(r'(?:static|public|private|override|dynamic|inline|macro)\b',
|
1475
|
-
Keyword.Declaration),
|
1476
|
-
default('class-member'),
|
1477
|
-
],
|
1478
|
-
|
1479
|
-
'class-member': [
|
1480
|
-
include('spaces'),
|
1481
|
-
(r'(var)\b', Keyword.Declaration,
|
1482
|
-
('#pop', 'optional-semicolon', 'var')),
|
1483
|
-
(r'(function)\b', Keyword.Declaration,
|
1484
|
-
('#pop', 'optional-semicolon', 'class-method')),
|
1485
|
-
],
|
1486
|
-
|
1487
|
-
# local function, anonymous or not
|
1488
|
-
'function-local': [
|
1489
|
-
include('spaces'),
|
1490
|
-
(r'(' + ident_no_keyword + ')?', Name.Function,
|
1491
|
-
('#pop', 'optional-expr', 'flag', 'function-param',
|
1492
|
-
'parenthesis-open', 'type-param-constraint')),
|
1493
|
-
],
|
1494
|
-
|
1495
|
-
'optional-expr': [
|
1496
|
-
include('spaces'),
|
1497
|
-
include('expr'),
|
1498
|
-
default('#pop'),
|
1499
|
-
],
|
1500
|
-
|
1501
|
-
'class-method': [
|
1502
|
-
include('spaces'),
|
1503
|
-
(ident, Name.Function, ('#pop', 'optional-expr', 'flag',
|
1504
|
-
'function-param', 'parenthesis-open',
|
1505
|
-
'type-param-constraint')),
|
1506
|
-
],
|
1507
|
-
|
1508
|
-
# function arguments
|
1509
|
-
'function-param': [
|
1510
|
-
include('spaces'),
|
1511
|
-
(r'\)', Punctuation, '#pop'),
|
1512
|
-
(r'\?', Punctuation),
|
1513
|
-
(ident_no_keyword, Name,
|
1514
|
-
('#pop', 'function-param-sep', 'assign', 'flag')),
|
1515
|
-
],
|
1516
|
-
|
1517
|
-
'function-param-sep': [
|
1518
|
-
include('spaces'),
|
1519
|
-
(r'\)', Punctuation, '#pop'),
|
1520
|
-
(r',', Punctuation, ('#pop', 'function-param')),
|
1521
|
-
],
|
1522
|
-
|
1523
|
-
'prop-get-set': [
|
1524
|
-
include('spaces'),
|
1525
|
-
(r'\(', Punctuation, ('#pop', 'parenthesis-close',
|
1526
|
-
'prop-get-set-opt', 'comma', 'prop-get-set-opt')),
|
1527
|
-
default('#pop'),
|
1528
|
-
],
|
1529
|
-
|
1530
|
-
'prop-get-set-opt': [
|
1531
|
-
include('spaces'),
|
1532
|
-
(r'(?:default|null|never|dynamic|get|set)\b', Keyword, '#pop'),
|
1533
|
-
(ident_no_keyword, Text, '#pop'), #custom getter/setter
|
1534
|
-
],
|
1535
|
-
|
1536
|
-
'expr-statement': [
|
1537
|
-
include('spaces'),
|
1538
|
-
# makes semicolon optional here, just to avoid checking the last
|
1539
|
-
# one is bracket or not.
|
1540
|
-
default(('#pop', 'optional-semicolon', 'expr')),
|
1541
|
-
],
|
1542
|
-
|
1543
|
-
'expr': [
|
1544
|
-
include('spaces'),
|
1545
|
-
(r'@', Name.Decorator, ('#pop', 'optional-expr', 'meta-body',
|
1546
|
-
'meta-ident', 'meta-colon')),
|
1547
|
-
(r'(?:\+\+|\-\-|~(?!/)|!|\-)', Operator),
|
1548
|
-
(r'\(', Punctuation, ('#pop', 'expr-chain', 'parenthesis')),
|
1549
|
-
(r'(?:static|public|private|override|dynamic|inline)\b',
|
1550
|
-
Keyword.Declaration),
|
1551
|
-
(r'(?:function)\b', Keyword.Declaration, ('#pop', 'expr-chain',
|
1552
|
-
'function-local')),
|
1553
|
-
(r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket')),
|
1554
|
-
(r'(?:true|false|null)\b', Keyword.Constant, ('#pop', 'expr-chain')),
|
1555
|
-
(r'(?:this)\b', Keyword, ('#pop', 'expr-chain')),
|
1556
|
-
(r'(?:cast)\b', Keyword, ('#pop', 'expr-chain', 'cast')),
|
1557
|
-
(r'(?:try)\b', Keyword, ('#pop', 'catch', 'expr')),
|
1558
|
-
(r'(?:var)\b', Keyword.Declaration, ('#pop', 'var')),
|
1559
|
-
(r'(?:new)\b', Keyword, ('#pop', 'expr-chain', 'new')),
|
1560
|
-
(r'(?:switch)\b', Keyword, ('#pop', 'switch')),
|
1561
|
-
(r'(?:if)\b', Keyword, ('#pop', 'if')),
|
1562
|
-
(r'(?:do)\b', Keyword, ('#pop', 'do')),
|
1563
|
-
(r'(?:while)\b', Keyword, ('#pop', 'while')),
|
1564
|
-
(r'(?:for)\b', Keyword, ('#pop', 'for')),
|
1565
|
-
(r'(?:untyped|throw)\b', Keyword),
|
1566
|
-
(r'(?:return)\b', Keyword, ('#pop', 'optional-expr')),
|
1567
|
-
(r'(?:macro)\b', Keyword, ('#pop', 'macro')),
|
1568
|
-
(r'(?:continue|break)\b', Keyword, '#pop'),
|
1569
|
-
(r'(?:\$\s*[a-z]\b|\$(?!'+ident+'))', Name, ('#pop', 'dollar')),
|
1570
|
-
(ident_no_keyword, Name, ('#pop', 'expr-chain')),
|
1571
|
-
|
1572
|
-
# Float
|
1573
|
-
(r'\.[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
1574
|
-
(r'[0-9]+[eE][\+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
1575
|
-
(r'[0-9]+\.[0-9]*[eE][\+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
1576
|
-
(r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'expr-chain')),
|
1577
|
-
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, ('#pop', 'expr-chain')),
|
1578
|
-
|
1579
|
-
# Int
|
1580
|
-
(r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'expr-chain')),
|
1581
|
-
(r'[0-9]+', Number.Integer, ('#pop', 'expr-chain')),
|
1582
|
-
|
1583
|
-
# String
|
1584
|
-
(r"'", String.Single, ('#pop', 'expr-chain', 'string-single-interpol')),
|
1585
|
-
(r'"', String.Double, ('#pop', 'expr-chain', 'string-double')),
|
1586
|
-
|
1587
|
-
# EReg
|
1588
|
-
(r'~/(\\\\|\\/|[^/\n])*/[gimsu]*', String.Regex, ('#pop', 'expr-chain')),
|
1589
|
-
|
1590
|
-
# Array
|
1591
|
-
(r'\[', Punctuation, ('#pop', 'expr-chain', 'array-decl')),
|
1592
|
-
],
|
1593
|
-
|
1594
|
-
'expr-chain': [
|
1595
|
-
include('spaces'),
|
1596
|
-
(r'(?:\+\+|\-\-)', Operator),
|
1597
|
-
(binop, Operator, ('#pop', 'expr')),
|
1598
|
-
(r'(?:in)\b', Keyword, ('#pop', 'expr')),
|
1599
|
-
(r'\?', Operator, ('#pop', 'expr', 'ternary', 'expr')),
|
1600
|
-
(r'(\.)(' + ident_no_keyword + ')', bygroups(Punctuation, Name)),
|
1601
|
-
(r'\[', Punctuation, 'array-access'),
|
1602
|
-
(r'\(', Punctuation, 'call'),
|
1603
|
-
default('#pop'),
|
1604
|
-
],
|
1605
|
-
|
1606
|
-
# macro reification
|
1607
|
-
'macro': [
|
1608
|
-
include('spaces'),
|
1609
|
-
include('meta'),
|
1610
|
-
(r':', Punctuation, ('#pop', 'type')),
|
1611
|
-
|
1612
|
-
(r'(?:extern|private)\b', Keyword.Declaration),
|
1613
|
-
(r'(?:abstract)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'abstract')),
|
1614
|
-
(r'(?:class|interface)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'class')),
|
1615
|
-
(r'(?:enum)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'enum')),
|
1616
|
-
(r'(?:typedef)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'typedef')),
|
1617
|
-
|
1618
|
-
default(('#pop', 'expr')),
|
1619
|
-
],
|
1620
|
-
|
1621
|
-
# cast can be written as "cast expr" or "cast(expr, type)"
|
1622
|
-
'cast': [
|
1623
|
-
include('spaces'),
|
1624
|
-
(r'\(', Punctuation, ('#pop', 'parenthesis-close',
|
1625
|
-
'cast-type', 'expr')),
|
1626
|
-
default(('#pop', 'expr')),
|
1627
|
-
],
|
1628
|
-
|
1629
|
-
# optionally give a type as the 2nd argument of cast()
|
1630
|
-
'cast-type': [
|
1631
|
-
include('spaces'),
|
1632
|
-
(r',', Punctuation, ('#pop', 'type')),
|
1633
|
-
default('#pop'),
|
1634
|
-
],
|
1635
|
-
|
1636
|
-
'catch': [
|
1637
|
-
include('spaces'),
|
1638
|
-
(r'(?:catch)\b', Keyword, ('expr', 'function-param',
|
1639
|
-
'parenthesis-open')),
|
1640
|
-
default('#pop'),
|
1641
|
-
],
|
1642
|
-
|
1643
|
-
# do-while loop
|
1644
|
-
'do': [
|
1645
|
-
include('spaces'),
|
1646
|
-
default(('#pop', 'do-while', 'expr')),
|
1647
|
-
],
|
1648
|
-
|
1649
|
-
# the while after do
|
1650
|
-
'do-while': [
|
1651
|
-
include('spaces'),
|
1652
|
-
(r'(?:while)\b', Keyword, ('#pop', 'parenthesis',
|
1653
|
-
'parenthesis-open')),
|
1654
|
-
],
|
1655
|
-
|
1656
|
-
'while': [
|
1657
|
-
include('spaces'),
|
1658
|
-
(r'\(', Punctuation, ('#pop', 'expr', 'parenthesis')),
|
1659
|
-
],
|
1660
|
-
|
1661
|
-
'for': [
|
1662
|
-
include('spaces'),
|
1663
|
-
(r'\(', Punctuation, ('#pop', 'expr', 'parenthesis')),
|
1664
|
-
],
|
1665
|
-
|
1666
|
-
'if': [
|
1667
|
-
include('spaces'),
|
1668
|
-
(r'\(', Punctuation, ('#pop', 'else', 'optional-semicolon', 'expr',
|
1669
|
-
'parenthesis')),
|
1670
|
-
],
|
1671
|
-
|
1672
|
-
'else': [
|
1673
|
-
include('spaces'),
|
1674
|
-
(r'(?:else)\b', Keyword, ('#pop', 'expr')),
|
1675
|
-
default('#pop'),
|
1676
|
-
],
|
1677
|
-
|
1678
|
-
'switch': [
|
1679
|
-
include('spaces'),
|
1680
|
-
default(('#pop', 'switch-body', 'bracket-open', 'expr')),
|
1681
|
-
],
|
1682
|
-
|
1683
|
-
'switch-body': [
|
1684
|
-
include('spaces'),
|
1685
|
-
(r'(?:case|default)\b', Keyword, ('case-block', 'case')),
|
1686
|
-
(r'\}', Punctuation, '#pop'),
|
1687
|
-
],
|
1688
|
-
|
1689
|
-
'case': [
|
1690
|
-
include('spaces'),
|
1691
|
-
(r':', Punctuation, '#pop'),
|
1692
|
-
default(('#pop', 'case-sep', 'case-guard', 'expr')),
|
1693
|
-
],
|
1694
|
-
|
1695
|
-
'case-sep': [
|
1696
|
-
include('spaces'),
|
1697
|
-
(r':', Punctuation, '#pop'),
|
1698
|
-
(r',', Punctuation, ('#pop', 'case')),
|
1699
|
-
],
|
1700
|
-
|
1701
|
-
'case-guard': [
|
1702
|
-
include('spaces'),
|
1703
|
-
(r'(?:if)\b', Keyword, ('#pop', 'parenthesis', 'parenthesis-open')),
|
1704
|
-
default('#pop'),
|
1705
|
-
],
|
1706
|
-
|
1707
|
-
# optional multiple expr under a case
|
1708
|
-
'case-block': [
|
1709
|
-
include('spaces'),
|
1710
|
-
(r'(?!(?:case|default)\b|\})', Keyword, 'expr-statement'),
|
1711
|
-
default('#pop'),
|
1712
|
-
],
|
1713
|
-
|
1714
|
-
'new': [
|
1715
|
-
include('spaces'),
|
1716
|
-
default(('#pop', 'call', 'parenthesis-open', 'type')),
|
1717
|
-
],
|
1718
|
-
|
1719
|
-
'array-decl': [
|
1720
|
-
include('spaces'),
|
1721
|
-
(r'\]', Punctuation, '#pop'),
|
1722
|
-
default(('#pop', 'array-decl-sep', 'expr')),
|
1723
|
-
],
|
1724
|
-
|
1725
|
-
'array-decl-sep': [
|
1726
|
-
include('spaces'),
|
1727
|
-
(r'\]', Punctuation, '#pop'),
|
1728
|
-
(r',', Punctuation, ('#pop', 'array-decl')),
|
1729
|
-
],
|
1730
|
-
|
1731
|
-
'array-access': [
|
1732
|
-
include('spaces'),
|
1733
|
-
default(('#pop', 'array-access-close', 'expr')),
|
1734
|
-
],
|
1735
|
-
|
1736
|
-
'array-access-close': [
|
1737
|
-
include('spaces'),
|
1738
|
-
(r'\]', Punctuation, '#pop'),
|
1739
|
-
],
|
1740
|
-
|
1741
|
-
'comma': [
|
1742
|
-
include('spaces'),
|
1743
|
-
(r',', Punctuation, '#pop'),
|
1744
|
-
],
|
1745
|
-
|
1746
|
-
'colon': [
|
1747
|
-
include('spaces'),
|
1748
|
-
(r':', Punctuation, '#pop'),
|
1749
|
-
],
|
1750
|
-
|
1751
|
-
'semicolon': [
|
1752
|
-
include('spaces'),
|
1753
|
-
(r';', Punctuation, '#pop'),
|
1754
|
-
],
|
1755
|
-
|
1756
|
-
'optional-semicolon': [
|
1757
|
-
include('spaces'),
|
1758
|
-
(r';', Punctuation, '#pop'),
|
1759
|
-
default('#pop'),
|
1760
|
-
],
|
1761
|
-
|
1762
|
-
# identity that CAN be a Haxe keyword
|
1763
|
-
'ident': [
|
1764
|
-
include('spaces'),
|
1765
|
-
(ident, Name, '#pop'),
|
1766
|
-
],
|
1767
|
-
|
1768
|
-
'dollar': [
|
1769
|
-
include('spaces'),
|
1770
|
-
(r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket-close', 'expr')),
|
1771
|
-
default(('#pop', 'expr-chain')),
|
1772
|
-
],
|
1773
|
-
|
1774
|
-
'type-name': [
|
1775
|
-
include('spaces'),
|
1776
|
-
(typeid, Name, '#pop'),
|
1777
|
-
],
|
1778
|
-
|
1779
|
-
'type-full-name': [
|
1780
|
-
include('spaces'),
|
1781
|
-
(r'\.', Punctuation, 'ident'),
|
1782
|
-
default('#pop'),
|
1783
|
-
],
|
1784
|
-
|
1785
|
-
'type': [
|
1786
|
-
include('spaces'),
|
1787
|
-
(r'\?', Punctuation),
|
1788
|
-
(ident, Name, ('#pop', 'type-check', 'type-full-name')),
|
1789
|
-
(r'\{', Punctuation, ('#pop', 'type-check', 'type-struct')),
|
1790
|
-
(r'\(', Punctuation, ('#pop', 'type-check', 'type-parenthesis')),
|
1791
|
-
],
|
1792
|
-
|
1793
|
-
'type-parenthesis': [
|
1794
|
-
include('spaces'),
|
1795
|
-
default(('#pop', 'parenthesis-close', 'type')),
|
1796
|
-
],
|
1797
|
-
|
1798
|
-
'type-check': [
|
1799
|
-
include('spaces'),
|
1800
|
-
(r'->', Punctuation, ('#pop', 'type')),
|
1801
|
-
(r'<(?!=)', Punctuation, 'type-param'),
|
1802
|
-
default('#pop'),
|
1803
|
-
],
|
1804
|
-
|
1805
|
-
'type-struct': [
|
1806
|
-
include('spaces'),
|
1807
|
-
(r'\}', Punctuation, '#pop'),
|
1808
|
-
(r'\?', Punctuation),
|
1809
|
-
(r'>', Punctuation, ('comma', 'type')),
|
1810
|
-
(ident_no_keyword, Name, ('#pop', 'type-struct-sep', 'type', 'colon')),
|
1811
|
-
include('class-body'),
|
1812
|
-
],
|
1813
|
-
|
1814
|
-
'type-struct-sep': [
|
1815
|
-
include('spaces'),
|
1816
|
-
(r'\}', Punctuation, '#pop'),
|
1817
|
-
(r',', Punctuation, ('#pop', 'type-struct')),
|
1818
|
-
],
|
1819
|
-
|
1820
|
-
# type-param can be a normal type or a constant literal...
|
1821
|
-
'type-param-type': [
|
1822
|
-
# Float
|
1823
|
-
(r'\.[0-9]+', Number.Float, '#pop'),
|
1824
|
-
(r'[0-9]+[eE][\+\-]?[0-9]+', Number.Float, '#pop'),
|
1825
|
-
(r'[0-9]+\.[0-9]*[eE][\+\-]?[0-9]+', Number.Float, '#pop'),
|
1826
|
-
(r'[0-9]+\.[0-9]+', Number.Float, '#pop'),
|
1827
|
-
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, '#pop'),
|
1828
|
-
|
1829
|
-
# Int
|
1830
|
-
(r'0x[0-9a-fA-F]+', Number.Hex, '#pop'),
|
1831
|
-
(r'[0-9]+', Number.Integer, '#pop'),
|
1832
|
-
|
1833
|
-
# String
|
1834
|
-
(r"'", String.Single, ('#pop', 'string-single')),
|
1835
|
-
(r'"', String.Double, ('#pop', 'string-double')),
|
1836
|
-
|
1837
|
-
# EReg
|
1838
|
-
(r'~/(\\\\|\\/|[^/\n])*/[gim]*', String.Regex, '#pop'),
|
1839
|
-
|
1840
|
-
# Array
|
1841
|
-
(r'\[', Operator, ('#pop', 'array-decl')),
|
1842
|
-
|
1843
|
-
include('type'),
|
1844
|
-
],
|
1845
|
-
|
1846
|
-
# type-param part of a type
|
1847
|
-
# ie. the <A,B> path in Map<A,B>
|
1848
|
-
'type-param': [
|
1849
|
-
include('spaces'),
|
1850
|
-
default(('#pop', 'type-param-sep', 'type-param-type')),
|
1851
|
-
],
|
1852
|
-
|
1853
|
-
'type-param-sep': [
|
1854
|
-
include('spaces'),
|
1855
|
-
(r'>', Punctuation, '#pop'),
|
1856
|
-
(r',', Punctuation, ('#pop', 'type-param')),
|
1857
|
-
],
|
1858
|
-
|
1859
|
-
# optional type-param that may include constraint
|
1860
|
-
# ie. <T:Constraint, T2:(ConstraintA,ConstraintB)>
|
1861
|
-
'type-param-constraint': [
|
1862
|
-
include('spaces'),
|
1863
|
-
(r'<(?!=)', Punctuation, ('#pop', 'type-param-constraint-sep',
|
1864
|
-
'type-param-constraint-flag', 'type-name')),
|
1865
|
-
default('#pop'),
|
1866
|
-
],
|
1867
|
-
|
1868
|
-
'type-param-constraint-sep': [
|
1869
|
-
include('spaces'),
|
1870
|
-
(r'>', Punctuation, '#pop'),
|
1871
|
-
(r',', Punctuation, ('#pop', 'type-param-constraint-sep',
|
1872
|
-
'type-param-constraint-flag', 'type-name')),
|
1873
|
-
],
|
1874
|
-
|
1875
|
-
# the optional constraint inside type-param
|
1876
|
-
'type-param-constraint-flag': [
|
1877
|
-
include('spaces'),
|
1878
|
-
(r':', Punctuation, ('#pop', 'type-param-constraint-flag-type')),
|
1879
|
-
default('#pop'),
|
1880
|
-
],
|
1881
|
-
|
1882
|
-
'type-param-constraint-flag-type': [
|
1883
|
-
include('spaces'),
|
1884
|
-
(r'\(', Punctuation, ('#pop', 'type-param-constraint-flag-type-sep',
|
1885
|
-
'type')),
|
1886
|
-
default(('#pop', 'type')),
|
1887
|
-
],
|
1888
|
-
|
1889
|
-
'type-param-constraint-flag-type-sep': [
|
1890
|
-
include('spaces'),
|
1891
|
-
(r'\)', Punctuation, '#pop'),
|
1892
|
-
(r',', Punctuation, 'type'),
|
1893
|
-
],
|
1894
|
-
|
1895
|
-
# a parenthesis expr that contain exactly one expr
|
1896
|
-
'parenthesis': [
|
1897
|
-
include('spaces'),
|
1898
|
-
default(('#pop', 'parenthesis-close', 'flag', 'expr')),
|
1899
|
-
],
|
1900
|
-
|
1901
|
-
'parenthesis-open': [
|
1902
|
-
include('spaces'),
|
1903
|
-
(r'\(', Punctuation, '#pop'),
|
1904
|
-
],
|
1905
|
-
|
1906
|
-
'parenthesis-close': [
|
1907
|
-
include('spaces'),
|
1908
|
-
(r'\)', Punctuation, '#pop'),
|
1909
|
-
],
|
1910
|
-
|
1911
|
-
'var': [
|
1912
|
-
include('spaces'),
|
1913
|
-
(ident_no_keyword, Text, ('#pop', 'var-sep', 'assign', 'flag', 'prop-get-set')),
|
1914
|
-
],
|
1915
|
-
|
1916
|
-
# optional more var decl.
|
1917
|
-
'var-sep': [
|
1918
|
-
include('spaces'),
|
1919
|
-
(r',', Punctuation, ('#pop', 'var')),
|
1920
|
-
default('#pop'),
|
1921
|
-
],
|
1922
|
-
|
1923
|
-
# optional assignment
|
1924
|
-
'assign': [
|
1925
|
-
include('spaces'),
|
1926
|
-
(r'=', Operator, ('#pop', 'expr')),
|
1927
|
-
default('#pop'),
|
1928
|
-
],
|
1929
|
-
|
1930
|
-
# optional type flag
|
1931
|
-
'flag': [
|
1932
|
-
include('spaces'),
|
1933
|
-
(r':', Punctuation, ('#pop', 'type')),
|
1934
|
-
default('#pop'),
|
1935
|
-
],
|
1936
|
-
|
1937
|
-
# colon as part of a ternary operator (?:)
|
1938
|
-
'ternary': [
|
1939
|
-
include('spaces'),
|
1940
|
-
(r':', Operator, '#pop'),
|
1941
|
-
],
|
1942
|
-
|
1943
|
-
# function call
|
1944
|
-
'call': [
|
1945
|
-
include('spaces'),
|
1946
|
-
(r'\)', Punctuation, '#pop'),
|
1947
|
-
default(('#pop', 'call-sep', 'expr')),
|
1948
|
-
],
|
1949
|
-
|
1950
|
-
# after a call param
|
1951
|
-
'call-sep': [
|
1952
|
-
include('spaces'),
|
1953
|
-
(r'\)', Punctuation, '#pop'),
|
1954
|
-
(r',', Punctuation, ('#pop', 'call')),
|
1955
|
-
],
|
1956
|
-
|
1957
|
-
# bracket can be block or object
|
1958
|
-
'bracket': [
|
1959
|
-
include('spaces'),
|
1960
|
-
(r'(?!(?:\$\s*[a-z]\b|\$(?!'+ident+')))' + ident_no_keyword, Name,
|
1961
|
-
('#pop', 'bracket-check')),
|
1962
|
-
(r"'", String.Single, ('#pop', 'bracket-check', 'string-single')),
|
1963
|
-
(r'"', String.Double, ('#pop', 'bracket-check', 'string-double')),
|
1964
|
-
default(('#pop', 'block')),
|
1965
|
-
],
|
1966
|
-
|
1967
|
-
'bracket-check': [
|
1968
|
-
include('spaces'),
|
1969
|
-
(r':', Punctuation, ('#pop', 'object-sep', 'expr')), #is object
|
1970
|
-
default(('#pop', 'block', 'optional-semicolon', 'expr-chain')), #is block
|
1971
|
-
],
|
1972
|
-
|
1973
|
-
# code block
|
1974
|
-
'block': [
|
1975
|
-
include('spaces'),
|
1976
|
-
(r'\}', Punctuation, '#pop'),
|
1977
|
-
default('expr-statement'),
|
1978
|
-
],
|
1979
|
-
|
1980
|
-
# object in key-value pairs
|
1981
|
-
'object': [
|
1982
|
-
include('spaces'),
|
1983
|
-
(r'\}', Punctuation, '#pop'),
|
1984
|
-
default(('#pop', 'object-sep', 'expr', 'colon', 'ident-or-string'))
|
1985
|
-
],
|
1986
|
-
|
1987
|
-
# a key of an object
|
1988
|
-
'ident-or-string': [
|
1989
|
-
include('spaces'),
|
1990
|
-
(ident_no_keyword, Name, '#pop'),
|
1991
|
-
(r"'", String.Single, ('#pop', 'string-single')),
|
1992
|
-
(r'"', String.Double, ('#pop', 'string-double')),
|
1993
|
-
],
|
1994
|
-
|
1995
|
-
# after a key-value pair in object
|
1996
|
-
'object-sep': [
|
1997
|
-
include('spaces'),
|
1998
|
-
(r'\}', Punctuation, '#pop'),
|
1999
|
-
(r',', Punctuation, ('#pop', 'object')),
|
2000
|
-
],
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
}
|
2005
|
-
|
2006
|
-
def analyse_text(text):
|
2007
|
-
if re.match(r'\w+\s*:\s*\w', text): return 0.3
|
2008
|
-
|
2009
|
-
|
2010
|
-
def _indentation(lexer, match, ctx):
|
2011
|
-
indentation = match.group(0)
|
2012
|
-
yield match.start(), Text, indentation
|
2013
|
-
ctx.last_indentation = indentation
|
2014
|
-
ctx.pos = match.end()
|
2015
|
-
|
2016
|
-
if hasattr(ctx, 'block_state') and ctx.block_state and \
|
2017
|
-
indentation.startswith(ctx.block_indentation) and \
|
2018
|
-
indentation != ctx.block_indentation:
|
2019
|
-
ctx.stack.append(ctx.block_state)
|
2020
|
-
else:
|
2021
|
-
ctx.block_state = None
|
2022
|
-
ctx.block_indentation = None
|
2023
|
-
ctx.stack.append('content')
|
2024
|
-
|
2025
|
-
def _starts_block(token, state):
|
2026
|
-
def callback(lexer, match, ctx):
|
2027
|
-
yield match.start(), token, match.group(0)
|
2028
|
-
|
2029
|
-
if hasattr(ctx, 'last_indentation'):
|
2030
|
-
ctx.block_indentation = ctx.last_indentation
|
2031
|
-
else:
|
2032
|
-
ctx.block_indentation = ''
|
2033
|
-
|
2034
|
-
ctx.block_state = state
|
2035
|
-
ctx.pos = match.end()
|
2036
|
-
|
2037
|
-
return callback
|
2038
|
-
|
2039
|
-
|
2040
|
-
class HamlLexer(ExtendedRegexLexer):
|
2041
|
-
"""
|
2042
|
-
For Haml markup.
|
2043
|
-
|
2044
|
-
.. versionadded:: 1.3
|
2045
|
-
"""
|
2046
|
-
|
2047
|
-
name = 'Haml'
|
2048
|
-
aliases = ['haml']
|
2049
|
-
filenames = ['*.haml']
|
2050
|
-
mimetypes = ['text/x-haml']
|
2051
|
-
|
2052
|
-
flags = re.IGNORECASE
|
2053
|
-
# Haml can include " |\n" anywhere,
|
2054
|
-
# which is ignored and used to wrap long lines.
|
2055
|
-
# To accomodate this, use this custom faux dot instead.
|
2056
|
-
_dot = r'(?: \|\n(?=.* \|)|.)'
|
2057
|
-
|
2058
|
-
# In certain places, a comma at the end of the line
|
2059
|
-
# allows line wrapping as well.
|
2060
|
-
_comma_dot = r'(?:,\s*\n|' + _dot + ')'
|
2061
|
-
tokens = {
|
2062
|
-
'root': [
|
2063
|
-
(r'[ \t]*\n', Text),
|
2064
|
-
(r'[ \t]*', _indentation),
|
2065
|
-
],
|
2066
|
-
|
2067
|
-
'css': [
|
2068
|
-
(r'\.[\w:-]+', Name.Class, 'tag'),
|
2069
|
-
(r'\#[\w:-]+', Name.Function, 'tag'),
|
2070
|
-
],
|
2071
|
-
|
2072
|
-
'eval-or-plain': [
|
2073
|
-
(r'[&!]?==', Punctuation, 'plain'),
|
2074
|
-
(r'([&!]?[=~])(' + _comma_dot + r'*\n)',
|
2075
|
-
bygroups(Punctuation, using(RubyLexer)),
|
2076
|
-
'root'),
|
2077
|
-
default('plain'),
|
2078
|
-
],
|
2079
|
-
|
2080
|
-
'content': [
|
2081
|
-
include('css'),
|
2082
|
-
(r'%[\w:-]+', Name.Tag, 'tag'),
|
2083
|
-
(r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
|
2084
|
-
(r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
|
2085
|
-
bygroups(Comment, Comment.Special, Comment),
|
2086
|
-
'#pop'),
|
2087
|
-
(r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'),
|
2088
|
-
'#pop'),
|
2089
|
-
(r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc,
|
2090
|
-
'haml-comment-block'), '#pop'),
|
2091
|
-
(r'(-)(' + _comma_dot + r'*\n)',
|
2092
|
-
bygroups(Punctuation, using(RubyLexer)),
|
2093
|
-
'#pop'),
|
2094
|
-
(r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'),
|
2095
|
-
'#pop'),
|
2096
|
-
include('eval-or-plain'),
|
2097
|
-
],
|
2098
|
-
|
2099
|
-
'tag': [
|
2100
|
-
include('css'),
|
2101
|
-
(r'\{(,\n|' + _dot + ')*?\}', using(RubyLexer)),
|
2102
|
-
(r'\[' + _dot + '*?\]', using(RubyLexer)),
|
2103
|
-
(r'\(', Text, 'html-attributes'),
|
2104
|
-
(r'/[ \t]*\n', Punctuation, '#pop:2'),
|
2105
|
-
(r'[<>]{1,2}(?=[ \t=])', Punctuation),
|
2106
|
-
include('eval-or-plain'),
|
2107
|
-
],
|
2108
|
-
|
2109
|
-
'plain': [
|
2110
|
-
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text),
|
2111
|
-
(r'(#\{)(' + _dot + '*?)(\})',
|
2112
|
-
bygroups(String.Interpol, using(RubyLexer), String.Interpol)),
|
2113
|
-
(r'\n', Text, 'root'),
|
2114
|
-
],
|
2115
|
-
|
2116
|
-
'html-attributes': [
|
2117
|
-
(r'\s+', Text),
|
2118
|
-
(r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'),
|
2119
|
-
(r'[\w:-]+', Name.Attribute),
|
2120
|
-
(r'\)', Text, '#pop'),
|
2121
|
-
],
|
2122
|
-
|
2123
|
-
'html-attribute-value': [
|
2124
|
-
(r'[ \t]+', Text),
|
2125
|
-
(r'\w+', Name.Variable, '#pop'),
|
2126
|
-
(r'@\w+', Name.Variable.Instance, '#pop'),
|
2127
|
-
(r'\$\w+', Name.Variable.Global, '#pop'),
|
2128
|
-
(r"'(\\\\|\\'|[^'\n])*'", String, '#pop'),
|
2129
|
-
(r'"(\\\\|\\"|[^"\n])*"', String, '#pop'),
|
2130
|
-
],
|
2131
|
-
|
2132
|
-
'html-comment-block': [
|
2133
|
-
(_dot + '+', Comment),
|
2134
|
-
(r'\n', Text, 'root'),
|
2135
|
-
],
|
2136
|
-
|
2137
|
-
'haml-comment-block': [
|
2138
|
-
(_dot + '+', Comment.Preproc),
|
2139
|
-
(r'\n', Text, 'root'),
|
2140
|
-
],
|
2141
|
-
|
2142
|
-
'filter-block': [
|
2143
|
-
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Name.Decorator),
|
2144
|
-
(r'(#\{)(' + _dot + '*?)(\})',
|
2145
|
-
bygroups(String.Interpol, using(RubyLexer), String.Interpol)),
|
2146
|
-
(r'\n', Text, 'root'),
|
2147
|
-
],
|
2148
|
-
}
|
2149
|
-
|
2150
|
-
|
2151
|
-
common_sass_tokens = {
|
2152
|
-
'value': [
|
2153
|
-
(r'[ \t]+', Text),
|
2154
|
-
(r'[!$][\w-]+', Name.Variable),
|
2155
|
-
(r'url\(', String.Other, 'string-url'),
|
2156
|
-
(r'[a-z_-][\w-]*(?=\()', Name.Function),
|
2157
|
-
(r'(azimuth|background-attachment|background-color|'
|
2158
|
-
r'background-image|background-position|background-repeat|'
|
2159
|
-
r'background|border-bottom-color|border-bottom-style|'
|
2160
|
-
r'border-bottom-width|border-left-color|border-left-style|'
|
2161
|
-
r'border-left-width|border-right|border-right-color|'
|
2162
|
-
r'border-right-style|border-right-width|border-top-color|'
|
2163
|
-
r'border-top-style|border-top-width|border-bottom|'
|
2164
|
-
r'border-collapse|border-left|border-width|border-color|'
|
2165
|
-
r'border-spacing|border-style|border-top|border|caption-side|'
|
2166
|
-
r'clear|clip|color|content|counter-increment|counter-reset|'
|
2167
|
-
r'cue-after|cue-before|cue|cursor|direction|display|'
|
2168
|
-
r'elevation|empty-cells|float|font-family|font-size|'
|
2169
|
-
r'font-size-adjust|font-stretch|font-style|font-variant|'
|
2170
|
-
r'font-weight|font|height|letter-spacing|line-height|'
|
2171
|
-
r'list-style-type|list-style-image|list-style-position|'
|
2172
|
-
r'list-style|margin-bottom|margin-left|margin-right|'
|
2173
|
-
r'margin-top|margin|marker-offset|marks|max-height|max-width|'
|
2174
|
-
r'min-height|min-width|opacity|orphans|outline|outline-color|'
|
2175
|
-
r'outline-style|outline-width|overflow|padding-bottom|'
|
2176
|
-
r'padding-left|padding-right|padding-top|padding|page|'
|
2177
|
-
r'page-break-after|page-break-before|page-break-inside|'
|
2178
|
-
r'pause-after|pause-before|pause|pitch|pitch-range|'
|
2179
|
-
r'play-during|position|quotes|richness|right|size|'
|
2180
|
-
r'speak-header|speak-numeral|speak-punctuation|speak|'
|
2181
|
-
r'speech-rate|stress|table-layout|text-align|text-decoration|'
|
2182
|
-
r'text-indent|text-shadow|text-transform|top|unicode-bidi|'
|
2183
|
-
r'vertical-align|visibility|voice-family|volume|white-space|'
|
2184
|
-
r'widows|width|word-spacing|z-index|bottom|left|'
|
2185
|
-
r'above|absolute|always|armenian|aural|auto|avoid|baseline|'
|
2186
|
-
r'behind|below|bidi-override|blink|block|bold|bolder|both|'
|
2187
|
-
r'capitalize|center-left|center-right|center|circle|'
|
2188
|
-
r'cjk-ideographic|close-quote|collapse|condensed|continuous|'
|
2189
|
-
r'crop|crosshair|cross|cursive|dashed|decimal-leading-zero|'
|
2190
|
-
r'decimal|default|digits|disc|dotted|double|e-resize|embed|'
|
2191
|
-
r'extra-condensed|extra-expanded|expanded|fantasy|far-left|'
|
2192
|
-
r'far-right|faster|fast|fixed|georgian|groove|hebrew|help|'
|
2193
|
-
r'hidden|hide|higher|high|hiragana-iroha|hiragana|icon|'
|
2194
|
-
r'inherit|inline-table|inline|inset|inside|invert|italic|'
|
2195
|
-
r'justify|katakana-iroha|katakana|landscape|larger|large|'
|
2196
|
-
r'left-side|leftwards|level|lighter|line-through|list-item|'
|
2197
|
-
r'loud|lower-alpha|lower-greek|lower-roman|lowercase|ltr|'
|
2198
|
-
r'lower|low|medium|message-box|middle|mix|monospace|'
|
2199
|
-
r'n-resize|narrower|ne-resize|no-close-quote|no-open-quote|'
|
2200
|
-
r'no-repeat|none|normal|nowrap|nw-resize|oblique|once|'
|
2201
|
-
r'open-quote|outset|outside|overline|pointer|portrait|px|'
|
2202
|
-
r'relative|repeat-x|repeat-y|repeat|rgb|ridge|right-side|'
|
2203
|
-
r'rightwards|s-resize|sans-serif|scroll|se-resize|'
|
2204
|
-
r'semi-condensed|semi-expanded|separate|serif|show|silent|'
|
2205
|
-
r'slow|slower|small-caps|small-caption|smaller|soft|solid|'
|
2206
|
-
r'spell-out|square|static|status-bar|super|sw-resize|'
|
2207
|
-
r'table-caption|table-cell|table-column|table-column-group|'
|
2208
|
-
r'table-footer-group|table-header-group|table-row|'
|
2209
|
-
r'table-row-group|text|text-bottom|text-top|thick|thin|'
|
2210
|
-
r'transparent|ultra-condensed|ultra-expanded|underline|'
|
2211
|
-
r'upper-alpha|upper-latin|upper-roman|uppercase|url|'
|
2212
|
-
r'visible|w-resize|wait|wider|x-fast|x-high|x-large|x-loud|'
|
2213
|
-
r'x-low|x-small|x-soft|xx-large|xx-small|yes)\b', Name.Constant),
|
2214
|
-
(r'(indigo|gold|firebrick|indianred|darkolivegreen|'
|
2215
|
-
r'darkseagreen|mediumvioletred|mediumorchid|chartreuse|'
|
2216
|
-
r'mediumslateblue|springgreen|crimson|lightsalmon|brown|'
|
2217
|
-
r'turquoise|olivedrab|cyan|skyblue|darkturquoise|'
|
2218
|
-
r'goldenrod|darkgreen|darkviolet|darkgray|lightpink|'
|
2219
|
-
r'darkmagenta|lightgoldenrodyellow|lavender|yellowgreen|thistle|'
|
2220
|
-
r'violet|orchid|ghostwhite|honeydew|cornflowerblue|'
|
2221
|
-
r'darkblue|darkkhaki|mediumpurple|cornsilk|bisque|slategray|'
|
2222
|
-
r'darkcyan|khaki|wheat|deepskyblue|darkred|steelblue|aliceblue|'
|
2223
|
-
r'gainsboro|mediumturquoise|floralwhite|coral|lightgrey|'
|
2224
|
-
r'lightcyan|darksalmon|beige|azure|lightsteelblue|oldlace|'
|
2225
|
-
r'greenyellow|royalblue|lightseagreen|mistyrose|sienna|'
|
2226
|
-
r'lightcoral|orangered|navajowhite|palegreen|burlywood|'
|
2227
|
-
r'seashell|mediumspringgreen|papayawhip|blanchedalmond|'
|
2228
|
-
r'peru|aquamarine|darkslategray|ivory|dodgerblue|'
|
2229
|
-
r'lemonchiffon|chocolate|orange|forestgreen|slateblue|'
|
2230
|
-
r'mintcream|antiquewhite|darkorange|cadetblue|moccasin|'
|
2231
|
-
r'limegreen|saddlebrown|darkslateblue|lightskyblue|deeppink|'
|
2232
|
-
r'plum|darkgoldenrod|sandybrown|magenta|tan|'
|
2233
|
-
r'rosybrown|pink|lightblue|palevioletred|mediumseagreen|'
|
2234
|
-
r'dimgray|powderblue|seagreen|snow|mediumblue|midnightblue|'
|
2235
|
-
r'paleturquoise|palegoldenrod|whitesmoke|darkorchid|salmon|'
|
2236
|
-
r'lightslategray|lawngreen|lightgreen|tomato|hotpink|'
|
2237
|
-
r'lightyellow|lavenderblush|linen|mediumaquamarine|'
|
2238
|
-
r'blueviolet|peachpuff)\b', Name.Entity),
|
2239
|
-
(r'(black|silver|gray|white|maroon|red|purple|fuchsia|green|'
|
2240
|
-
r'lime|olive|yellow|navy|blue|teal|aqua)\b', Name.Builtin),
|
2241
|
-
(r'\!(important|default)', Name.Exception),
|
2242
|
-
(r'(true|false)', Name.Pseudo),
|
2243
|
-
(r'(and|or|not)', Operator.Word),
|
2244
|
-
(r'/\*', Comment.Multiline, 'inline-comment'),
|
2245
|
-
(r'//[^\n]*', Comment.Single),
|
2246
|
-
(r'\#[a-z0-9]{1,6}', Number.Hex),
|
2247
|
-
(r'(-?\d+)(\%|[a-z]+)?', bygroups(Number.Integer, Keyword.Type)),
|
2248
|
-
(r'(-?\d*\.\d+)(\%|[a-z]+)?', bygroups(Number.Float, Keyword.Type)),
|
2249
|
-
(r'#{', String.Interpol, 'interpolation'),
|
2250
|
-
(r'[~\^\*!&%<>\|+=@:,./?-]+', Operator),
|
2251
|
-
(r'[\[\]()]+', Punctuation),
|
2252
|
-
(r'"', String.Double, 'string-double'),
|
2253
|
-
(r"'", String.Single, 'string-single'),
|
2254
|
-
(r'[a-z_-][\w-]*', Name),
|
2255
|
-
],
|
2256
|
-
|
2257
|
-
'interpolation': [
|
2258
|
-
(r'\}', String.Interpol, '#pop'),
|
2259
|
-
include('value'),
|
2260
|
-
],
|
2261
|
-
|
2262
|
-
'selector': [
|
2263
|
-
(r'[ \t]+', Text),
|
2264
|
-
(r'\:', Name.Decorator, 'pseudo-class'),
|
2265
|
-
(r'\.', Name.Class, 'class'),
|
2266
|
-
(r'\#', Name.Namespace, 'id'),
|
2267
|
-
(r'[\w-]+', Name.Tag),
|
2268
|
-
(r'#\{', String.Interpol, 'interpolation'),
|
2269
|
-
(r'&', Keyword),
|
2270
|
-
(r'[~\^\*!&\[\]\(\)<>\|+=@:;,./?-]', Operator),
|
2271
|
-
(r'"', String.Double, 'string-double'),
|
2272
|
-
(r"'", String.Single, 'string-single'),
|
2273
|
-
],
|
2274
|
-
|
2275
|
-
'string-double': [
|
2276
|
-
(r'(\\.|#(?=[^\n{])|[^\n"#])+', String.Double),
|
2277
|
-
(r'#\{', String.Interpol, 'interpolation'),
|
2278
|
-
(r'"', String.Double, '#pop'),
|
2279
|
-
],
|
2280
|
-
|
2281
|
-
'string-single': [
|
2282
|
-
(r"(\\.|#(?=[^\n{])|[^\n'#])+", String.Double),
|
2283
|
-
(r'#\{', String.Interpol, 'interpolation'),
|
2284
|
-
(r"'", String.Double, '#pop'),
|
2285
|
-
],
|
2286
|
-
|
2287
|
-
'string-url': [
|
2288
|
-
(r'(\\#|#(?=[^\n{])|[^\n#)])+', String.Other),
|
2289
|
-
(r'#\{', String.Interpol, 'interpolation'),
|
2290
|
-
(r'\)', String.Other, '#pop'),
|
2291
|
-
],
|
2292
|
-
|
2293
|
-
'pseudo-class': [
|
2294
|
-
(r'[\w-]+', Name.Decorator),
|
2295
|
-
(r'#\{', String.Interpol, 'interpolation'),
|
2296
|
-
default('#pop'),
|
2297
|
-
],
|
2298
|
-
|
2299
|
-
'class': [
|
2300
|
-
(r'[\w-]+', Name.Class),
|
2301
|
-
(r'#\{', String.Interpol, 'interpolation'),
|
2302
|
-
default('#pop'),
|
2303
|
-
],
|
2304
|
-
|
2305
|
-
'id': [
|
2306
|
-
(r'[\w-]+', Name.Namespace),
|
2307
|
-
(r'#\{', String.Interpol, 'interpolation'),
|
2308
|
-
default('#pop'),
|
2309
|
-
],
|
2310
|
-
|
2311
|
-
'for': [
|
2312
|
-
(r'(from|to|through)', Operator.Word),
|
2313
|
-
include('value'),
|
2314
|
-
],
|
2315
|
-
}
|
2316
|
-
|
2317
|
-
class SassLexer(ExtendedRegexLexer):
|
2318
|
-
"""
|
2319
|
-
For Sass stylesheets.
|
2320
|
-
|
2321
|
-
.. versionadded:: 1.3
|
2322
|
-
"""
|
2323
|
-
|
2324
|
-
name = 'Sass'
|
2325
|
-
aliases = ['sass']
|
2326
|
-
filenames = ['*.sass']
|
2327
|
-
mimetypes = ['text/x-sass']
|
2328
|
-
|
2329
|
-
flags = re.IGNORECASE
|
2330
|
-
tokens = {
|
2331
|
-
'root': [
|
2332
|
-
(r'[ \t]*\n', Text),
|
2333
|
-
(r'[ \t]*', _indentation),
|
2334
|
-
],
|
2335
|
-
|
2336
|
-
'content': [
|
2337
|
-
(r'//[^\n]*', _starts_block(Comment.Single, 'single-comment'),
|
2338
|
-
'root'),
|
2339
|
-
(r'/\*[^\n]*', _starts_block(Comment.Multiline, 'multi-comment'),
|
2340
|
-
'root'),
|
2341
|
-
(r'@import', Keyword, 'import'),
|
2342
|
-
(r'@for', Keyword, 'for'),
|
2343
|
-
(r'@(debug|warn|if|while)', Keyword, 'value'),
|
2344
|
-
(r'(@mixin)( [\w-]+)', bygroups(Keyword, Name.Function), 'value'),
|
2345
|
-
(r'(@include)( [\w-]+)', bygroups(Keyword, Name.Decorator), 'value'),
|
2346
|
-
(r'@extend', Keyword, 'selector'),
|
2347
|
-
(r'@[\w-]+', Keyword, 'selector'),
|
2348
|
-
(r'=[\w-]+', Name.Function, 'value'),
|
2349
|
-
(r'\+[\w-]+', Name.Decorator, 'value'),
|
2350
|
-
(r'([!$][\w-]\w*)([ \t]*(?:(?:\|\|)?=|:))',
|
2351
|
-
bygroups(Name.Variable, Operator), 'value'),
|
2352
|
-
(r':', Name.Attribute, 'old-style-attr'),
|
2353
|
-
(r'(?=.+?[=:]([^a-z]|$))', Name.Attribute, 'new-style-attr'),
|
2354
|
-
default('selector'),
|
2355
|
-
],
|
2356
|
-
|
2357
|
-
'single-comment': [
|
2358
|
-
(r'.+', Comment.Single),
|
2359
|
-
(r'\n', Text, 'root'),
|
2360
|
-
],
|
2361
|
-
|
2362
|
-
'multi-comment': [
|
2363
|
-
(r'.+', Comment.Multiline),
|
2364
|
-
(r'\n', Text, 'root'),
|
2365
|
-
],
|
2366
|
-
|
2367
|
-
'import': [
|
2368
|
-
(r'[ \t]+', Text),
|
2369
|
-
(r'\S+', String),
|
2370
|
-
(r'\n', Text, 'root'),
|
2371
|
-
],
|
2372
|
-
|
2373
|
-
'old-style-attr': [
|
2374
|
-
(r'[^\s:="\[]+', Name.Attribute),
|
2375
|
-
(r'#{', String.Interpol, 'interpolation'),
|
2376
|
-
(r'[ \t]*=', Operator, 'value'),
|
2377
|
-
default('value'),
|
2378
|
-
],
|
2379
|
-
|
2380
|
-
'new-style-attr': [
|
2381
|
-
(r'[^\s:="\[]+', Name.Attribute),
|
2382
|
-
(r'#{', String.Interpol, 'interpolation'),
|
2383
|
-
(r'[ \t]*[=:]', Operator, 'value'),
|
2384
|
-
],
|
2385
|
-
|
2386
|
-
'inline-comment': [
|
2387
|
-
(r"(\\#|#(?=[^\n{])|\*(?=[^\n/])|[^\n#*])+", Comment.Multiline),
|
2388
|
-
(r'#\{', String.Interpol, 'interpolation'),
|
2389
|
-
(r"\*/", Comment, '#pop'),
|
2390
|
-
],
|
2391
|
-
}
|
2392
|
-
for group, common in iteritems(common_sass_tokens):
|
2393
|
-
tokens[group] = copy.copy(common)
|
2394
|
-
tokens['value'].append((r'\n', Text, 'root'))
|
2395
|
-
tokens['selector'].append((r'\n', Text, 'root'))
|
2396
|
-
|
2397
|
-
|
2398
|
-
class ScssLexer(RegexLexer):
|
2399
|
-
"""
|
2400
|
-
For SCSS stylesheets.
|
2401
|
-
"""
|
2402
|
-
|
2403
|
-
name = 'SCSS'
|
2404
|
-
aliases = ['scss']
|
2405
|
-
filenames = ['*.scss']
|
2406
|
-
mimetypes = ['text/x-scss']
|
2407
|
-
|
2408
|
-
flags = re.IGNORECASE | re.DOTALL
|
2409
|
-
tokens = {
|
2410
|
-
'root': [
|
2411
|
-
(r'\s+', Text),
|
2412
|
-
(r'//.*?\n', Comment.Single),
|
2413
|
-
(r'/\*.*?\*/', Comment.Multiline),
|
2414
|
-
(r'@import', Keyword, 'value'),
|
2415
|
-
(r'@for', Keyword, 'for'),
|
2416
|
-
(r'@(debug|warn|if|while)', Keyword, 'value'),
|
2417
|
-
(r'(@mixin)( [\w-]+)', bygroups(Keyword, Name.Function), 'value'),
|
2418
|
-
(r'(@include)( [\w-]+)', bygroups(Keyword, Name.Decorator), 'value'),
|
2419
|
-
(r'@extend', Keyword, 'selector'),
|
2420
|
-
(r'@[\w-]+', Keyword, 'selector'),
|
2421
|
-
(r'(\$[\w-]*\w)([ \t]*:)', bygroups(Name.Variable, Operator), 'value'),
|
2422
|
-
(r'(?=[^;{}][;}])', Name.Attribute, 'attr'),
|
2423
|
-
(r'(?=[^;{}:]+:[^a-z])', Name.Attribute, 'attr'),
|
2424
|
-
default('selector'),
|
2425
|
-
],
|
2426
|
-
|
2427
|
-
'attr': [
|
2428
|
-
(r'[^\s:="\[]+', Name.Attribute),
|
2429
|
-
(r'#{', String.Interpol, 'interpolation'),
|
2430
|
-
(r'[ \t]*:', Operator, 'value'),
|
2431
|
-
],
|
2432
|
-
|
2433
|
-
'inline-comment': [
|
2434
|
-
(r"(\\#|#(?=[^{])|\*(?=[^/])|[^#*])+", Comment.Multiline),
|
2435
|
-
(r'#\{', String.Interpol, 'interpolation'),
|
2436
|
-
(r"\*/", Comment, '#pop'),
|
2437
|
-
],
|
2438
|
-
}
|
2439
|
-
for group, common in iteritems(common_sass_tokens):
|
2440
|
-
tokens[group] = copy.copy(common)
|
2441
|
-
tokens['value'].extend([(r'\n', Text), (r'[;{}]', Punctuation, 'root')])
|
2442
|
-
tokens['selector'].extend([(r'\n', Text), (r'[;{}]', Punctuation, 'root')])
|
2443
|
-
|
2444
|
-
|
2445
|
-
class CoffeeScriptLexer(RegexLexer):
|
2446
|
-
"""
|
2447
|
-
For `CoffeeScript`_ source code.
|
2448
|
-
|
2449
|
-
.. _CoffeeScript: http://coffeescript.org
|
2450
|
-
|
2451
|
-
.. versionadded:: 1.3
|
2452
|
-
"""
|
2453
|
-
|
2454
|
-
name = 'CoffeeScript'
|
2455
|
-
aliases = ['coffee-script', 'coffeescript', 'coffee']
|
2456
|
-
filenames = ['*.coffee']
|
2457
|
-
mimetypes = ['text/coffeescript']
|
2458
|
-
|
2459
|
-
flags = re.DOTALL
|
2460
|
-
tokens = {
|
2461
|
-
'commentsandwhitespace': [
|
2462
|
-
(r'\s+', Text),
|
2463
|
-
(r'###[^#].*?###', Comment.Multiline),
|
2464
|
-
(r'#(?!##[^#]).*?\n', Comment.Single),
|
2465
|
-
],
|
2466
|
-
'multilineregex': [
|
2467
|
-
(r'[^/#]+', String.Regex),
|
2468
|
-
(r'///([gim]+\b|\B)', String.Regex, '#pop'),
|
2469
|
-
(r'#{', String.Interpol, 'interpoling_string'),
|
2470
|
-
(r'[/#]', String.Regex),
|
2471
|
-
],
|
2472
|
-
'slashstartsregex': [
|
2473
|
-
include('commentsandwhitespace'),
|
2474
|
-
(r'///', String.Regex, ('#pop', 'multilineregex')),
|
2475
|
-
(r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
2476
|
-
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
2477
|
-
default('#pop'),
|
2478
|
-
],
|
2479
|
-
'root': [
|
2480
|
-
# this next expr leads to infinite loops root -> slashstartsregex
|
2481
|
-
#(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
2482
|
-
include('commentsandwhitespace'),
|
2483
|
-
(r'\+\+|~|&&|\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|\?|:|'
|
2484
|
-
r'\|\||\\(?=\n)|'
|
2485
|
-
r'(<<|>>>?|==?(?!>)|!=?|=(?!>)|-(?!>)|[<>+*`%&\|\^/])=?',
|
2486
|
-
Operator, 'slashstartsregex'),
|
2487
|
-
(r'(?:\([^()]*\))?\s*[=-]>', Name.Function),
|
2488
|
-
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
2489
|
-
(r'[})\].]', Punctuation),
|
2490
|
-
(r'(?<![\.\$])(for|own|in|of|while|until|'
|
2491
|
-
r'loop|break|return|continue|'
|
2492
|
-
r'switch|when|then|if|unless|else|'
|
2493
|
-
r'throw|try|catch|finally|new|delete|typeof|instanceof|super|'
|
2494
|
-
r'extends|this|class|by)\b', Keyword, 'slashstartsregex'),
|
2495
|
-
(r'(?<![\.\$])(true|false|yes|no|on|off|null|'
|
2496
|
-
r'NaN|Infinity|undefined)\b',
|
2497
|
-
Keyword.Constant),
|
2498
|
-
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
2499
|
-
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
2500
|
-
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
2501
|
-
r'eval|isFinite|isNaN|parseFloat|parseInt|document|window)\b',
|
2502
|
-
Name.Builtin),
|
2503
|
-
(r'[$a-zA-Z_][\w\.:\$]*\s*[:=]\s', Name.Variable,
|
2504
|
-
'slashstartsregex'),
|
2505
|
-
(r'@[$a-zA-Z_][\w\.:\$]*\s*[:=]\s', Name.Variable.Instance,
|
2506
|
-
'slashstartsregex'),
|
2507
|
-
(r'@', Name.Other, 'slashstartsregex'),
|
2508
|
-
(r'@?[$a-zA-Z_][\w\$]*', Name.Other, 'slashstartsregex'),
|
2509
|
-
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
2510
|
-
(r'0x[0-9a-fA-F]+', Number.Hex),
|
2511
|
-
(r'[0-9]+', Number.Integer),
|
2512
|
-
('"""', String, 'tdqs'),
|
2513
|
-
("'''", String, 'tsqs'),
|
2514
|
-
('"', String, 'dqs'),
|
2515
|
-
("'", String, 'sqs'),
|
2516
|
-
],
|
2517
|
-
'strings': [
|
2518
|
-
(r'[^#\\\'"]+', String),
|
2519
|
-
# note that all coffee script strings are multi-line.
|
2520
|
-
# hashmarks, quotes and backslashes must be parsed one at a time
|
2521
|
-
],
|
2522
|
-
'interpoling_string' : [
|
2523
|
-
(r'}', String.Interpol, "#pop"),
|
2524
|
-
include('root')
|
2525
|
-
],
|
2526
|
-
'dqs': [
|
2527
|
-
(r'"', String, '#pop'),
|
2528
|
-
(r'\\.|\'', String), # double-quoted string don't need ' escapes
|
2529
|
-
(r'#{', String.Interpol, "interpoling_string"),
|
2530
|
-
(r'#', String),
|
2531
|
-
include('strings')
|
2532
|
-
],
|
2533
|
-
'sqs': [
|
2534
|
-
(r"'", String, '#pop'),
|
2535
|
-
(r'#|\\.|"', String), # single quoted strings don't need " escapses
|
2536
|
-
include('strings')
|
2537
|
-
],
|
2538
|
-
'tdqs': [
|
2539
|
-
(r'"""', String, '#pop'),
|
2540
|
-
(r'\\.|\'|"', String), # no need to escape quotes in triple-string
|
2541
|
-
(r'#{', String.Interpol, "interpoling_string"),
|
2542
|
-
(r'#', String),
|
2543
|
-
include('strings'),
|
2544
|
-
],
|
2545
|
-
'tsqs': [
|
2546
|
-
(r"'''", String, '#pop'),
|
2547
|
-
(r'#|\\.|\'|"', String), # no need to escape quotes in triple-strings
|
2548
|
-
include('strings')
|
2549
|
-
],
|
2550
|
-
}
|
2551
|
-
|
2552
|
-
|
2553
|
-
class KalLexer(RegexLexer):
|
2554
|
-
"""
|
2555
|
-
For `Kal`_ source code.
|
2556
|
-
|
2557
|
-
.. _Kal: http://rzimmerman.github.io/kal
|
2558
|
-
|
2559
|
-
|
2560
|
-
.. versionadded:: 2.0
|
2561
|
-
"""
|
2562
|
-
|
2563
|
-
name = 'Kal'
|
2564
|
-
aliases = ['kal']
|
2565
|
-
filenames = ['*.kal']
|
2566
|
-
mimetypes = ['text/kal', 'application/kal']
|
2567
|
-
|
2568
|
-
flags = re.DOTALL
|
2569
|
-
tokens = {
|
2570
|
-
'commentsandwhitespace': [
|
2571
|
-
(r'\s+', Text),
|
2572
|
-
(r'###[^#].*?###', Comment.Multiline),
|
2573
|
-
(r'#(?!##[^#]).*?\n', Comment.Single),
|
2574
|
-
],
|
2575
|
-
'functiondef': [
|
2576
|
-
(r'[$a-zA-Z_][\w\$]*\s*', Name.Function, '#pop'),
|
2577
|
-
include('commentsandwhitespace'),
|
2578
|
-
],
|
2579
|
-
'classdef': [
|
2580
|
-
(r'\binherits\s+from\b', Keyword),
|
2581
|
-
(r'[$a-zA-Z_][\w\$]*\s*\n', Name.Class, '#pop'),
|
2582
|
-
(r'[$a-zA-Z_][\w\$]*\s*', Name.Class),
|
2583
|
-
include('commentsandwhitespace'),
|
2584
|
-
],
|
2585
|
-
'listcomprehension': [
|
2586
|
-
(r'\]', Punctuation, '#pop'),
|
2587
|
-
(r'\b(property|value)\b', Keyword),
|
2588
|
-
include('root'),
|
2589
|
-
],
|
2590
|
-
'waitfor': [
|
2591
|
-
(r'\n', Punctuation, '#pop'),
|
2592
|
-
(r'\bfrom\b', Keyword),
|
2593
|
-
include('root'),
|
2594
|
-
],
|
2595
|
-
'root': [
|
2596
|
-
include('commentsandwhitespace'),
|
2597
|
-
(r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
2598
|
-
r'([gim]+\b|\B)', String.Regex),
|
2599
|
-
(r'\?|:|_(?=\n)|==?|!=|-(?!>)|[<>+*/-]=?',
|
2600
|
-
Operator),
|
2601
|
-
(r'\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|'
|
2602
|
-
r'\bbut\b|\bbitwise\b|\bmod\b|\^|\bxor\b|\bexists\b|\bdoesnt\s+exist\b',
|
2603
|
-
Operator.Word),
|
2604
|
-
(r'(?:\([^()]+\))?\s*>', Name.Function),
|
2605
|
-
(r'[{(]', Punctuation),
|
2606
|
-
(r'\[', Punctuation, 'listcomprehension'),
|
2607
|
-
(r'[})\]\.\,]', Punctuation),
|
2608
|
-
(r'\b(function|method|task)\b', Keyword.Declaration, 'functiondef'),
|
2609
|
-
(r'\bclass\b', Keyword.Declaration, 'classdef'),
|
2610
|
-
(r'\b(safe\s+)?wait\s+for\b', Keyword, 'waitfor'),
|
2611
|
-
(r'\b(me|this)(\.[$a-zA-Z_][\w\.\$]*)?\b', Name.Variable.Instance),
|
2612
|
-
(r'(?<![\.\$])(for(\s+(parallel|series))?|in|of|while|until|'
|
2613
|
-
r'break|return|continue|'
|
2614
|
-
r'when|if|unless|else|otherwise|except\s+when|'
|
2615
|
-
r'throw|raise|fail\s+with|try|catch|finally|new|delete|'
|
2616
|
-
r'typeof|instanceof|super|run\s+in\s+parallel|'
|
2617
|
-
r'inherits\s+from)\b', Keyword),
|
2618
|
-
(r'(?<![\.\$])(true|false|yes|no|on|off|null|nothing|none|'
|
2619
|
-
r'NaN|Infinity|undefined)\b',
|
2620
|
-
Keyword.Constant),
|
2621
|
-
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
2622
|
-
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
2623
|
-
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
2624
|
-
r'eval|isFinite|isNaN|parseFloat|parseInt|document|window|'
|
2625
|
-
r'print)\b',
|
2626
|
-
Name.Builtin),
|
2627
|
-
(r'[$a-zA-Z_][\w\.\$]*\s*(:|[\+\-\*\/]?\=)?\b', Name.Variable),
|
2628
|
-
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
2629
|
-
(r'0x[0-9a-fA-F]+', Number.Hex),
|
2630
|
-
(r'[0-9]+', Number.Integer),
|
2631
|
-
('"""', String, 'tdqs'),
|
2632
|
-
("'''", String, 'tsqs'),
|
2633
|
-
('"', String, 'dqs'),
|
2634
|
-
("'", String, 'sqs'),
|
2635
|
-
],
|
2636
|
-
'strings': [
|
2637
|
-
(r'[^#\\\'"]+', String),
|
2638
|
-
# note that all kal strings are multi-line.
|
2639
|
-
# hashmarks, quotes and backslashes must be parsed one at a time
|
2640
|
-
],
|
2641
|
-
'interpoling_string' : [
|
2642
|
-
(r'}', String.Interpol, "#pop"),
|
2643
|
-
include('root')
|
2644
|
-
],
|
2645
|
-
'dqs': [
|
2646
|
-
(r'"', String, '#pop'),
|
2647
|
-
(r'\\.|\'', String), # double-quoted string don't need ' escapes
|
2648
|
-
(r'#{', String.Interpol, "interpoling_string"),
|
2649
|
-
include('strings')
|
2650
|
-
],
|
2651
|
-
'sqs': [
|
2652
|
-
(r"'", String, '#pop'),
|
2653
|
-
(r'#|\\.|"', String), # single quoted strings don't need " escapses
|
2654
|
-
include('strings')
|
2655
|
-
],
|
2656
|
-
'tdqs': [
|
2657
|
-
(r'"""', String, '#pop'),
|
2658
|
-
(r'\\.|\'|"', String), # no need to escape quotes in triple-string
|
2659
|
-
(r'#{', String.Interpol, "interpoling_string"),
|
2660
|
-
include('strings'),
|
2661
|
-
],
|
2662
|
-
'tsqs': [
|
2663
|
-
(r"'''", String, '#pop'),
|
2664
|
-
(r'#|\\.|\'|"', String), # no need to escape quotes in triple-strings
|
2665
|
-
include('strings')
|
2666
|
-
],
|
2667
|
-
}
|
2668
|
-
|
2669
|
-
|
2670
|
-
class LiveScriptLexer(RegexLexer):
|
2671
|
-
"""
|
2672
|
-
For `LiveScript`_ source code.
|
2673
|
-
|
2674
|
-
.. _LiveScript: http://gkz.github.com/LiveScript/
|
2675
|
-
|
2676
|
-
New in Pygments 1.6.
|
2677
|
-
"""
|
2678
|
-
|
2679
|
-
name = 'LiveScript'
|
2680
|
-
aliases = ['live-script', 'livescript']
|
2681
|
-
filenames = ['*.ls']
|
2682
|
-
mimetypes = ['text/livescript']
|
2683
|
-
|
2684
|
-
flags = re.DOTALL
|
2685
|
-
tokens = {
|
2686
|
-
'commentsandwhitespace': [
|
2687
|
-
(r'\s+', Text),
|
2688
|
-
(r'/\*.*?\*/', Comment.Multiline),
|
2689
|
-
(r'#.*?\n', Comment.Single),
|
2690
|
-
],
|
2691
|
-
'multilineregex': [
|
2692
|
-
include('commentsandwhitespace'),
|
2693
|
-
(r'//([gim]+\b|\B)', String.Regex, '#pop'),
|
2694
|
-
(r'/', String.Regex),
|
2695
|
-
(r'[^/#]+', String.Regex)
|
2696
|
-
],
|
2697
|
-
'slashstartsregex': [
|
2698
|
-
include('commentsandwhitespace'),
|
2699
|
-
(r'//', String.Regex, ('#pop', 'multilineregex')),
|
2700
|
-
(r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
2701
|
-
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
2702
|
-
default('#pop'),
|
2703
|
-
],
|
2704
|
-
'root': [
|
2705
|
-
# this next expr leads to infinite loops root -> slashstartsregex
|
2706
|
-
#(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
2707
|
-
include('commentsandwhitespace'),
|
2708
|
-
(r'(?:\([^()]+\))?[ ]*[~-]{1,2}>|'
|
2709
|
-
r'(?:\(?[^()\n]+\)?)?[ ]*<[~-]{1,2}', Name.Function),
|
2710
|
-
(r'\+\+|&&|(?<![\.\$])\b(?:and|x?or|is|isnt|not)\b|\?|:|=|'
|
2711
|
-
r'\|\||\\(?=\n)|(<<|>>>?|==?|!=?|'
|
2712
|
-
r'~(?!\~?>)|-(?!\-?>)|<(?!\[)|(?<!\])>|'
|
2713
|
-
r'[+*`%&\|\^/])=?',
|
2714
|
-
Operator, 'slashstartsregex'),
|
2715
|
-
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
2716
|
-
(r'[})\].]', Punctuation),
|
2717
|
-
(r'(?<![\.\$])(for|own|in|of|while|until|loop|break|'
|
2718
|
-
r'return|continue|switch|when|then|if|unless|else|'
|
2719
|
-
r'throw|try|catch|finally|new|delete|typeof|instanceof|super|'
|
2720
|
-
r'extends|this|class|by|const|var|to|til)\b', Keyword,
|
2721
|
-
'slashstartsregex'),
|
2722
|
-
(r'(?<![\.\$])(true|false|yes|no|on|off|'
|
2723
|
-
r'null|NaN|Infinity|undefined|void)\b',
|
2724
|
-
Keyword.Constant),
|
2725
|
-
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
2726
|
-
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
2727
|
-
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
2728
|
-
r'eval|isFinite|isNaN|parseFloat|parseInt|document|window)\b',
|
2729
|
-
Name.Builtin),
|
2730
|
-
(r'[$a-zA-Z_][\w\.\-:\$]*\s*[:=]\s', Name.Variable,
|
2731
|
-
'slashstartsregex'),
|
2732
|
-
(r'@[$a-zA-Z_][\w\.\-:\$]*\s*[:=]\s', Name.Variable.Instance,
|
2733
|
-
'slashstartsregex'),
|
2734
|
-
(r'@', Name.Other, 'slashstartsregex'),
|
2735
|
-
(r'@?[$a-zA-Z_][\w\-]*', Name.Other, 'slashstartsregex'),
|
2736
|
-
(r'[0-9]+\.[0-9]+([eE][0-9]+)?[fd]?(?:[a-zA-Z_]+)?', Number.Float),
|
2737
|
-
(r'[0-9]+(~[0-9a-z]+)?(?:[a-zA-Z_]+)?', Number.Integer),
|
2738
|
-
('"""', String, 'tdqs'),
|
2739
|
-
("'''", String, 'tsqs'),
|
2740
|
-
('"', String, 'dqs'),
|
2741
|
-
("'", String, 'sqs'),
|
2742
|
-
(r'\\\S+', String),
|
2743
|
-
(r'<\[.*?\]>', String),
|
2744
|
-
],
|
2745
|
-
'strings': [
|
2746
|
-
(r'[^#\\\'"]+', String),
|
2747
|
-
# note that all coffee script strings are multi-line.
|
2748
|
-
# hashmarks, quotes and backslashes must be parsed one at a time
|
2749
|
-
],
|
2750
|
-
'interpoling_string' : [
|
2751
|
-
(r'}', String.Interpol, "#pop"),
|
2752
|
-
include('root')
|
2753
|
-
],
|
2754
|
-
'dqs': [
|
2755
|
-
(r'"', String, '#pop'),
|
2756
|
-
(r'\\.|\'', String), # double-quoted string don't need ' escapes
|
2757
|
-
(r'#{', String.Interpol, "interpoling_string"),
|
2758
|
-
(r'#', String),
|
2759
|
-
include('strings')
|
2760
|
-
],
|
2761
|
-
'sqs': [
|
2762
|
-
(r"'", String, '#pop'),
|
2763
|
-
(r'#|\\.|"', String), # single quoted strings don't need " escapses
|
2764
|
-
include('strings')
|
2765
|
-
],
|
2766
|
-
'tdqs': [
|
2767
|
-
(r'"""', String, '#pop'),
|
2768
|
-
(r'\\.|\'|"', String), # no need to escape quotes in triple-string
|
2769
|
-
(r'#{', String.Interpol, "interpoling_string"),
|
2770
|
-
(r'#', String),
|
2771
|
-
include('strings'),
|
2772
|
-
],
|
2773
|
-
'tsqs': [
|
2774
|
-
(r"'''", String, '#pop'),
|
2775
|
-
(r'#|\\.|\'|"', String), # no need to escape quotes in triple-strings
|
2776
|
-
include('strings')
|
2777
|
-
],
|
2778
|
-
}
|
2779
|
-
|
2780
|
-
|
2781
|
-
class DuelLexer(RegexLexer):
|
2782
|
-
"""
|
2783
|
-
Lexer for Duel Views Engine (formerly JBST) markup with JavaScript code blocks.
|
2784
|
-
See http://duelengine.org/.
|
2785
|
-
See http://jsonml.org/jbst/.
|
2786
|
-
|
2787
|
-
.. versionadded:: 1.4
|
2788
|
-
"""
|
2789
|
-
|
2790
|
-
name = 'Duel'
|
2791
|
-
aliases = ['duel', 'jbst', 'jsonml+bst']
|
2792
|
-
filenames = ['*.duel','*.jbst']
|
2793
|
-
mimetypes = ['text/x-duel','text/x-jbst']
|
2794
|
-
|
2795
|
-
flags = re.DOTALL
|
2796
|
-
|
2797
|
-
tokens = {
|
2798
|
-
'root': [
|
2799
|
-
(r'(<%[@=#!:]?)(.*?)(%>)',
|
2800
|
-
bygroups(Name.Tag, using(JavascriptLexer), Name.Tag)),
|
2801
|
-
(r'(<%\$)(.*?)(:)(.*?)(%>)',
|
2802
|
-
bygroups(Name.Tag, Name.Function, Punctuation, String, Name.Tag)),
|
2803
|
-
(r'(<%--)(.*?)(--%>)',
|
2804
|
-
bygroups(Name.Tag, Comment.Multiline, Name.Tag)),
|
2805
|
-
(r'(<script.*?>)(.*?)(</script>)',
|
2806
|
-
bygroups(using(HtmlLexer),
|
2807
|
-
using(JavascriptLexer), using(HtmlLexer))),
|
2808
|
-
(r'(.+?)(?=<)', using(HtmlLexer)),
|
2809
|
-
(r'.+', using(HtmlLexer)),
|
2810
|
-
],
|
2811
|
-
}
|
2812
|
-
|
2813
|
-
|
2814
|
-
class ScamlLexer(ExtendedRegexLexer):
|
2815
|
-
"""
|
2816
|
-
For `Scaml markup <http://scalate.fusesource.org/>`_. Scaml is Haml for Scala.
|
2817
|
-
|
2818
|
-
.. versionadded:: 1.4
|
2819
|
-
"""
|
2820
|
-
|
2821
|
-
name = 'Scaml'
|
2822
|
-
aliases = ['scaml']
|
2823
|
-
filenames = ['*.scaml']
|
2824
|
-
mimetypes = ['text/x-scaml']
|
2825
|
-
|
2826
|
-
flags = re.IGNORECASE
|
2827
|
-
# Scaml does not yet support the " |\n" notation to
|
2828
|
-
# wrap long lines. Once it does, use the custom faux
|
2829
|
-
# dot instead.
|
2830
|
-
# _dot = r'(?: \|\n(?=.* \|)|.)'
|
2831
|
-
_dot = r'.'
|
2832
|
-
|
2833
|
-
tokens = {
|
2834
|
-
'root': [
|
2835
|
-
(r'[ \t]*\n', Text),
|
2836
|
-
(r'[ \t]*', _indentation),
|
2837
|
-
],
|
2838
|
-
|
2839
|
-
'css': [
|
2840
|
-
(r'\.[\w:-]+', Name.Class, 'tag'),
|
2841
|
-
(r'\#[\w:-]+', Name.Function, 'tag'),
|
2842
|
-
],
|
2843
|
-
|
2844
|
-
'eval-or-plain': [
|
2845
|
-
(r'[&!]?==', Punctuation, 'plain'),
|
2846
|
-
(r'([&!]?[=~])(' + _dot + r'*\n)',
|
2847
|
-
bygroups(Punctuation, using(ScalaLexer)),
|
2848
|
-
'root'),
|
2849
|
-
default('plain'),
|
2850
|
-
],
|
2851
|
-
|
2852
|
-
'content': [
|
2853
|
-
include('css'),
|
2854
|
-
(r'%[\w:-]+', Name.Tag, 'tag'),
|
2855
|
-
(r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
|
2856
|
-
(r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
|
2857
|
-
bygroups(Comment, Comment.Special, Comment),
|
2858
|
-
'#pop'),
|
2859
|
-
(r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'),
|
2860
|
-
'#pop'),
|
2861
|
-
(r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc,
|
2862
|
-
'scaml-comment-block'), '#pop'),
|
2863
|
-
(r'(-@\s*)(import)?(' + _dot + r'*\n)',
|
2864
|
-
bygroups(Punctuation, Keyword, using(ScalaLexer)),
|
2865
|
-
'#pop'),
|
2866
|
-
(r'(-)(' + _dot + r'*\n)',
|
2867
|
-
bygroups(Punctuation, using(ScalaLexer)),
|
2868
|
-
'#pop'),
|
2869
|
-
(r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'),
|
2870
|
-
'#pop'),
|
2871
|
-
include('eval-or-plain'),
|
2872
|
-
],
|
2873
|
-
|
2874
|
-
'tag': [
|
2875
|
-
include('css'),
|
2876
|
-
(r'\{(,\n|' + _dot + ')*?\}', using(ScalaLexer)),
|
2877
|
-
(r'\[' + _dot + '*?\]', using(ScalaLexer)),
|
2878
|
-
(r'\(', Text, 'html-attributes'),
|
2879
|
-
(r'/[ \t]*\n', Punctuation, '#pop:2'),
|
2880
|
-
(r'[<>]{1,2}(?=[ \t=])', Punctuation),
|
2881
|
-
include('eval-or-plain'),
|
2882
|
-
],
|
2883
|
-
|
2884
|
-
'plain': [
|
2885
|
-
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text),
|
2886
|
-
(r'(#\{)(' + _dot + '*?)(\})',
|
2887
|
-
bygroups(String.Interpol, using(ScalaLexer), String.Interpol)),
|
2888
|
-
(r'\n', Text, 'root'),
|
2889
|
-
],
|
2890
|
-
|
2891
|
-
'html-attributes': [
|
2892
|
-
(r'\s+', Text),
|
2893
|
-
(r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'),
|
2894
|
-
(r'[\w:-]+', Name.Attribute),
|
2895
|
-
(r'\)', Text, '#pop'),
|
2896
|
-
],
|
2897
|
-
|
2898
|
-
'html-attribute-value': [
|
2899
|
-
(r'[ \t]+', Text),
|
2900
|
-
(r'\w+', Name.Variable, '#pop'),
|
2901
|
-
(r'@\w+', Name.Variable.Instance, '#pop'),
|
2902
|
-
(r'\$\w+', Name.Variable.Global, '#pop'),
|
2903
|
-
(r"'(\\\\|\\'|[^'\n])*'", String, '#pop'),
|
2904
|
-
(r'"(\\\\|\\"|[^"\n])*"', String, '#pop'),
|
2905
|
-
],
|
2906
|
-
|
2907
|
-
'html-comment-block': [
|
2908
|
-
(_dot + '+', Comment),
|
2909
|
-
(r'\n', Text, 'root'),
|
2910
|
-
],
|
2911
|
-
|
2912
|
-
'scaml-comment-block': [
|
2913
|
-
(_dot + '+', Comment.Preproc),
|
2914
|
-
(r'\n', Text, 'root'),
|
2915
|
-
],
|
2916
|
-
|
2917
|
-
'filter-block': [
|
2918
|
-
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Name.Decorator),
|
2919
|
-
(r'(#\{)(' + _dot + '*?)(\})',
|
2920
|
-
bygroups(String.Interpol, using(ScalaLexer), String.Interpol)),
|
2921
|
-
(r'\n', Text, 'root'),
|
2922
|
-
],
|
2923
|
-
}
|
2924
|
-
|
2925
|
-
|
2926
|
-
class JadeLexer(ExtendedRegexLexer):
|
2927
|
-
"""
|
2928
|
-
For Jade markup.
|
2929
|
-
Jade is a variant of Scaml, see:
|
2930
|
-
http://scalate.fusesource.org/documentation/scaml-reference.html
|
2931
|
-
|
2932
|
-
.. versionadded:: 1.4
|
2933
|
-
"""
|
2934
|
-
|
2935
|
-
name = 'Jade'
|
2936
|
-
aliases = ['jade']
|
2937
|
-
filenames = ['*.jade']
|
2938
|
-
mimetypes = ['text/x-jade']
|
2939
|
-
|
2940
|
-
flags = re.IGNORECASE
|
2941
|
-
_dot = r'.'
|
2942
|
-
|
2943
|
-
tokens = {
|
2944
|
-
'root': [
|
2945
|
-
(r'[ \t]*\n', Text),
|
2946
|
-
(r'[ \t]*', _indentation),
|
2947
|
-
],
|
2948
|
-
|
2949
|
-
'css': [
|
2950
|
-
(r'\.[\w:-]+', Name.Class, 'tag'),
|
2951
|
-
(r'\#[\w:-]+', Name.Function, 'tag'),
|
2952
|
-
],
|
2953
|
-
|
2954
|
-
'eval-or-plain': [
|
2955
|
-
(r'[&!]?==', Punctuation, 'plain'),
|
2956
|
-
(r'([&!]?[=~])(' + _dot + r'*\n)',
|
2957
|
-
bygroups(Punctuation, using(ScalaLexer)), 'root'),
|
2958
|
-
default('plain'),
|
2959
|
-
],
|
2960
|
-
|
2961
|
-
'content': [
|
2962
|
-
include('css'),
|
2963
|
-
(r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
|
2964
|
-
(r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
|
2965
|
-
bygroups(Comment, Comment.Special, Comment),
|
2966
|
-
'#pop'),
|
2967
|
-
(r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'),
|
2968
|
-
'#pop'),
|
2969
|
-
(r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc,
|
2970
|
-
'scaml-comment-block'), '#pop'),
|
2971
|
-
(r'(-@\s*)(import)?(' + _dot + r'*\n)',
|
2972
|
-
bygroups(Punctuation, Keyword, using(ScalaLexer)),
|
2973
|
-
'#pop'),
|
2974
|
-
(r'(-)(' + _dot + r'*\n)',
|
2975
|
-
bygroups(Punctuation, using(ScalaLexer)),
|
2976
|
-
'#pop'),
|
2977
|
-
(r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'),
|
2978
|
-
'#pop'),
|
2979
|
-
(r'[\w:-]+', Name.Tag, 'tag'),
|
2980
|
-
(r'\|', Text, 'eval-or-plain'),
|
2981
|
-
],
|
2982
|
-
|
2983
|
-
'tag': [
|
2984
|
-
include('css'),
|
2985
|
-
(r'\{(,\n|' + _dot + ')*?\}', using(ScalaLexer)),
|
2986
|
-
(r'\[' + _dot + '*?\]', using(ScalaLexer)),
|
2987
|
-
(r'\(', Text, 'html-attributes'),
|
2988
|
-
(r'/[ \t]*\n', Punctuation, '#pop:2'),
|
2989
|
-
(r'[<>]{1,2}(?=[ \t=])', Punctuation),
|
2990
|
-
include('eval-or-plain'),
|
2991
|
-
],
|
2992
|
-
|
2993
|
-
'plain': [
|
2994
|
-
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text),
|
2995
|
-
(r'(#\{)(' + _dot + '*?)(\})',
|
2996
|
-
bygroups(String.Interpol, using(ScalaLexer), String.Interpol)),
|
2997
|
-
(r'\n', Text, 'root'),
|
2998
|
-
],
|
2999
|
-
|
3000
|
-
'html-attributes': [
|
3001
|
-
(r'\s+', Text),
|
3002
|
-
(r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'),
|
3003
|
-
(r'[\w:-]+', Name.Attribute),
|
3004
|
-
(r'\)', Text, '#pop'),
|
3005
|
-
],
|
3006
|
-
|
3007
|
-
'html-attribute-value': [
|
3008
|
-
(r'[ \t]+', Text),
|
3009
|
-
(r'\w+', Name.Variable, '#pop'),
|
3010
|
-
(r'@\w+', Name.Variable.Instance, '#pop'),
|
3011
|
-
(r'\$\w+', Name.Variable.Global, '#pop'),
|
3012
|
-
(r"'(\\\\|\\'|[^'\n])*'", String, '#pop'),
|
3013
|
-
(r'"(\\\\|\\"|[^"\n])*"', String, '#pop'),
|
3014
|
-
],
|
3015
|
-
|
3016
|
-
'html-comment-block': [
|
3017
|
-
(_dot + '+', Comment),
|
3018
|
-
(r'\n', Text, 'root'),
|
3019
|
-
],
|
3020
|
-
|
3021
|
-
'scaml-comment-block': [
|
3022
|
-
(_dot + '+', Comment.Preproc),
|
3023
|
-
(r'\n', Text, 'root'),
|
3024
|
-
],
|
3025
|
-
|
3026
|
-
'filter-block': [
|
3027
|
-
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Name.Decorator),
|
3028
|
-
(r'(#\{)(' + _dot + '*?)(\})',
|
3029
|
-
bygroups(String.Interpol, using(ScalaLexer), String.Interpol)),
|
3030
|
-
(r'\n', Text, 'root'),
|
3031
|
-
],
|
3032
|
-
}
|
3033
|
-
|
3034
|
-
|
3035
|
-
class XQueryLexer(ExtendedRegexLexer):
|
3036
|
-
"""
|
3037
|
-
An XQuery lexer, parsing a stream and outputting the tokens needed to
|
3038
|
-
highlight xquery code.
|
3039
|
-
|
3040
|
-
.. versionadded:: 1.4
|
3041
|
-
"""
|
3042
|
-
name = 'XQuery'
|
3043
|
-
aliases = ['xquery', 'xqy', 'xq', 'xql', 'xqm']
|
3044
|
-
filenames = ['*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm']
|
3045
|
-
mimetypes = ['text/xquery', 'application/xquery']
|
3046
|
-
|
3047
|
-
xquery_parse_state = []
|
3048
|
-
|
3049
|
-
# FIX UNICODE LATER
|
3050
|
-
#ncnamestartchar = (
|
3051
|
-
# ur"[A-Z]|_|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|"
|
3052
|
-
# ur"[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|"
|
3053
|
-
# ur"[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|"
|
3054
|
-
# ur"[\u10000-\uEFFFF]"
|
3055
|
-
#)
|
3056
|
-
ncnamestartchar = r"(?:[A-Z]|_|[a-z])"
|
3057
|
-
# FIX UNICODE LATER
|
3058
|
-
#ncnamechar = ncnamestartchar + (ur"|-|\.|[0-9]|\u00B7|[\u0300-\u036F]|"
|
3059
|
-
# ur"[\u203F-\u2040]")
|
3060
|
-
ncnamechar = r"(?:" + ncnamestartchar + r"|-|\.|[0-9])"
|
3061
|
-
ncname = "(?:%s+%s*)" % (ncnamestartchar, ncnamechar)
|
3062
|
-
pitarget_namestartchar = r"(?:[A-KN-WY-Z]|_|:|[a-kn-wy-z])"
|
3063
|
-
pitarget_namechar = r"(?:" + pitarget_namestartchar + r"|-|\.|[0-9])"
|
3064
|
-
pitarget = "%s+%s*" % (pitarget_namestartchar, pitarget_namechar)
|
3065
|
-
prefixedname = "%s:%s" % (ncname, ncname)
|
3066
|
-
unprefixedname = ncname
|
3067
|
-
qname = "(?:%s|%s)" % (prefixedname, unprefixedname)
|
3068
|
-
|
3069
|
-
entityref = r'(?:&(?:lt|gt|amp|quot|apos|nbsp);)'
|
3070
|
-
charref = r'(?:&#[0-9]+;|&#x[0-9a-fA-F]+;)'
|
3071
|
-
|
3072
|
-
stringdouble = r'(?:"(?:' + entityref + r'|' + charref + r'|""|[^&"])*")'
|
3073
|
-
stringsingle = r"(?:'(?:" + entityref + r"|" + charref + r"|''|[^&'])*')"
|
3074
|
-
|
3075
|
-
# FIX UNICODE LATER
|
3076
|
-
#elementcontentchar = (ur'\t|\r|\n|[\u0020-\u0025]|[\u0028-\u003b]|'
|
3077
|
-
# ur'[\u003d-\u007a]|\u007c|[\u007e-\u007F]')
|
3078
|
-
elementcontentchar = r'[A-Za-z]|\s|\d|[!"#$%\(\)\*\+,\-\./\:;=\?\@\[\\\]^_\'`\|~]'
|
3079
|
-
#quotattrcontentchar = (ur'\t|\r|\n|[\u0020-\u0021]|[\u0023-\u0025]|'
|
3080
|
-
# ur'[\u0027-\u003b]|[\u003d-\u007a]|\u007c|[\u007e-\u007F]')
|
3081
|
-
quotattrcontentchar = r'[A-Za-z]|\s|\d|[!#$%\(\)\*\+,\-\./\:;=\?\@\[\\\]^_\'`\|~]'
|
3082
|
-
#aposattrcontentchar = (ur'\t|\r|\n|[\u0020-\u0025]|[\u0028-\u003b]|'
|
3083
|
-
# ur'[\u003d-\u007a]|\u007c|[\u007e-\u007F]')
|
3084
|
-
aposattrcontentchar = r'[A-Za-z]|\s|\d|[!"#$%\(\)\*\+,\-\./\:;=\?\@\[\\\]^_`\|~]'
|
3085
|
-
|
3086
|
-
|
3087
|
-
# CHAR elements - fix the above elementcontentchar, quotattrcontentchar,
|
3088
|
-
# aposattrcontentchar
|
3089
|
-
#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
|
3090
|
-
|
3091
|
-
flags = re.DOTALL | re.MULTILINE | re.UNICODE
|
3092
|
-
|
3093
|
-
def punctuation_root_callback(lexer, match, ctx):
|
3094
|
-
yield match.start(), Punctuation, match.group(1)
|
3095
|
-
# transition to root always - don't pop off stack
|
3096
|
-
ctx.stack = ['root']
|
3097
|
-
ctx.pos = match.end()
|
3098
|
-
|
3099
|
-
def operator_root_callback(lexer, match, ctx):
|
3100
|
-
yield match.start(), Operator, match.group(1)
|
3101
|
-
# transition to root always - don't pop off stack
|
3102
|
-
ctx.stack = ['root']
|
3103
|
-
ctx.pos = match.end()
|
3104
|
-
|
3105
|
-
def popstate_tag_callback(lexer, match, ctx):
|
3106
|
-
yield match.start(), Name.Tag, match.group(1)
|
3107
|
-
ctx.stack.append(lexer.xquery_parse_state.pop())
|
3108
|
-
ctx.pos = match.end()
|
3109
|
-
|
3110
|
-
def popstate_xmlcomment_callback(lexer, match, ctx):
|
3111
|
-
yield match.start(), String.Doc, match.group(1)
|
3112
|
-
ctx.stack.append(lexer.xquery_parse_state.pop())
|
3113
|
-
ctx.pos = match.end()
|
3114
|
-
|
3115
|
-
def popstate_kindtest_callback(lexer, match, ctx):
|
3116
|
-
yield match.start(), Punctuation, match.group(1)
|
3117
|
-
next_state = lexer.xquery_parse_state.pop()
|
3118
|
-
if next_state == 'occurrenceindicator':
|
3119
|
-
if re.match("[?*+]+", match.group(2)):
|
3120
|
-
yield match.start(), Punctuation, match.group(2)
|
3121
|
-
ctx.stack.append('operator')
|
3122
|
-
ctx.pos = match.end()
|
3123
|
-
else:
|
3124
|
-
ctx.stack.append('operator')
|
3125
|
-
ctx.pos = match.end(1)
|
3126
|
-
else:
|
3127
|
-
ctx.stack.append(next_state)
|
3128
|
-
ctx.pos = match.end(1)
|
3129
|
-
|
3130
|
-
def popstate_callback(lexer, match, ctx):
|
3131
|
-
yield match.start(), Punctuation, match.group(1)
|
3132
|
-
# if we have run out of our state stack, pop whatever is on the pygments
|
3133
|
-
# state stack
|
3134
|
-
if len(lexer.xquery_parse_state) == 0:
|
3135
|
-
ctx.stack.pop()
|
3136
|
-
elif len(ctx.stack) > 1:
|
3137
|
-
ctx.stack.append(lexer.xquery_parse_state.pop())
|
3138
|
-
else:
|
3139
|
-
# i don't know if i'll need this, but in case, default back to root
|
3140
|
-
ctx.stack = ['root']
|
3141
|
-
ctx.pos = match.end()
|
3142
|
-
|
3143
|
-
def pushstate_element_content_starttag_callback(lexer, match, ctx):
|
3144
|
-
yield match.start(), Name.Tag, match.group(1)
|
3145
|
-
lexer.xquery_parse_state.append('element_content')
|
3146
|
-
ctx.stack.append('start_tag')
|
3147
|
-
ctx.pos = match.end()
|
3148
|
-
|
3149
|
-
def pushstate_cdata_section_callback(lexer, match, ctx):
|
3150
|
-
yield match.start(), String.Doc, match.group(1)
|
3151
|
-
ctx.stack.append('cdata_section')
|
3152
|
-
lexer.xquery_parse_state.append(ctx.state.pop)
|
3153
|
-
ctx.pos = match.end()
|
3154
|
-
|
3155
|
-
def pushstate_starttag_callback(lexer, match, ctx):
|
3156
|
-
yield match.start(), Name.Tag, match.group(1)
|
3157
|
-
lexer.xquery_parse_state.append(ctx.state.pop)
|
3158
|
-
ctx.stack.append('start_tag')
|
3159
|
-
ctx.pos = match.end()
|
3160
|
-
|
3161
|
-
def pushstate_operator_order_callback(lexer, match, ctx):
|
3162
|
-
yield match.start(), Keyword, match.group(1)
|
3163
|
-
yield match.start(), Text, match.group(2)
|
3164
|
-
yield match.start(), Punctuation, match.group(3)
|
3165
|
-
ctx.stack = ['root']
|
3166
|
-
lexer.xquery_parse_state.append('operator')
|
3167
|
-
ctx.pos = match.end()
|
3168
|
-
|
3169
|
-
def pushstate_operator_root_validate(lexer, match, ctx):
|
3170
|
-
yield match.start(), Keyword, match.group(1)
|
3171
|
-
yield match.start(), Text, match.group(2)
|
3172
|
-
yield match.start(), Punctuation, match.group(3)
|
3173
|
-
ctx.stack = ['root']
|
3174
|
-
lexer.xquery_parse_state.append('operator')
|
3175
|
-
ctx.pos = match.end()
|
3176
|
-
|
3177
|
-
def pushstate_operator_root_validate_withmode(lexer, match, ctx):
|
3178
|
-
yield match.start(), Keyword, match.group(1)
|
3179
|
-
yield match.start(), Text, match.group(2)
|
3180
|
-
yield match.start(), Keyword, match.group(3)
|
3181
|
-
ctx.stack = ['root']
|
3182
|
-
lexer.xquery_parse_state.append('operator')
|
3183
|
-
ctx.pos = match.end()
|
3184
|
-
|
3185
|
-
def pushstate_operator_processing_instruction_callback(lexer, match, ctx):
|
3186
|
-
yield match.start(), String.Doc, match.group(1)
|
3187
|
-
ctx.stack.append('processing_instruction')
|
3188
|
-
lexer.xquery_parse_state.append('operator')
|
3189
|
-
ctx.pos = match.end()
|
3190
|
-
|
3191
|
-
def pushstate_element_content_processing_instruction_callback(lexer, match, ctx):
|
3192
|
-
yield match.start(), String.Doc, match.group(1)
|
3193
|
-
ctx.stack.append('processing_instruction')
|
3194
|
-
lexer.xquery_parse_state.append('element_content')
|
3195
|
-
ctx.pos = match.end()
|
3196
|
-
|
3197
|
-
def pushstate_element_content_cdata_section_callback(lexer, match, ctx):
|
3198
|
-
yield match.start(), String.Doc, match.group(1)
|
3199
|
-
ctx.stack.append('cdata_section')
|
3200
|
-
lexer.xquery_parse_state.append('element_content')
|
3201
|
-
ctx.pos = match.end()
|
3202
|
-
|
3203
|
-
def pushstate_operator_cdata_section_callback(lexer, match, ctx):
|
3204
|
-
yield match.start(), String.Doc, match.group(1)
|
3205
|
-
ctx.stack.append('cdata_section')
|
3206
|
-
lexer.xquery_parse_state.append('operator')
|
3207
|
-
ctx.pos = match.end()
|
3208
|
-
|
3209
|
-
def pushstate_element_content_xmlcomment_callback(lexer, match, ctx):
|
3210
|
-
yield match.start(), String.Doc, match.group(1)
|
3211
|
-
ctx.stack.append('xml_comment')
|
3212
|
-
lexer.xquery_parse_state.append('element_content')
|
3213
|
-
ctx.pos = match.end()
|
3214
|
-
|
3215
|
-
def pushstate_operator_xmlcomment_callback(lexer, match, ctx):
|
3216
|
-
yield match.start(), String.Doc, match.group(1)
|
3217
|
-
ctx.stack.append('xml_comment')
|
3218
|
-
lexer.xquery_parse_state.append('operator')
|
3219
|
-
ctx.pos = match.end()
|
3220
|
-
|
3221
|
-
def pushstate_kindtest_callback(lexer, match, ctx):
|
3222
|
-
yield match.start(), Keyword, match.group(1)
|
3223
|
-
yield match.start(), Text, match.group(2)
|
3224
|
-
yield match.start(), Punctuation, match.group(3)
|
3225
|
-
lexer.xquery_parse_state.append('kindtest')
|
3226
|
-
ctx.stack.append('kindtest')
|
3227
|
-
ctx.pos = match.end()
|
3228
|
-
|
3229
|
-
def pushstate_operator_kindtestforpi_callback(lexer, match, ctx):
|
3230
|
-
yield match.start(), Keyword, match.group(1)
|
3231
|
-
yield match.start(), Text, match.group(2)
|
3232
|
-
yield match.start(), Punctuation, match.group(3)
|
3233
|
-
lexer.xquery_parse_state.append('operator')
|
3234
|
-
ctx.stack.append('kindtestforpi')
|
3235
|
-
ctx.pos = match.end()
|
3236
|
-
|
3237
|
-
def pushstate_operator_kindtest_callback(lexer, match, ctx):
|
3238
|
-
yield match.start(), Keyword, match.group(1)
|
3239
|
-
yield match.start(), Text, match.group(2)
|
3240
|
-
yield match.start(), Punctuation, match.group(3)
|
3241
|
-
lexer.xquery_parse_state.append('operator')
|
3242
|
-
ctx.stack.append('kindtest')
|
3243
|
-
ctx.pos = match.end()
|
3244
|
-
|
3245
|
-
def pushstate_occurrenceindicator_kindtest_callback(lexer, match, ctx):
|
3246
|
-
yield match.start(), Name.Tag, match.group(1)
|
3247
|
-
yield match.start(), Text, match.group(2)
|
3248
|
-
yield match.start(), Punctuation, match.group(3)
|
3249
|
-
lexer.xquery_parse_state.append('occurrenceindicator')
|
3250
|
-
ctx.stack.append('kindtest')
|
3251
|
-
ctx.pos = match.end()
|
3252
|
-
|
3253
|
-
def pushstate_operator_starttag_callback(lexer, match, ctx):
|
3254
|
-
yield match.start(), Name.Tag, match.group(1)
|
3255
|
-
lexer.xquery_parse_state.append('operator')
|
3256
|
-
ctx.stack.append('start_tag')
|
3257
|
-
ctx.pos = match.end()
|
3258
|
-
|
3259
|
-
def pushstate_operator_root_callback(lexer, match, ctx):
|
3260
|
-
yield match.start(), Punctuation, match.group(1)
|
3261
|
-
lexer.xquery_parse_state.append('operator')
|
3262
|
-
ctx.stack = ['root']#.append('root')
|
3263
|
-
ctx.pos = match.end()
|
3264
|
-
|
3265
|
-
def pushstate_operator_root_construct_callback(lexer, match, ctx):
|
3266
|
-
yield match.start(), Keyword, match.group(1)
|
3267
|
-
yield match.start(), Text, match.group(2)
|
3268
|
-
yield match.start(), Punctuation, match.group(3)
|
3269
|
-
lexer.xquery_parse_state.append('operator')
|
3270
|
-
ctx.stack = ['root']
|
3271
|
-
ctx.pos = match.end()
|
3272
|
-
|
3273
|
-
def pushstate_root_callback(lexer, match, ctx):
|
3274
|
-
yield match.start(), Punctuation, match.group(1)
|
3275
|
-
cur_state = ctx.stack.pop()
|
3276
|
-
lexer.xquery_parse_state.append(cur_state)
|
3277
|
-
ctx.stack = ['root']#.append('root')
|
3278
|
-
ctx.pos = match.end()
|
3279
|
-
|
3280
|
-
def pushstate_operator_attribute_callback(lexer, match, ctx):
|
3281
|
-
yield match.start(), Name.Attribute, match.group(1)
|
3282
|
-
ctx.stack.append('operator')
|
3283
|
-
ctx.pos = match.end()
|
3284
|
-
|
3285
|
-
def pushstate_operator_callback(lexer, match, ctx):
|
3286
|
-
yield match.start(), Keyword, match.group(1)
|
3287
|
-
yield match.start(), Text, match.group(2)
|
3288
|
-
yield match.start(), Punctuation, match.group(3)
|
3289
|
-
lexer.xquery_parse_state.append('operator')
|
3290
|
-
ctx.pos = match.end()
|
3291
|
-
|
3292
|
-
tokens = {
|
3293
|
-
'comment': [
|
3294
|
-
# xquery comments
|
3295
|
-
(r'(:\))', Comment, '#pop'),
|
3296
|
-
(r'(\(:)', Comment, '#push'),
|
3297
|
-
(r'[^:)]', Comment),
|
3298
|
-
(r'([^:)]|:|\))', Comment),
|
3299
|
-
],
|
3300
|
-
'whitespace': [
|
3301
|
-
(r'\s+', Text),
|
3302
|
-
],
|
3303
|
-
'operator': [
|
3304
|
-
include('whitespace'),
|
3305
|
-
(r'(\})', popstate_callback),
|
3306
|
-
(r'\(:', Comment, 'comment'),
|
3307
|
-
|
3308
|
-
(r'(\{)', pushstate_root_callback),
|
3309
|
-
(r'then|else|external|at|div|except', Keyword, 'root'),
|
3310
|
-
(r'order by', Keyword, 'root'),
|
3311
|
-
(r'is|mod|order\s+by|stable\s+order\s+by', Keyword, 'root'),
|
3312
|
-
(r'and|or', Operator.Word, 'root'),
|
3313
|
-
(r'(eq|ge|gt|le|lt|ne|idiv|intersect|in)(?=\b)',
|
3314
|
-
Operator.Word, 'root'),
|
3315
|
-
(r'return|satisfies|to|union|where|preserve\s+strip',
|
3316
|
-
Keyword, 'root'),
|
3317
|
-
(r'(>=|>>|>|<=|<<|<|-|\*|!=|\+|\||:=|=)',
|
3318
|
-
operator_root_callback),
|
3319
|
-
(r'(::|;|\[|//|/|,)',
|
3320
|
-
punctuation_root_callback),
|
3321
|
-
(r'(castable|cast)(\s+)(as)\b',
|
3322
|
-
bygroups(Keyword, Text, Keyword), 'singletype'),
|
3323
|
-
(r'(instance)(\s+)(of)\b',
|
3324
|
-
bygroups(Keyword, Text, Keyword), 'itemtype'),
|
3325
|
-
(r'(treat)(\s+)(as)\b',
|
3326
|
-
bygroups(Keyword, Text, Keyword), 'itemtype'),
|
3327
|
-
(r'(case|as)\b', Keyword, 'itemtype'),
|
3328
|
-
(r'(\))(\s*)(as)',
|
3329
|
-
bygroups(Punctuation, Text, Keyword), 'itemtype'),
|
3330
|
-
(r'\$', Name.Variable, 'varname'),
|
3331
|
-
(r'(for|let)(\s+)(\$)',
|
3332
|
-
bygroups(Keyword, Text, Name.Variable), 'varname'),
|
3333
|
-
#(r'\)|\?|\]', Punctuation, '#push'),
|
3334
|
-
(r'\)|\?|\]', Punctuation),
|
3335
|
-
(r'(empty)(\s+)(greatest|least)', bygroups(Keyword, Text, Keyword)),
|
3336
|
-
(r'ascending|descending|default', Keyword, '#push'),
|
3337
|
-
(r'external', Keyword),
|
3338
|
-
(r'collation', Keyword, 'uritooperator'),
|
3339
|
-
# finally catch all string literals and stay in operator state
|
3340
|
-
(stringdouble, String.Double),
|
3341
|
-
(stringsingle, String.Single),
|
3342
|
-
|
3343
|
-
(r'(catch)(\s*)', bygroups(Keyword, Text), 'root'),
|
3344
|
-
],
|
3345
|
-
'uritooperator': [
|
3346
|
-
(stringdouble, String.Double, '#pop'),
|
3347
|
-
(stringsingle, String.Single, '#pop'),
|
3348
|
-
],
|
3349
|
-
'namespacedecl': [
|
3350
|
-
include('whitespace'),
|
3351
|
-
(r'\(:', Comment, 'comment'),
|
3352
|
-
(r'(at)(\s+)('+stringdouble+')', bygroups(Keyword, Text, String.Double)),
|
3353
|
-
(r"(at)(\s+)("+stringsingle+')', bygroups(Keyword, Text, String.Single)),
|
3354
|
-
(stringdouble, String.Double),
|
3355
|
-
(stringsingle, String.Single),
|
3356
|
-
(r',', Punctuation),
|
3357
|
-
(r'=', Operator),
|
3358
|
-
(r';', Punctuation, 'root'),
|
3359
|
-
(ncname, Name.Namespace),
|
3360
|
-
],
|
3361
|
-
'namespacekeyword': [
|
3362
|
-
include('whitespace'),
|
3363
|
-
(r'\(:', Comment, 'comment'),
|
3364
|
-
(stringdouble, String.Double, 'namespacedecl'),
|
3365
|
-
(stringsingle, String.Single, 'namespacedecl'),
|
3366
|
-
(r'inherit|no-inherit', Keyword, 'root'),
|
3367
|
-
(r'namespace', Keyword, 'namespacedecl'),
|
3368
|
-
(r'(default)(\s+)(element)', bygroups(Keyword, Text, Keyword)),
|
3369
|
-
(r'preserve|no-preserve', Keyword),
|
3370
|
-
(r',', Punctuation),
|
3371
|
-
],
|
3372
|
-
'varname': [
|
3373
|
-
(r'\(:', Comment, 'comment'),
|
3374
|
-
(qname, Name.Variable, 'operator'),
|
3375
|
-
],
|
3376
|
-
'singletype': [
|
3377
|
-
(r'\(:', Comment, 'comment'),
|
3378
|
-
(ncname + r'(:\*)', Name.Variable, 'operator'),
|
3379
|
-
(qname, Name.Variable, 'operator'),
|
3380
|
-
],
|
3381
|
-
'itemtype': [
|
3382
|
-
include('whitespace'),
|
3383
|
-
(r'\(:', Comment, 'comment'),
|
3384
|
-
(r'\$', Punctuation, 'varname'),
|
3385
|
-
(r'(void)(\s*)(\()(\s*)(\))',
|
3386
|
-
bygroups(Keyword, Text, Punctuation, Text, Punctuation), 'operator'),
|
3387
|
-
(r'(element|attribute|schema-element|schema-attribute|comment|text|'
|
3388
|
-
r'node|binary|document-node|empty-sequence)(\s*)(\()',
|
3389
|
-
pushstate_occurrenceindicator_kindtest_callback),
|
3390
|
-
# Marklogic specific type?
|
3391
|
-
(r'(processing-instruction)(\s*)(\()',
|
3392
|
-
bygroups(Keyword, Text, Punctuation),
|
3393
|
-
('occurrenceindicator', 'kindtestforpi')),
|
3394
|
-
(r'(item)(\s*)(\()(\s*)(\))(?=[*+?])',
|
3395
|
-
bygroups(Keyword, Text, Punctuation, Text, Punctuation),
|
3396
|
-
'occurrenceindicator'),
|
3397
|
-
(r'\(\#', Punctuation, 'pragma'),
|
3398
|
-
(r';', Punctuation, '#pop'),
|
3399
|
-
(r'then|else', Keyword, '#pop'),
|
3400
|
-
(r'(at)(\s+)(' + stringdouble + ')',
|
3401
|
-
bygroups(Keyword, Text, String.Double), 'namespacedecl'),
|
3402
|
-
(r'(at)(\s+)(' + stringsingle + ')',
|
3403
|
-
bygroups(Keyword, Text, String.Single), 'namespacedecl'),
|
3404
|
-
(r'except|intersect|in|is|return|satisfies|to|union|where',
|
3405
|
-
Keyword, 'root'),
|
3406
|
-
(r'and|div|eq|ge|gt|le|lt|ne|idiv|mod|or', Operator.Word, 'root'),
|
3407
|
-
(r':=|=|,|>=|>>|>|\[|\(|<=|<<|<|-|!=|\|', Operator, 'root'),
|
3408
|
-
(r'external|at', Keyword, 'root'),
|
3409
|
-
(r'(stable)(\s+)(order)(\s+)(by)',
|
3410
|
-
bygroups(Keyword, Text, Keyword, Text, Keyword), 'root'),
|
3411
|
-
(r'(castable|cast)(\s+)(as)',
|
3412
|
-
bygroups(Keyword, Text, Keyword), 'singletype'),
|
3413
|
-
(r'(treat)(\s+)(as)', bygroups(Keyword, Text, Keyword)),
|
3414
|
-
(r'(instance)(\s+)(of)', bygroups(Keyword, Text, Keyword)),
|
3415
|
-
(r'case|as', Keyword, 'itemtype'),
|
3416
|
-
(r'(\))(\s*)(as)', bygroups(Operator, Text, Keyword), 'itemtype'),
|
3417
|
-
(ncname + r':\*', Keyword.Type, 'operator'),
|
3418
|
-
(qname, Keyword.Type, 'occurrenceindicator'),
|
3419
|
-
],
|
3420
|
-
'kindtest': [
|
3421
|
-
(r'\(:', Comment, 'comment'),
|
3422
|
-
(r'{', Punctuation, 'root'),
|
3423
|
-
(r'(\))([*+?]?)', popstate_kindtest_callback),
|
3424
|
-
(r'\*', Name, 'closekindtest'),
|
3425
|
-
(qname, Name, 'closekindtest'),
|
3426
|
-
(r'(element|schema-element)(\s*)(\()', pushstate_kindtest_callback),
|
3427
|
-
],
|
3428
|
-
'kindtestforpi': [
|
3429
|
-
(r'\(:', Comment, 'comment'),
|
3430
|
-
(r'\)', Punctuation, '#pop'),
|
3431
|
-
(ncname, Name.Variable),
|
3432
|
-
(stringdouble, String.Double),
|
3433
|
-
(stringsingle, String.Single),
|
3434
|
-
],
|
3435
|
-
'closekindtest': [
|
3436
|
-
(r'\(:', Comment, 'comment'),
|
3437
|
-
(r'(\))', popstate_callback),
|
3438
|
-
(r',', Punctuation),
|
3439
|
-
(r'(\{)', pushstate_operator_root_callback),
|
3440
|
-
(r'\?', Punctuation),
|
3441
|
-
],
|
3442
|
-
'xml_comment': [
|
3443
|
-
(r'(-->)', popstate_xmlcomment_callback),
|
3444
|
-
(r'[^-]{1,2}', Literal),
|
3445
|
-
(u'\\t|\\r|\\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|' +
|
3446
|
-
unirange(0x10000, 0x10ffff), Literal),
|
3447
|
-
],
|
3448
|
-
'processing_instruction': [
|
3449
|
-
(r'\s+', Text, 'processing_instruction_content'),
|
3450
|
-
(r'\?>', String.Doc, '#pop'),
|
3451
|
-
(pitarget, Name),
|
3452
|
-
],
|
3453
|
-
'processing_instruction_content': [
|
3454
|
-
(r'\?>', String.Doc, '#pop'),
|
3455
|
-
(u'\\t|\\r|\\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|' +
|
3456
|
-
unirange(0x10000, 0x10ffff), Literal),
|
3457
|
-
],
|
3458
|
-
'cdata_section': [
|
3459
|
-
(r']]>', String.Doc, '#pop'),
|
3460
|
-
(u'\\t|\\r|\\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|' +
|
3461
|
-
unirange(0x10000, 0x10ffff), Literal),
|
3462
|
-
],
|
3463
|
-
'start_tag': [
|
3464
|
-
include('whitespace'),
|
3465
|
-
(r'(/>)', popstate_tag_callback),
|
3466
|
-
(r'>', Name.Tag, 'element_content'),
|
3467
|
-
(r'"', Punctuation, 'quot_attribute_content'),
|
3468
|
-
(r"'", Punctuation, 'apos_attribute_content'),
|
3469
|
-
(r'=', Operator),
|
3470
|
-
(qname, Name.Tag),
|
3471
|
-
],
|
3472
|
-
'quot_attribute_content': [
|
3473
|
-
(r'"', Punctuation, 'start_tag'),
|
3474
|
-
(r'(\{)', pushstate_root_callback),
|
3475
|
-
(r'""', Name.Attribute),
|
3476
|
-
(quotattrcontentchar, Name.Attribute),
|
3477
|
-
(entityref, Name.Attribute),
|
3478
|
-
(charref, Name.Attribute),
|
3479
|
-
(r'\{\{|\}\}', Name.Attribute),
|
3480
|
-
],
|
3481
|
-
'apos_attribute_content': [
|
3482
|
-
(r"'", Punctuation, 'start_tag'),
|
3483
|
-
(r'\{', Punctuation, 'root'),
|
3484
|
-
(r"''", Name.Attribute),
|
3485
|
-
(aposattrcontentchar, Name.Attribute),
|
3486
|
-
(entityref, Name.Attribute),
|
3487
|
-
(charref, Name.Attribute),
|
3488
|
-
(r'\{\{|\}\}', Name.Attribute),
|
3489
|
-
],
|
3490
|
-
'element_content': [
|
3491
|
-
(r'</', Name.Tag, 'end_tag'),
|
3492
|
-
(r'(\{)', pushstate_root_callback),
|
3493
|
-
(r'(<!--)', pushstate_element_content_xmlcomment_callback),
|
3494
|
-
(r'(<\?)', pushstate_element_content_processing_instruction_callback),
|
3495
|
-
(r'(<!\[CDATA\[)', pushstate_element_content_cdata_section_callback),
|
3496
|
-
(r'(<)', pushstate_element_content_starttag_callback),
|
3497
|
-
(elementcontentchar, Literal),
|
3498
|
-
(entityref, Literal),
|
3499
|
-
(charref, Literal),
|
3500
|
-
(r'\{\{|\}\}', Literal),
|
3501
|
-
],
|
3502
|
-
'end_tag': [
|
3503
|
-
include('whitespace'),
|
3504
|
-
(r'(>)', popstate_tag_callback),
|
3505
|
-
(qname, Name.Tag),
|
3506
|
-
],
|
3507
|
-
'xmlspace_decl': [
|
3508
|
-
(r'\(:', Comment, 'comment'),
|
3509
|
-
(r'preserve|strip', Keyword, '#pop'),
|
3510
|
-
],
|
3511
|
-
'declareordering': [
|
3512
|
-
(r'\(:', Comment, 'comment'),
|
3513
|
-
include('whitespace'),
|
3514
|
-
(r'ordered|unordered', Keyword, '#pop'),
|
3515
|
-
],
|
3516
|
-
'xqueryversion': [
|
3517
|
-
include('whitespace'),
|
3518
|
-
(r'\(:', Comment, 'comment'),
|
3519
|
-
(stringdouble, String.Double),
|
3520
|
-
(stringsingle, String.Single),
|
3521
|
-
(r'encoding', Keyword),
|
3522
|
-
(r';', Punctuation, '#pop'),
|
3523
|
-
],
|
3524
|
-
'pragma': [
|
3525
|
-
(qname, Name.Variable, 'pragmacontents'),
|
3526
|
-
],
|
3527
|
-
'pragmacontents': [
|
3528
|
-
(r'#\)', Punctuation, 'operator'),
|
3529
|
-
(u'\\t|\\r|\\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|' +
|
3530
|
-
unirange(0x10000, 0x10ffff), Literal),
|
3531
|
-
(r'(\s+)', Text),
|
3532
|
-
],
|
3533
|
-
'occurrenceindicator': [
|
3534
|
-
include('whitespace'),
|
3535
|
-
(r'\(:', Comment, 'comment'),
|
3536
|
-
(r'\*|\?|\+', Operator, 'operator'),
|
3537
|
-
(r':=', Operator, 'root'),
|
3538
|
-
default('operator'),
|
3539
|
-
],
|
3540
|
-
'option': [
|
3541
|
-
include('whitespace'),
|
3542
|
-
(qname, Name.Variable, '#pop'),
|
3543
|
-
],
|
3544
|
-
'qname_braren': [
|
3545
|
-
include('whitespace'),
|
3546
|
-
(r'(\{)', pushstate_operator_root_callback),
|
3547
|
-
(r'(\()', Punctuation, 'root'),
|
3548
|
-
],
|
3549
|
-
'element_qname': [
|
3550
|
-
(qname, Name.Variable, 'root'),
|
3551
|
-
],
|
3552
|
-
'attribute_qname': [
|
3553
|
-
(qname, Name.Variable, 'root'),
|
3554
|
-
],
|
3555
|
-
'root': [
|
3556
|
-
include('whitespace'),
|
3557
|
-
(r'\(:', Comment, 'comment'),
|
3558
|
-
|
3559
|
-
# handle operator state
|
3560
|
-
# order on numbers matters - handle most complex first
|
3561
|
-
(r'\d+(\.\d*)?[eE][\+\-]?\d+', Number.Float, 'operator'),
|
3562
|
-
(r'(\.\d+)[eE][\+\-]?\d+', Number.Float, 'operator'),
|
3563
|
-
(r'(\.\d+|\d+\.\d*)', Number.Float, 'operator'),
|
3564
|
-
(r'(\d+)', Number.Integer, 'operator'),
|
3565
|
-
(r'(\.\.|\.|\))', Punctuation, 'operator'),
|
3566
|
-
(r'(declare)(\s+)(construction)',
|
3567
|
-
bygroups(Keyword, Text, Keyword), 'operator'),
|
3568
|
-
(r'(declare)(\s+)(default)(\s+)(order)',
|
3569
|
-
bygroups(Keyword, Text, Keyword, Text, Keyword), 'operator'),
|
3570
|
-
(ncname + ':\*', Name, 'operator'),
|
3571
|
-
('\*:'+ncname, Name.Tag, 'operator'),
|
3572
|
-
('\*', Name.Tag, 'operator'),
|
3573
|
-
(stringdouble, String.Double, 'operator'),
|
3574
|
-
(stringsingle, String.Single, 'operator'),
|
3575
|
-
|
3576
|
-
(r'(\})', popstate_callback),
|
3577
|
-
|
3578
|
-
#NAMESPACE DECL
|
3579
|
-
(r'(declare)(\s+)(default)(\s+)(collation)',
|
3580
|
-
bygroups(Keyword, Text, Keyword, Text, Keyword)),
|
3581
|
-
(r'(module|declare)(\s+)(namespace)',
|
3582
|
-
bygroups(Keyword, Text, Keyword), 'namespacedecl'),
|
3583
|
-
(r'(declare)(\s+)(base-uri)',
|
3584
|
-
bygroups(Keyword, Text, Keyword), 'namespacedecl'),
|
3585
|
-
|
3586
|
-
#NAMESPACE KEYWORD
|
3587
|
-
(r'(declare)(\s+)(default)(\s+)(element|function)',
|
3588
|
-
bygroups(Keyword, Text, Keyword, Text, Keyword), 'namespacekeyword'),
|
3589
|
-
(r'(import)(\s+)(schema|module)',
|
3590
|
-
bygroups(Keyword.Pseudo, Text, Keyword.Pseudo), 'namespacekeyword'),
|
3591
|
-
(r'(declare)(\s+)(copy-namespaces)',
|
3592
|
-
bygroups(Keyword, Text, Keyword), 'namespacekeyword'),
|
3593
|
-
|
3594
|
-
#VARNAMEs
|
3595
|
-
(r'(for|let|some|every)(\s+)(\$)',
|
3596
|
-
bygroups(Keyword, Text, Name.Variable), 'varname'),
|
3597
|
-
(r'\$', Name.Variable, 'varname'),
|
3598
|
-
(r'(declare)(\s+)(variable)(\s+)(\$)',
|
3599
|
-
bygroups(Keyword, Text, Keyword, Text, Name.Variable), 'varname'),
|
3600
|
-
|
3601
|
-
#ITEMTYPE
|
3602
|
-
(r'(\))(\s+)(as)', bygroups(Operator, Text, Keyword), 'itemtype'),
|
3603
|
-
|
3604
|
-
(r'(element|attribute|schema-element|schema-attribute|comment|'
|
3605
|
-
r'text|node|document-node|empty-sequence)(\s+)(\()',
|
3606
|
-
pushstate_operator_kindtest_callback),
|
3607
|
-
|
3608
|
-
(r'(processing-instruction)(\s+)(\()',
|
3609
|
-
pushstate_operator_kindtestforpi_callback),
|
3610
|
-
|
3611
|
-
(r'(<!--)', pushstate_operator_xmlcomment_callback),
|
3612
|
-
|
3613
|
-
(r'(<\?)', pushstate_operator_processing_instruction_callback),
|
3614
|
-
|
3615
|
-
(r'(<!\[CDATA\[)', pushstate_operator_cdata_section_callback),
|
3616
|
-
|
3617
|
-
# (r'</', Name.Tag, 'end_tag'),
|
3618
|
-
(r'(<)', pushstate_operator_starttag_callback),
|
3619
|
-
|
3620
|
-
(r'(declare)(\s+)(boundary-space)',
|
3621
|
-
bygroups(Keyword, Text, Keyword), 'xmlspace_decl'),
|
3622
|
-
|
3623
|
-
(r'(validate)(\s+)(lax|strict)',
|
3624
|
-
pushstate_operator_root_validate_withmode),
|
3625
|
-
(r'(validate)(\s*)(\{)', pushstate_operator_root_validate),
|
3626
|
-
(r'(typeswitch)(\s*)(\()', bygroups(Keyword, Text, Punctuation)),
|
3627
|
-
(r'(element|attribute)(\s*)(\{)',
|
3628
|
-
pushstate_operator_root_construct_callback),
|
3629
|
-
|
3630
|
-
(r'(document|text|processing-instruction|comment)(\s*)(\{)',
|
3631
|
-
pushstate_operator_root_construct_callback),
|
3632
|
-
#ATTRIBUTE
|
3633
|
-
(r'(attribute)(\s+)(?=' + qname + r')',
|
3634
|
-
bygroups(Keyword, Text), 'attribute_qname'),
|
3635
|
-
#ELEMENT
|
3636
|
-
(r'(element)(\s+)(?=' +qname+ r')',
|
3637
|
-
bygroups(Keyword, Text), 'element_qname'),
|
3638
|
-
#PROCESSING_INSTRUCTION
|
3639
|
-
(r'(processing-instruction)(\s+)(' + ncname + r')(\s*)(\{)',
|
3640
|
-
bygroups(Keyword, Text, Name.Variable, Text, Punctuation),
|
3641
|
-
'operator'),
|
3642
|
-
|
3643
|
-
(r'(declare|define)(\s+)(function)',
|
3644
|
-
bygroups(Keyword, Text, Keyword)),
|
3645
|
-
|
3646
|
-
(r'(\{)', pushstate_operator_root_callback),
|
3647
|
-
|
3648
|
-
(r'(unordered|ordered)(\s*)(\{)',
|
3649
|
-
pushstate_operator_order_callback),
|
3650
|
-
|
3651
|
-
(r'(declare)(\s+)(ordering)',
|
3652
|
-
bygroups(Keyword, Text, Keyword), 'declareordering'),
|
3653
|
-
|
3654
|
-
(r'(xquery)(\s+)(version)',
|
3655
|
-
bygroups(Keyword.Pseudo, Text, Keyword.Pseudo), 'xqueryversion'),
|
3656
|
-
|
3657
|
-
(r'(\(#)', Punctuation, 'pragma'),
|
3658
|
-
|
3659
|
-
# sometimes return can occur in root state
|
3660
|
-
(r'return', Keyword),
|
3661
|
-
|
3662
|
-
(r'(declare)(\s+)(option)', bygroups(Keyword, Text, Keyword),
|
3663
|
-
'option'),
|
3664
|
-
|
3665
|
-
#URI LITERALS - single and double quoted
|
3666
|
-
(r'(at)(\s+)('+stringdouble+')', String.Double, 'namespacedecl'),
|
3667
|
-
(r'(at)(\s+)('+stringsingle+')', String.Single, 'namespacedecl'),
|
3668
|
-
|
3669
|
-
(r'(ancestor-or-self|ancestor|attribute|child|descendant-or-self)(::)',
|
3670
|
-
bygroups(Keyword, Punctuation)),
|
3671
|
-
(r'(descendant|following-sibling|following|parent|preceding-sibling'
|
3672
|
-
r'|preceding|self)(::)', bygroups(Keyword, Punctuation)),
|
3673
|
-
|
3674
|
-
(r'(if)(\s*)(\()', bygroups(Keyword, Text, Punctuation)),
|
3675
|
-
|
3676
|
-
(r'then|else', Keyword),
|
3677
|
-
|
3678
|
-
# ML specific
|
3679
|
-
(r'(try)(\s*)', bygroups(Keyword, Text), 'root'),
|
3680
|
-
(r'(catch)(\s*)(\()(\$)',
|
3681
|
-
bygroups(Keyword, Text, Punctuation, Name.Variable), 'varname'),
|
3682
|
-
|
3683
|
-
(r'(@'+qname+')', Name.Attribute),
|
3684
|
-
(r'(@'+ncname+')', Name.Attribute),
|
3685
|
-
(r'@\*:'+ncname, Name.Attribute),
|
3686
|
-
(r'(@)', Name.Attribute),
|
3687
|
-
|
3688
|
-
(r'//|/|\+|-|;|,|\(|\)', Punctuation),
|
3689
|
-
|
3690
|
-
# STANDALONE QNAMES
|
3691
|
-
(qname + r'(?=\s*{)', Name.Tag, 'qname_braren'),
|
3692
|
-
(qname + r'(?=\s*\([^:])', Name.Function, 'qname_braren'),
|
3693
|
-
(qname, Name.Tag, 'operator'),
|
3694
|
-
]
|
3695
|
-
}
|
3696
|
-
|
3697
|
-
|
3698
|
-
class DartLexer(RegexLexer):
|
3699
|
-
"""
|
3700
|
-
For `Dart <http://dartlang.org/>`_ source code.
|
3701
|
-
|
3702
|
-
.. versionadded:: 1.5
|
3703
|
-
"""
|
3704
|
-
|
3705
|
-
name = 'Dart'
|
3706
|
-
aliases = ['dart']
|
3707
|
-
filenames = ['*.dart']
|
3708
|
-
mimetypes = ['text/x-dart']
|
3709
|
-
|
3710
|
-
flags = re.MULTILINE | re.DOTALL
|
3711
|
-
|
3712
|
-
tokens = {
|
3713
|
-
'root': [
|
3714
|
-
include('string_literal'),
|
3715
|
-
(r'#!(.*?)$', Comment.Preproc),
|
3716
|
-
(r'\b(import|export)\b', Keyword, 'import_decl'),
|
3717
|
-
(r'\b(library|source|part of|part)\b', Keyword),
|
3718
|
-
(r'[^\S\n]+', Text),
|
3719
|
-
(r'//.*?\n', Comment.Single),
|
3720
|
-
(r'/\*.*?\*/', Comment.Multiline),
|
3721
|
-
(r'\b(class)\b(\s+)',
|
3722
|
-
bygroups(Keyword.Declaration, Text), 'class'),
|
3723
|
-
(r'\b(assert|break|case|catch|continue|default|do|else|finally|for|'
|
3724
|
-
r'if|in|is|new|return|super|switch|this|throw|try|while)\b',
|
3725
|
-
Keyword),
|
3726
|
-
(r'\b(abstract|const|extends|factory|final|get|implements|'
|
3727
|
-
r'native|operator|set|static|typedef|var)\b', Keyword.Declaration),
|
3728
|
-
(r'\b(bool|double|Dynamic|int|num|Object|String|void)\b', Keyword.Type),
|
3729
|
-
(r'\b(false|null|true)\b', Keyword.Constant),
|
3730
|
-
(r'[~!%^&*+=|?:<>/-]|as\b', Operator),
|
3731
|
-
(r'[a-zA-Z_$]\w*:', Name.Label),
|
3732
|
-
(r'[a-zA-Z_$]\w*', Name),
|
3733
|
-
(r'[(){}\[\],.;]', Punctuation),
|
3734
|
-
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
3735
|
-
# DIGIT+ (‘.’ DIGIT*)? EXPONENT?
|
3736
|
-
(r'\d+(\.\d*)?([eE][+-]?\d+)?', Number),
|
3737
|
-
(r'\.\d+([eE][+-]?\d+)?', Number), # ‘.’ DIGIT+ EXPONENT?
|
3738
|
-
(r'\n', Text)
|
3739
|
-
# pseudo-keyword negate intentionally left out
|
3740
|
-
],
|
3741
|
-
'class': [
|
3742
|
-
(r'[a-zA-Z_$]\w*', Name.Class, '#pop')
|
3743
|
-
],
|
3744
|
-
'import_decl': [
|
3745
|
-
include('string_literal'),
|
3746
|
-
(r'\s+', Text),
|
3747
|
-
(r'\b(as|show|hide)\b', Keyword),
|
3748
|
-
(r'[a-zA-Z_$]\w*', Name),
|
3749
|
-
(r'\,', Punctuation),
|
3750
|
-
(r'\;', Punctuation, '#pop')
|
3751
|
-
],
|
3752
|
-
'string_literal': [
|
3753
|
-
# Raw strings.
|
3754
|
-
(r'r"""([\s|\S]*?)"""', String.Double),
|
3755
|
-
(r"r'''([\s|\S]*?)'''", String.Single),
|
3756
|
-
(r'r"(.*?)"', String.Double),
|
3757
|
-
(r"r'(.*?)'", String.Single),
|
3758
|
-
# Normal Strings.
|
3759
|
-
(r'"""', String.Double, 'string_double_multiline'),
|
3760
|
-
(r"'''", String.Single, 'string_single_multiline'),
|
3761
|
-
(r'"', String.Double, 'string_double'),
|
3762
|
-
(r"'", String.Single, 'string_single')
|
3763
|
-
],
|
3764
|
-
'string_common': [
|
3765
|
-
(r"\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]*\}|[a-z\'\"$\\])",
|
3766
|
-
String.Escape),
|
3767
|
-
(r'(\$)([a-zA-Z_]\w*)', bygroups(String.Interpol, Name)),
|
3768
|
-
(r'(\$\{)(.*?)(\})',
|
3769
|
-
bygroups(String.Interpol, using(this), String.Interpol))
|
3770
|
-
],
|
3771
|
-
'string_double': [
|
3772
|
-
(r'"', String.Double, '#pop'),
|
3773
|
-
(r'[^\"$\\\n]+', String.Double),
|
3774
|
-
include('string_common'),
|
3775
|
-
(r'\$+', String.Double)
|
3776
|
-
],
|
3777
|
-
'string_double_multiline': [
|
3778
|
-
(r'"""', String.Double, '#pop'),
|
3779
|
-
(r'[^\"$\\]+', String.Double),
|
3780
|
-
include('string_common'),
|
3781
|
-
(r'(\$|\")+', String.Double)
|
3782
|
-
],
|
3783
|
-
'string_single': [
|
3784
|
-
(r"'", String.Single, '#pop'),
|
3785
|
-
(r"[^\'$\\\n]+", String.Single),
|
3786
|
-
include('string_common'),
|
3787
|
-
(r'\$+', String.Single)
|
3788
|
-
],
|
3789
|
-
'string_single_multiline': [
|
3790
|
-
(r"'''", String.Single, '#pop'),
|
3791
|
-
(r'[^\'$\\]+', String.Single),
|
3792
|
-
include('string_common'),
|
3793
|
-
(r'(\$|\')+', String.Single)
|
3794
|
-
]
|
3795
|
-
}
|
3796
|
-
|
3797
|
-
|
3798
|
-
class TypeScriptLexer(RegexLexer):
|
3799
|
-
"""
|
3800
|
-
For `TypeScript <http://typescriptlang.org/>`_ source code.
|
3801
|
-
|
3802
|
-
.. versionadded:: 1.6
|
3803
|
-
"""
|
3804
|
-
|
3805
|
-
name = 'TypeScript'
|
3806
|
-
aliases = ['ts']
|
3807
|
-
filenames = ['*.ts']
|
3808
|
-
mimetypes = ['text/x-typescript']
|
3809
|
-
|
3810
|
-
flags = re.DOTALL
|
3811
|
-
tokens = {
|
3812
|
-
'commentsandwhitespace': [
|
3813
|
-
(r'\s+', Text),
|
3814
|
-
(r'<!--', Comment),
|
3815
|
-
(r'//.*?\n', Comment.Single),
|
3816
|
-
(r'/\*.*?\*/', Comment.Multiline)
|
3817
|
-
],
|
3818
|
-
'slashstartsregex': [
|
3819
|
-
include('commentsandwhitespace'),
|
3820
|
-
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
3821
|
-
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
3822
|
-
(r'(?=/)', Text, ('#pop', 'badregex')),
|
3823
|
-
default('#pop')
|
3824
|
-
],
|
3825
|
-
'badregex': [
|
3826
|
-
(r'\n', Text, '#pop')
|
3827
|
-
],
|
3828
|
-
'root': [
|
3829
|
-
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
3830
|
-
include('commentsandwhitespace'),
|
3831
|
-
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
3832
|
-
r'(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'),
|
3833
|
-
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
3834
|
-
(r'[})\].]', Punctuation),
|
3835
|
-
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
|
3836
|
-
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
3837
|
-
r'this)\b', Keyword, 'slashstartsregex'),
|
3838
|
-
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
3839
|
-
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
|
3840
|
-
r'extends|final|float|goto|implements|import|int|interface|long|native|'
|
3841
|
-
r'package|private|protected|public|short|static|super|synchronized|throws|'
|
3842
|
-
r'transient|volatile)\b', Keyword.Reserved),
|
3843
|
-
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
|
3844
|
-
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
3845
|
-
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
3846
|
-
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
3847
|
-
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
3848
|
-
r'window)\b', Name.Builtin),
|
3849
|
-
# Match stuff like: module name {...}
|
3850
|
-
(r'\b(module)(\s*)(\s*[\w?.$][\w?.$]*)(\s*)',
|
3851
|
-
bygroups(Keyword.Reserved, Text, Name.Other, Text), 'slashstartsregex'),
|
3852
|
-
# Match variable type keywords
|
3853
|
-
(r'\b(string|bool|number)\b', Keyword.Type),
|
3854
|
-
# Match stuff like: constructor
|
3855
|
-
(r'\b(constructor|declare|interface|as|AS)\b', Keyword.Reserved),
|
3856
|
-
# Match stuff like: super(argument, list)
|
3857
|
-
(r'(super)(\s*)(\([a-zA-Z0-9,_?.$\s]+\s*\))',
|
3858
|
-
bygroups(Keyword.Reserved, Text), 'slashstartsregex'),
|
3859
|
-
# Match stuff like: function() {...}
|
3860
|
-
(r'([a-zA-Z_?.$][\w?.$]*)\(\) \{', Name.Other, 'slashstartsregex'),
|
3861
|
-
# Match stuff like: (function: return type)
|
3862
|
-
(r'([\w?.$][\w?.$]*)(\s*:\s*)([\w?.$][\w?.$]*)',
|
3863
|
-
bygroups(Name.Other, Text, Keyword.Type)),
|
3864
|
-
(r'[$a-zA-Z_]\w*', Name.Other),
|
3865
|
-
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
3866
|
-
(r'0x[0-9a-fA-F]+', Number.Hex),
|
3867
|
-
(r'[0-9]+', Number.Integer),
|
3868
|
-
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
3869
|
-
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
3870
|
-
]
|
3871
|
-
}
|
3872
|
-
|
3873
|
-
|
3874
|
-
class LassoLexer(RegexLexer):
|
3875
|
-
"""
|
3876
|
-
For `Lasso <http://www.lassosoft.com/>`_ source code, covering both Lasso 9
|
3877
|
-
syntax and LassoScript for Lasso 8.6 and earlier. For Lasso embedded in
|
3878
|
-
HTML, use the `LassoHtmlLexer`.
|
3879
|
-
|
3880
|
-
Additional options accepted:
|
3881
|
-
|
3882
|
-
`builtinshighlighting`
|
3883
|
-
If given and ``True``, highlight builtin types, traits, methods, and
|
3884
|
-
members (default: ``True``).
|
3885
|
-
`requiredelimiters`
|
3886
|
-
If given and ``True``, only highlight code between delimiters as Lasso
|
3887
|
-
(default: ``False``).
|
3888
|
-
|
3889
|
-
.. versionadded:: 1.6
|
3890
|
-
"""
|
3891
|
-
|
3892
|
-
name = 'Lasso'
|
3893
|
-
aliases = ['lasso', 'lassoscript']
|
3894
|
-
filenames = ['*.lasso', '*.lasso[89]']
|
3895
|
-
alias_filenames = ['*.incl', '*.inc', '*.las']
|
3896
|
-
mimetypes = ['text/x-lasso']
|
3897
|
-
flags = re.IGNORECASE | re.DOTALL | re.MULTILINE
|
3898
|
-
|
3899
|
-
tokens = {
|
3900
|
-
'root': [
|
3901
|
-
(r'^#!.+lasso9\b', Comment.Preproc, 'lasso'),
|
3902
|
-
(r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
|
3903
|
-
(r'\[noprocess\]', Comment.Preproc, ('delimiters', 'noprocess')),
|
3904
|
-
(r'\[', Comment.Preproc, ('delimiters', 'squarebrackets')),
|
3905
|
-
(r'<\?(LassoScript|lasso|=)', Comment.Preproc,
|
3906
|
-
('delimiters', 'anglebrackets')),
|
3907
|
-
(r'<(!--.*?-->)?', Other, 'delimiters'),
|
3908
|
-
(r'\s+', Other),
|
3909
|
-
default(('delimiters', 'lassofile')),
|
3910
|
-
],
|
3911
|
-
'delimiters': [
|
3912
|
-
(r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
|
3913
|
-
(r'\[noprocess\]', Comment.Preproc, 'noprocess'),
|
3914
|
-
(r'\[', Comment.Preproc, 'squarebrackets'),
|
3915
|
-
(r'<\?(LassoScript|lasso|=)', Comment.Preproc, 'anglebrackets'),
|
3916
|
-
(r'<(!--.*?-->)?', Other),
|
3917
|
-
(r'[^[<]+', Other),
|
3918
|
-
],
|
3919
|
-
'nosquarebrackets': [
|
3920
|
-
(r'<\?(LassoScript|lasso|=)', Comment.Preproc, 'anglebrackets'),
|
3921
|
-
(r'<', Other),
|
3922
|
-
(r'[^<]+', Other),
|
3923
|
-
],
|
3924
|
-
'noprocess': [
|
3925
|
-
(r'\[/noprocess\]', Comment.Preproc, '#pop'),
|
3926
|
-
(r'\[', Other),
|
3927
|
-
(r'[^[]', Other),
|
3928
|
-
],
|
3929
|
-
'squarebrackets': [
|
3930
|
-
(r'\]', Comment.Preproc, '#pop'),
|
3931
|
-
include('lasso'),
|
3932
|
-
],
|
3933
|
-
'anglebrackets': [
|
3934
|
-
(r'\?>', Comment.Preproc, '#pop'),
|
3935
|
-
include('lasso'),
|
3936
|
-
],
|
3937
|
-
'lassofile': [
|
3938
|
-
(r'\]|\?>', Comment.Preproc, '#pop'),
|
3939
|
-
include('lasso'),
|
3940
|
-
],
|
3941
|
-
'whitespacecomments': [
|
3942
|
-
(r'\s+', Text),
|
3943
|
-
(r'//.*?\n', Comment.Single),
|
3944
|
-
(r'/\*\*!.*?\*/', String.Doc),
|
3945
|
-
(r'/\*.*?\*/', Comment.Multiline),
|
3946
|
-
],
|
3947
|
-
'lasso': [
|
3948
|
-
# whitespace/comments
|
3949
|
-
include('whitespacecomments'),
|
3950
|
-
|
3951
|
-
# literals
|
3952
|
-
(r'\d*\.\d+(e[+-]?\d+)?', Number.Float),
|
3953
|
-
(r'0x[\da-f]+', Number.Hex),
|
3954
|
-
(r'\d+', Number.Integer),
|
3955
|
-
(r'([+-]?)(infinity|NaN)\b', bygroups(Operator, Number)),
|
3956
|
-
(r"'", String.Single, 'singlestring'),
|
3957
|
-
(r'"', String.Double, 'doublestring'),
|
3958
|
-
(r'`[^`]*`', String.Backtick),
|
3959
|
-
|
3960
|
-
# names
|
3961
|
-
(r'\$[a-z_][\w.]*', Name.Variable),
|
3962
|
-
(r'#([a-z_][\w.]*|\d+)', Name.Variable.Instance),
|
3963
|
-
(r"(\.)('[a-z_][\w.]*')",
|
3964
|
-
bygroups(Name.Builtin.Pseudo, Name.Variable.Class)),
|
3965
|
-
(r"(self)(\s*->\s*)('[a-z_][\w.]*')",
|
3966
|
-
bygroups(Name.Builtin.Pseudo, Operator, Name.Variable.Class)),
|
3967
|
-
(r'(\.\.?)([a-z_][\w.]*(=(?!=))?)',
|
3968
|
-
bygroups(Name.Builtin.Pseudo, Name.Other.Member)),
|
3969
|
-
(r'(->\\?\s*|&\s*)([a-z_][\w.]*(=(?!=))?)',
|
3970
|
-
bygroups(Operator, Name.Other.Member)),
|
3971
|
-
(r'(self|inherited)\b', Name.Builtin.Pseudo),
|
3972
|
-
(r'-[a-z_][\w.]*', Name.Attribute),
|
3973
|
-
(r'::\s*[a-z_][\w.]*', Name.Label),
|
3974
|
-
(r'(error_(code|msg)_\w+|Error_AddError|Error_ColumnRestriction|'
|
3975
|
-
r'Error_DatabaseConnectionUnavailable|Error_DatabaseTimeout|'
|
3976
|
-
r'Error_DeleteError|Error_FieldRestriction|Error_FileNotFound|'
|
3977
|
-
r'Error_InvalidDatabase|Error_InvalidPassword|'
|
3978
|
-
r'Error_InvalidUsername|Error_ModuleNotFound|'
|
3979
|
-
r'Error_NoError|Error_NoPermission|Error_OutOfMemory|'
|
3980
|
-
r'Error_ReqColumnMissing|Error_ReqFieldMissing|'
|
3981
|
-
r'Error_RequiredColumnMissing|Error_RequiredFieldMissing|'
|
3982
|
-
r'Error_UpdateError)\b', Name.Exception),
|
3983
|
-
|
3984
|
-
# definitions
|
3985
|
-
(r'(define)(\s+)([a-z_][\w.]*)(\s*=>\s*)(type|trait|thread)\b',
|
3986
|
-
bygroups(Keyword.Declaration, Text, Name.Class, Operator, Keyword)),
|
3987
|
-
(r'(define)(\s+)([a-z_][\w.]*)(\s*->\s*)([a-z_][\w.]*=?|[-+*/%])',
|
3988
|
-
bygroups(Keyword.Declaration, Text, Name.Class, Operator,
|
3989
|
-
Name.Function), 'signature'),
|
3990
|
-
(r'(define)(\s+)([a-z_][\w.]*)',
|
3991
|
-
bygroups(Keyword.Declaration, Text, Name.Function), 'signature'),
|
3992
|
-
(r'(public|protected|private|provide)(\s+)(([a-z_][\w.]*=?|[-+*/%])'
|
3993
|
-
r'(?=\s*\())', bygroups(Keyword, Text, Name.Function),
|
3994
|
-
'signature'),
|
3995
|
-
(r'(public|protected|private|provide)(\s+)([a-z_][\w.]*)',
|
3996
|
-
bygroups(Keyword, Text, Name.Function)),
|
3997
|
-
|
3998
|
-
# keywords
|
3999
|
-
(r'(true|false|none|minimal|full|all|void)\b', Keyword.Constant),
|
4000
|
-
(r'(local|var|variable|global|data(?=\s))\b', Keyword.Declaration),
|
4001
|
-
(r'(array|date|decimal|duration|integer|map|pair|string|tag|xml|'
|
4002
|
-
r'null|bytes|list|queue|set|stack|staticarray|tie)\b', Keyword.Type),
|
4003
|
-
(r'([a-z_][\w.]*)(\s+)(in)\b', bygroups(Name, Text, Keyword)),
|
4004
|
-
(r'(let|into)(\s+)([a-z_][\w.]*)', bygroups(Keyword, Text, Name)),
|
4005
|
-
(r'require\b', Keyword, 'requiresection'),
|
4006
|
-
(r'(/?)(Namespace_Using)\b', bygroups(Punctuation, Keyword.Namespace)),
|
4007
|
-
(r'(/?)(Cache|Database_Names|Database_SchemaNames|'
|
4008
|
-
r'Database_TableNames|Define_Tag|Define_Type|Email_Batch|'
|
4009
|
-
r'Encode_Set|HTML_Comment|Handle|Handle_Error|Header|If|Inline|'
|
4010
|
-
r'Iterate|LJAX_Target|Link|Link_CurrentAction|Link_CurrentGroup|'
|
4011
|
-
r'Link_CurrentRecord|Link_Detail|Link_FirstGroup|'
|
4012
|
-
r'Link_FirstRecord|Link_LastGroup|Link_LastRecord|Link_NextGroup|'
|
4013
|
-
r'Link_NextRecord|Link_PrevGroup|Link_PrevRecord|Log|Loop|'
|
4014
|
-
r'NoProcess|Output_None|Portal|Private|Protect|Records|Referer|'
|
4015
|
-
r'Referrer|Repeating|ResultSet|Rows|Search_Args|Search_Arguments|'
|
4016
|
-
r'Select|Sort_Args|Sort_Arguments|Thread_Atomic|Value_List|While|'
|
4017
|
-
r'Abort|Case|Else|If_Empty|If_False|If_Null|If_True|Loop_Abort|'
|
4018
|
-
r'Loop_Continue|Loop_Count|Params|Params_Up|Return|Return_Value|'
|
4019
|
-
r'Run_Children|SOAP_DefineTag|SOAP_LastRequest|SOAP_LastResponse|'
|
4020
|
-
r'Tag_Name|ascending|average|by|define|descending|do|equals|'
|
4021
|
-
r'frozen|group|handle_failure|import|in|into|join|let|match|max|'
|
4022
|
-
r'min|on|order|parent|protected|provide|public|require|returnhome|'
|
4023
|
-
r'skip|split_thread|sum|take|thread|to|trait|type|where|with|'
|
4024
|
-
r'yield|yieldhome)\b',
|
4025
|
-
bygroups(Punctuation, Keyword)),
|
4026
|
-
|
4027
|
-
# other
|
4028
|
-
(r',', Punctuation, 'commamember'),
|
4029
|
-
(r'(and|or|not)\b', Operator.Word),
|
4030
|
-
(r'([a-z_][\w.]*)(\s*::\s*[a-z_][\w.]*)?(\s*=(?!=))',
|
4031
|
-
bygroups(Name, Name.Label, Operator)),
|
4032
|
-
(r'(/?)([\w.]+)', bygroups(Punctuation, Name.Other)),
|
4033
|
-
(r'(=)(n?bw|n?ew|n?cn|lte?|gte?|n?eq|n?rx|ft)\b',
|
4034
|
-
bygroups(Operator, Operator.Word)),
|
4035
|
-
(r':=|[-+*/%=<>&|!?\\]+', Operator),
|
4036
|
-
(r'[{}():;,@^]', Punctuation),
|
4037
|
-
],
|
4038
|
-
'singlestring': [
|
4039
|
-
(r"'", String.Single, '#pop'),
|
4040
|
-
(r"[^'\\]+", String.Single),
|
4041
|
-
include('escape'),
|
4042
|
-
(r"\\", String.Single),
|
4043
|
-
],
|
4044
|
-
'doublestring': [
|
4045
|
-
(r'"', String.Double, '#pop'),
|
4046
|
-
(r'[^"\\]+', String.Double),
|
4047
|
-
include('escape'),
|
4048
|
-
(r'\\', String.Double),
|
4049
|
-
],
|
4050
|
-
'escape': [
|
4051
|
-
(r'\\(U[\da-f]{8}|u[\da-f]{4}|x[\da-f]{1,2}|[0-7]{1,3}|:[^:]+:|'
|
4052
|
-
r'[abefnrtv?\"\'\\]|$)', String.Escape),
|
4053
|
-
],
|
4054
|
-
'signature': [
|
4055
|
-
(r'=>', Operator, '#pop'),
|
4056
|
-
(r'\)', Punctuation, '#pop'),
|
4057
|
-
(r'[(,]', Punctuation, 'parameter'),
|
4058
|
-
include('lasso'),
|
4059
|
-
],
|
4060
|
-
'parameter': [
|
4061
|
-
(r'\)', Punctuation, '#pop'),
|
4062
|
-
(r'-?[a-z_][\w.]*', Name.Attribute, '#pop'),
|
4063
|
-
(r'\.\.\.', Name.Builtin.Pseudo),
|
4064
|
-
include('lasso'),
|
4065
|
-
],
|
4066
|
-
'requiresection': [
|
4067
|
-
(r'(([a-z_][\w.]*=?|[-+*/%])(?=\s*\())', Name, 'requiresignature'),
|
4068
|
-
(r'(([a-z_][\w.]*=?|[-+*/%])(?=(\s*::\s*[\w.]+)?\s*,))', Name),
|
4069
|
-
(r'[a-z_][\w.]*=?|[-+*/%]', Name, '#pop'),
|
4070
|
-
(r'::\s*[a-z_][\w.]*', Name.Label),
|
4071
|
-
(r',', Punctuation),
|
4072
|
-
include('whitespacecomments'),
|
4073
|
-
],
|
4074
|
-
'requiresignature': [
|
4075
|
-
(r'(\)(?=(\s*::\s*[\w.]+)?\s*,))', Punctuation, '#pop'),
|
4076
|
-
(r'\)', Punctuation, '#pop:2'),
|
4077
|
-
(r'-?[a-z_][\w.]*', Name.Attribute),
|
4078
|
-
(r'::\s*[a-z_][\w.]*', Name.Label),
|
4079
|
-
(r'\.\.\.', Name.Builtin.Pseudo),
|
4080
|
-
(r'[(,]', Punctuation),
|
4081
|
-
include('whitespacecomments'),
|
4082
|
-
],
|
4083
|
-
'commamember': [
|
4084
|
-
(r'(([a-z_][\w.]*=?|[-+*/%])'
|
4085
|
-
r'(?=\s*(\(([^()]*\([^()]*\))*[^)]*\)\s*)?(::[\w.\s]+)?=>))',
|
4086
|
-
Name.Function, 'signature'),
|
4087
|
-
include('whitespacecomments'),
|
4088
|
-
default('#pop'),
|
4089
|
-
],
|
4090
|
-
}
|
4091
|
-
|
4092
|
-
def __init__(self, **options):
|
4093
|
-
self.builtinshighlighting = get_bool_opt(
|
4094
|
-
options, 'builtinshighlighting', True)
|
4095
|
-
self.requiredelimiters = get_bool_opt(
|
4096
|
-
options, 'requiredelimiters', False)
|
4097
|
-
|
4098
|
-
self._builtins = set()
|
4099
|
-
self._members = set()
|
4100
|
-
if self.builtinshighlighting:
|
4101
|
-
from pygments.lexers._lassobuiltins import BUILTINS, MEMBERS
|
4102
|
-
for key, value in iteritems(BUILTINS):
|
4103
|
-
self._builtins.update(value)
|
4104
|
-
for key, value in iteritems(MEMBERS):
|
4105
|
-
self._members.update(value)
|
4106
|
-
RegexLexer.__init__(self, **options)
|
4107
|
-
|
4108
|
-
def get_tokens_unprocessed(self, text):
|
4109
|
-
stack = ['root']
|
4110
|
-
if self.requiredelimiters:
|
4111
|
-
stack.append('delimiters')
|
4112
|
-
for index, token, value in \
|
4113
|
-
RegexLexer.get_tokens_unprocessed(self, text, stack):
|
4114
|
-
if (token is Name.Other and value.lower() in self._builtins or
|
4115
|
-
token is Name.Other.Member and
|
4116
|
-
value.lower().rstrip('=') in self._members):
|
4117
|
-
yield index, Name.Builtin, value
|
4118
|
-
continue
|
4119
|
-
yield index, token, value
|
4120
|
-
|
4121
|
-
def analyse_text(text):
|
4122
|
-
rv = 0.0
|
4123
|
-
if 'bin/lasso9' in text:
|
4124
|
-
rv += 0.8
|
4125
|
-
if re.search(r'<\?(=|lasso)|\A\[', text, re.I):
|
4126
|
-
rv += 0.4
|
4127
|
-
if re.search(r'local\(', text, re.I):
|
4128
|
-
rv += 0.4
|
4129
|
-
if '?>' in text:
|
4130
|
-
rv += 0.1
|
4131
|
-
return rv
|
4132
|
-
|
4133
|
-
|
4134
|
-
class QmlLexer(RegexLexer):
|
4135
|
-
"""
|
4136
|
-
For QML files. See http://doc.qt.digia.com/4.7/qdeclarativeintroduction.html.
|
4137
|
-
|
4138
|
-
.. versionadded:: 1.6
|
4139
|
-
"""
|
4140
|
-
|
4141
|
-
# QML is based on javascript, so much of this is taken from the
|
4142
|
-
# JavascriptLexer above.
|
4143
|
-
|
4144
|
-
name = 'QML'
|
4145
|
-
aliases = ['qml']
|
4146
|
-
filenames = ['*.qml',]
|
4147
|
-
mimetypes = [ 'application/x-qml',]
|
4148
|
-
|
4149
|
-
|
4150
|
-
# pasted from JavascriptLexer, with some additions
|
4151
|
-
flags = re.DOTALL
|
4152
|
-
tokens = {
|
4153
|
-
'commentsandwhitespace': [
|
4154
|
-
(r'\s+', Text),
|
4155
|
-
(r'<!--', Comment),
|
4156
|
-
(r'//.*?\n', Comment.Single),
|
4157
|
-
(r'/\*.*?\*/', Comment.Multiline)
|
4158
|
-
],
|
4159
|
-
'slashstartsregex': [
|
4160
|
-
include('commentsandwhitespace'),
|
4161
|
-
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
4162
|
-
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
4163
|
-
(r'(?=/)', Text, ('#pop', 'badregex')),
|
4164
|
-
default('#pop')
|
4165
|
-
],
|
4166
|
-
'badregex': [
|
4167
|
-
(r'\n', Text, '#pop')
|
4168
|
-
],
|
4169
|
-
'root' : [
|
4170
|
-
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
4171
|
-
include('commentsandwhitespace'),
|
4172
|
-
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
4173
|
-
r'(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'),
|
4174
|
-
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
4175
|
-
(r'[})\].]', Punctuation),
|
4176
|
-
|
4177
|
-
# QML insertions
|
4178
|
-
(r'\bid\s*:\s*[A-Za-z][_A-Za-z.0-9]*',Keyword.Declaration,
|
4179
|
-
'slashstartsregex'),
|
4180
|
-
(r'\b[A-Za-z][_A-Za-z.0-9]*\s*:',Keyword, 'slashstartsregex'),
|
4181
|
-
|
4182
|
-
# the rest from JavascriptLexer
|
4183
|
-
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
|
4184
|
-
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
4185
|
-
r'this)\b', Keyword, 'slashstartsregex'),
|
4186
|
-
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
4187
|
-
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
|
4188
|
-
r'extends|final|float|goto|implements|import|int|interface|long|native|'
|
4189
|
-
r'package|private|protected|public|short|static|super|synchronized|throws|'
|
4190
|
-
r'transient|volatile)\b', Keyword.Reserved),
|
4191
|
-
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
|
4192
|
-
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
4193
|
-
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
4194
|
-
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
4195
|
-
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
4196
|
-
r'window)\b', Name.Builtin),
|
4197
|
-
(r'[$a-zA-Z_]\w*', Name.Other),
|
4198
|
-
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
4199
|
-
(r'0x[0-9a-fA-F]+', Number.Hex),
|
4200
|
-
(r'[0-9]+', Number.Integer),
|
4201
|
-
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
4202
|
-
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
4203
|
-
]
|
4204
|
-
}
|
4205
|
-
|
4206
|
-
|
4207
|
-
class CirruLexer(RegexLexer):
|
4208
|
-
"""
|
4209
|
-
Syntax rules of Cirru can be found at:
|
4210
|
-
http://grammar.cirru.org/
|
4211
|
-
|
4212
|
-
* using ``()`` to markup blocks, but limited in the same line
|
4213
|
-
* using ``""`` to markup strings, allow ``\`` to escape
|
4214
|
-
* using ``$`` as a shorthand for ``()`` till indentation end or ``)``
|
4215
|
-
* using indentations for create nesting
|
4216
|
-
|
4217
|
-
.. versionadded:: 2.0
|
4218
|
-
"""
|
4219
|
-
|
4220
|
-
name = 'Cirru'
|
4221
|
-
aliases = ['cirru']
|
4222
|
-
filenames = ['*.cirru', '*.cr']
|
4223
|
-
mimetypes = ['text/x-cirru']
|
4224
|
-
flags = re.MULTILINE
|
4225
|
-
|
4226
|
-
tokens = {
|
4227
|
-
'string': [
|
4228
|
-
(r'[^"\\\n]', String),
|
4229
|
-
(r'\\', String.Escape, 'escape'),
|
4230
|
-
(r'"', String, '#pop'),
|
4231
|
-
],
|
4232
|
-
'escape': [
|
4233
|
-
(r'.', String.Escape, '#pop'),
|
4234
|
-
],
|
4235
|
-
'function': [
|
4236
|
-
(r'[\w-][^\s\(\)\"]*', Name.Function, '#pop'),
|
4237
|
-
(r'\)', Operator, '#pop'),
|
4238
|
-
(r'(?=\n)', Text, '#pop'),
|
4239
|
-
(r'\(', Operator, '#push'),
|
4240
|
-
(r'"', String, ('#pop', 'string')),
|
4241
|
-
(r'\s+', Text.Whitespace),
|
4242
|
-
(r'\,', Operator, '#pop'),
|
4243
|
-
],
|
4244
|
-
'line': [
|
4245
|
-
(r'^\B', Text.Whitespace, 'function'),
|
4246
|
-
(r'\$', Operator, 'function'),
|
4247
|
-
(r'\(', Operator, 'function'),
|
4248
|
-
(r'\)', Operator),
|
4249
|
-
(r'(?=\n)', Text, '#pop'),
|
4250
|
-
(r'\n', Text, '#pop'),
|
4251
|
-
(r'"', String, 'string'),
|
4252
|
-
(r'\s+', Text.Whitespace),
|
4253
|
-
(r'[\d\.]+', Number),
|
4254
|
-
(r'[\w-][^\"\(\)\s]*', Name.Variable),
|
4255
|
-
(r'--', Comment.Single)
|
4256
|
-
],
|
4257
|
-
'root': [
|
4258
|
-
(r'^\s*', Text.Whitespace, ('line', 'function')),
|
4259
|
-
(r'^\s+$', Text.Whitespace),
|
4260
|
-
]
|
4261
|
-
}
|
4262
|
-
|
4263
|
-
|
4264
|
-
class MaskLexer(RegexLexer):
|
4265
|
-
"""
|
4266
|
-
For `Mask <http://github.com/atmajs/MaskJS>`__ markup.
|
4267
|
-
|
4268
|
-
.. versionadded:: 2.0
|
4269
|
-
"""
|
4270
|
-
name = 'Mask'
|
4271
|
-
aliases = ['mask']
|
4272
|
-
filenames = ['*.mask']
|
4273
|
-
mimetypes = ['text/x-mask']
|
4274
|
-
|
4275
|
-
flags = re.MULTILINE | re.IGNORECASE | re.DOTALL
|
4276
|
-
tokens = {
|
4277
|
-
'root': [
|
4278
|
-
(r'\s+', Text),
|
4279
|
-
(r'//.*?\n', Comment.Single),
|
4280
|
-
(r'/\*.*?\*/', Comment.Multiline),
|
4281
|
-
(r'[\{\};>]', Punctuation),
|
4282
|
-
(r"'''", String, 'string-trpl-single'),
|
4283
|
-
(r'"""', String, 'string-trpl-double'),
|
4284
|
-
(r"'", String, 'string-single'),
|
4285
|
-
(r'"', String, 'string-double'),
|
4286
|
-
(r'([\w-]+)', Name.Tag, 'node'),
|
4287
|
-
(r'([^\.#;{>\s]+)', Name.Class, 'node'),
|
4288
|
-
(r'(#[\w-]+)', Name.Function, 'node'),
|
4289
|
-
(r'(\.[\w-]+)', Name.Variable.Class, 'node')
|
4290
|
-
],
|
4291
|
-
'string-base': [
|
4292
|
-
(r'\\.', String.Escape),
|
4293
|
-
(r'~\[', String.Interpol, 'interpolation'),
|
4294
|
-
(r'.', String.Single),
|
4295
|
-
],
|
4296
|
-
'string-single':[
|
4297
|
-
(r"'", String.Single, '#pop'),
|
4298
|
-
include('string-base')
|
4299
|
-
],
|
4300
|
-
'string-double':[
|
4301
|
-
(r'"', String.Single, '#pop'),
|
4302
|
-
include('string-base')
|
4303
|
-
],
|
4304
|
-
'string-trpl-single':[
|
4305
|
-
(r"'''", String.Single, '#pop'),
|
4306
|
-
include('string-base')
|
4307
|
-
],
|
4308
|
-
'string-trpl-double':[
|
4309
|
-
(r'"""', String.Single, '#pop'),
|
4310
|
-
include('string-base')
|
4311
|
-
],
|
4312
|
-
'interpolation': [
|
4313
|
-
(r'\]', String.Interpol, '#pop'),
|
4314
|
-
(r'\s*:', String.Interpol, 'expression'),
|
4315
|
-
(r'\s*\w+:', Name.Other),
|
4316
|
-
(r'[^\]]+', String.Interpol)
|
4317
|
-
],
|
4318
|
-
'expression': [
|
4319
|
-
(r'[^\]]+', using(JavascriptLexer), '#pop')
|
4320
|
-
],
|
4321
|
-
'node': [
|
4322
|
-
(r'\s+', Text),
|
4323
|
-
(r'\.', Name.Variable.Class, 'node-class'),
|
4324
|
-
(r'\#', Name.Function, 'node-id'),
|
4325
|
-
(r'style[ \t]*=', Name.Attribute, 'node-attr-style-value'),
|
4326
|
-
(r'[\w:-]+[ \t]*=', Name.Attribute, 'node-attr-value'),
|
4327
|
-
(r'[\w:-]+', Name.Attribute),
|
4328
|
-
(r'[>{;]', Punctuation, '#pop')
|
4329
|
-
],
|
4330
|
-
'node-class': [
|
4331
|
-
(r'[\w-]+', Name.Variable.Class),
|
4332
|
-
(r'~\[', String.Interpol, 'interpolation'),
|
4333
|
-
default('#pop')
|
4334
|
-
],
|
4335
|
-
'node-id': [
|
4336
|
-
(r'[\w-]+', Name.Function),
|
4337
|
-
(r'~\[', String.Interpol, 'interpolation'),
|
4338
|
-
default('#pop')
|
4339
|
-
],
|
4340
|
-
'node-attr-value':[
|
4341
|
-
(r'\s+', Text),
|
4342
|
-
(r'\w+', Name.Variable, '#pop'),
|
4343
|
-
(r"'", String, 'string-single-pop2'),
|
4344
|
-
(r'"', String, 'string-double-pop2'),
|
4345
|
-
default('#pop')
|
4346
|
-
],
|
4347
|
-
'node-attr-style-value':[
|
4348
|
-
(r'\s+', Text),
|
4349
|
-
(r"'", String.Single, 'css-single-end'),
|
4350
|
-
(r'"', String.Single, 'css-double-end'),
|
4351
|
-
include('node-attr-value')
|
4352
|
-
],
|
4353
|
-
'css-base': [
|
4354
|
-
(r'\s+', Text),
|
4355
|
-
(r";", Punctuation),
|
4356
|
-
(r"[\w\-]+\s*:", Name.Builtin)
|
4357
|
-
],
|
4358
|
-
'css-single-end': [
|
4359
|
-
include('css-base'),
|
4360
|
-
(r"'", String.Single, '#pop:2'),
|
4361
|
-
(r"[^;']+", Name.Entity)
|
4362
|
-
],
|
4363
|
-
'css-double-end': [
|
4364
|
-
include('css-base'),
|
4365
|
-
(r'"', String.Single, '#pop:2'),
|
4366
|
-
(r"[^;\"]+", Name.Entity)
|
4367
|
-
],
|
4368
|
-
'string-single-pop2':[
|
4369
|
-
(r"'", String.Single, '#pop:2'),
|
4370
|
-
include('string-base')
|
4371
|
-
],
|
4372
|
-
'string-double-pop2':[
|
4373
|
-
(r'"', String.Single, '#pop:2'),
|
4374
|
-
include('string-base')
|
4375
|
-
],
|
4376
|
-
}
|
4377
|
-
|
4378
|
-
|
4379
|
-
class ZephirLexer(RegexLexer):
|
4380
|
-
"""
|
4381
|
-
For `Zephir language <http://zephir-lang.com/>`_ source code.
|
4382
|
-
|
4383
|
-
Zephir is a compiled high level language aimed
|
4384
|
-
to the creation of C-extensions for PHP.
|
4385
|
-
|
4386
|
-
.. versionadded:: 2.0
|
4387
|
-
"""
|
4388
|
-
|
4389
|
-
name = 'Zephir'
|
4390
|
-
aliases = ['zephir']
|
4391
|
-
filenames = ['*.zep']
|
4392
|
-
|
4393
|
-
zephir_keywords = [ 'fetch', 'echo', 'isset', 'empty']
|
4394
|
-
zephir_type = [ 'bit', 'bits' , 'string' ]
|
4395
|
-
|
4396
|
-
flags = re.DOTALL | re.MULTILINE
|
4397
|
-
|
4398
|
-
tokens = {
|
4399
|
-
'commentsandwhitespace': [
|
4400
|
-
(r'\s+', Text),
|
4401
|
-
(r'//.*?\n', Comment.Single),
|
4402
|
-
(r'/\*.*?\*/', Comment.Multiline)
|
4403
|
-
],
|
4404
|
-
'slashstartsregex': [
|
4405
|
-
include('commentsandwhitespace'),
|
4406
|
-
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
4407
|
-
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
4408
|
-
default('#pop')
|
4409
|
-
],
|
4410
|
-
'badregex': [
|
4411
|
-
(r'\n', Text, '#pop')
|
4412
|
-
],
|
4413
|
-
'root': [
|
4414
|
-
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
4415
|
-
include('commentsandwhitespace'),
|
4416
|
-
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
4417
|
-
r'(<<|>>>?|==?|!=?|->|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'),
|
4418
|
-
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
4419
|
-
(r'[})\].]', Punctuation),
|
4420
|
-
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|loop|'
|
4421
|
-
r'require|inline|throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
4422
|
-
r'namespace|use|extends|this|fetch|isset|unset|echo|fetch|likely|unlikely|'
|
4423
|
-
r'empty)\b', Keyword, 'slashstartsregex'),
|
4424
|
-
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
4425
|
-
(r'(abstract|boolean|bool|char|class|const|double|enum|export|extends|final|'
|
4426
|
-
r'native|goto|implements|import|int|string|interface|long|ulong|char|uchar|'
|
4427
|
-
r'float|unsigned|private|protected|public|short|static|self|throws|reverse|'
|
4428
|
-
r'transient|volatile)\b', Keyword.Reserved),
|
4429
|
-
(r'(true|false|null|undefined)\b', Keyword.Constant),
|
4430
|
-
(r'(Array|Boolean|Date|_REQUEST|_COOKIE|_SESSION|'
|
4431
|
-
r'_GET|_POST|_SERVER|this|stdClass|range|count|iterator|'
|
4432
|
-
r'window)\b', Name.Builtin),
|
4433
|
-
(r'[$a-zA-Z_][\w\\]*', Name.Other),
|
4434
|
-
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
4435
|
-
(r'0x[0-9a-fA-F]+', Number.Hex),
|
4436
|
-
(r'[0-9]+', Number.Integer),
|
4437
|
-
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
4438
|
-
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
4439
|
-
]
|
4440
|
-
}
|
4441
|
-
|
4442
|
-
class SlimLexer(ExtendedRegexLexer):
|
4443
|
-
"""
|
4444
|
-
For Slim markup.
|
4445
|
-
"""
|
4446
|
-
|
4447
|
-
name = 'Slim'
|
4448
|
-
aliases = ['slim']
|
4449
|
-
filenames = ['*.slim']
|
4450
|
-
mimetypes = ['text/x-slim']
|
4451
|
-
|
4452
|
-
flags = re.IGNORECASE
|
4453
|
-
_dot = r'(?: \|\n(?=.* \|)|.)'
|
4454
|
-
tokens = {
|
4455
|
-
'root': [
|
4456
|
-
(r'[ \t]*\n', Text),
|
4457
|
-
(r'[ \t]*', _indentation),
|
4458
|
-
],
|
4459
|
-
|
4460
|
-
'css': [
|
4461
|
-
(r'\.[\w:-]+', Name.Class, 'tag'),
|
4462
|
-
(r'\#[\w:-]+', Name.Function, 'tag'),
|
4463
|
-
],
|
4464
|
-
|
4465
|
-
'eval-or-plain': [
|
4466
|
-
(r'([ \t]*==?)(.*\n)',
|
4467
|
-
bygroups(Punctuation, using(RubyLexer)),
|
4468
|
-
'root'),
|
4469
|
-
(r'[ \t]+[\w:-]+(?=[=])', Name.Attribute, 'html-attributes'),
|
4470
|
-
(r'', Text, 'plain'),
|
4471
|
-
],
|
4472
|
-
|
4473
|
-
'content': [
|
4474
|
-
include('css'),
|
4475
|
-
(r'[\w:-]+:[ \t]*\n', Text, 'plain'),
|
4476
|
-
(r'(-)(.*\n)',
|
4477
|
-
bygroups(Punctuation, using(RubyLexer)),
|
4478
|
-
'#pop'),
|
4479
|
-
(r'\|' + _dot + r'*\n', _starts_block(Text, 'plain'), '#pop'),
|
4480
|
-
(r'/' + _dot + r'*\n', _starts_block(Comment.Preproc, 'slim-comment-block'), '#pop'),
|
4481
|
-
(r'[\w:-]+', Name.Tag, 'tag'),
|
4482
|
-
include('eval-or-plain'),
|
4483
|
-
],
|
4484
|
-
|
4485
|
-
'tag': [
|
4486
|
-
include('css'),
|
4487
|
-
(r'[<>]{1,2}(?=[ \t=])', Punctuation),
|
4488
|
-
(r'[ \t]+\n', Punctuation, '#pop:2'),
|
4489
|
-
include('eval-or-plain'),
|
4490
|
-
],
|
4491
|
-
|
4492
|
-
'plain': [
|
4493
|
-
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text),
|
4494
|
-
(r'(#\{)(.*?)(\})',
|
4495
|
-
bygroups(String.Interpol, using(RubyLexer), String.Interpol)),
|
4496
|
-
(r'\n', Text, 'root'),
|
4497
|
-
],
|
4498
|
-
|
4499
|
-
'html-attributes': [
|
4500
|
-
(r'=', Punctuation),
|
4501
|
-
(r'"[^\"]+"', using(RubyLexer), 'tag'),
|
4502
|
-
(r'\'[^\']+\'', using(RubyLexer), 'tag'),
|
4503
|
-
(r'[\w]+', Text, 'tag'),
|
4504
|
-
],
|
4505
|
-
|
4506
|
-
'slim-comment-block': [
|
4507
|
-
(_dot + '+', Comment.Preproc),
|
4508
|
-
(r'\n', Text, 'root'),
|
4509
|
-
],
|
4510
|
-
}
|
24
|
+
__all__ = []
|