pygments.rb-jruby 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/CHANGELOG.md +71 -0
- data/Gemfile +2 -0
- data/LICENSE +17 -0
- data/README.md +118 -0
- data/Rakefile +66 -0
- data/bench.rb +22 -0
- data/cache-lexers.rb +8 -0
- data/lexers +0 -0
- data/lib/pygments.rb +8 -0
- data/lib/pygments/lexer.rb +148 -0
- data/lib/pygments/mentos.py +351 -0
- data/lib/pygments/popen.rb +404 -0
- data/lib/pygments/version.rb +3 -0
- data/pygments.rb.gemspec +24 -0
- data/test/test_data.c +2581 -0
- data/test/test_data.py +514 -0
- data/test/test_data_generated +2582 -0
- data/test/test_pygments.rb +287 -0
- data/vendor/custom_lexers/github.py +565 -0
- data/vendor/pygments-main/AUTHORS +153 -0
- data/vendor/pygments-main/CHANGES +889 -0
- data/vendor/pygments-main/LICENSE +25 -0
- data/vendor/pygments-main/MANIFEST.in +6 -0
- data/vendor/pygments-main/Makefile +59 -0
- data/vendor/pygments-main/REVISION +1 -0
- data/vendor/pygments-main/TODO +15 -0
- data/vendor/pygments-main/docs/generate.py +472 -0
- data/vendor/pygments-main/docs/pygmentize.1 +94 -0
- data/vendor/pygments-main/docs/src/api.txt +270 -0
- data/vendor/pygments-main/docs/src/authors.txt +5 -0
- data/vendor/pygments-main/docs/src/changelog.txt +5 -0
- data/vendor/pygments-main/docs/src/cmdline.txt +147 -0
- data/vendor/pygments-main/docs/src/filterdevelopment.txt +70 -0
- data/vendor/pygments-main/docs/src/filters.txt +42 -0
- data/vendor/pygments-main/docs/src/formatterdevelopment.txt +169 -0
- data/vendor/pygments-main/docs/src/formatters.txt +48 -0
- data/vendor/pygments-main/docs/src/index.txt +69 -0
- data/vendor/pygments-main/docs/src/installation.txt +71 -0
- data/vendor/pygments-main/docs/src/integrate.txt +48 -0
- data/vendor/pygments-main/docs/src/java.txt +70 -0
- data/vendor/pygments-main/docs/src/lexerdevelopment.txt +603 -0
- data/vendor/pygments-main/docs/src/lexers.txt +67 -0
- data/vendor/pygments-main/docs/src/moinmoin.txt +39 -0
- data/vendor/pygments-main/docs/src/plugins.txt +93 -0
- data/vendor/pygments-main/docs/src/quickstart.txt +202 -0
- data/vendor/pygments-main/docs/src/rstdirective.txt +22 -0
- data/vendor/pygments-main/docs/src/styles.txt +143 -0
- data/vendor/pygments-main/docs/src/tokens.txt +349 -0
- data/vendor/pygments-main/docs/src/unicode.txt +49 -0
- data/vendor/pygments-main/external/autopygmentize +64 -0
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +144 -0
- data/vendor/pygments-main/external/markdown-processor.py +67 -0
- data/vendor/pygments-main/external/moin-parser.py +112 -0
- data/vendor/pygments-main/external/pygments.bashcomp +38 -0
- data/vendor/pygments-main/external/rst-directive-old.py +77 -0
- data/vendor/pygments-main/external/rst-directive.py +83 -0
- data/vendor/pygments-main/ez_setup.py +276 -0
- data/vendor/pygments-main/pygmentize +7 -0
- data/vendor/pygments-main/pygments/__init__.py +91 -0
- data/vendor/pygments-main/pygments/cmdline.py +441 -0
- data/vendor/pygments-main/pygments/console.py +74 -0
- data/vendor/pygments-main/pygments/filter.py +74 -0
- data/vendor/pygments-main/pygments/filters/__init__.py +356 -0
- data/vendor/pygments-main/pygments/formatter.py +95 -0
- data/vendor/pygments-main/pygments/formatters/__init__.py +68 -0
- data/vendor/pygments-main/pygments/formatters/_mapping.py +92 -0
- data/vendor/pygments-main/pygments/formatters/bbcode.py +109 -0
- data/vendor/pygments-main/pygments/formatters/html.py +821 -0
- data/vendor/pygments-main/pygments/formatters/img.py +553 -0
- data/vendor/pygments-main/pygments/formatters/latex.py +378 -0
- data/vendor/pygments-main/pygments/formatters/other.py +115 -0
- data/vendor/pygments-main/pygments/formatters/rtf.py +136 -0
- data/vendor/pygments-main/pygments/formatters/svg.py +154 -0
- data/vendor/pygments-main/pygments/formatters/terminal.py +112 -0
- data/vendor/pygments-main/pygments/formatters/terminal256.py +222 -0
- data/vendor/pygments-main/pygments/lexer.py +765 -0
- data/vendor/pygments-main/pygments/lexers/__init__.py +240 -0
- data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1645 -0
- data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +232 -0
- data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +5172 -0
- data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +249 -0
- data/vendor/pygments-main/pygments/lexers/_mapping.py +354 -0
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +562 -0
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +3787 -0
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +233 -0
- data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +557 -0
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +40 -0
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +360 -0
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +2290 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +398 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +3723 -0
- data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +671 -0
- data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +2731 -0
- data/vendor/pygments-main/pygments/lexers/github.py +565 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +356 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +1112 -0
- data/vendor/pygments-main/pygments/lexers/math.py +1918 -0
- data/vendor/pygments-main/pygments/lexers/other.py +3778 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +778 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +424 -0
- data/vendor/pygments-main/pygments/lexers/special.py +100 -0
- data/vendor/pygments-main/pygments/lexers/sql.py +559 -0
- data/vendor/pygments-main/pygments/lexers/templates.py +1742 -0
- data/vendor/pygments-main/pygments/lexers/text.py +1893 -0
- data/vendor/pygments-main/pygments/lexers/web.py +4045 -0
- data/vendor/pygments-main/pygments/modeline.py +40 -0
- data/vendor/pygments-main/pygments/plugin.py +74 -0
- data/vendor/pygments-main/pygments/scanner.py +104 -0
- data/vendor/pygments-main/pygments/style.py +117 -0
- data/vendor/pygments-main/pygments/styles/__init__.py +70 -0
- data/vendor/pygments-main/pygments/styles/autumn.py +65 -0
- data/vendor/pygments-main/pygments/styles/borland.py +51 -0
- data/vendor/pygments-main/pygments/styles/bw.py +49 -0
- data/vendor/pygments-main/pygments/styles/colorful.py +81 -0
- data/vendor/pygments-main/pygments/styles/default.py +73 -0
- data/vendor/pygments-main/pygments/styles/emacs.py +72 -0
- data/vendor/pygments-main/pygments/styles/friendly.py +72 -0
- data/vendor/pygments-main/pygments/styles/fruity.py +42 -0
- data/vendor/pygments-main/pygments/styles/manni.py +75 -0
- data/vendor/pygments-main/pygments/styles/monokai.py +106 -0
- data/vendor/pygments-main/pygments/styles/murphy.py +80 -0
- data/vendor/pygments-main/pygments/styles/native.py +65 -0
- data/vendor/pygments-main/pygments/styles/pastie.py +75 -0
- data/vendor/pygments-main/pygments/styles/perldoc.py +69 -0
- data/vendor/pygments-main/pygments/styles/rrt.py +33 -0
- data/vendor/pygments-main/pygments/styles/tango.py +141 -0
- data/vendor/pygments-main/pygments/styles/trac.py +63 -0
- data/vendor/pygments-main/pygments/styles/vim.py +63 -0
- data/vendor/pygments-main/pygments/styles/vs.py +38 -0
- data/vendor/pygments-main/pygments/token.py +195 -0
- data/vendor/pygments-main/pygments/unistring.py +140 -0
- data/vendor/pygments-main/pygments/util.py +277 -0
- data/vendor/pygments-main/scripts/check_sources.py +242 -0
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +32 -0
- data/vendor/pygments-main/scripts/epydoc.css +280 -0
- data/vendor/pygments-main/scripts/find_codetags.py +205 -0
- data/vendor/pygments-main/scripts/find_error.py +170 -0
- data/vendor/pygments-main/scripts/get_vimkw.py +43 -0
- data/vendor/pygments-main/scripts/pylintrc +301 -0
- data/vendor/pygments-main/scripts/reindent.py +291 -0
- data/vendor/pygments-main/scripts/vim2pygments.py +933 -0
- data/vendor/pygments-main/setup.cfg +7 -0
- data/vendor/pygments-main/setup.py +90 -0
- data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +37 -0
- data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +869 -0
- data/vendor/pygments-main/tests/dtds/HTML4.dcl +88 -0
- data/vendor/pygments-main/tests/dtds/HTML4.dtd +1092 -0
- data/vendor/pygments-main/tests/dtds/HTML4.soc +9 -0
- data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +195 -0
- data/vendor/pygments-main/tests/dtds/HTMLspec.ent +77 -0
- data/vendor/pygments-main/tests/dtds/HTMLsym.ent +241 -0
- data/vendor/pygments-main/tests/examplefiles/ANTLRv3.g +608 -0
- data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +209 -0
- data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +102 -0
- data/vendor/pygments-main/tests/examplefiles/BOM.js +1 -0
- data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +611 -0
- data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -0
- data/vendor/pygments-main/tests/examplefiles/Constants.mo +158 -0
- data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +411 -0
- data/vendor/pygments-main/tests/examplefiles/Deflate.fs +578 -0
- data/vendor/pygments-main/tests/examplefiles/Errors.scala +18 -0
- data/vendor/pygments-main/tests/examplefiles/File.hy +174 -0
- data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +66 -0
- data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
- data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -0
- data/vendor/pygments-main/tests/examplefiles/Intro.java +1660 -0
- data/vendor/pygments-main/tests/examplefiles/Makefile +1131 -0
- data/vendor/pygments-main/tests/examplefiles/Object.st +4394 -0
- data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +584 -0
- data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +23 -0
- data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +378 -0
- data/vendor/pygments-main/tests/examplefiles/Sorting.mod +470 -0
- data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +382 -0
- data/vendor/pygments-main/tests/examplefiles/addressbook.proto +30 -0
- data/vendor/pygments-main/tests/examplefiles/antlr_throws +1 -0
- data/vendor/pygments-main/tests/examplefiles/apache2.conf +393 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test.as +143 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test2.as +46 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test3.as +3 -0
- data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +27 -0
- data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +25 -0
- data/vendor/pygments-main/tests/examplefiles/badcase.java +2 -0
- data/vendor/pygments-main/tests/examplefiles/batchfile.bat +49 -0
- data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +308 -0
- data/vendor/pygments-main/tests/examplefiles/boot-9.scm +1557 -0
- data/vendor/pygments-main/tests/examplefiles/ca65_example +284 -0
- data/vendor/pygments-main/tests/examplefiles/cbmbas_example +9 -0
- data/vendor/pygments-main/tests/examplefiles/cells.ps +515 -0
- data/vendor/pygments-main/tests/examplefiles/ceval.c +2604 -0
- data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +13 -0
- data/vendor/pygments-main/tests/examplefiles/classes.dylan +125 -0
- data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +10 -0
- data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +447 -0
- data/vendor/pygments-main/tests/examplefiles/database.pytb +20 -0
- data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +2461 -0
- data/vendor/pygments-main/tests/examplefiles/demo.ahk +181 -0
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +38 -0
- data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +68 -0
- data/vendor/pygments-main/tests/examplefiles/dwarf.cw +17 -0
- data/vendor/pygments-main/tests/examplefiles/erl_session +10 -0
- data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +1 -0
- data/vendor/pygments-main/tests/examplefiles/evil_regex.js +48 -0
- data/vendor/pygments-main/tests/examplefiles/example.Rd +78 -0
- data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
- data/vendor/pygments-main/tests/examplefiles/example.c +2080 -0
- data/vendor/pygments-main/tests/examplefiles/example.ceylon +52 -0
- data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
- data/vendor/pygments-main/tests/examplefiles/example.cls +15 -0
- data/vendor/pygments-main/tests/examplefiles/example.cob +3556 -0
- data/vendor/pygments-main/tests/examplefiles/example.cpp +2363 -0
- data/vendor/pygments-main/tests/examplefiles/example.gs +106 -0
- data/vendor/pygments-main/tests/examplefiles/example.gst +7 -0
- data/vendor/pygments-main/tests/examplefiles/example.hx +142 -0
- data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
- data/vendor/pygments-main/tests/examplefiles/example.kt +47 -0
- data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.lua +250 -0
- data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -0
- data/vendor/pygments-main/tests/examplefiles/example.moo +26 -0
- data/vendor/pygments-main/tests/examplefiles/example.moon +629 -0
- data/vendor/pygments-main/tests/examplefiles/example.msc +43 -0
- data/vendor/pygments-main/tests/examplefiles/example.nim +1010 -0
- data/vendor/pygments-main/tests/examplefiles/example.ns2 +69 -0
- data/vendor/pygments-main/tests/examplefiles/example.p +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.pas +2708 -0
- data/vendor/pygments-main/tests/examplefiles/example.prg +161 -0
- data/vendor/pygments-main/tests/examplefiles/example.rb +1852 -0
- data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
- data/vendor/pygments-main/tests/examplefiles/example.rhtml +561 -0
- data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
- data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.shell-session +45 -0
- data/vendor/pygments-main/tests/examplefiles/example.sml +156 -0
- data/vendor/pygments-main/tests/examplefiles/example.snobol +15 -0
- data/vendor/pygments-main/tests/examplefiles/example.stan +108 -0
- data/vendor/pygments-main/tests/examplefiles/example.tea +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.ts +28 -0
- data/vendor/pygments-main/tests/examplefiles/example.u +548 -0
- data/vendor/pygments-main/tests/examplefiles/example.weechatlog +9 -0
- data/vendor/pygments-main/tests/examplefiles/example.xhtml +376 -0
- data/vendor/pygments-main/tests/examplefiles/example.xtend +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.yaml +302 -0
- data/vendor/pygments-main/tests/examplefiles/example2.aspx +29 -0
- data/vendor/pygments-main/tests/examplefiles/example2.msc +79 -0
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +363 -0
- data/vendor/pygments-main/tests/examplefiles/example_file.fy +128 -0
- data/vendor/pygments-main/tests/examplefiles/firefox.mak +586 -0
- data/vendor/pygments-main/tests/examplefiles/flipflop.sv +19 -0
- data/vendor/pygments-main/tests/examplefiles/foo.sce +6 -0
- data/vendor/pygments-main/tests/examplefiles/format.ml +1213 -0
- data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +77 -0
- data/vendor/pygments-main/tests/examplefiles/function.mu +1 -0
- data/vendor/pygments-main/tests/examplefiles/functional.rst +1472 -0
- data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +133 -0
- data/vendor/pygments-main/tests/examplefiles/genclass.clj +510 -0
- data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +193 -0
- data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +33 -0
- data/vendor/pygments-main/tests/examplefiles/glsl.frag +7 -0
- data/vendor/pygments-main/tests/examplefiles/glsl.vert +13 -0
- data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +22 -0
- data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
- data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
- data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +1 -0
- data/vendor/pygments-main/tests/examplefiles/http_request_example +15 -0
- data/vendor/pygments-main/tests/examplefiles/http_response_example +29 -0
- data/vendor/pygments-main/tests/examplefiles/import.hs +4 -0
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -0
- data/vendor/pygments-main/tests/examplefiles/intro.ik +24 -0
- data/vendor/pygments-main/tests/examplefiles/ints.php +10 -0
- data/vendor/pygments-main/tests/examplefiles/intsyn.fun +675 -0
- data/vendor/pygments-main/tests/examplefiles/intsyn.sig +286 -0
- data/vendor/pygments-main/tests/examplefiles/irb_heredoc +8 -0
- data/vendor/pygments-main/tests/examplefiles/irc.lsp +214 -0
- data/vendor/pygments-main/tests/examplefiles/java.properties +16 -0
- data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +28 -0
- data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +45 -0
- data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +713 -0
- data/vendor/pygments-main/tests/examplefiles/json.lasso +301 -0
- data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -0
- data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +13 -0
- data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +47 -0
- data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +41 -0
- data/vendor/pygments-main/tests/examplefiles/logos_example.xm +28 -0
- data/vendor/pygments-main/tests/examplefiles/ltmain.sh +2849 -0
- data/vendor/pygments-main/tests/examplefiles/main.cmake +42 -0
- data/vendor/pygments-main/tests/examplefiles/markdown.lsp +679 -0
- data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +3 -0
- data/vendor/pygments-main/tests/examplefiles/matlab_sample +30 -0
- data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +37 -0
- data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
- data/vendor/pygments-main/tests/examplefiles/mg_sample.pro +73 -0
- data/vendor/pygments-main/tests/examplefiles/minehunt.qml +112 -0
- data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +4 -0
- data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +340 -0
- data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +38 -0
- data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +95 -0
- data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +96 -0
- data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +30 -0
- data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +87 -0
- data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +118 -0
- data/vendor/pygments-main/tests/examplefiles/numbers.c +12 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +32 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example2.m +24 -0
- data/vendor/pygments-main/tests/examplefiles/perl_misc +62 -0
- data/vendor/pygments-main/tests/examplefiles/perl_perl5db +998 -0
- data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +120 -0
- data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +856 -0
- data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +163 -0
- data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +567 -0
- data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +1223 -0
- data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +47 -0
- data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +10 -0
- data/vendor/pygments-main/tests/examplefiles/psql_session.txt +122 -0
- data/vendor/pygments-main/tests/examplefiles/py3_test.txt +2 -0
- data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +4 -0
- data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +14 -0
- data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +2 -0
- data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +4 -0
- data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +234 -0
- data/vendor/pygments-main/tests/examplefiles/qsort.prolog +13 -0
- data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +38 -0
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +280 -0
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +2 -0
- data/vendor/pygments-main/tests/examplefiles/regex.js +22 -0
- data/vendor/pygments-main/tests/examplefiles/reversi.lsp +427 -0
- data/vendor/pygments-main/tests/examplefiles/robotframework.txt +39 -0
- data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +11 -0
- data/vendor/pygments-main/tests/examplefiles/rust_example.rs +233 -0
- data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -0
- data/vendor/pygments-main/tests/examplefiles/session.dylan-console +9 -0
- data/vendor/pygments-main/tests/examplefiles/sibling.prolog +19 -0
- data/vendor/pygments-main/tests/examplefiles/simple.md +747 -0
- data/vendor/pygments-main/tests/examplefiles/smarty_example.html +209 -0
- data/vendor/pygments-main/tests/examplefiles/source.lgt +343 -0
- data/vendor/pygments-main/tests/examplefiles/sources.list +62 -0
- data/vendor/pygments-main/tests/examplefiles/sphere.pov +18 -0
- data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +27 -0
- data/vendor/pygments-main/tests/examplefiles/squid.conf +30 -0
- data/vendor/pygments-main/tests/examplefiles/string.jl +1031 -0
- data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +21 -0
- data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +3 -0
- data/vendor/pygments-main/tests/examplefiles/swig_java.swg +1329 -0
- data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
- data/vendor/pygments-main/tests/examplefiles/test.R +153 -0
- data/vendor/pygments-main/tests/examplefiles/test.adb +211 -0
- data/vendor/pygments-main/tests/examplefiles/test.agda +102 -0
- data/vendor/pygments-main/tests/examplefiles/test.asy +131 -0
- data/vendor/pygments-main/tests/examplefiles/test.awk +121 -0
- data/vendor/pygments-main/tests/examplefiles/test.bas +29 -0
- data/vendor/pygments-main/tests/examplefiles/test.bb +95 -0
- data/vendor/pygments-main/tests/examplefiles/test.bmx +145 -0
- data/vendor/pygments-main/tests/examplefiles/test.boo +39 -0
- data/vendor/pygments-main/tests/examplefiles/test.bro +250 -0
- data/vendor/pygments-main/tests/examplefiles/test.cs +374 -0
- data/vendor/pygments-main/tests/examplefiles/test.css +54 -0
- data/vendor/pygments-main/tests/examplefiles/test.cu +36 -0
- data/vendor/pygments-main/tests/examplefiles/test.d +135 -0
- data/vendor/pygments-main/tests/examplefiles/test.dart +23 -0
- data/vendor/pygments-main/tests/examplefiles/test.dtd +89 -0
- data/vendor/pygments-main/tests/examplefiles/test.ebnf +31 -0
- data/vendor/pygments-main/tests/examplefiles/test.ec +605 -0
- data/vendor/pygments-main/tests/examplefiles/test.ecl +58 -0
- data/vendor/pygments-main/tests/examplefiles/test.eh +315 -0
- data/vendor/pygments-main/tests/examplefiles/test.erl +169 -0
- data/vendor/pygments-main/tests/examplefiles/test.evoque +33 -0
- data/vendor/pygments-main/tests/examplefiles/test.fan +818 -0
- data/vendor/pygments-main/tests/examplefiles/test.flx +57 -0
- data/vendor/pygments-main/tests/examplefiles/test.gdc +13 -0
- data/vendor/pygments-main/tests/examplefiles/test.groovy +97 -0
- data/vendor/pygments-main/tests/examplefiles/test.html +339 -0
- data/vendor/pygments-main/tests/examplefiles/test.ini +10 -0
- data/vendor/pygments-main/tests/examplefiles/test.java +653 -0
- data/vendor/pygments-main/tests/examplefiles/test.jsp +24 -0
- data/vendor/pygments-main/tests/examplefiles/test.maql +45 -0
- data/vendor/pygments-main/tests/examplefiles/test.mod +374 -0
- data/vendor/pygments-main/tests/examplefiles/test.moo +51 -0
- data/vendor/pygments-main/tests/examplefiles/test.myt +166 -0
- data/vendor/pygments-main/tests/examplefiles/test.nim +93 -0
- data/vendor/pygments-main/tests/examplefiles/test.opa +10 -0
- data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -0
- data/vendor/pygments-main/tests/examplefiles/test.pas +743 -0
- data/vendor/pygments-main/tests/examplefiles/test.php +505 -0
- data/vendor/pygments-main/tests/examplefiles/test.plot +333 -0
- data/vendor/pygments-main/tests/examplefiles/test.ps1 +108 -0
- data/vendor/pygments-main/tests/examplefiles/test.pypylog +1839 -0
- data/vendor/pygments-main/tests/examplefiles/test.r3 +94 -0
- data/vendor/pygments-main/tests/examplefiles/test.rb +177 -0
- data/vendor/pygments-main/tests/examplefiles/test.rhtml +43 -0
- data/vendor/pygments-main/tests/examplefiles/test.scaml +8 -0
- data/vendor/pygments-main/tests/examplefiles/test.ssp +12 -0
- data/vendor/pygments-main/tests/examplefiles/test.tcsh +830 -0
- data/vendor/pygments-main/tests/examplefiles/test.vb +407 -0
- data/vendor/pygments-main/tests/examplefiles/test.vhdl +161 -0
- data/vendor/pygments-main/tests/examplefiles/test.xqy +138 -0
- data/vendor/pygments-main/tests/examplefiles/test.xsl +23 -0
- data/vendor/pygments-main/tests/examplefiles/test2.pypylog +120 -0
- data/vendor/pygments-main/tests/examplefiles/truncated.pytb +15 -0
- data/vendor/pygments-main/tests/examplefiles/type.lisp +1218 -0
- data/vendor/pygments-main/tests/examplefiles/underscore.coffee +603 -0
- data/vendor/pygments-main/tests/examplefiles/unicode.applescript +5 -0
- data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +11 -0
- data/vendor/pygments-main/tests/examplefiles/unix-io.lid +37 -0
- data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +3 -0
- data/vendor/pygments-main/tests/examplefiles/while.pov +13 -0
- data/vendor/pygments-main/tests/examplefiles/wiki.factor +384 -0
- data/vendor/pygments-main/tests/examplefiles/xml_example +1897 -0
- data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +798 -0
- data/vendor/pygments-main/tests/old_run.py +138 -0
- data/vendor/pygments-main/tests/run.py +49 -0
- data/vendor/pygments-main/tests/support.py +15 -0
- data/vendor/pygments-main/tests/support/tags +36 -0
- data/vendor/pygments-main/tests/test_basic_api.py +295 -0
- data/vendor/pygments-main/tests/test_clexer.py +31 -0
- data/vendor/pygments-main/tests/test_cmdline.py +105 -0
- data/vendor/pygments-main/tests/test_examplefiles.py +99 -0
- data/vendor/pygments-main/tests/test_html_formatter.py +178 -0
- data/vendor/pygments-main/tests/test_latex_formatter.py +55 -0
- data/vendor/pygments-main/tests/test_lexers_other.py +68 -0
- data/vendor/pygments-main/tests/test_perllexer.py +137 -0
- data/vendor/pygments-main/tests/test_regexlexer.py +47 -0
- data/vendor/pygments-main/tests/test_token.py +46 -0
- data/vendor/pygments-main/tests/test_using_api.py +40 -0
- data/vendor/pygments-main/tests/test_util.py +135 -0
- data/vendor/simplejson/.gitignore +10 -0
- data/vendor/simplejson/.travis.yml +5 -0
- data/vendor/simplejson/CHANGES.txt +291 -0
- data/vendor/simplejson/LICENSE.txt +19 -0
- data/vendor/simplejson/MANIFEST.in +5 -0
- data/vendor/simplejson/README.rst +19 -0
- data/vendor/simplejson/conf.py +179 -0
- data/vendor/simplejson/index.rst +628 -0
- data/vendor/simplejson/scripts/make_docs.py +18 -0
- data/vendor/simplejson/setup.py +104 -0
- data/vendor/simplejson/simplejson/__init__.py +510 -0
- data/vendor/simplejson/simplejson/_speedups.c +2745 -0
- data/vendor/simplejson/simplejson/decoder.py +425 -0
- data/vendor/simplejson/simplejson/encoder.py +567 -0
- data/vendor/simplejson/simplejson/ordered_dict.py +119 -0
- data/vendor/simplejson/simplejson/scanner.py +77 -0
- data/vendor/simplejson/simplejson/tests/__init__.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +55 -0
- data/vendor/simplejson/simplejson/tests/test_check_circular.py +30 -0
- data/vendor/simplejson/simplejson/tests/test_decimal.py +66 -0
- data/vendor/simplejson/simplejson/tests/test_decode.py +83 -0
- data/vendor/simplejson/simplejson/tests/test_default.py +9 -0
- data/vendor/simplejson/simplejson/tests/test_dump.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +46 -0
- data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +32 -0
- data/vendor/simplejson/simplejson/tests/test_errors.py +34 -0
- data/vendor/simplejson/simplejson/tests/test_fail.py +91 -0
- data/vendor/simplejson/simplejson/tests/test_float.py +19 -0
- data/vendor/simplejson/simplejson/tests/test_indent.py +86 -0
- data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_namedtuple.py +121 -0
- data/vendor/simplejson/simplejson/tests/test_pass1.py +76 -0
- data/vendor/simplejson/simplejson/tests/test_pass2.py +14 -0
- data/vendor/simplejson/simplejson/tests/test_pass3.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_recursion.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_scanstring.py +117 -0
- data/vendor/simplejson/simplejson/tests/test_separators.py +42 -0
- data/vendor/simplejson/simplejson/tests/test_speedups.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_tuple.py +49 -0
- data/vendor/simplejson/simplejson/tests/test_unicode.py +109 -0
- data/vendor/simplejson/simplejson/tool.py +39 -0
- metadata +557 -0
@@ -0,0 +1,3778 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.other
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Lexers for other languages.
|
7
|
+
|
8
|
+
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
|
9
|
+
:license: BSD, see LICENSE for details.
|
10
|
+
"""
|
11
|
+
|
12
|
+
import re
|
13
|
+
|
14
|
+
from pygments.lexer import RegexLexer, include, bygroups, using, \
|
15
|
+
this, combined, ExtendedRegexLexer
|
16
|
+
from pygments.token import Error, Punctuation, Literal, Token, \
|
17
|
+
Text, Comment, Operator, Keyword, Name, String, Number, Generic, \
|
18
|
+
Whitespace
|
19
|
+
from pygments.util import get_bool_opt
|
20
|
+
from pygments.lexers.web import HtmlLexer
|
21
|
+
|
22
|
+
from pygments.lexers._openedgebuiltins import OPENEDGEKEYWORDS
|
23
|
+
from pygments.lexers._robotframeworklexer import RobotFrameworkLexer
|
24
|
+
|
25
|
+
# backwards compatibility
|
26
|
+
from pygments.lexers.sql import SqlLexer, MySqlLexer, SqliteConsoleLexer
|
27
|
+
from pygments.lexers.shell import BashLexer, BashSessionLexer, BatchLexer, \
|
28
|
+
TcshLexer
|
29
|
+
|
30
|
+
__all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'MOOCodeLexer',
|
31
|
+
'SmalltalkLexer', 'LogtalkLexer', 'GnuplotLexer', 'PovrayLexer',
|
32
|
+
'AppleScriptLexer', 'ModelicaLexer', 'RebolLexer', 'ABAPLexer',
|
33
|
+
'NewspeakLexer', 'GherkinLexer', 'AsymptoteLexer', 'PostScriptLexer',
|
34
|
+
'AutohotkeyLexer', 'GoodDataCLLexer', 'MaqlLexer', 'ProtoBufLexer',
|
35
|
+
'HybrisLexer', 'AwkLexer', 'Cfengine3Lexer', 'SnobolLexer',
|
36
|
+
'ECLLexer', 'UrbiscriptLexer', 'OpenEdgeLexer', 'BroLexer',
|
37
|
+
'MscgenLexer', 'KconfigLexer', 'VGLLexer', 'SourcePawnLexer',
|
38
|
+
'RobotFrameworkLexer', 'PuppetLexer', 'NSISLexer', 'RPMSpecLexer',
|
39
|
+
'CbmBasicV2Lexer', 'AutoItLexer', 'RexxLexer']
|
40
|
+
|
41
|
+
|
42
|
+
class ECLLexer(RegexLexer):
|
43
|
+
"""
|
44
|
+
Lexer for the declarative big-data `ECL
|
45
|
+
<http://hpccsystems.com/community/docs/ecl-language-reference/html>`_
|
46
|
+
language.
|
47
|
+
|
48
|
+
*New in Pygments 1.5.*
|
49
|
+
"""
|
50
|
+
|
51
|
+
name = 'ECL'
|
52
|
+
aliases = ['ecl']
|
53
|
+
filenames = ['*.ecl']
|
54
|
+
mimetypes = ['application/x-ecl']
|
55
|
+
|
56
|
+
flags = re.IGNORECASE | re.MULTILINE
|
57
|
+
|
58
|
+
tokens = {
|
59
|
+
'root': [
|
60
|
+
include('whitespace'),
|
61
|
+
include('statements'),
|
62
|
+
],
|
63
|
+
'whitespace': [
|
64
|
+
(r'\s+', Text),
|
65
|
+
(r'\/\/.*', Comment.Single),
|
66
|
+
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
|
67
|
+
],
|
68
|
+
'statements': [
|
69
|
+
include('types'),
|
70
|
+
include('keywords'),
|
71
|
+
include('functions'),
|
72
|
+
include('hash'),
|
73
|
+
(r'"', String, 'string'),
|
74
|
+
(r'\'', String, 'string'),
|
75
|
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
|
76
|
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
77
|
+
(r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
|
78
|
+
(r'0[0-7]+[LlUu]*', Number.Oct),
|
79
|
+
(r'\d+[LlUu]*', Number.Integer),
|
80
|
+
(r'\*/', Error),
|
81
|
+
(r'[~!%^&*+=|?:<>/-]+', Operator),
|
82
|
+
(r'[{}()\[\],.;]', Punctuation),
|
83
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
84
|
+
],
|
85
|
+
'hash': [
|
86
|
+
(r'^#.*$', Comment.Preproc),
|
87
|
+
],
|
88
|
+
'types': [
|
89
|
+
(r'(RECORD|END)\D', Keyword.Declaration),
|
90
|
+
(r'((?:ASCII|BIG_ENDIAN|BOOLEAN|DATA|DECIMAL|EBCDIC|INTEGER|PATTERN|'
|
91
|
+
r'QSTRING|REAL|RECORD|RULE|SET OF|STRING|TOKEN|UDECIMAL|UNICODE|'
|
92
|
+
r'UNSIGNED|VARSTRING|VARUNICODE)\d*)(\s+)',
|
93
|
+
bygroups(Keyword.Type, Text)),
|
94
|
+
],
|
95
|
+
'keywords': [
|
96
|
+
(r'(APPLY|ASSERT|BUILD|BUILDINDEX|EVALUATE|FAIL|KEYDIFF|KEYPATCH|'
|
97
|
+
r'LOADXML|NOTHOR|NOTIFY|OUTPUT|PARALLEL|SEQUENTIAL|SOAPCALL|WAIT'
|
98
|
+
r'CHECKPOINT|DEPRECATED|FAILCODE|FAILMESSAGE|FAILURE|GLOBAL|'
|
99
|
+
r'INDEPENDENT|ONWARNING|PERSIST|PRIORITY|RECOVERY|STORED|SUCCESS|'
|
100
|
+
r'WAIT|WHEN)\b', Keyword.Reserved),
|
101
|
+
# These are classed differently, check later
|
102
|
+
(r'(ALL|AND|ANY|AS|ATMOST|BEFORE|BEGINC\+\+|BEST|BETWEEN|CASE|CONST|'
|
103
|
+
r'COUNTER|CSV|DESCEND|ENCRYPT|ENDC\+\+|ENDMACRO|EXCEPT|EXCLUSIVE|'
|
104
|
+
r'EXPIRE|EXPORT|EXTEND|FALSE|FEW|FIRST|FLAT|FULL|FUNCTION|GROUP|'
|
105
|
+
r'HEADER|HEADING|HOLE|IFBLOCK|IMPORT|IN|JOINED|KEEP|KEYED|LAST|'
|
106
|
+
r'LEFT|LIMIT|LOAD|LOCAL|LOCALE|LOOKUP|MACRO|MANY|MAXCOUNT|'
|
107
|
+
r'MAXLENGTH|MIN SKEW|MODULE|INTERFACE|NAMED|NOCASE|NOROOT|NOSCAN|'
|
108
|
+
r'NOSORT|NOT|OF|ONLY|OPT|OR|OUTER|OVERWRITE|PACKED|PARTITION|'
|
109
|
+
r'PENALTY|PHYSICALLENGTH|PIPE|QUOTE|RELATIONSHIP|REPEAT|RETURN|'
|
110
|
+
r'RIGHT|SCAN|SELF|SEPARATOR|SERVICE|SHARED|SKEW|SKIP|SQL|STORE|'
|
111
|
+
r'TERMINATOR|THOR|THRESHOLD|TOKEN|TRANSFORM|TRIM|TRUE|TYPE|'
|
112
|
+
r'UNICODEORDER|UNSORTED|VALIDATE|VIRTUAL|WHOLE|WILD|WITHIN|XML|'
|
113
|
+
r'XPATH|__COMPRESSED__)\b', Keyword.Reserved),
|
114
|
+
],
|
115
|
+
'functions': [
|
116
|
+
(r'(ABS|ACOS|ALLNODES|ASCII|ASIN|ASSTRING|ATAN|ATAN2|AVE|CASE|'
|
117
|
+
r'CHOOSE|CHOOSEN|CHOOSESETS|CLUSTERSIZE|COMBINE|CORRELATION|COS|'
|
118
|
+
r'COSH|COUNT|COVARIANCE|CRON|DATASET|DEDUP|DEFINE|DENORMALIZE|'
|
119
|
+
r'DISTRIBUTE|DISTRIBUTED|DISTRIBUTION|EBCDIC|ENTH|ERROR|EVALUATE|'
|
120
|
+
r'EVENT|EVENTEXTRA|EVENTNAME|EXISTS|EXP|FAILCODE|FAILMESSAGE|'
|
121
|
+
r'FETCH|FROMUNICODE|GETISVALID|GLOBAL|GRAPH|GROUP|HASH|HASH32|'
|
122
|
+
r'HASH64|HASHCRC|HASHMD5|HAVING|IF|INDEX|INTFORMAT|ISVALID|'
|
123
|
+
r'ITERATE|JOIN|KEYUNICODE|LENGTH|LIBRARY|LIMIT|LN|LOCAL|LOG|LOOP|'
|
124
|
+
r'MAP|MATCHED|MATCHLENGTH|MATCHPOSITION|MATCHTEXT|MATCHUNICODE|'
|
125
|
+
r'MAX|MERGE|MERGEJOIN|MIN|NOLOCAL|NONEMPTY|NORMALIZE|PARSE|PIPE|'
|
126
|
+
r'POWER|PRELOAD|PROCESS|PROJECT|PULL|RANDOM|RANGE|RANK|RANKED|'
|
127
|
+
r'REALFORMAT|RECORDOF|REGEXFIND|REGEXREPLACE|REGROUP|REJECTED|'
|
128
|
+
r'ROLLUP|ROUND|ROUNDUP|ROW|ROWDIFF|SAMPLE|SET|SIN|SINH|SIZEOF|'
|
129
|
+
r'SOAPCALL|SORT|SORTED|SQRT|STEPPED|STORED|SUM|TABLE|TAN|TANH|'
|
130
|
+
r'THISNODE|TOPN|TOUNICODE|TRANSFER|TRIM|TRUNCATE|TYPEOF|UNGROUP|'
|
131
|
+
r'UNICODEORDER|VARIANCE|WHICH|WORKUNIT|XMLDECODE|XMLENCODE|'
|
132
|
+
r'XMLTEXT|XMLUNICODE)\b', Name.Function),
|
133
|
+
],
|
134
|
+
'string': [
|
135
|
+
(r'"', String, '#pop'),
|
136
|
+
(r'\'', String, '#pop'),
|
137
|
+
(r'[^"\']+', String),
|
138
|
+
],
|
139
|
+
}
|
140
|
+
|
141
|
+
|
142
|
+
class BrainfuckLexer(RegexLexer):
|
143
|
+
"""
|
144
|
+
Lexer for the esoteric `BrainFuck <http://www.muppetlabs.com/~breadbox/bf/>`_
|
145
|
+
language.
|
146
|
+
"""
|
147
|
+
|
148
|
+
name = 'Brainfuck'
|
149
|
+
aliases = ['brainfuck', 'bf']
|
150
|
+
filenames = ['*.bf', '*.b']
|
151
|
+
mimetypes = ['application/x-brainfuck']
|
152
|
+
|
153
|
+
tokens = {
|
154
|
+
'common': [
|
155
|
+
# use different colors for different instruction types
|
156
|
+
(r'[.,]+', Name.Tag),
|
157
|
+
(r'[+-]+', Name.Builtin),
|
158
|
+
(r'[<>]+', Name.Variable),
|
159
|
+
(r'[^.,+\-<>\[\]]+', Comment),
|
160
|
+
],
|
161
|
+
'root': [
|
162
|
+
(r'\[', Keyword, 'loop'),
|
163
|
+
(r'\]', Error),
|
164
|
+
include('common'),
|
165
|
+
],
|
166
|
+
'loop': [
|
167
|
+
(r'\[', Keyword, '#push'),
|
168
|
+
(r'\]', Keyword, '#pop'),
|
169
|
+
include('common'),
|
170
|
+
]
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
class BefungeLexer(RegexLexer):
|
175
|
+
"""
|
176
|
+
Lexer for the esoteric `Befunge <http://en.wikipedia.org/wiki/Befunge>`_
|
177
|
+
language.
|
178
|
+
|
179
|
+
*New in Pygments 0.7.*
|
180
|
+
"""
|
181
|
+
name = 'Befunge'
|
182
|
+
aliases = ['befunge']
|
183
|
+
filenames = ['*.befunge']
|
184
|
+
mimetypes = ['application/x-befunge']
|
185
|
+
|
186
|
+
tokens = {
|
187
|
+
'root': [
|
188
|
+
(r'[0-9a-f]', Number),
|
189
|
+
(r'[\+\*/%!`-]', Operator), # Traditional math
|
190
|
+
(r'[<>^v?\[\]rxjk]', Name.Variable), # Move, imperatives
|
191
|
+
(r'[:\\$.,n]', Name.Builtin), # Stack ops, imperatives
|
192
|
+
(r'[|_mw]', Keyword),
|
193
|
+
(r'[{}]', Name.Tag), # Befunge-98 stack ops
|
194
|
+
(r'".*?"', String.Double), # Strings don't appear to allow escapes
|
195
|
+
(r'\'.', String.Single), # Single character
|
196
|
+
(r'[#;]', Comment), # Trampoline... depends on direction hit
|
197
|
+
(r'[pg&~=@iotsy]', Keyword), # Misc
|
198
|
+
(r'[()A-Z]', Comment), # Fingerprints
|
199
|
+
(r'\s+', Text), # Whitespace doesn't matter
|
200
|
+
],
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
class RedcodeLexer(RegexLexer):
|
205
|
+
"""
|
206
|
+
A simple Redcode lexer based on ICWS'94.
|
207
|
+
Contributed by Adam Blinkinsop <blinks@acm.org>.
|
208
|
+
|
209
|
+
*New in Pygments 0.8.*
|
210
|
+
"""
|
211
|
+
name = 'Redcode'
|
212
|
+
aliases = ['redcode']
|
213
|
+
filenames = ['*.cw']
|
214
|
+
|
215
|
+
opcodes = ['DAT','MOV','ADD','SUB','MUL','DIV','MOD',
|
216
|
+
'JMP','JMZ','JMN','DJN','CMP','SLT','SPL',
|
217
|
+
'ORG','EQU','END']
|
218
|
+
modifiers = ['A','B','AB','BA','F','X','I']
|
219
|
+
|
220
|
+
tokens = {
|
221
|
+
'root': [
|
222
|
+
# Whitespace:
|
223
|
+
(r'\s+', Text),
|
224
|
+
(r';.*$', Comment.Single),
|
225
|
+
# Lexemes:
|
226
|
+
# Identifiers
|
227
|
+
(r'\b(%s)\b' % '|'.join(opcodes), Name.Function),
|
228
|
+
(r'\b(%s)\b' % '|'.join(modifiers), Name.Decorator),
|
229
|
+
(r'[A-Za-z_][A-Za-z_0-9]+', Name),
|
230
|
+
# Operators
|
231
|
+
(r'[-+*/%]', Operator),
|
232
|
+
(r'[#$@<>]', Operator), # mode
|
233
|
+
(r'[.,]', Punctuation), # mode
|
234
|
+
# Numbers
|
235
|
+
(r'[-+]?\d+', Number.Integer),
|
236
|
+
],
|
237
|
+
}
|
238
|
+
|
239
|
+
|
240
|
+
class MOOCodeLexer(RegexLexer):
|
241
|
+
"""
|
242
|
+
For `MOOCode <http://www.moo.mud.org/>`_ (the MOO scripting
|
243
|
+
language).
|
244
|
+
|
245
|
+
*New in Pygments 0.9.*
|
246
|
+
"""
|
247
|
+
name = 'MOOCode'
|
248
|
+
filenames = ['*.moo']
|
249
|
+
aliases = ['moocode', 'moo']
|
250
|
+
mimetypes = ['text/x-moocode']
|
251
|
+
|
252
|
+
tokens = {
|
253
|
+
'root' : [
|
254
|
+
# Numbers
|
255
|
+
(r'(0|[1-9][0-9_]*)', Number.Integer),
|
256
|
+
# Strings
|
257
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
258
|
+
# exceptions
|
259
|
+
(r'(E_PERM|E_DIV)', Name.Exception),
|
260
|
+
# db-refs
|
261
|
+
(r'((#[-0-9]+)|(\$[a-z_A-Z0-9]+))', Name.Entity),
|
262
|
+
# Keywords
|
263
|
+
(r'\b(if|else|elseif|endif|for|endfor|fork|endfork|while'
|
264
|
+
r'|endwhile|break|continue|return|try'
|
265
|
+
r'|except|endtry|finally|in)\b', Keyword),
|
266
|
+
# builtins
|
267
|
+
(r'(random|length)', Name.Builtin),
|
268
|
+
# special variables
|
269
|
+
(r'(player|caller|this|args)', Name.Variable.Instance),
|
270
|
+
# skip whitespace
|
271
|
+
(r'\s+', Text),
|
272
|
+
(r'\n', Text),
|
273
|
+
# other operators
|
274
|
+
(r'([!;=,{}&\|:\.\[\]@\(\)\<\>\?]+)', Operator),
|
275
|
+
# function call
|
276
|
+
(r'([a-z_A-Z0-9]+)(\()', bygroups(Name.Function, Operator)),
|
277
|
+
# variables
|
278
|
+
(r'([a-zA-Z_0-9]+)', Text),
|
279
|
+
]
|
280
|
+
}
|
281
|
+
|
282
|
+
|
283
|
+
class SmalltalkLexer(RegexLexer):
|
284
|
+
"""
|
285
|
+
For `Smalltalk <http://www.smalltalk.org/>`_ syntax.
|
286
|
+
Contributed by Stefan Matthias Aust.
|
287
|
+
Rewritten by Nils Winter.
|
288
|
+
|
289
|
+
*New in Pygments 0.10.*
|
290
|
+
"""
|
291
|
+
name = 'Smalltalk'
|
292
|
+
filenames = ['*.st']
|
293
|
+
aliases = ['smalltalk', 'squeak', 'st']
|
294
|
+
mimetypes = ['text/x-smalltalk']
|
295
|
+
|
296
|
+
tokens = {
|
297
|
+
'root' : [
|
298
|
+
(r'(<)(\w+:)(.*?)(>)', bygroups(Text, Keyword, Text, Text)),
|
299
|
+
include('squeak fileout'),
|
300
|
+
include('whitespaces'),
|
301
|
+
include('method definition'),
|
302
|
+
(r'(\|)([\w\s]*)(\|)', bygroups(Operator, Name.Variable, Operator)),
|
303
|
+
include('objects'),
|
304
|
+
(r'\^|\:=|\_', Operator),
|
305
|
+
# temporaries
|
306
|
+
(r'[\]({}.;!]', Text),
|
307
|
+
],
|
308
|
+
'method definition' : [
|
309
|
+
# Not perfect can't allow whitespaces at the beginning and the
|
310
|
+
# without breaking everything
|
311
|
+
(r'([a-zA-Z]+\w*:)(\s*)(\w+)',
|
312
|
+
bygroups(Name.Function, Text, Name.Variable)),
|
313
|
+
(r'^(\b[a-zA-Z]+\w*\b)(\s*)$', bygroups(Name.Function, Text)),
|
314
|
+
(r'^([-+*/\\~<>=|&!?,@%]+)(\s*)(\w+)(\s*)$',
|
315
|
+
bygroups(Name.Function, Text, Name.Variable, Text)),
|
316
|
+
],
|
317
|
+
'blockvariables' : [
|
318
|
+
include('whitespaces'),
|
319
|
+
(r'(:)(\s*)(\w+)',
|
320
|
+
bygroups(Operator, Text, Name.Variable)),
|
321
|
+
(r'\|', Operator, '#pop'),
|
322
|
+
(r'', Text, '#pop'), # else pop
|
323
|
+
],
|
324
|
+
'literals' : [
|
325
|
+
(r"'(''|[^'])*'", String, 'afterobject'),
|
326
|
+
(r'\$.', String.Char, 'afterobject'),
|
327
|
+
(r'#\(', String.Symbol, 'parenth'),
|
328
|
+
(r'\)', Text, 'afterobject'),
|
329
|
+
(r'(\d+r)?-?\d+(\.\d+)?(e-?\d+)?', Number, 'afterobject'),
|
330
|
+
],
|
331
|
+
'_parenth_helper' : [
|
332
|
+
include('whitespaces'),
|
333
|
+
(r'(\d+r)?-?\d+(\.\d+)?(e-?\d+)?', Number),
|
334
|
+
(r'[-+*/\\~<>=|&#!?,@%\w:]+', String.Symbol),
|
335
|
+
# literals
|
336
|
+
(r"'(''|[^'])*'", String),
|
337
|
+
(r'\$.', String.Char),
|
338
|
+
(r'#*\(', String.Symbol, 'inner_parenth'),
|
339
|
+
],
|
340
|
+
'parenth' : [
|
341
|
+
# This state is a bit tricky since
|
342
|
+
# we can't just pop this state
|
343
|
+
(r'\)', String.Symbol, ('root', 'afterobject')),
|
344
|
+
include('_parenth_helper'),
|
345
|
+
],
|
346
|
+
'inner_parenth': [
|
347
|
+
(r'\)', String.Symbol, '#pop'),
|
348
|
+
include('_parenth_helper'),
|
349
|
+
],
|
350
|
+
'whitespaces' : [
|
351
|
+
# skip whitespace and comments
|
352
|
+
(r'\s+', Text),
|
353
|
+
(r'"(""|[^"])*"', Comment),
|
354
|
+
],
|
355
|
+
'objects' : [
|
356
|
+
(r'\[', Text, 'blockvariables'),
|
357
|
+
(r'\]', Text, 'afterobject'),
|
358
|
+
(r'\b(self|super|true|false|nil|thisContext)\b',
|
359
|
+
Name.Builtin.Pseudo, 'afterobject'),
|
360
|
+
(r'\b[A-Z]\w*(?!:)\b', Name.Class, 'afterobject'),
|
361
|
+
(r'\b[a-z]\w*(?!:)\b', Name.Variable, 'afterobject'),
|
362
|
+
(r'#("(""|[^"])*"|[-+*/\\~<>=|&!?,@%]+|[\w:]+)',
|
363
|
+
String.Symbol, 'afterobject'),
|
364
|
+
include('literals'),
|
365
|
+
],
|
366
|
+
'afterobject' : [
|
367
|
+
(r'! !$', Keyword , '#pop'), # squeak chunk delimiter
|
368
|
+
include('whitespaces'),
|
369
|
+
(r'\b(ifTrue:|ifFalse:|whileTrue:|whileFalse:|timesRepeat:)',
|
370
|
+
Name.Builtin, '#pop'),
|
371
|
+
(r'\b(new\b(?!:))', Name.Builtin),
|
372
|
+
(r'\:=|\_', Operator, '#pop'),
|
373
|
+
(r'\b[a-zA-Z]+\w*:', Name.Function, '#pop'),
|
374
|
+
(r'\b[a-zA-Z]+\w*', Name.Function),
|
375
|
+
(r'\w+:?|[-+*/\\~<>=|&!?,@%]+', Name.Function, '#pop'),
|
376
|
+
(r'\.', Punctuation, '#pop'),
|
377
|
+
(r';', Punctuation),
|
378
|
+
(r'[\])}]', Text),
|
379
|
+
(r'[\[({]', Text, '#pop'),
|
380
|
+
],
|
381
|
+
'squeak fileout' : [
|
382
|
+
# Squeak fileout format (optional)
|
383
|
+
(r'^"(""|[^"])*"!', Keyword),
|
384
|
+
(r"^'(''|[^'])*'!", Keyword),
|
385
|
+
(r'^(!)(\w+)( commentStamp: )(.*?)( prior: .*?!\n)(.*?)(!)',
|
386
|
+
bygroups(Keyword, Name.Class, Keyword, String, Keyword, Text, Keyword)),
|
387
|
+
(r"^(!)(\w+(?: class)?)( methodsFor: )('(?:''|[^'])*')(.*?!)",
|
388
|
+
bygroups(Keyword, Name.Class, Keyword, String, Keyword)),
|
389
|
+
(r'^(\w+)( subclass: )(#\w+)'
|
390
|
+
r'(\s+instanceVariableNames: )(.*?)'
|
391
|
+
r'(\s+classVariableNames: )(.*?)'
|
392
|
+
r'(\s+poolDictionaries: )(.*?)'
|
393
|
+
r'(\s+category: )(.*?)(!)',
|
394
|
+
bygroups(Name.Class, Keyword, String.Symbol, Keyword, String, Keyword,
|
395
|
+
String, Keyword, String, Keyword, String, Keyword)),
|
396
|
+
(r'^(\w+(?: class)?)(\s+instanceVariableNames: )(.*?)(!)',
|
397
|
+
bygroups(Name.Class, Keyword, String, Keyword)),
|
398
|
+
(r'(!\n)(\].*)(! !)$', bygroups(Keyword, Text, Keyword)),
|
399
|
+
(r'! !$', Keyword),
|
400
|
+
],
|
401
|
+
}
|
402
|
+
|
403
|
+
|
404
|
+
class LogtalkLexer(RegexLexer):
|
405
|
+
"""
|
406
|
+
For `Logtalk <http://logtalk.org/>`_ source code.
|
407
|
+
|
408
|
+
*New in Pygments 0.10.*
|
409
|
+
"""
|
410
|
+
|
411
|
+
name = 'Logtalk'
|
412
|
+
aliases = ['logtalk']
|
413
|
+
filenames = ['*.lgt']
|
414
|
+
mimetypes = ['text/x-logtalk']
|
415
|
+
|
416
|
+
tokens = {
|
417
|
+
'root': [
|
418
|
+
# Directives
|
419
|
+
(r'^\s*:-\s',Punctuation,'directive'),
|
420
|
+
# Comments
|
421
|
+
(r'%.*?\n', Comment),
|
422
|
+
(r'/\*(.|\n)*?\*/',Comment),
|
423
|
+
# Whitespace
|
424
|
+
(r'\n', Text),
|
425
|
+
(r'\s+', Text),
|
426
|
+
# Numbers
|
427
|
+
(r"0'.", Number),
|
428
|
+
(r'0b[01]+', Number),
|
429
|
+
(r'0o[0-7]+', Number),
|
430
|
+
(r'0x[0-9a-fA-F]+', Number),
|
431
|
+
(r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number),
|
432
|
+
# Variables
|
433
|
+
(r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable),
|
434
|
+
# Event handlers
|
435
|
+
(r'(after|before)(?=[(])', Keyword),
|
436
|
+
# Execution-context methods
|
437
|
+
(r'(parameter|this|se(lf|nder))(?=[(])', Keyword),
|
438
|
+
# Reflection
|
439
|
+
(r'(current_predicate|predicate_property)(?=[(])', Keyword),
|
440
|
+
# DCGs and term expansion
|
441
|
+
(r'(expand_(goal|term)|(goal|term)_expansion|phrase)(?=[(])',
|
442
|
+
Keyword),
|
443
|
+
# Entity
|
444
|
+
(r'(abolish|c(reate|urrent))_(object|protocol|category)(?=[(])',
|
445
|
+
Keyword),
|
446
|
+
(r'(object|protocol|category)_property(?=[(])', Keyword),
|
447
|
+
# Entity relations
|
448
|
+
(r'co(mplements_object|nforms_to_protocol)(?=[(])', Keyword),
|
449
|
+
(r'extends_(object|protocol|category)(?=[(])', Keyword),
|
450
|
+
(r'imp(lements_protocol|orts_category)(?=[(])', Keyword),
|
451
|
+
(r'(instantiat|specializ)es_class(?=[(])', Keyword),
|
452
|
+
# Events
|
453
|
+
(r'(current_event|(abolish|define)_events)(?=[(])', Keyword),
|
454
|
+
# Flags
|
455
|
+
(r'(current|set)_logtalk_flag(?=[(])', Keyword),
|
456
|
+
# Compiling, loading, and library paths
|
457
|
+
(r'logtalk_(compile|l(ibrary_path|oad_context|oad))(?=[(])',
|
458
|
+
Keyword),
|
459
|
+
# Database
|
460
|
+
(r'(clause|retract(all)?)(?=[(])', Keyword),
|
461
|
+
(r'a(bolish|ssert(a|z))(?=[(])', Keyword),
|
462
|
+
# Control constructs
|
463
|
+
(r'(ca(ll|tch)|throw)(?=[(])', Keyword),
|
464
|
+
(r'(fail|true)\b', Keyword),
|
465
|
+
# All solutions
|
466
|
+
(r'((bag|set)of|f(ind|or)all)(?=[(])', Keyword),
|
467
|
+
# Multi-threading meta-predicates
|
468
|
+
(r'threaded(_(call|once|ignore|exit|peek|wait|notify))?(?=[(])',
|
469
|
+
Keyword),
|
470
|
+
# Term unification
|
471
|
+
(r'unify_with_occurs_check(?=[(])', Keyword),
|
472
|
+
# Term creation and decomposition
|
473
|
+
(r'(functor|arg|copy_term|numbervars)(?=[(])', Keyword),
|
474
|
+
# Evaluable functors
|
475
|
+
(r'(rem|mod|abs|sign)(?=[(])', Keyword),
|
476
|
+
(r'float(_(integer|fractional)_part)?(?=[(])', Keyword),
|
477
|
+
(r'(floor|truncate|round|ceiling)(?=[(])', Keyword),
|
478
|
+
# Other arithmetic functors
|
479
|
+
(r'(cos|atan|exp|log|s(in|qrt))(?=[(])', Keyword),
|
480
|
+
# Term testing
|
481
|
+
(r'(var|atom(ic)?|integer|float|c(allable|ompound)|n(onvar|umber)|'
|
482
|
+
r'ground)(?=[(])', Keyword),
|
483
|
+
# Term comparison
|
484
|
+
(r'compare(?=[(])', Keyword),
|
485
|
+
# Stream selection and control
|
486
|
+
(r'(curren|se)t_(in|out)put(?=[(])', Keyword),
|
487
|
+
(r'(open|close)(?=[(])', Keyword),
|
488
|
+
(r'flush_output(?=[(])', Keyword),
|
489
|
+
(r'(at_end_of_stream|flush_output)\b', Keyword),
|
490
|
+
(r'(stream_property|at_end_of_stream|set_stream_position)(?=[(])',
|
491
|
+
Keyword),
|
492
|
+
# Character and byte input/output
|
493
|
+
(r'(nl|(get|peek|put)_(byte|c(har|ode)))(?=[(])', Keyword),
|
494
|
+
(r'\bnl\b', Keyword),
|
495
|
+
# Term input/output
|
496
|
+
(r'read(_term)?(?=[(])', Keyword),
|
497
|
+
(r'write(q|_(canonical|term))?(?=[(])', Keyword),
|
498
|
+
(r'(current_)?op(?=[(])', Keyword),
|
499
|
+
(r'(current_)?char_conversion(?=[(])', Keyword),
|
500
|
+
# Atomic term processing
|
501
|
+
(r'atom_(length|c(hars|o(ncat|des)))(?=[(])', Keyword),
|
502
|
+
(r'(char_code|sub_atom)(?=[(])', Keyword),
|
503
|
+
(r'number_c(har|ode)s(?=[(])', Keyword),
|
504
|
+
# Implementation defined hooks functions
|
505
|
+
(r'(se|curren)t_prolog_flag(?=[(])', Keyword),
|
506
|
+
(r'\bhalt\b', Keyword),
|
507
|
+
(r'halt(?=[(])', Keyword),
|
508
|
+
# Message sending operators
|
509
|
+
(r'(::|:|\^\^)', Operator),
|
510
|
+
# External call
|
511
|
+
(r'[{}]', Keyword),
|
512
|
+
# Logic and control
|
513
|
+
(r'\b(ignore|once)(?=[(])', Keyword),
|
514
|
+
(r'\brepeat\b', Keyword),
|
515
|
+
# Sorting
|
516
|
+
(r'(key)?sort(?=[(])', Keyword),
|
517
|
+
# Bitwise functors
|
518
|
+
(r'(>>|<<|/\\|\\\\|\\)', Operator),
|
519
|
+
# Arithemtic evaluation
|
520
|
+
(r'\bis\b', Keyword),
|
521
|
+
# Arithemtic comparison
|
522
|
+
(r'(=:=|=\\=|<|=<|>=|>)', Operator),
|
523
|
+
# Term creation and decomposition
|
524
|
+
(r'=\.\.', Operator),
|
525
|
+
# Term unification
|
526
|
+
(r'(=|\\=)', Operator),
|
527
|
+
# Term comparison
|
528
|
+
(r'(==|\\==|@=<|@<|@>=|@>)', Operator),
|
529
|
+
# Evaluable functors
|
530
|
+
(r'(//|[-+*/])', Operator),
|
531
|
+
(r'\b(e|pi|mod|rem)\b', Operator),
|
532
|
+
# Other arithemtic functors
|
533
|
+
(r'\b\*\*\b', Operator),
|
534
|
+
# DCG rules
|
535
|
+
(r'-->', Operator),
|
536
|
+
# Control constructs
|
537
|
+
(r'([!;]|->)', Operator),
|
538
|
+
# Logic and control
|
539
|
+
(r'\\+', Operator),
|
540
|
+
# Mode operators
|
541
|
+
(r'[?@]', Operator),
|
542
|
+
# Existential quantifier
|
543
|
+
(r'\^', Operator),
|
544
|
+
# Strings
|
545
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
546
|
+
# Ponctuation
|
547
|
+
(r'[()\[\],.|]', Text),
|
548
|
+
# Atoms
|
549
|
+
(r"[a-z][a-zA-Z0-9_]*", Text),
|
550
|
+
(r"'", String, 'quoted_atom'),
|
551
|
+
],
|
552
|
+
|
553
|
+
'quoted_atom': [
|
554
|
+
(r"''", String),
|
555
|
+
(r"'", String, '#pop'),
|
556
|
+
(r'\\([\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\)', String.Escape),
|
557
|
+
(r"[^\\'\n]+", String),
|
558
|
+
(r'\\', String),
|
559
|
+
],
|
560
|
+
|
561
|
+
'directive': [
|
562
|
+
# Conditional compilation directives
|
563
|
+
(r'(el)?if(?=[(])', Keyword, 'root'),
|
564
|
+
(r'(e(lse|ndif))[.]', Keyword, 'root'),
|
565
|
+
# Entity directives
|
566
|
+
(r'(category|object|protocol)(?=[(])', Keyword, 'entityrelations'),
|
567
|
+
(r'(end_(category|object|protocol))[.]',Keyword, 'root'),
|
568
|
+
# Predicate scope directives
|
569
|
+
(r'(public|protected|private)(?=[(])', Keyword, 'root'),
|
570
|
+
# Other directives
|
571
|
+
(r'e(n(coding|sure_loaded)|xport)(?=[(])', Keyword, 'root'),
|
572
|
+
(r'in(fo|itialization)(?=[(])', Keyword, 'root'),
|
573
|
+
(r'(dynamic|synchronized|threaded)[.]', Keyword, 'root'),
|
574
|
+
(r'(alias|d(ynamic|iscontiguous)|m(eta_predicate|ode|ultifile)|'
|
575
|
+
r's(et_(logtalk|prolog)_flag|ynchronized))(?=[(])',
|
576
|
+
Keyword, 'root'),
|
577
|
+
(r'op(?=[(])', Keyword, 'root'),
|
578
|
+
(r'(c(alls|oinductive)|reexport|use(s|_module))(?=[(])',
|
579
|
+
Keyword, 'root'),
|
580
|
+
(r'[a-z][a-zA-Z0-9_]*(?=[(])', Text, 'root'),
|
581
|
+
(r'[a-z][a-zA-Z0-9_]*[.]', Text, 'root'),
|
582
|
+
],
|
583
|
+
|
584
|
+
'entityrelations': [
|
585
|
+
(r'(complements|extends|i(nstantiates|mp(lements|orts))|specializes)'
|
586
|
+
r'(?=[(])', Keyword),
|
587
|
+
# Numbers
|
588
|
+
(r"0'.", Number),
|
589
|
+
(r'0b[01]+', Number),
|
590
|
+
(r'0o[0-7]+', Number),
|
591
|
+
(r'0x[0-9a-fA-F]+', Number),
|
592
|
+
(r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number),
|
593
|
+
# Variables
|
594
|
+
(r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable),
|
595
|
+
# Atoms
|
596
|
+
(r"[a-z][a-zA-Z0-9_]*", Text),
|
597
|
+
(r"'", String, 'quoted_atom'),
|
598
|
+
# Strings
|
599
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
600
|
+
# End of entity-opening directive
|
601
|
+
(r'([)]\.)', Text, 'root'),
|
602
|
+
# Scope operator
|
603
|
+
(r'(::)', Operator),
|
604
|
+
# Ponctuation
|
605
|
+
(r'[()\[\],.|]', Text),
|
606
|
+
# Comments
|
607
|
+
(r'%.*?\n', Comment),
|
608
|
+
(r'/\*(.|\n)*?\*/',Comment),
|
609
|
+
# Whitespace
|
610
|
+
(r'\n', Text),
|
611
|
+
(r'\s+', Text),
|
612
|
+
]
|
613
|
+
}
|
614
|
+
|
615
|
+
def analyse_text(text):
|
616
|
+
if ':- object(' in text:
|
617
|
+
return True
|
618
|
+
if ':- protocol(' in text:
|
619
|
+
return True
|
620
|
+
if ':- category(' in text:
|
621
|
+
return True
|
622
|
+
return False
|
623
|
+
|
624
|
+
|
625
|
+
def _shortened(word):
|
626
|
+
dpos = word.find('$')
|
627
|
+
return '|'.join([word[:dpos] + word[dpos+1:i] + r'\b'
|
628
|
+
for i in range(len(word), dpos, -1)])
|
629
|
+
def _shortened_many(*words):
|
630
|
+
return '|'.join(map(_shortened, words))
|
631
|
+
|
632
|
+
class GnuplotLexer(RegexLexer):
|
633
|
+
"""
|
634
|
+
For `Gnuplot <http://gnuplot.info/>`_ plotting scripts.
|
635
|
+
|
636
|
+
*New in Pygments 0.11.*
|
637
|
+
"""
|
638
|
+
|
639
|
+
name = 'Gnuplot'
|
640
|
+
aliases = ['gnuplot']
|
641
|
+
filenames = ['*.plot', '*.plt']
|
642
|
+
mimetypes = ['text/x-gnuplot']
|
643
|
+
|
644
|
+
tokens = {
|
645
|
+
'root': [
|
646
|
+
include('whitespace'),
|
647
|
+
(_shortened('bi$nd'), Keyword, 'bind'),
|
648
|
+
(_shortened_many('ex$it', 'q$uit'), Keyword, 'quit'),
|
649
|
+
(_shortened('f$it'), Keyword, 'fit'),
|
650
|
+
(r'(if)(\s*)(\()', bygroups(Keyword, Text, Punctuation), 'if'),
|
651
|
+
(r'else\b', Keyword),
|
652
|
+
(_shortened('pa$use'), Keyword, 'pause'),
|
653
|
+
(_shortened_many('p$lot', 'rep$lot', 'sp$lot'), Keyword, 'plot'),
|
654
|
+
(_shortened('sa$ve'), Keyword, 'save'),
|
655
|
+
(_shortened('se$t'), Keyword, ('genericargs', 'optionarg')),
|
656
|
+
(_shortened_many('sh$ow', 'uns$et'),
|
657
|
+
Keyword, ('noargs', 'optionarg')),
|
658
|
+
(_shortened_many('low$er', 'ra$ise', 'ca$ll', 'cd$', 'cl$ear',
|
659
|
+
'h$elp', '\\?$', 'hi$story', 'l$oad', 'pr$int',
|
660
|
+
'pwd$', 're$read', 'res$et', 'scr$eendump',
|
661
|
+
'she$ll', 'sy$stem', 'up$date'),
|
662
|
+
Keyword, 'genericargs'),
|
663
|
+
(_shortened_many('pwd$', 're$read', 'res$et', 'scr$eendump',
|
664
|
+
'she$ll', 'test$'),
|
665
|
+
Keyword, 'noargs'),
|
666
|
+
('([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(=)',
|
667
|
+
bygroups(Name.Variable, Text, Operator), 'genericargs'),
|
668
|
+
('([a-zA-Z_][a-zA-Z0-9_]*)(\s*\(.*?\)\s*)(=)',
|
669
|
+
bygroups(Name.Function, Text, Operator), 'genericargs'),
|
670
|
+
(r'@[a-zA-Z_][a-zA-Z0-9_]*', Name.Constant), # macros
|
671
|
+
(r';', Keyword),
|
672
|
+
],
|
673
|
+
'comment': [
|
674
|
+
(r'[^\\\n]', Comment),
|
675
|
+
(r'\\\n', Comment),
|
676
|
+
(r'\\', Comment),
|
677
|
+
# don't add the newline to the Comment token
|
678
|
+
('', Comment, '#pop'),
|
679
|
+
],
|
680
|
+
'whitespace': [
|
681
|
+
('#', Comment, 'comment'),
|
682
|
+
(r'[ \t\v\f]+', Text),
|
683
|
+
],
|
684
|
+
'noargs': [
|
685
|
+
include('whitespace'),
|
686
|
+
# semicolon and newline end the argument list
|
687
|
+
(r';', Punctuation, '#pop'),
|
688
|
+
(r'\n', Text, '#pop'),
|
689
|
+
],
|
690
|
+
'dqstring': [
|
691
|
+
(r'"', String, '#pop'),
|
692
|
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
693
|
+
(r'[^\\"\n]+', String), # all other characters
|
694
|
+
(r'\\\n', String), # line continuation
|
695
|
+
(r'\\', String), # stray backslash
|
696
|
+
(r'\n', String, '#pop'), # newline ends the string too
|
697
|
+
],
|
698
|
+
'sqstring': [
|
699
|
+
(r"''", String), # escaped single quote
|
700
|
+
(r"'", String, '#pop'),
|
701
|
+
(r"[^\\'\n]+", String), # all other characters
|
702
|
+
(r'\\\n', String), # line continuation
|
703
|
+
(r'\\', String), # normal backslash
|
704
|
+
(r'\n', String, '#pop'), # newline ends the string too
|
705
|
+
],
|
706
|
+
'genericargs': [
|
707
|
+
include('noargs'),
|
708
|
+
(r'"', String, 'dqstring'),
|
709
|
+
(r"'", String, 'sqstring'),
|
710
|
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float),
|
711
|
+
(r'(\d+\.\d*|\.\d+)', Number.Float),
|
712
|
+
(r'-?\d+', Number.Integer),
|
713
|
+
('[,.~!%^&*+=|?:<>/-]', Operator),
|
714
|
+
('[{}()\[\]]', Punctuation),
|
715
|
+
(r'(eq|ne)\b', Operator.Word),
|
716
|
+
(r'([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(\()',
|
717
|
+
bygroups(Name.Function, Text, Punctuation)),
|
718
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
719
|
+
(r'@[a-zA-Z_][a-zA-Z0-9_]*', Name.Constant), # macros
|
720
|
+
(r'\\\n', Text),
|
721
|
+
],
|
722
|
+
'optionarg': [
|
723
|
+
include('whitespace'),
|
724
|
+
(_shortened_many(
|
725
|
+
"a$ll","an$gles","ar$row","au$toscale","b$ars","bor$der",
|
726
|
+
"box$width","cl$abel","c$lip","cn$trparam","co$ntour","da$ta",
|
727
|
+
"data$file","dg$rid3d","du$mmy","enc$oding","dec$imalsign",
|
728
|
+
"fit$","font$path","fo$rmat","fu$nction","fu$nctions","g$rid",
|
729
|
+
"hid$den3d","his$torysize","is$osamples","k$ey","keyt$itle",
|
730
|
+
"la$bel","li$nestyle","ls$","loa$dpath","loc$ale","log$scale",
|
731
|
+
"mac$ros","map$ping","map$ping3d","mar$gin","lmar$gin",
|
732
|
+
"rmar$gin","tmar$gin","bmar$gin","mo$use","multi$plot",
|
733
|
+
"mxt$ics","nomxt$ics","mx2t$ics","nomx2t$ics","myt$ics",
|
734
|
+
"nomyt$ics","my2t$ics","nomy2t$ics","mzt$ics","nomzt$ics",
|
735
|
+
"mcbt$ics","nomcbt$ics","of$fsets","or$igin","o$utput",
|
736
|
+
"pa$rametric","pm$3d","pal$ette","colorb$ox","p$lot",
|
737
|
+
"poi$ntsize","pol$ar","pr$int","obj$ect","sa$mples","si$ze",
|
738
|
+
"st$yle","su$rface","table$","t$erminal","termo$ptions","ti$cs",
|
739
|
+
"ticsc$ale","ticsl$evel","timef$mt","tim$estamp","tit$le",
|
740
|
+
"v$ariables","ve$rsion","vi$ew","xyp$lane","xda$ta","x2da$ta",
|
741
|
+
"yda$ta","y2da$ta","zda$ta","cbda$ta","xl$abel","x2l$abel",
|
742
|
+
"yl$abel","y2l$abel","zl$abel","cbl$abel","xti$cs","noxti$cs",
|
743
|
+
"x2ti$cs","nox2ti$cs","yti$cs","noyti$cs","y2ti$cs","noy2ti$cs",
|
744
|
+
"zti$cs","nozti$cs","cbti$cs","nocbti$cs","xdti$cs","noxdti$cs",
|
745
|
+
"x2dti$cs","nox2dti$cs","ydti$cs","noydti$cs","y2dti$cs",
|
746
|
+
"noy2dti$cs","zdti$cs","nozdti$cs","cbdti$cs","nocbdti$cs",
|
747
|
+
"xmti$cs","noxmti$cs","x2mti$cs","nox2mti$cs","ymti$cs",
|
748
|
+
"noymti$cs","y2mti$cs","noy2mti$cs","zmti$cs","nozmti$cs",
|
749
|
+
"cbmti$cs","nocbmti$cs","xr$ange","x2r$ange","yr$ange",
|
750
|
+
"y2r$ange","zr$ange","cbr$ange","rr$ange","tr$ange","ur$ange",
|
751
|
+
"vr$ange","xzeroa$xis","x2zeroa$xis","yzeroa$xis","y2zeroa$xis",
|
752
|
+
"zzeroa$xis","zeroa$xis","z$ero"), Name.Builtin, '#pop'),
|
753
|
+
],
|
754
|
+
'bind': [
|
755
|
+
('!', Keyword, '#pop'),
|
756
|
+
(_shortened('all$windows'), Name.Builtin),
|
757
|
+
include('genericargs'),
|
758
|
+
],
|
759
|
+
'quit': [
|
760
|
+
(r'gnuplot\b', Keyword),
|
761
|
+
include('noargs'),
|
762
|
+
],
|
763
|
+
'fit': [
|
764
|
+
(r'via\b', Name.Builtin),
|
765
|
+
include('plot'),
|
766
|
+
],
|
767
|
+
'if': [
|
768
|
+
(r'\)', Punctuation, '#pop'),
|
769
|
+
include('genericargs'),
|
770
|
+
],
|
771
|
+
'pause': [
|
772
|
+
(r'(mouse|any|button1|button2|button3)\b', Name.Builtin),
|
773
|
+
(_shortened('key$press'), Name.Builtin),
|
774
|
+
include('genericargs'),
|
775
|
+
],
|
776
|
+
'plot': [
|
777
|
+
(_shortened_many('ax$es', 'axi$s', 'bin$ary', 'ev$ery', 'i$ndex',
|
778
|
+
'mat$rix', 's$mooth', 'thru$', 't$itle',
|
779
|
+
'not$itle', 'u$sing', 'w$ith'),
|
780
|
+
Name.Builtin),
|
781
|
+
include('genericargs'),
|
782
|
+
],
|
783
|
+
'save': [
|
784
|
+
(_shortened_many('f$unctions', 's$et', 't$erminal', 'v$ariables'),
|
785
|
+
Name.Builtin),
|
786
|
+
include('genericargs'),
|
787
|
+
],
|
788
|
+
}
|
789
|
+
|
790
|
+
|
791
|
+
class PovrayLexer(RegexLexer):
|
792
|
+
"""
|
793
|
+
For `Persistence of Vision Raytracer <http://www.povray.org/>`_ files.
|
794
|
+
|
795
|
+
*New in Pygments 0.11.*
|
796
|
+
"""
|
797
|
+
name = 'POVRay'
|
798
|
+
aliases = ['pov']
|
799
|
+
filenames = ['*.pov', '*.inc']
|
800
|
+
mimetypes = ['text/x-povray']
|
801
|
+
|
802
|
+
tokens = {
|
803
|
+
'root': [
|
804
|
+
(r'/\*[\w\W]*?\*/', Comment.Multiline),
|
805
|
+
(r'//.*\n', Comment.Single),
|
806
|
+
(r'(?s)"(?:\\.|[^"\\])+"', String.Double),
|
807
|
+
(r'#(debug|default|else|end|error|fclose|fopen|ifdef|ifndef|'
|
808
|
+
r'include|range|read|render|statistics|switch|undef|version|'
|
809
|
+
r'warning|while|write|define|macro|local|declare)\b',
|
810
|
+
Comment.Preproc),
|
811
|
+
(r'\b(aa_level|aa_threshold|abs|acos|acosh|adaptive|adc_bailout|'
|
812
|
+
r'agate|agate_turb|all|alpha|ambient|ambient_light|angle|'
|
813
|
+
r'aperture|arc_angle|area_light|asc|asin|asinh|assumed_gamma|'
|
814
|
+
r'atan|atan2|atanh|atmosphere|atmospheric_attenuation|'
|
815
|
+
r'attenuating|average|background|black_hole|blue|blur_samples|'
|
816
|
+
r'bounded_by|box_mapping|bozo|break|brick|brick_size|'
|
817
|
+
r'brightness|brilliance|bumps|bumpy1|bumpy2|bumpy3|bump_map|'
|
818
|
+
r'bump_size|case|caustics|ceil|checker|chr|clipped_by|clock|'
|
819
|
+
r'color|color_map|colour|colour_map|component|composite|concat|'
|
820
|
+
r'confidence|conic_sweep|constant|control0|control1|cos|cosh|'
|
821
|
+
r'count|crackle|crand|cube|cubic_spline|cylindrical_mapping|'
|
822
|
+
r'debug|declare|default|degrees|dents|diffuse|direction|'
|
823
|
+
r'distance|distance_maximum|div|dust|dust_type|eccentricity|'
|
824
|
+
r'else|emitting|end|error|error_bound|exp|exponent|'
|
825
|
+
r'fade_distance|fade_power|falloff|falloff_angle|false|'
|
826
|
+
r'file_exists|filter|finish|fisheye|flatness|flip|floor|'
|
827
|
+
r'focal_point|fog|fog_alt|fog_offset|fog_type|frequency|gif|'
|
828
|
+
r'global_settings|glowing|gradient|granite|gray_threshold|'
|
829
|
+
r'green|halo|hexagon|hf_gray_16|hierarchy|hollow|hypercomplex|'
|
830
|
+
r'if|ifdef|iff|image_map|incidence|include|int|interpolate|'
|
831
|
+
r'inverse|ior|irid|irid_wavelength|jitter|lambda|leopard|'
|
832
|
+
r'linear|linear_spline|linear_sweep|location|log|looks_like|'
|
833
|
+
r'look_at|low_error_factor|mandel|map_type|marble|material_map|'
|
834
|
+
r'matrix|max|max_intersections|max_iteration|max_trace_level|'
|
835
|
+
r'max_value|metallic|min|minimum_reuse|mod|mortar|'
|
836
|
+
r'nearest_count|no|normal|normal_map|no_shadow|number_of_waves|'
|
837
|
+
r'octaves|off|offset|omega|omnimax|on|once|onion|open|'
|
838
|
+
r'orthographic|panoramic|pattern1|pattern2|pattern3|'
|
839
|
+
r'perspective|pgm|phase|phong|phong_size|pi|pigment|'
|
840
|
+
r'pigment_map|planar_mapping|png|point_at|pot|pow|ppm|'
|
841
|
+
r'precision|pwr|quadratic_spline|quaternion|quick_color|'
|
842
|
+
r'quick_colour|quilted|radial|radians|radiosity|radius|rainbow|'
|
843
|
+
r'ramp_wave|rand|range|reciprocal|recursion_limit|red|'
|
844
|
+
r'reflection|refraction|render|repeat|rgb|rgbf|rgbft|rgbt|'
|
845
|
+
r'right|ripples|rotate|roughness|samples|scale|scallop_wave|'
|
846
|
+
r'scattering|seed|shadowless|sin|sine_wave|sinh|sky|sky_sphere|'
|
847
|
+
r'slice|slope_map|smooth|specular|spherical_mapping|spiral|'
|
848
|
+
r'spiral1|spiral2|spotlight|spotted|sqr|sqrt|statistics|str|'
|
849
|
+
r'strcmp|strength|strlen|strlwr|strupr|sturm|substr|switch|sys|'
|
850
|
+
r't|tan|tanh|test_camera_1|test_camera_2|test_camera_3|'
|
851
|
+
r'test_camera_4|texture|texture_map|tga|thickness|threshold|'
|
852
|
+
r'tightness|tile2|tiles|track|transform|translate|transmit|'
|
853
|
+
r'triangle_wave|true|ttf|turbulence|turb_depth|type|'
|
854
|
+
r'ultra_wide_angle|up|use_color|use_colour|use_index|u_steps|'
|
855
|
+
r'val|variance|vaxis_rotate|vcross|vdot|version|vlength|'
|
856
|
+
r'vnormalize|volume_object|volume_rendered|vol_with_light|'
|
857
|
+
r'vrotate|v_steps|warning|warp|water_level|waves|while|width|'
|
858
|
+
r'wood|wrinkles|yes)\b', Keyword),
|
859
|
+
(r'(bicubic_patch|blob|box|camera|cone|cubic|cylinder|difference|'
|
860
|
+
r'disc|height_field|intersection|julia_fractal|lathe|'
|
861
|
+
r'light_source|merge|mesh|object|plane|poly|polygon|prism|'
|
862
|
+
r'quadric|quartic|smooth_triangle|sor|sphere|superellipsoid|'
|
863
|
+
r'text|torus|triangle|union)\b', Name.Builtin),
|
864
|
+
# TODO: <=, etc
|
865
|
+
(r'[\[\](){}<>;,]', Punctuation),
|
866
|
+
(r'[-+*/=]', Operator),
|
867
|
+
(r'\b(x|y|z|u|v)\b', Name.Builtin.Pseudo),
|
868
|
+
(r'[a-zA-Z_][a-zA-Z_0-9]*', Name),
|
869
|
+
(r'[0-9]+\.[0-9]*', Number.Float),
|
870
|
+
(r'\.[0-9]+', Number.Float),
|
871
|
+
(r'[0-9]+', Number.Integer),
|
872
|
+
(r'\s+', Text),
|
873
|
+
]
|
874
|
+
}
|
875
|
+
|
876
|
+
|
877
|
+
class AppleScriptLexer(RegexLexer):
|
878
|
+
"""
|
879
|
+
For `AppleScript source code
|
880
|
+
<http://developer.apple.com/documentation/AppleScript/
|
881
|
+
Conceptual/AppleScriptLangGuide>`_,
|
882
|
+
including `AppleScript Studio
|
883
|
+
<http://developer.apple.com/documentation/AppleScript/
|
884
|
+
Reference/StudioReference>`_.
|
885
|
+
Contributed by Andreas Amann <aamann@mac.com>.
|
886
|
+
"""
|
887
|
+
|
888
|
+
name = 'AppleScript'
|
889
|
+
aliases = ['applescript']
|
890
|
+
filenames = ['*.applescript']
|
891
|
+
|
892
|
+
flags = re.MULTILINE | re.DOTALL
|
893
|
+
|
894
|
+
Identifiers = r'[a-zA-Z]\w*'
|
895
|
+
Literals = ['AppleScript', 'current application', 'false', 'linefeed',
|
896
|
+
'missing value', 'pi','quote', 'result', 'return', 'space',
|
897
|
+
'tab', 'text item delimiters', 'true', 'version']
|
898
|
+
Classes = ['alias ', 'application ', 'boolean ', 'class ', 'constant ',
|
899
|
+
'date ', 'file ', 'integer ', 'list ', 'number ', 'POSIX file ',
|
900
|
+
'real ', 'record ', 'reference ', 'RGB color ', 'script ',
|
901
|
+
'text ', 'unit types', '(?:Unicode )?text', 'string']
|
902
|
+
BuiltIn = ['attachment', 'attribute run', 'character', 'day', 'month',
|
903
|
+
'paragraph', 'word', 'year']
|
904
|
+
HandlerParams = ['about', 'above', 'against', 'apart from', 'around',
|
905
|
+
'aside from', 'at', 'below', 'beneath', 'beside',
|
906
|
+
'between', 'for', 'given', 'instead of', 'on', 'onto',
|
907
|
+
'out of', 'over', 'since']
|
908
|
+
Commands = ['ASCII (character|number)', 'activate', 'beep', 'choose URL',
|
909
|
+
'choose application', 'choose color', 'choose file( name)?',
|
910
|
+
'choose folder', 'choose from list',
|
911
|
+
'choose remote application', 'clipboard info',
|
912
|
+
'close( access)?', 'copy', 'count', 'current date', 'delay',
|
913
|
+
'delete', 'display (alert|dialog)', 'do shell script',
|
914
|
+
'duplicate', 'exists', 'get eof', 'get volume settings',
|
915
|
+
'info for', 'launch', 'list (disks|folder)', 'load script',
|
916
|
+
'log', 'make', 'mount volume', 'new', 'offset',
|
917
|
+
'open( (for access|location))?', 'path to', 'print', 'quit',
|
918
|
+
'random number', 'read', 'round', 'run( script)?',
|
919
|
+
'say', 'scripting components',
|
920
|
+
'set (eof|the clipboard to|volume)', 'store script',
|
921
|
+
'summarize', 'system attribute', 'system info',
|
922
|
+
'the clipboard', 'time to GMT', 'write', 'quoted form']
|
923
|
+
References = ['(in )?back of', '(in )?front of', '[0-9]+(st|nd|rd|th)',
|
924
|
+
'first', 'second', 'third', 'fourth', 'fifth', 'sixth',
|
925
|
+
'seventh', 'eighth', 'ninth', 'tenth', 'after', 'back',
|
926
|
+
'before', 'behind', 'every', 'front', 'index', 'last',
|
927
|
+
'middle', 'some', 'that', 'through', 'thru', 'where', 'whose']
|
928
|
+
Operators = ["and", "or", "is equal", "equals", "(is )?equal to", "is not",
|
929
|
+
"isn't", "isn't equal( to)?", "is not equal( to)?",
|
930
|
+
"doesn't equal", "does not equal", "(is )?greater than",
|
931
|
+
"comes after", "is not less than or equal( to)?",
|
932
|
+
"isn't less than or equal( to)?", "(is )?less than",
|
933
|
+
"comes before", "is not greater than or equal( to)?",
|
934
|
+
"isn't greater than or equal( to)?",
|
935
|
+
"(is )?greater than or equal( to)?", "is not less than",
|
936
|
+
"isn't less than", "does not come before",
|
937
|
+
"doesn't come before", "(is )?less than or equal( to)?",
|
938
|
+
"is not greater than", "isn't greater than",
|
939
|
+
"does not come after", "doesn't come after", "starts? with",
|
940
|
+
"begins? with", "ends? with", "contains?", "does not contain",
|
941
|
+
"doesn't contain", "is in", "is contained by", "is not in",
|
942
|
+
"is not contained by", "isn't contained by", "div", "mod",
|
943
|
+
"not", "(a )?(ref( to)?|reference to)", "is", "does"]
|
944
|
+
Control = ['considering', 'else', 'error', 'exit', 'from', 'if',
|
945
|
+
'ignoring', 'in', 'repeat', 'tell', 'then', 'times', 'to',
|
946
|
+
'try', 'until', 'using terms from', 'while', 'whith',
|
947
|
+
'with timeout( of)?', 'with transaction', 'by', 'continue',
|
948
|
+
'end', 'its?', 'me', 'my', 'return', 'of' , 'as']
|
949
|
+
Declarations = ['global', 'local', 'prop(erty)?', 'set', 'get']
|
950
|
+
Reserved = ['but', 'put', 'returning', 'the']
|
951
|
+
StudioClasses = ['action cell', 'alert reply', 'application', 'box',
|
952
|
+
'browser( cell)?', 'bundle', 'button( cell)?', 'cell',
|
953
|
+
'clip view', 'color well', 'color-panel',
|
954
|
+
'combo box( item)?', 'control',
|
955
|
+
'data( (cell|column|item|row|source))?', 'default entry',
|
956
|
+
'dialog reply', 'document', 'drag info', 'drawer',
|
957
|
+
'event', 'font(-panel)?', 'formatter',
|
958
|
+
'image( (cell|view))?', 'matrix', 'menu( item)?', 'item',
|
959
|
+
'movie( view)?', 'open-panel', 'outline view', 'panel',
|
960
|
+
'pasteboard', 'plugin', 'popup button',
|
961
|
+
'progress indicator', 'responder', 'save-panel',
|
962
|
+
'scroll view', 'secure text field( cell)?', 'slider',
|
963
|
+
'sound', 'split view', 'stepper', 'tab view( item)?',
|
964
|
+
'table( (column|header cell|header view|view))',
|
965
|
+
'text( (field( cell)?|view))?', 'toolbar( item)?',
|
966
|
+
'user-defaults', 'view', 'window']
|
967
|
+
StudioEvents = ['accept outline drop', 'accept table drop', 'action',
|
968
|
+
'activated', 'alert ended', 'awake from nib', 'became key',
|
969
|
+
'became main', 'begin editing', 'bounds changed',
|
970
|
+
'cell value', 'cell value changed', 'change cell value',
|
971
|
+
'change item value', 'changed', 'child of item',
|
972
|
+
'choose menu item', 'clicked', 'clicked toolbar item',
|
973
|
+
'closed', 'column clicked', 'column moved',
|
974
|
+
'column resized', 'conclude drop', 'data representation',
|
975
|
+
'deminiaturized', 'dialog ended', 'document nib name',
|
976
|
+
'double clicked', 'drag( (entered|exited|updated))?',
|
977
|
+
'drop', 'end editing', 'exposed', 'idle', 'item expandable',
|
978
|
+
'item value', 'item value changed', 'items changed',
|
979
|
+
'keyboard down', 'keyboard up', 'launched',
|
980
|
+
'load data representation', 'miniaturized', 'mouse down',
|
981
|
+
'mouse dragged', 'mouse entered', 'mouse exited',
|
982
|
+
'mouse moved', 'mouse up', 'moved',
|
983
|
+
'number of browser rows', 'number of items',
|
984
|
+
'number of rows', 'open untitled', 'opened', 'panel ended',
|
985
|
+
'parameters updated', 'plugin loaded', 'prepare drop',
|
986
|
+
'prepare outline drag', 'prepare outline drop',
|
987
|
+
'prepare table drag', 'prepare table drop',
|
988
|
+
'read from file', 'resigned active', 'resigned key',
|
989
|
+
'resigned main', 'resized( sub views)?',
|
990
|
+
'right mouse down', 'right mouse dragged',
|
991
|
+
'right mouse up', 'rows changed', 'scroll wheel',
|
992
|
+
'selected tab view item', 'selection changed',
|
993
|
+
'selection changing', 'should begin editing',
|
994
|
+
'should close', 'should collapse item',
|
995
|
+
'should end editing', 'should expand item',
|
996
|
+
'should open( untitled)?',
|
997
|
+
'should quit( after last window closed)?',
|
998
|
+
'should select column', 'should select item',
|
999
|
+
'should select row', 'should select tab view item',
|
1000
|
+
'should selection change', 'should zoom', 'shown',
|
1001
|
+
'update menu item', 'update parameters',
|
1002
|
+
'update toolbar item', 'was hidden', 'was miniaturized',
|
1003
|
+
'will become active', 'will close', 'will dismiss',
|
1004
|
+
'will display browser cell', 'will display cell',
|
1005
|
+
'will display item cell', 'will display outline cell',
|
1006
|
+
'will finish launching', 'will hide', 'will miniaturize',
|
1007
|
+
'will move', 'will open', 'will pop up', 'will quit',
|
1008
|
+
'will resign active', 'will resize( sub views)?',
|
1009
|
+
'will select tab view item', 'will show', 'will zoom',
|
1010
|
+
'write to file', 'zoomed']
|
1011
|
+
StudioCommands = ['animate', 'append', 'call method', 'center',
|
1012
|
+
'close drawer', 'close panel', 'display',
|
1013
|
+
'display alert', 'display dialog', 'display panel', 'go',
|
1014
|
+
'hide', 'highlight', 'increment', 'item for',
|
1015
|
+
'load image', 'load movie', 'load nib', 'load panel',
|
1016
|
+
'load sound', 'localized string', 'lock focus', 'log',
|
1017
|
+
'open drawer', 'path for', 'pause', 'perform action',
|
1018
|
+
'play', 'register', 'resume', 'scroll', 'select( all)?',
|
1019
|
+
'show', 'size to fit', 'start', 'step back',
|
1020
|
+
'step forward', 'stop', 'synchronize', 'unlock focus',
|
1021
|
+
'update']
|
1022
|
+
StudioProperties = ['accepts arrow key', 'action method', 'active',
|
1023
|
+
'alignment', 'allowed identifiers',
|
1024
|
+
'allows branch selection', 'allows column reordering',
|
1025
|
+
'allows column resizing', 'allows column selection',
|
1026
|
+
'allows customization',
|
1027
|
+
'allows editing text attributes',
|
1028
|
+
'allows empty selection', 'allows mixed state',
|
1029
|
+
'allows multiple selection', 'allows reordering',
|
1030
|
+
'allows undo', 'alpha( value)?', 'alternate image',
|
1031
|
+
'alternate increment value', 'alternate title',
|
1032
|
+
'animation delay', 'associated file name',
|
1033
|
+
'associated object', 'auto completes', 'auto display',
|
1034
|
+
'auto enables items', 'auto repeat',
|
1035
|
+
'auto resizes( outline column)?',
|
1036
|
+
'auto save expanded items', 'auto save name',
|
1037
|
+
'auto save table columns', 'auto saves configuration',
|
1038
|
+
'auto scroll', 'auto sizes all columns to fit',
|
1039
|
+
'auto sizes cells', 'background color', 'bezel state',
|
1040
|
+
'bezel style', 'bezeled', 'border rect', 'border type',
|
1041
|
+
'bordered', 'bounds( rotation)?', 'box type',
|
1042
|
+
'button returned', 'button type',
|
1043
|
+
'can choose directories', 'can choose files',
|
1044
|
+
'can draw', 'can hide',
|
1045
|
+
'cell( (background color|size|type))?', 'characters',
|
1046
|
+
'class', 'click count', 'clicked( data)? column',
|
1047
|
+
'clicked data item', 'clicked( data)? row',
|
1048
|
+
'closeable', 'collating', 'color( (mode|panel))',
|
1049
|
+
'command key down', 'configuration',
|
1050
|
+
'content(s| (size|view( margins)?))?', 'context',
|
1051
|
+
'continuous', 'control key down', 'control size',
|
1052
|
+
'control tint', 'control view',
|
1053
|
+
'controller visible', 'coordinate system',
|
1054
|
+
'copies( on scroll)?', 'corner view', 'current cell',
|
1055
|
+
'current column', 'current( field)? editor',
|
1056
|
+
'current( menu)? item', 'current row',
|
1057
|
+
'current tab view item', 'data source',
|
1058
|
+
'default identifiers', 'delta (x|y|z)',
|
1059
|
+
'destination window', 'directory', 'display mode',
|
1060
|
+
'displayed cell', 'document( (edited|rect|view))?',
|
1061
|
+
'double value', 'dragged column', 'dragged distance',
|
1062
|
+
'dragged items', 'draws( cell)? background',
|
1063
|
+
'draws grid', 'dynamically scrolls', 'echos bullets',
|
1064
|
+
'edge', 'editable', 'edited( data)? column',
|
1065
|
+
'edited data item', 'edited( data)? row', 'enabled',
|
1066
|
+
'enclosing scroll view', 'ending page',
|
1067
|
+
'error handling', 'event number', 'event type',
|
1068
|
+
'excluded from windows menu', 'executable path',
|
1069
|
+
'expanded', 'fax number', 'field editor', 'file kind',
|
1070
|
+
'file name', 'file type', 'first responder',
|
1071
|
+
'first visible column', 'flipped', 'floating',
|
1072
|
+
'font( panel)?', 'formatter', 'frameworks path',
|
1073
|
+
'frontmost', 'gave up', 'grid color', 'has data items',
|
1074
|
+
'has horizontal ruler', 'has horizontal scroller',
|
1075
|
+
'has parent data item', 'has resize indicator',
|
1076
|
+
'has shadow', 'has sub menu', 'has vertical ruler',
|
1077
|
+
'has vertical scroller', 'header cell', 'header view',
|
1078
|
+
'hidden', 'hides when deactivated', 'highlights by',
|
1079
|
+
'horizontal line scroll', 'horizontal page scroll',
|
1080
|
+
'horizontal ruler view', 'horizontally resizable',
|
1081
|
+
'icon image', 'id', 'identifier',
|
1082
|
+
'ignores multiple clicks',
|
1083
|
+
'image( (alignment|dims when disabled|frame style|'
|
1084
|
+
'scaling))?',
|
1085
|
+
'imports graphics', 'increment value',
|
1086
|
+
'indentation per level', 'indeterminate', 'index',
|
1087
|
+
'integer value', 'intercell spacing', 'item height',
|
1088
|
+
'key( (code|equivalent( modifier)?|window))?',
|
1089
|
+
'knob thickness', 'label', 'last( visible)? column',
|
1090
|
+
'leading offset', 'leaf', 'level', 'line scroll',
|
1091
|
+
'loaded', 'localized sort', 'location', 'loop mode',
|
1092
|
+
'main( (bunde|menu|window))?', 'marker follows cell',
|
1093
|
+
'matrix mode', 'maximum( content)? size',
|
1094
|
+
'maximum visible columns',
|
1095
|
+
'menu( form representation)?', 'miniaturizable',
|
1096
|
+
'miniaturized', 'minimized image', 'minimized title',
|
1097
|
+
'minimum column width', 'minimum( content)? size',
|
1098
|
+
'modal', 'modified', 'mouse down state',
|
1099
|
+
'movie( (controller|file|rect))?', 'muted', 'name',
|
1100
|
+
'needs display', 'next state', 'next text',
|
1101
|
+
'number of tick marks', 'only tick mark values',
|
1102
|
+
'opaque', 'open panel', 'option key down',
|
1103
|
+
'outline table column', 'page scroll', 'pages across',
|
1104
|
+
'pages down', 'palette label', 'pane splitter',
|
1105
|
+
'parent data item', 'parent window', 'pasteboard',
|
1106
|
+
'path( (names|separator))?', 'playing',
|
1107
|
+
'plays every frame', 'plays selection only', 'position',
|
1108
|
+
'preferred edge', 'preferred type', 'pressure',
|
1109
|
+
'previous text', 'prompt', 'properties',
|
1110
|
+
'prototype cell', 'pulls down', 'rate',
|
1111
|
+
'released when closed', 'repeated',
|
1112
|
+
'requested print time', 'required file type',
|
1113
|
+
'resizable', 'resized column', 'resource path',
|
1114
|
+
'returns records', 'reuses columns', 'rich text',
|
1115
|
+
'roll over', 'row height', 'rulers visible',
|
1116
|
+
'save panel', 'scripts path', 'scrollable',
|
1117
|
+
'selectable( identifiers)?', 'selected cell',
|
1118
|
+
'selected( data)? columns?', 'selected data items?',
|
1119
|
+
'selected( data)? rows?', 'selected item identifier',
|
1120
|
+
'selection by rect', 'send action on arrow key',
|
1121
|
+
'sends action when done editing', 'separates columns',
|
1122
|
+
'separator item', 'sequence number', 'services menu',
|
1123
|
+
'shared frameworks path', 'shared support path',
|
1124
|
+
'sheet', 'shift key down', 'shows alpha',
|
1125
|
+
'shows state by', 'size( mode)?',
|
1126
|
+
'smart insert delete enabled', 'sort case sensitivity',
|
1127
|
+
'sort column', 'sort order', 'sort type',
|
1128
|
+
'sorted( data rows)?', 'sound', 'source( mask)?',
|
1129
|
+
'spell checking enabled', 'starting page', 'state',
|
1130
|
+
'string value', 'sub menu', 'super menu', 'super view',
|
1131
|
+
'tab key traverses cells', 'tab state', 'tab type',
|
1132
|
+
'tab view', 'table view', 'tag', 'target( printer)?',
|
1133
|
+
'text color', 'text container insert',
|
1134
|
+
'text container origin', 'text returned',
|
1135
|
+
'tick mark position', 'time stamp',
|
1136
|
+
'title(d| (cell|font|height|position|rect))?',
|
1137
|
+
'tool tip', 'toolbar', 'trailing offset', 'transparent',
|
1138
|
+
'treat packages as directories', 'truncated labels',
|
1139
|
+
'types', 'unmodified characters', 'update views',
|
1140
|
+
'use sort indicator', 'user defaults',
|
1141
|
+
'uses data source', 'uses ruler',
|
1142
|
+
'uses threaded animation',
|
1143
|
+
'uses title from previous column', 'value wraps',
|
1144
|
+
'version',
|
1145
|
+
'vertical( (line scroll|page scroll|ruler view))?',
|
1146
|
+
'vertically resizable', 'view',
|
1147
|
+
'visible( document rect)?', 'volume', 'width', 'window',
|
1148
|
+
'windows menu', 'wraps', 'zoomable', 'zoomed']
|
1149
|
+
|
1150
|
+
tokens = {
|
1151
|
+
'root': [
|
1152
|
+
(r'\s+', Text),
|
1153
|
+
(ur'¬\n', String.Escape),
|
1154
|
+
(r"'s\s+", Text), # This is a possessive, consider moving
|
1155
|
+
(r'(--|#).*?$', Comment),
|
1156
|
+
(r'\(\*', Comment.Multiline, 'comment'),
|
1157
|
+
(r'[\(\){}!,.:]', Punctuation),
|
1158
|
+
(ur'(«)([^»]+)(»)',
|
1159
|
+
bygroups(Text, Name.Builtin, Text)),
|
1160
|
+
(r'\b((?:considering|ignoring)\s*)'
|
1161
|
+
r'(application responses|case|diacriticals|hyphens|'
|
1162
|
+
r'numeric strings|punctuation|white space)',
|
1163
|
+
bygroups(Keyword, Name.Builtin)),
|
1164
|
+
(ur'(-|\*|\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\^)', Operator),
|
1165
|
+
(r"\b(%s)\b" % '|'.join(Operators), Operator.Word),
|
1166
|
+
(r'^(\s*(?:on|end)\s+)'
|
1167
|
+
r'(%s)' % '|'.join(StudioEvents[::-1]),
|
1168
|
+
bygroups(Keyword, Name.Function)),
|
1169
|
+
(r'^(\s*)(in|on|script|to)(\s+)', bygroups(Text, Keyword, Text)),
|
1170
|
+
(r'\b(as )(%s)\b' % '|'.join(Classes),
|
1171
|
+
bygroups(Keyword, Name.Class)),
|
1172
|
+
(r'\b(%s)\b' % '|'.join(Literals), Name.Constant),
|
1173
|
+
(r'\b(%s)\b' % '|'.join(Commands), Name.Builtin),
|
1174
|
+
(r'\b(%s)\b' % '|'.join(Control), Keyword),
|
1175
|
+
(r'\b(%s)\b' % '|'.join(Declarations), Keyword),
|
1176
|
+
(r'\b(%s)\b' % '|'.join(Reserved), Name.Builtin),
|
1177
|
+
(r'\b(%s)s?\b' % '|'.join(BuiltIn), Name.Builtin),
|
1178
|
+
(r'\b(%s)\b' % '|'.join(HandlerParams), Name.Builtin),
|
1179
|
+
(r'\b(%s)\b' % '|'.join(StudioProperties), Name.Attribute),
|
1180
|
+
(r'\b(%s)s?\b' % '|'.join(StudioClasses), Name.Builtin),
|
1181
|
+
(r'\b(%s)\b' % '|'.join(StudioCommands), Name.Builtin),
|
1182
|
+
(r'\b(%s)\b' % '|'.join(References), Name.Builtin),
|
1183
|
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
1184
|
+
(r'\b(%s)\b' % Identifiers, Name.Variable),
|
1185
|
+
(r'[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?', Number.Float),
|
1186
|
+
(r'[-+]?\d+', Number.Integer),
|
1187
|
+
],
|
1188
|
+
'comment': [
|
1189
|
+
('\(\*', Comment.Multiline, '#push'),
|
1190
|
+
('\*\)', Comment.Multiline, '#pop'),
|
1191
|
+
('[^*(]+', Comment.Multiline),
|
1192
|
+
('[*(]', Comment.Multiline),
|
1193
|
+
],
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
|
1197
|
+
class ModelicaLexer(RegexLexer):
|
1198
|
+
"""
|
1199
|
+
For `Modelica <http://www.modelica.org/>`_ source code.
|
1200
|
+
|
1201
|
+
*New in Pygments 1.1.*
|
1202
|
+
"""
|
1203
|
+
name = 'Modelica'
|
1204
|
+
aliases = ['modelica']
|
1205
|
+
filenames = ['*.mo']
|
1206
|
+
mimetypes = ['text/x-modelica']
|
1207
|
+
|
1208
|
+
flags = re.IGNORECASE | re.DOTALL
|
1209
|
+
|
1210
|
+
tokens = {
|
1211
|
+
'whitespace': [
|
1212
|
+
(r'\n', Text),
|
1213
|
+
(r'\s+', Text),
|
1214
|
+
(r'\\\n', Text), # line continuation
|
1215
|
+
(r'//(\n|(.|\n)*?[^\\]\n)', Comment),
|
1216
|
+
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment),
|
1217
|
+
],
|
1218
|
+
'statements': [
|
1219
|
+
(r'"', String, 'string'),
|
1220
|
+
(r'(\d+\.\d*|\.\d+|\d+|\d.)[eE][+-]?\d+[lL]?', Number.Float),
|
1221
|
+
(r'(\d+\.\d*|\.\d+)', Number.Float),
|
1222
|
+
(r'\d+[Ll]?', Number.Integer),
|
1223
|
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
1224
|
+
(r'[()\[\]{},.;]', Punctuation),
|
1225
|
+
(r'(true|false|NULL|Real|Integer|Boolean)\b', Name.Builtin),
|
1226
|
+
(r"([a-zA-Z_][\w]*|'[a-zA-Z_\+\-\*\/\^][\w]*')"
|
1227
|
+
r"(\.([a-zA-Z_][\w]*|'[a-zA-Z_\+\-\*\/\^][\w]*'))+", Name.Class),
|
1228
|
+
(r"('[\w\+\-\*\/\^]+'|\w+)", Name),
|
1229
|
+
],
|
1230
|
+
'root': [
|
1231
|
+
include('whitespace'),
|
1232
|
+
include('keywords'),
|
1233
|
+
include('functions'),
|
1234
|
+
include('operators'),
|
1235
|
+
include('classes'),
|
1236
|
+
(r'("<html>|<html>)', Name.Tag, 'html-content'),
|
1237
|
+
include('statements'),
|
1238
|
+
],
|
1239
|
+
'keywords': [
|
1240
|
+
(r'(algorithm|annotation|break|connect|constant|constrainedby|'
|
1241
|
+
r'discrete|each|else|elseif|elsewhen|encapsulated|enumeration|'
|
1242
|
+
r'end|equation|exit|expandable|extends|'
|
1243
|
+
r'external|false|final|flow|for|if|import|impure|in|initial\sequation|'
|
1244
|
+
r'inner|input|loop|nondiscrete|outer|output|parameter|partial|'
|
1245
|
+
r'protected|public|pure|redeclare|replaceable|stream|time|then|true|'
|
1246
|
+
r'when|while|within)\b', Keyword),
|
1247
|
+
],
|
1248
|
+
'functions': [
|
1249
|
+
(r'(abs|acos|acosh|asin|asinh|atan|atan2|atan3|ceil|cos|cosh|'
|
1250
|
+
r'cross|div|exp|floor|getInstanceName|log|log10|mod|rem|'
|
1251
|
+
r'semiLinear|sign|sin|sinh|size|spatialDistribution|sqrt|tan|'
|
1252
|
+
r'tanh|zeros)\b', Name.Function),
|
1253
|
+
],
|
1254
|
+
'operators': [
|
1255
|
+
(r'(actualStream|and|assert|cardinality|change|Clock|delay|der|edge|'
|
1256
|
+
r'hold|homotopy|initial|inStream|noEvent|not|or|pre|previous|reinit|'
|
1257
|
+
r'return|sample|smooth|spatialDistribution|subSample|terminal|'
|
1258
|
+
r'terminate)\b', Name.Builtin),
|
1259
|
+
],
|
1260
|
+
'classes': [
|
1261
|
+
(r'(block|class|connector|function|model|package|'
|
1262
|
+
r'record|type)(\s+)([A-Za-z_]+)',
|
1263
|
+
bygroups(Keyword, Text, Name.Class))
|
1264
|
+
],
|
1265
|
+
'string': [
|
1266
|
+
(r'"', String, '#pop'),
|
1267
|
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})',
|
1268
|
+
String.Escape),
|
1269
|
+
(r'[^\\"\n]+', String), # all other characters
|
1270
|
+
(r'\\\n', String), # line continuation
|
1271
|
+
(r'\\', String), # stray backslash
|
1272
|
+
],
|
1273
|
+
'html-content': [
|
1274
|
+
(r'<\s*/\s*html\s*>', Name.Tag, '#pop'),
|
1275
|
+
(r'.+?(?=<\s*/\s*html\s*>)', using(HtmlLexer)),
|
1276
|
+
]
|
1277
|
+
}
|
1278
|
+
|
1279
|
+
|
1280
|
+
class RebolLexer(RegexLexer):
|
1281
|
+
"""
|
1282
|
+
A `REBOL <http://www.rebol.com/>`_ lexer.
|
1283
|
+
|
1284
|
+
*New in Pygments 1.1.*
|
1285
|
+
"""
|
1286
|
+
name = 'REBOL'
|
1287
|
+
aliases = ['rebol']
|
1288
|
+
filenames = ['*.r', '*.r3']
|
1289
|
+
mimetypes = ['text/x-rebol']
|
1290
|
+
|
1291
|
+
flags = re.IGNORECASE | re.MULTILINE
|
1292
|
+
|
1293
|
+
re.IGNORECASE
|
1294
|
+
|
1295
|
+
escape_re = r'(?:\^\([0-9a-fA-F]{1,4}\)*)'
|
1296
|
+
|
1297
|
+
def word_callback(lexer, match):
|
1298
|
+
word = match.group()
|
1299
|
+
|
1300
|
+
if re.match(".*:$", word):
|
1301
|
+
yield match.start(), Generic.Subheading, word
|
1302
|
+
elif re.match(
|
1303
|
+
r'(native|alias|all|any|as-string|as-binary|bind|bound\?|case|'
|
1304
|
+
r'catch|checksum|comment|debase|dehex|exclude|difference|disarm|'
|
1305
|
+
r'either|else|enbase|foreach|remove-each|form|free|get|get-env|if|'
|
1306
|
+
r'in|intersect|loop|minimum-of|maximum-of|mold|new-line|'
|
1307
|
+
r'new-line\?|not|now|prin|print|reduce|compose|construct|repeat|'
|
1308
|
+
r'reverse|save|script\?|set|shift|switch|throw|to-hex|trace|try|'
|
1309
|
+
r'type\?|union|unique|unless|unprotect|unset|until|use|value\?|'
|
1310
|
+
r'while|compress|decompress|secure|open|close|read|read-io|'
|
1311
|
+
r'write-io|write|update|query|wait|input\?|exp|log-10|log-2|'
|
1312
|
+
r'log-e|square-root|cosine|sine|tangent|arccosine|arcsine|'
|
1313
|
+
r'arctangent|protect|lowercase|uppercase|entab|detab|connected\?|'
|
1314
|
+
r'browse|launch|stats|get-modes|set-modes|to-local-file|'
|
1315
|
+
r'to-rebol-file|encloak|decloak|create-link|do-browser|bind\?|'
|
1316
|
+
r'hide|draw|show|size-text|textinfo|offset-to-caret|'
|
1317
|
+
r'caret-to-offset|local-request-file|rgb-to-hsv|hsv-to-rgb|'
|
1318
|
+
r'crypt-strength\?|dh-make-key|dh-generate-key|dh-compute-key|'
|
1319
|
+
r'dsa-make-key|dsa-generate-key|dsa-make-signature|'
|
1320
|
+
r'dsa-verify-signature|rsa-make-key|rsa-generate-key|'
|
1321
|
+
r'rsa-encrypt)$', word):
|
1322
|
+
yield match.start(), Name.Builtin, word
|
1323
|
+
elif re.match(
|
1324
|
+
r'(add|subtract|multiply|divide|remainder|power|and~|or~|xor~|'
|
1325
|
+
r'minimum|maximum|negate|complement|absolute|random|head|tail|'
|
1326
|
+
r'next|back|skip|at|pick|first|second|third|fourth|fifth|sixth|'
|
1327
|
+
r'seventh|eighth|ninth|tenth|last|path|find|select|make|to|copy\*|'
|
1328
|
+
r'insert|remove|change|poke|clear|trim|sort|min|max|abs|cp|'
|
1329
|
+
r'copy)$', word):
|
1330
|
+
yield match.start(), Name.Function, word
|
1331
|
+
elif re.match(
|
1332
|
+
r'(error|source|input|license|help|install|echo|Usage|with|func|'
|
1333
|
+
r'throw-on-error|function|does|has|context|probe|\?\?|as-pair|'
|
1334
|
+
r'mod|modulo|round|repend|about|set-net|append|join|rejoin|reform|'
|
1335
|
+
r'remold|charset|array|replace|move|extract|forskip|forall|alter|'
|
1336
|
+
r'first+|also|take|for|forever|dispatch|attempt|what-dir|'
|
1337
|
+
r'change-dir|clean-path|list-dir|dirize|rename|split-path|delete|'
|
1338
|
+
r'make-dir|delete-dir|in-dir|confirm|dump-obj|upgrade|what|'
|
1339
|
+
r'build-tag|process-source|build-markup|decode-cgi|read-cgi|'
|
1340
|
+
r'write-user|save-user|set-user-name|protect-system|parse-xml|'
|
1341
|
+
r'cvs-date|cvs-version|do-boot|get-net-info|desktop|layout|'
|
1342
|
+
r'scroll-para|get-face|alert|set-face|uninstall|unfocus|'
|
1343
|
+
r'request-dir|center-face|do-events|net-error|decode-url|'
|
1344
|
+
r'parse-header|parse-header-date|parse-email-addrs|import-email|'
|
1345
|
+
r'send|build-attach-body|resend|show-popup|hide-popup|open-events|'
|
1346
|
+
r'find-key-face|do-face|viewtop|confine|find-window|'
|
1347
|
+
r'insert-event-func|remove-event-func|inform|dump-pane|dump-face|'
|
1348
|
+
r'flag-face|deflag-face|clear-fields|read-net|vbug|path-thru|'
|
1349
|
+
r'read-thru|load-thru|do-thru|launch-thru|load-image|'
|
1350
|
+
r'request-download|do-face-alt|set-font|set-para|get-style|'
|
1351
|
+
r'set-style|make-face|stylize|choose|hilight-text|hilight-all|'
|
1352
|
+
r'unlight-text|focus|scroll-drag|clear-face|reset-face|scroll-face|'
|
1353
|
+
r'resize-face|load-stock|load-stock-block|notify|request|flash|'
|
1354
|
+
r'request-color|request-pass|request-text|request-list|'
|
1355
|
+
r'request-date|request-file|dbug|editor|link-relative-path|'
|
1356
|
+
r'emailer|parse-error)$', word):
|
1357
|
+
yield match.start(), Keyword.Namespace, word
|
1358
|
+
elif re.match(
|
1359
|
+
r'(halt|quit|do|load|q|recycle|call|run|ask|parse|view|unview|'
|
1360
|
+
r'return|exit|break)$', word):
|
1361
|
+
yield match.start(), Name.Exception, word
|
1362
|
+
elif re.match('REBOL$', word):
|
1363
|
+
yield match.start(), Generic.Heading, word
|
1364
|
+
elif re.match("to-.*", word):
|
1365
|
+
yield match.start(), Keyword, word
|
1366
|
+
elif re.match('(\+|-|\*|/|//|\*\*|and|or|xor|=\?|=|==|<>|<|>|<=|>=)$',
|
1367
|
+
word):
|
1368
|
+
yield match.start(), Operator, word
|
1369
|
+
elif re.match(".*\?$", word):
|
1370
|
+
yield match.start(), Keyword, word
|
1371
|
+
elif re.match(".*\!$", word):
|
1372
|
+
yield match.start(), Keyword.Type, word
|
1373
|
+
elif re.match("'.*", word):
|
1374
|
+
yield match.start(), Name.Variable.Instance, word # lit-word
|
1375
|
+
elif re.match("#.*", word):
|
1376
|
+
yield match.start(), Name.Label, word # issue
|
1377
|
+
elif re.match("%.*", word):
|
1378
|
+
yield match.start(), Name.Decorator, word # file
|
1379
|
+
else:
|
1380
|
+
yield match.start(), Name.Variable, word
|
1381
|
+
|
1382
|
+
tokens = {
|
1383
|
+
'root': [
|
1384
|
+
(r'REBOL', Generic.Strong, 'script'),
|
1385
|
+
(r'R', Comment),
|
1386
|
+
(r'[^R]+', Comment),
|
1387
|
+
],
|
1388
|
+
'script': [
|
1389
|
+
(r'\s+', Text),
|
1390
|
+
(r'#"', String.Char, 'char'),
|
1391
|
+
(r'#{[0-9a-fA-F]*}', Number.Hex),
|
1392
|
+
(r'2#{', Number.Hex, 'bin2'),
|
1393
|
+
(r'64#{[0-9a-zA-Z+/=\s]*}', Number.Hex),
|
1394
|
+
(r'"', String, 'string'),
|
1395
|
+
(r'{', String, 'string2'),
|
1396
|
+
(r';#+.*\n', Comment.Special),
|
1397
|
+
(r';\*+.*\n', Comment.Preproc),
|
1398
|
+
(r';.*\n', Comment),
|
1399
|
+
(r'%"', Name.Decorator, 'stringFile'),
|
1400
|
+
(r'%[^(\^{^")\s\[\]]+', Name.Decorator),
|
1401
|
+
(r'[+-]?([a-zA-Z]{1,3})?\$\d+(\.\d+)?', Number.Float), # money
|
1402
|
+
(r'[+-]?\d+\:\d+(\:\d+)?(\.\d+)?', String.Other), # time
|
1403
|
+
(r'\d+\-[0-9a-zA-Z]+\-\d+(\/\d+\:\d+(\:\d+)?'
|
1404
|
+
r'([\.\d+]?([+-]?\d+:\d+)?)?)?', String.Other), # date
|
1405
|
+
(r'\d+(\.\d+)+\.\d+', Keyword.Constant), # tuple
|
1406
|
+
(r'\d+[xX]\d+', Keyword.Constant), # pair
|
1407
|
+
(r'[+-]?\d+(\'\d+)?([\.,]\d*)?[eE][+-]?\d+', Number.Float),
|
1408
|
+
(r'[+-]?\d+(\'\d+)?[\.,]\d*', Number.Float),
|
1409
|
+
(r'[+-]?\d+(\'\d+)?', Number),
|
1410
|
+
(r'[\[\]\(\)]', Generic.Strong),
|
1411
|
+
(r'[a-zA-Z]+[^(\^{"\s:)]*://[^(\^{"\s)]*', Name.Decorator), # url
|
1412
|
+
(r'mailto:[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # url
|
1413
|
+
(r'[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # email
|
1414
|
+
(r'comment\s', Comment, 'comment'),
|
1415
|
+
(r'/[^(\^{^")\s/[\]]*', Name.Attribute),
|
1416
|
+
(r'([^(\^{^")\s/[\]]+)(?=[:({"\s/\[\]])', word_callback),
|
1417
|
+
(r'<[a-zA-Z0-9:._-]*>', Name.Tag),
|
1418
|
+
(r'<[^(<>\s")]+', Name.Tag, 'tag'),
|
1419
|
+
(r'([^(\^{^")\s]+)', Text),
|
1420
|
+
],
|
1421
|
+
'string': [
|
1422
|
+
(r'[^(\^")]+', String),
|
1423
|
+
(escape_re, String.Escape),
|
1424
|
+
(r'[\(|\)]+', String),
|
1425
|
+
(r'\^.', String.Escape),
|
1426
|
+
(r'"', String, '#pop'),
|
1427
|
+
],
|
1428
|
+
'string2': [
|
1429
|
+
(r'[^(\^{^})]+', String),
|
1430
|
+
(escape_re, String.Escape),
|
1431
|
+
(r'[\(|\)]+', String),
|
1432
|
+
(r'\^.', String.Escape),
|
1433
|
+
(r'{', String, '#push'),
|
1434
|
+
(r'}', String, '#pop'),
|
1435
|
+
],
|
1436
|
+
'stringFile': [
|
1437
|
+
(r'[^(\^")]+', Name.Decorator),
|
1438
|
+
(escape_re, Name.Decorator),
|
1439
|
+
(r'\^.', Name.Decorator),
|
1440
|
+
(r'"', Name.Decorator, '#pop'),
|
1441
|
+
],
|
1442
|
+
'char': [
|
1443
|
+
(escape_re + '"', String.Char, '#pop'),
|
1444
|
+
(r'\^."', String.Char, '#pop'),
|
1445
|
+
(r'."', String.Char, '#pop'),
|
1446
|
+
],
|
1447
|
+
'tag': [
|
1448
|
+
(escape_re, Name.Tag),
|
1449
|
+
(r'"', Name.Tag, 'tagString'),
|
1450
|
+
(r'[^(<>\r\n")]+', Name.Tag),
|
1451
|
+
(r'>', Name.Tag, '#pop'),
|
1452
|
+
],
|
1453
|
+
'tagString': [
|
1454
|
+
(r'[^(\^")]+', Name.Tag),
|
1455
|
+
(escape_re, Name.Tag),
|
1456
|
+
(r'[\(|\)]+', Name.Tag),
|
1457
|
+
(r'\^.', Name.Tag),
|
1458
|
+
(r'"', Name.Tag, '#pop'),
|
1459
|
+
],
|
1460
|
+
'tuple': [
|
1461
|
+
(r'(\d+\.)+', Keyword.Constant),
|
1462
|
+
(r'\d+', Keyword.Constant, '#pop'),
|
1463
|
+
],
|
1464
|
+
'bin2': [
|
1465
|
+
(r'\s+', Number.Hex),
|
1466
|
+
(r'([0-1]\s*){8}', Number.Hex),
|
1467
|
+
(r'}', Number.Hex, '#pop'),
|
1468
|
+
],
|
1469
|
+
'comment': [
|
1470
|
+
(r'"', Comment, 'commentString1'),
|
1471
|
+
(r'{', Comment, 'commentString2'),
|
1472
|
+
(r'\[', Comment, 'commentBlock'),
|
1473
|
+
(r'[^(\s{\"\[]+', Comment, '#pop'),
|
1474
|
+
],
|
1475
|
+
'commentString1': [
|
1476
|
+
(r'[^(\^")]+', Comment),
|
1477
|
+
(escape_re, Comment),
|
1478
|
+
(r'[\(|\)]+', Comment),
|
1479
|
+
(r'\^.', Comment),
|
1480
|
+
(r'"', Comment, '#pop'),
|
1481
|
+
],
|
1482
|
+
'commentString2': [
|
1483
|
+
(r'[^(\^{^})]+', Comment),
|
1484
|
+
(escape_re, Comment),
|
1485
|
+
(r'[\(|\)]+', Comment),
|
1486
|
+
(r'\^.', Comment),
|
1487
|
+
(r'{', Comment, '#push'),
|
1488
|
+
(r'}', Comment, '#pop'),
|
1489
|
+
],
|
1490
|
+
'commentBlock': [
|
1491
|
+
(r'\[', Comment, '#push'),
|
1492
|
+
(r'\]', Comment, '#pop'),
|
1493
|
+
(r'[^(\[\])]+', Comment),
|
1494
|
+
],
|
1495
|
+
}
|
1496
|
+
|
1497
|
+
|
1498
|
+
class ABAPLexer(RegexLexer):
|
1499
|
+
"""
|
1500
|
+
Lexer for ABAP, SAP's integrated language.
|
1501
|
+
|
1502
|
+
*New in Pygments 1.1.*
|
1503
|
+
"""
|
1504
|
+
name = 'ABAP'
|
1505
|
+
aliases = ['abap']
|
1506
|
+
filenames = ['*.abap']
|
1507
|
+
mimetypes = ['text/x-abap']
|
1508
|
+
|
1509
|
+
flags = re.IGNORECASE | re.MULTILINE
|
1510
|
+
|
1511
|
+
tokens = {
|
1512
|
+
'common': [
|
1513
|
+
(r'\s+', Text),
|
1514
|
+
(r'^\*.*$', Comment.Single),
|
1515
|
+
(r'\".*?\n', Comment.Single),
|
1516
|
+
],
|
1517
|
+
'variable-names': [
|
1518
|
+
(r'<[\S_]+>', Name.Variable),
|
1519
|
+
(r'\w[\w~]*(?:(\[\])|->\*)?', Name.Variable),
|
1520
|
+
],
|
1521
|
+
'root': [
|
1522
|
+
include('common'),
|
1523
|
+
#function calls
|
1524
|
+
(r'(CALL\s+(?:BADI|CUSTOMER-FUNCTION|FUNCTION))(\s+)(\'?\S+\'?)',
|
1525
|
+
bygroups(Keyword, Text, Name.Function)),
|
1526
|
+
(r'(CALL\s+(?:DIALOG|SCREEN|SUBSCREEN|SELECTION-SCREEN|'
|
1527
|
+
r'TRANSACTION|TRANSFORMATION))\b',
|
1528
|
+
Keyword),
|
1529
|
+
(r'(FORM|PERFORM)(\s+)(\w+)',
|
1530
|
+
bygroups(Keyword, Text, Name.Function)),
|
1531
|
+
(r'(PERFORM)(\s+)(\()(\w+)(\))',
|
1532
|
+
bygroups(Keyword, Text, Punctuation, Name.Variable, Punctuation )),
|
1533
|
+
(r'(MODULE)(\s+)(\S+)(\s+)(INPUT|OUTPUT)',
|
1534
|
+
bygroups(Keyword, Text, Name.Function, Text, Keyword)),
|
1535
|
+
|
1536
|
+
# method implementation
|
1537
|
+
(r'(METHOD)(\s+)([\w~]+)',
|
1538
|
+
bygroups(Keyword, Text, Name.Function)),
|
1539
|
+
# method calls
|
1540
|
+
(r'(\s+)([\w\-]+)([=\-]>)([\w\-~]+)',
|
1541
|
+
bygroups(Text, Name.Variable, Operator, Name.Function)),
|
1542
|
+
# call methodnames returning style
|
1543
|
+
(r'(?<=(=|-)>)([\w\-~]+)(?=\()', Name.Function),
|
1544
|
+
|
1545
|
+
# keywords with dashes in them.
|
1546
|
+
# these need to be first, because for instance the -ID part
|
1547
|
+
# of MESSAGE-ID wouldn't get highlighted if MESSAGE was
|
1548
|
+
# first in the list of keywords.
|
1549
|
+
(r'(ADD-CORRESPONDING|AUTHORITY-CHECK|'
|
1550
|
+
r'CLASS-DATA|CLASS-EVENTS|CLASS-METHODS|CLASS-POOL|'
|
1551
|
+
r'DELETE-ADJACENT|DIVIDE-CORRESPONDING|'
|
1552
|
+
r'EDITOR-CALL|ENHANCEMENT-POINT|ENHANCEMENT-SECTION|EXIT-COMMAND|'
|
1553
|
+
r'FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|'
|
1554
|
+
r'INTERFACE-POOL|INVERTED-DATE|'
|
1555
|
+
r'LOAD-OF-PROGRAM|LOG-POINT|'
|
1556
|
+
r'MESSAGE-ID|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|'
|
1557
|
+
r'NEW-LINE|NEW-PAGE|NEW-SECTION|NO-EXTENSION|'
|
1558
|
+
r'OUTPUT-LENGTH|PRINT-CONTROL|'
|
1559
|
+
r'SELECT-OPTIONS|START-OF-SELECTION|SUBTRACT-CORRESPONDING|'
|
1560
|
+
r'SYNTAX-CHECK|SYSTEM-EXCEPTIONS|'
|
1561
|
+
r'TYPE-POOL|TYPE-POOLS'
|
1562
|
+
r')\b', Keyword),
|
1563
|
+
|
1564
|
+
# keyword kombinations
|
1565
|
+
(r'CREATE\s+(PUBLIC|PRIVATE|DATA|OBJECT)|'
|
1566
|
+
r'((PUBLIC|PRIVATE|PROTECTED)\s+SECTION|'
|
1567
|
+
r'(TYPE|LIKE)(\s+(LINE\s+OF|REF\s+TO|'
|
1568
|
+
r'(SORTED|STANDARD|HASHED)\s+TABLE\s+OF))?|'
|
1569
|
+
r'FROM\s+(DATABASE|MEMORY)|CALL\s+METHOD|'
|
1570
|
+
r'(GROUP|ORDER) BY|HAVING|SEPARATED BY|'
|
1571
|
+
r'GET\s+(BADI|BIT|CURSOR|DATASET|LOCALE|PARAMETER|'
|
1572
|
+
r'PF-STATUS|(PROPERTY|REFERENCE)\s+OF|'
|
1573
|
+
r'RUN\s+TIME|TIME\s+(STAMP)?)?|'
|
1574
|
+
r'SET\s+(BIT|BLANK\s+LINES|COUNTRY|CURSOR|DATASET|EXTENDED\s+CHECK|'
|
1575
|
+
r'HANDLER|HOLD\s+DATA|LANGUAGE|LEFT\s+SCROLL-BOUNDARY|'
|
1576
|
+
r'LOCALE|MARGIN|PARAMETER|PF-STATUS|PROPERTY\s+OF|'
|
1577
|
+
r'RUN\s+TIME\s+(ANALYZER|CLOCK\s+RESOLUTION)|SCREEN|'
|
1578
|
+
r'TITLEBAR|UPADTE\s+TASK\s+LOCAL|USER-COMMAND)|'
|
1579
|
+
r'CONVERT\s+((INVERTED-)?DATE|TIME|TIME\s+STAMP|TEXT)|'
|
1580
|
+
r'(CLOSE|OPEN)\s+(DATASET|CURSOR)|'
|
1581
|
+
r'(TO|FROM)\s+(DATA BUFFER|INTERNAL TABLE|MEMORY ID|'
|
1582
|
+
r'DATABASE|SHARED\s+(MEMORY|BUFFER))|'
|
1583
|
+
r'DESCRIBE\s+(DISTANCE\s+BETWEEN|FIELD|LIST|TABLE)|'
|
1584
|
+
r'FREE\s(MEMORY|OBJECT)?|'
|
1585
|
+
r'PROCESS\s+(BEFORE\s+OUTPUT|AFTER\s+INPUT|'
|
1586
|
+
r'ON\s+(VALUE-REQUEST|HELP-REQUEST))|'
|
1587
|
+
r'AT\s+(LINE-SELECTION|USER-COMMAND|END\s+OF|NEW)|'
|
1588
|
+
r'AT\s+SELECTION-SCREEN(\s+(ON(\s+(BLOCK|(HELP|VALUE)-REQUEST\s+FOR|'
|
1589
|
+
r'END\s+OF|RADIOBUTTON\s+GROUP))?|OUTPUT))?|'
|
1590
|
+
r'SELECTION-SCREEN:?\s+((BEGIN|END)\s+OF\s+((TABBED\s+)?BLOCK|LINE|'
|
1591
|
+
r'SCREEN)|COMMENT|FUNCTION\s+KEY|'
|
1592
|
+
r'INCLUDE\s+BLOCKS|POSITION|PUSHBUTTON|'
|
1593
|
+
r'SKIP|ULINE)|'
|
1594
|
+
r'LEAVE\s+(LIST-PROCESSING|PROGRAM|SCREEN|'
|
1595
|
+
r'TO LIST-PROCESSING|TO TRANSACTION)'
|
1596
|
+
r'(ENDING|STARTING)\s+AT|'
|
1597
|
+
r'FORMAT\s+(COLOR|INTENSIFIED|INVERSE|HOTSPOT|INPUT|FRAMES|RESET)|'
|
1598
|
+
r'AS\s+(CHECKBOX|SUBSCREEN|WINDOW)|'
|
1599
|
+
r'WITH\s+(((NON-)?UNIQUE)?\s+KEY|FRAME)|'
|
1600
|
+
r'(BEGIN|END)\s+OF|'
|
1601
|
+
r'DELETE(\s+ADJACENT\s+DUPLICATES\sFROM)?|'
|
1602
|
+
r'COMPARING(\s+ALL\s+FIELDS)?|'
|
1603
|
+
r'INSERT(\s+INITIAL\s+LINE\s+INTO|\s+LINES\s+OF)?|'
|
1604
|
+
r'IN\s+((BYTE|CHARACTER)\s+MODE|PROGRAM)|'
|
1605
|
+
r'END-OF-(DEFINITION|PAGE|SELECTION)|'
|
1606
|
+
r'WITH\s+FRAME(\s+TITLE)|'
|
1607
|
+
|
1608
|
+
# simple kombinations
|
1609
|
+
r'AND\s+(MARK|RETURN)|CLIENT\s+SPECIFIED|CORRESPONDING\s+FIELDS\s+OF|'
|
1610
|
+
r'IF\s+FOUND|FOR\s+EVENT|INHERITING\s+FROM|LEAVE\s+TO\s+SCREEN|'
|
1611
|
+
r'LOOP\s+AT\s+(SCREEN)?|LOWER\s+CASE|MATCHCODE\s+OBJECT|MODIF\s+ID|'
|
1612
|
+
r'MODIFY\s+SCREEN|NESTING\s+LEVEL|NO\s+INTERVALS|OF\s+STRUCTURE|'
|
1613
|
+
r'RADIOBUTTON\s+GROUP|RANGE\s+OF|REF\s+TO|SUPPRESS DIALOG|'
|
1614
|
+
r'TABLE\s+OF|UPPER\s+CASE|TRANSPORTING\s+NO\s+FIELDS|'
|
1615
|
+
r'VALUE\s+CHECK|VISIBLE\s+LENGTH|HEADER\s+LINE)\b', Keyword),
|
1616
|
+
|
1617
|
+
# single word keywords.
|
1618
|
+
(r'(^|(?<=(\s|\.)))(ABBREVIATED|ADD|ALIASES|APPEND|ASSERT|'
|
1619
|
+
r'ASSIGN(ING)?|AT(\s+FIRST)?|'
|
1620
|
+
r'BACK|BLOCK|BREAK-POINT|'
|
1621
|
+
r'CASE|CATCH|CHANGING|CHECK|CLASS|CLEAR|COLLECT|COLOR|COMMIT|'
|
1622
|
+
r'CREATE|COMMUNICATION|COMPONENTS?|COMPUTE|CONCATENATE|CONDENSE|'
|
1623
|
+
r'CONSTANTS|CONTEXTS|CONTINUE|CONTROLS|'
|
1624
|
+
r'DATA|DECIMALS|DEFAULT|DEFINE|DEFINITION|DEFERRED|DEMAND|'
|
1625
|
+
r'DETAIL|DIRECTORY|DIVIDE|DO|'
|
1626
|
+
r'ELSE(IF)?|ENDAT|ENDCASE|ENDCLASS|ENDDO|ENDFORM|ENDFUNCTION|'
|
1627
|
+
r'ENDIF|ENDLOOP|ENDMETHOD|ENDMODULE|ENDSELECT|ENDTRY|'
|
1628
|
+
r'ENHANCEMENT|EVENTS|EXCEPTIONS|EXIT|EXPORT|EXPORTING|EXTRACT|'
|
1629
|
+
r'FETCH|FIELDS?|FIND|FOR|FORM|FORMAT|FREE|FROM|'
|
1630
|
+
r'HIDE|'
|
1631
|
+
r'ID|IF|IMPORT|IMPLEMENTATION|IMPORTING|IN|INCLUDE|INCLUDING|'
|
1632
|
+
r'INDEX|INFOTYPES|INITIALIZATION|INTERFACE|INTERFACES|INTO|'
|
1633
|
+
r'LENGTH|LINES|LOAD|LOCAL|'
|
1634
|
+
r'JOIN|'
|
1635
|
+
r'KEY|'
|
1636
|
+
r'MAXIMUM|MESSAGE|METHOD[S]?|MINIMUM|MODULE|MODIFY|MOVE|MULTIPLY|'
|
1637
|
+
r'NODES|'
|
1638
|
+
r'OBLIGATORY|OF|OFF|ON|OVERLAY|'
|
1639
|
+
r'PACK|PARAMETERS|PERCENTAGE|POSITION|PROGRAM|PROVIDE|PUBLIC|PUT|'
|
1640
|
+
r'RAISE|RAISING|RANGES|READ|RECEIVE|REFRESH|REJECT|REPORT|RESERVE|'
|
1641
|
+
r'RESUME|RETRY|RETURN|RETURNING|RIGHT|ROLLBACK|'
|
1642
|
+
r'SCROLL|SEARCH|SELECT|SHIFT|SINGLE|SKIP|SORT|SPLIT|STATICS|STOP|'
|
1643
|
+
r'SUBMIT|SUBTRACT|SUM|SUMMARY|SUMMING|SUPPLY|'
|
1644
|
+
r'TABLE|TABLES|TIMES|TITLE|TO|TOP-OF-PAGE|TRANSFER|TRANSLATE|TRY|TYPES|'
|
1645
|
+
r'ULINE|UNDER|UNPACK|UPDATE|USING|'
|
1646
|
+
r'VALUE|VALUES|VIA|'
|
1647
|
+
r'WAIT|WHEN|WHERE|WHILE|WITH|WINDOW|WRITE)\b', Keyword),
|
1648
|
+
|
1649
|
+
# builtins
|
1650
|
+
(r'(abs|acos|asin|atan|'
|
1651
|
+
r'boolc|boolx|bit_set|'
|
1652
|
+
r'char_off|charlen|ceil|cmax|cmin|condense|contains|'
|
1653
|
+
r'contains_any_of|contains_any_not_of|concat_lines_of|cos|cosh|'
|
1654
|
+
r'count|count_any_of|count_any_not_of|'
|
1655
|
+
r'dbmaxlen|distance|'
|
1656
|
+
r'escape|exp|'
|
1657
|
+
r'find|find_end|find_any_of|find_any_not_of|floor|frac|from_mixed|'
|
1658
|
+
r'insert|'
|
1659
|
+
r'lines|log|log10|'
|
1660
|
+
r'match|matches|'
|
1661
|
+
r'nmax|nmin|numofchar|'
|
1662
|
+
r'repeat|replace|rescale|reverse|round|'
|
1663
|
+
r'segment|shift_left|shift_right|sign|sin|sinh|sqrt|strlen|'
|
1664
|
+
r'substring|substring_after|substring_from|substring_before|substring_to|'
|
1665
|
+
r'tan|tanh|to_upper|to_lower|to_mixed|translate|trunc|'
|
1666
|
+
r'xstrlen)(\()\b', bygroups(Name.Builtin, Punctuation)),
|
1667
|
+
|
1668
|
+
(r'&[0-9]', Name),
|
1669
|
+
(r'[0-9]+', Number.Integer),
|
1670
|
+
|
1671
|
+
# operators which look like variable names before
|
1672
|
+
# parsing variable names.
|
1673
|
+
(r'(?<=(\s|.))(AND|EQ|NE|GT|LT|GE|LE|CO|CN|CA|NA|CS|NOT|NS|CP|NP|'
|
1674
|
+
r'BYTE-CO|BYTE-CN|BYTE-CA|BYTE-NA|BYTE-CS|BYTE-NS|'
|
1675
|
+
r'IS\s+(NOT\s+)?(INITIAL|ASSIGNED|REQUESTED|BOUND))\b', Operator),
|
1676
|
+
|
1677
|
+
include('variable-names'),
|
1678
|
+
|
1679
|
+
# standard oparators after variable names,
|
1680
|
+
# because < and > are part of field symbols.
|
1681
|
+
(r'[?*<>=\-+]', Operator),
|
1682
|
+
(r"'(''|[^'])*'", String.Single),
|
1683
|
+
(r'[/;:()\[\],\.]', Punctuation)
|
1684
|
+
],
|
1685
|
+
}
|
1686
|
+
|
1687
|
+
|
1688
|
+
class NewspeakLexer(RegexLexer):
|
1689
|
+
"""
|
1690
|
+
For `Newspeak <http://newspeaklanguage.org/>` syntax.
|
1691
|
+
"""
|
1692
|
+
name = 'Newspeak'
|
1693
|
+
filenames = ['*.ns2']
|
1694
|
+
aliases = ['newspeak', ]
|
1695
|
+
mimetypes = ['text/x-newspeak']
|
1696
|
+
|
1697
|
+
tokens = {
|
1698
|
+
'root' : [
|
1699
|
+
(r'\b(Newsqueak2)\b',Keyword.Declaration),
|
1700
|
+
(r"'[^']*'",String),
|
1701
|
+
(r'\b(class)(\s+)([a-zA-Z0-9_]+)(\s*)',
|
1702
|
+
bygroups(Keyword.Declaration,Text,Name.Class,Text)),
|
1703
|
+
(r'\b(mixin|self|super|private|public|protected|nil|true|false)\b',
|
1704
|
+
Keyword),
|
1705
|
+
(r'([a-zA-Z0-9_]+\:)(\s*)([a-zA-Z_]\w+)',
|
1706
|
+
bygroups(Name.Function,Text,Name.Variable)),
|
1707
|
+
(r'([a-zA-Z0-9_]+)(\s*)(=)',
|
1708
|
+
bygroups(Name.Attribute,Text,Operator)),
|
1709
|
+
(r'<[a-zA-Z0-9_]+>', Comment.Special),
|
1710
|
+
include('expressionstat'),
|
1711
|
+
include('whitespace')
|
1712
|
+
],
|
1713
|
+
|
1714
|
+
'expressionstat': [
|
1715
|
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
1716
|
+
(r'\d+', Number.Integer),
|
1717
|
+
(r':\w+',Name.Variable),
|
1718
|
+
(r'(\w+)(::)', bygroups(Name.Variable, Operator)),
|
1719
|
+
(r'\w+:', Name.Function),
|
1720
|
+
(r'\w+', Name.Variable),
|
1721
|
+
(r'\(|\)', Punctuation),
|
1722
|
+
(r'\[|\]', Punctuation),
|
1723
|
+
(r'\{|\}', Punctuation),
|
1724
|
+
|
1725
|
+
(r'(\^|\+|\/|~|\*|<|>|=|@|%|\||&|\?|!|,|-|:)', Operator),
|
1726
|
+
(r'\.|;', Punctuation),
|
1727
|
+
include('whitespace'),
|
1728
|
+
include('literals'),
|
1729
|
+
],
|
1730
|
+
'literals': [
|
1731
|
+
(r'\$.', String),
|
1732
|
+
(r"'[^']*'", String),
|
1733
|
+
(r"#'[^']*'", String.Symbol),
|
1734
|
+
(r"#\w+:?", String.Symbol),
|
1735
|
+
(r"#(\+|\/|~|\*|<|>|=|@|%|\||&|\?|!|,|-)+", String.Symbol)
|
1736
|
+
|
1737
|
+
],
|
1738
|
+
'whitespace' : [
|
1739
|
+
(r'\s+', Text),
|
1740
|
+
(r'"[^"]*"', Comment)
|
1741
|
+
]
|
1742
|
+
}
|
1743
|
+
|
1744
|
+
|
1745
|
+
class GherkinLexer(RegexLexer):
|
1746
|
+
"""
|
1747
|
+
For `Gherkin <http://github.com/aslakhellesoy/gherkin/>` syntax.
|
1748
|
+
|
1749
|
+
*New in Pygments 1.2.*
|
1750
|
+
"""
|
1751
|
+
name = 'Gherkin'
|
1752
|
+
aliases = ['Cucumber', 'cucumber', 'Gherkin', 'gherkin']
|
1753
|
+
filenames = ['*.feature']
|
1754
|
+
mimetypes = ['text/x-gherkin']
|
1755
|
+
|
1756
|
+
feature_keywords = ur'^(기능|機能|功能|フィーチャ|خاصية|תכונה|Функціонал|Функционалност|Функционал|Фича|Особина|Могућност|Özellik|Właściwość|Tính năng|Trajto|Savybė|Požiadavka|Požadavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Fīča|Funzionalità|Funktionalität|Funkcionalnost|Funkcionalitāte|Funcționalitate|Functionaliteit|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Feature|Egenskap|Egenskab|Crikey|Característica|Arwedd)(:)(.*)$'
|
1757
|
+
feature_element_keywords = ur'^(\s*)(시나리오 개요|시나리오|배경|背景|場景大綱|場景|场景大纲|场景|劇本大綱|劇本|テンプレ|シナリオテンプレート|シナリオテンプレ|シナリオアウトライン|シナリオ|سيناريو مخطط|سيناريو|الخلفية|תרחיש|תבנית תרחיש|רקע|Тарих|Сценарій|Сценарио|Сценарий структураси|Сценарий|Структура сценарію|Структура сценарија|Структура сценария|Скица|Рамка на сценарий|Пример|Предыстория|Предистория|Позадина|Передумова|Основа|Концепт|Контекст|Założenia|Wharrimean is|Tình huống|The thing of it is|Tausta|Taust|Tapausaihio|Tapaus|Szenariogrundriss|Szenario|Szablon scenariusza|Stsenaarium|Struktura scenarija|Skica|Skenario konsep|Skenario|Situācija|Senaryo taslağı|Senaryo|Scénář|Scénario|Schema dello scenario|Scenārijs pēc parauga|Scenārijs|Scenár|Scenaro|Scenariusz|Scenariul de şablon|Scenariul de sablon|Scenariu|Scenario Outline|Scenario Amlinellol|Scenario|Scenarijus|Scenarijaus šablonas|Scenarij|Scenarie|Rerefons|Raamstsenaarium|Primer|Pozadí|Pozadina|Pozadie|Plan du scénario|Plan du Scénario|Osnova scénáře|Osnova|Náčrt Scénáře|Náčrt Scenáru|Mate|MISHUN SRSLY|MISHUN|Kịch bản|Konturo de la scenaro|Kontext|Konteksts|Kontekstas|Kontekst|Koncept|Khung tình huống|Khung kịch bản|Háttér|Grundlage|Geçmiş|Forgatókönyv vázlat|Forgatókönyv|Fono|Esquema do Cenário|Esquema do Cenario|Esquema del escenario|Esquema de l\'escenari|Escenario|Escenari|Dis is what went down|Dasar|Contexto|Contexte|Contesto|Condiţii|Conditii|Cenário|Cenario|Cefndir|Bối cảnh|Blokes|Bakgrunn|Bakgrund|Baggrund|Background|B4|Antecedents|Antecedentes|All y\'all|Achtergrond|Abstrakt Scenario|Abstract Scenario)(:)(.*)$'
|
1758
|
+
examples_keywords = ur'^(\s*)(예|例子|例|サンプル|امثلة|דוגמאות|Сценарији|Примери|Приклади|Мисоллар|Значения|Örnekler|Voorbeelden|Variantai|Tapaukset|Scenarios|Scenariji|Scenarijai|Příklady|Példák|Príklady|Przykłady|Primjeri|Primeri|Piemēri|Pavyzdžiai|Paraugs|Juhtumid|Exemplos|Exemples|Exemplele|Exempel|Examples|Esempi|Enghreifftiau|Ekzemploj|Eksempler|Ejemplos|EXAMPLZ|Dữ liệu|Contoh|Cobber|Beispiele)(:)(.*)$'
|
1759
|
+
step_keywords = ur'^(\s*)(하지만|조건|먼저|만일|만약|단|그리고|그러면|那麼|那么|而且|當|当|前提|假設|假如|但是|但し|並且|もし|ならば|ただし|しかし|かつ|و |متى |لكن |عندما |ثم |بفرض |اذاً |כאשר |וגם |בהינתן |אזי |אז |אבל |Якщо |Унда |То |Припустимо, що |Припустимо |Онда |Но |Нехай |Лекин |Когато |Када |Кад |К тому же |И |Задато |Задати |Задате |Если |Допустим |Дадено |Ва |Бирок |Аммо |Али |Але |Агар |А |І |Și |És |Zatati |Zakładając |Zadato |Zadate |Zadano |Zadani |Zadan |Youse know when youse got |Youse know like when |Yna |Ya know how |Ya gotta |Y |Wun |Wtedy |When y\'all |When |Wenn |WEN |Và |Ve |Und |Un |Thì |Then y\'all |Then |Tapi |Tak |Tada |Tad |Så |Stel |Soit |Siis |Si |Sed |Se |Quando |Quand |Quan |Pryd |Pokud |Pokiaľ |Però |Pero |Pak |Oraz |Onda |Ond |Oletetaan |Og |Och |O zaman |Når |När |Niin |Nhưng |N |Mutta |Men |Mas |Maka |Majd |Mais |Maar |Ma |Lorsque |Lorsqu\'|Kun |Kuid |Kui |Khi |Keď |Ketika |Když |Kaj |Kai |Kada |Kad |Jeżeli |Ja |Ir |I CAN HAZ |I |Ha |Givun |Givet |Given y\'all |Given |Gitt |Gegeven |Gegeben sei |Fakat |Eğer ki |Etant donné |Et |Então |Entonces |Entao |En |Eeldades |E |Duota |Dun |Donitaĵo |Donat |Donada |Do |Diyelim ki |Dengan |Den youse gotta |De |Dato |Dar |Dann |Dan |Dado |Dacă |Daca |DEN |Când |Cuando |Cho |Cept |Cand |Cal |But y\'all |But |Buh |Biết |Bet |BUT |Atès |Atunci |Atesa |Anrhegedig a |Angenommen |And y\'all |And |An |Ama |Als |Alors |Allora |Ali |Aleshores |Ale |Akkor |Aber |AN |A také |A |\* )'
|
1760
|
+
|
1761
|
+
tokens = {
|
1762
|
+
'comments': [
|
1763
|
+
(r'#.*$', Comment),
|
1764
|
+
],
|
1765
|
+
'feature_elements' : [
|
1766
|
+
(step_keywords, Keyword, "step_content_stack"),
|
1767
|
+
include('comments'),
|
1768
|
+
(r"(\s|.)", Name.Function),
|
1769
|
+
],
|
1770
|
+
'feature_elements_on_stack' : [
|
1771
|
+
(step_keywords, Keyword, "#pop:2"),
|
1772
|
+
include('comments'),
|
1773
|
+
(r"(\s|.)", Name.Function),
|
1774
|
+
],
|
1775
|
+
'examples_table': [
|
1776
|
+
(r"\s+\|", Keyword, 'examples_table_header'),
|
1777
|
+
include('comments'),
|
1778
|
+
(r"(\s|.)", Name.Function),
|
1779
|
+
],
|
1780
|
+
'examples_table_header': [
|
1781
|
+
(r"\s+\|\s*$", Keyword, "#pop:2"),
|
1782
|
+
include('comments'),
|
1783
|
+
(r"\s*\|", Keyword),
|
1784
|
+
(r"[^\|]", Name.Variable),
|
1785
|
+
],
|
1786
|
+
'scenario_sections_on_stack': [
|
1787
|
+
(feature_element_keywords, bygroups(Name.Function, Keyword, Keyword, Name.Function), "feature_elements_on_stack"),
|
1788
|
+
],
|
1789
|
+
'narrative': [
|
1790
|
+
include('scenario_sections_on_stack'),
|
1791
|
+
(r"(\s|.)", Name.Function),
|
1792
|
+
],
|
1793
|
+
'table_vars': [
|
1794
|
+
(r'(<[^>]+>)', Name.Variable),
|
1795
|
+
],
|
1796
|
+
'numbers': [
|
1797
|
+
(r'(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', String),
|
1798
|
+
],
|
1799
|
+
'string': [
|
1800
|
+
include('table_vars'),
|
1801
|
+
(r'(\s|.)', String),
|
1802
|
+
],
|
1803
|
+
'py_string': [
|
1804
|
+
(r'"""', Keyword, "#pop"),
|
1805
|
+
include('string'),
|
1806
|
+
],
|
1807
|
+
'step_content_root':[
|
1808
|
+
(r"$", Keyword, "#pop"),
|
1809
|
+
include('step_content'),
|
1810
|
+
],
|
1811
|
+
'step_content_stack':[
|
1812
|
+
(r"$", Keyword, "#pop:2"),
|
1813
|
+
include('step_content'),
|
1814
|
+
],
|
1815
|
+
'step_content':[
|
1816
|
+
(r'"', Name.Function, "double_string"),
|
1817
|
+
include('table_vars'),
|
1818
|
+
include('numbers'),
|
1819
|
+
include('comments'),
|
1820
|
+
(r'(\s|.)', Name.Function),
|
1821
|
+
],
|
1822
|
+
'table_content': [
|
1823
|
+
(r"\s+\|\s*$", Keyword, "#pop"),
|
1824
|
+
include('comments'),
|
1825
|
+
(r"\s*\|", Keyword),
|
1826
|
+
include('string'),
|
1827
|
+
],
|
1828
|
+
'double_string': [
|
1829
|
+
(r'"', Name.Function, "#pop"),
|
1830
|
+
include('string'),
|
1831
|
+
],
|
1832
|
+
'root': [
|
1833
|
+
(r'\n', Name.Function),
|
1834
|
+
include('comments'),
|
1835
|
+
(r'"""', Keyword, "py_string"),
|
1836
|
+
(r'\s+\|', Keyword, 'table_content'),
|
1837
|
+
(r'"', Name.Function, "double_string"),
|
1838
|
+
include('table_vars'),
|
1839
|
+
include('numbers'),
|
1840
|
+
(r'(\s*)(@[^@\r\n\t ]+)', bygroups(Name.Function, Name.Tag)),
|
1841
|
+
(step_keywords, bygroups(Name.Function, Keyword),
|
1842
|
+
'step_content_root'),
|
1843
|
+
(feature_keywords, bygroups(Keyword, Keyword, Name.Function),
|
1844
|
+
'narrative'),
|
1845
|
+
(feature_element_keywords,
|
1846
|
+
bygroups(Name.Function, Keyword, Keyword, Name.Function),
|
1847
|
+
'feature_elements'),
|
1848
|
+
(examples_keywords,
|
1849
|
+
bygroups(Name.Function, Keyword, Keyword, Name.Function),
|
1850
|
+
'examples_table'),
|
1851
|
+
(r'(\s|.)', Name.Function),
|
1852
|
+
]
|
1853
|
+
}
|
1854
|
+
|
1855
|
+
class AsymptoteLexer(RegexLexer):
|
1856
|
+
"""
|
1857
|
+
For `Asymptote <http://asymptote.sf.net/>`_ source code.
|
1858
|
+
|
1859
|
+
*New in Pygments 1.2.*
|
1860
|
+
"""
|
1861
|
+
name = 'Asymptote'
|
1862
|
+
aliases = ['asy', 'asymptote']
|
1863
|
+
filenames = ['*.asy']
|
1864
|
+
mimetypes = ['text/x-asymptote']
|
1865
|
+
|
1866
|
+
#: optional Comment or Whitespace
|
1867
|
+
_ws = r'(?:\s|//.*?\n|/\*.*?\*/)+'
|
1868
|
+
|
1869
|
+
tokens = {
|
1870
|
+
'whitespace': [
|
1871
|
+
(r'\n', Text),
|
1872
|
+
(r'\s+', Text),
|
1873
|
+
(r'\\\n', Text), # line continuation
|
1874
|
+
(r'//(\n|(.|\n)*?[^\\]\n)', Comment),
|
1875
|
+
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment),
|
1876
|
+
],
|
1877
|
+
'statements': [
|
1878
|
+
# simple string (TeX friendly)
|
1879
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
1880
|
+
# C style string (with character escapes)
|
1881
|
+
(r"'", String, 'string'),
|
1882
|
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
|
1883
|
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
1884
|
+
(r'0x[0-9a-fA-F]+[Ll]?', Number.Hex),
|
1885
|
+
(r'0[0-7]+[Ll]?', Number.Oct),
|
1886
|
+
(r'\d+[Ll]?', Number.Integer),
|
1887
|
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
1888
|
+
(r'[()\[\],.]', Punctuation),
|
1889
|
+
(r'\b(case)(.+?)(:)', bygroups(Keyword, using(this), Text)),
|
1890
|
+
(r'(and|controls|tension|atleast|curl|if|else|while|for|do|'
|
1891
|
+
r'return|break|continue|struct|typedef|new|access|import|'
|
1892
|
+
r'unravel|from|include|quote|static|public|private|restricted|'
|
1893
|
+
r'this|explicit|true|false|null|cycle|newframe|operator)\b', Keyword),
|
1894
|
+
# Since an asy-type-name can be also an asy-function-name,
|
1895
|
+
# in the following we test if the string " [a-zA-Z]" follows
|
1896
|
+
# the Keyword.Type.
|
1897
|
+
# Of course it is not perfect !
|
1898
|
+
(r'(Braid|FitResult|Label|Legend|TreeNode|abscissa|arc|arrowhead|'
|
1899
|
+
r'binarytree|binarytreeNode|block|bool|bool3|bounds|bqe|circle|'
|
1900
|
+
r'conic|coord|coordsys|cputime|ellipse|file|filltype|frame|grid3|'
|
1901
|
+
r'guide|horner|hsv|hyperbola|indexedTransform|int|inversion|key|'
|
1902
|
+
r'light|line|linefit|marginT|marker|mass|object|pair|parabola|path|'
|
1903
|
+
r'path3|pen|picture|point|position|projection|real|revolution|'
|
1904
|
+
r'scaleT|scientific|segment|side|slice|splitface|string|surface|'
|
1905
|
+
r'tensionSpecifier|ticklocate|ticksgridT|tickvalues|transform|'
|
1906
|
+
r'transformation|tree|triangle|trilinear|triple|vector|'
|
1907
|
+
r'vertex|void)(?=([ ]{1,}[a-zA-Z]))', Keyword.Type),
|
1908
|
+
# Now the asy-type-name which are not asy-function-name
|
1909
|
+
# except yours !
|
1910
|
+
# Perhaps useless
|
1911
|
+
(r'(Braid|FitResult|TreeNode|abscissa|arrowhead|block|bool|bool3|'
|
1912
|
+
r'bounds|coord|frame|guide|horner|int|linefit|marginT|pair|pen|'
|
1913
|
+
r'picture|position|real|revolution|slice|splitface|ticksgridT|'
|
1914
|
+
r'tickvalues|tree|triple|vertex|void)\b', Keyword.Type),
|
1915
|
+
('[a-zA-Z_][a-zA-Z0-9_]*:(?!:)', Name.Label),
|
1916
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
1917
|
+
],
|
1918
|
+
'root': [
|
1919
|
+
include('whitespace'),
|
1920
|
+
# functions
|
1921
|
+
(r'((?:[a-zA-Z0-9_*\s])+?(?:\s|\*))' # return arguments
|
1922
|
+
r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
|
1923
|
+
r'(\s*\([^;]*?\))' # signature
|
1924
|
+
r'(' + _ws + r')({)',
|
1925
|
+
bygroups(using(this), Name.Function, using(this), using(this),
|
1926
|
+
Punctuation),
|
1927
|
+
'function'),
|
1928
|
+
# function declarations
|
1929
|
+
(r'((?:[a-zA-Z0-9_*\s])+?(?:\s|\*))' # return arguments
|
1930
|
+
r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
|
1931
|
+
r'(\s*\([^;]*?\))' # signature
|
1932
|
+
r'(' + _ws + r')(;)',
|
1933
|
+
bygroups(using(this), Name.Function, using(this), using(this),
|
1934
|
+
Punctuation)),
|
1935
|
+
('', Text, 'statement'),
|
1936
|
+
],
|
1937
|
+
'statement' : [
|
1938
|
+
include('whitespace'),
|
1939
|
+
include('statements'),
|
1940
|
+
('[{}]', Punctuation),
|
1941
|
+
(';', Punctuation, '#pop'),
|
1942
|
+
],
|
1943
|
+
'function': [
|
1944
|
+
include('whitespace'),
|
1945
|
+
include('statements'),
|
1946
|
+
(';', Punctuation),
|
1947
|
+
('{', Punctuation, '#push'),
|
1948
|
+
('}', Punctuation, '#pop'),
|
1949
|
+
],
|
1950
|
+
'string': [
|
1951
|
+
(r"'", String, '#pop'),
|
1952
|
+
(r'\\([\\abfnrtv"\'?]|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
1953
|
+
(r'\n', String),
|
1954
|
+
(r"[^\\'\n]+", String), # all other characters
|
1955
|
+
(r'\\\n', String),
|
1956
|
+
(r'\\n', String), # line continuation
|
1957
|
+
(r'\\', String), # stray backslash
|
1958
|
+
]
|
1959
|
+
}
|
1960
|
+
|
1961
|
+
def get_tokens_unprocessed(self, text):
|
1962
|
+
from pygments.lexers._asybuiltins import ASYFUNCNAME, ASYVARNAME
|
1963
|
+
for index, token, value in \
|
1964
|
+
RegexLexer.get_tokens_unprocessed(self, text):
|
1965
|
+
if token is Name and value in ASYFUNCNAME:
|
1966
|
+
token = Name.Function
|
1967
|
+
elif token is Name and value in ASYVARNAME:
|
1968
|
+
token = Name.Variable
|
1969
|
+
yield index, token, value
|
1970
|
+
|
1971
|
+
|
1972
|
+
class PostScriptLexer(RegexLexer):
|
1973
|
+
"""
|
1974
|
+
Lexer for PostScript files.
|
1975
|
+
|
1976
|
+
The PostScript Language Reference published by Adobe at
|
1977
|
+
<http://partners.adobe.com/public/developer/en/ps/PLRM.pdf>
|
1978
|
+
is the authority for this.
|
1979
|
+
|
1980
|
+
*New in Pygments 1.4.*
|
1981
|
+
"""
|
1982
|
+
name = 'PostScript'
|
1983
|
+
aliases = ['postscript', 'postscr']
|
1984
|
+
filenames = ['*.ps', '*.eps']
|
1985
|
+
mimetypes = ['application/postscript']
|
1986
|
+
|
1987
|
+
delimiter = r'\(\)\<\>\[\]\{\}\/\%\s'
|
1988
|
+
delimiter_end = r'(?=[%s])' % delimiter
|
1989
|
+
|
1990
|
+
valid_name_chars = r'[^%s]' % delimiter
|
1991
|
+
valid_name = r"%s+%s" % (valid_name_chars, delimiter_end)
|
1992
|
+
|
1993
|
+
tokens = {
|
1994
|
+
'root': [
|
1995
|
+
# All comment types
|
1996
|
+
(r'^%!.+\n', Comment.Preproc),
|
1997
|
+
(r'%%.*\n', Comment.Special),
|
1998
|
+
(r'(^%.*\n){2,}', Comment.Multiline),
|
1999
|
+
(r'%.*\n', Comment.Single),
|
2000
|
+
|
2001
|
+
# String literals are awkward; enter separate state.
|
2002
|
+
(r'\(', String, 'stringliteral'),
|
2003
|
+
|
2004
|
+
(r'[\{\}(\<\<)(\>\>)\[\]]', Punctuation),
|
2005
|
+
|
2006
|
+
# Numbers
|
2007
|
+
(r'<[0-9A-Fa-f]+>' + delimiter_end, Number.Hex),
|
2008
|
+
# Slight abuse: use Oct to signify any explicit base system
|
2009
|
+
(r'[0-9]+\#(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)'
|
2010
|
+
r'((e|E)[0-9]+)?' + delimiter_end, Number.Oct),
|
2011
|
+
(r'(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)((e|E)[0-9]+)?'
|
2012
|
+
+ delimiter_end, Number.Float),
|
2013
|
+
(r'(\-|\+)?[0-9]+' + delimiter_end, Number.Integer),
|
2014
|
+
|
2015
|
+
# References
|
2016
|
+
(r'\/%s' % valid_name, Name.Variable),
|
2017
|
+
|
2018
|
+
# Names
|
2019
|
+
(valid_name, Name.Function), # Anything else is executed
|
2020
|
+
|
2021
|
+
# These keywords taken from
|
2022
|
+
# <http://www.math.ubc.ca/~cass/graphics/manual/pdf/a1.pdf>
|
2023
|
+
# Is there an authoritative list anywhere that doesn't involve
|
2024
|
+
# trawling documentation?
|
2025
|
+
|
2026
|
+
(r'(false|true)' + delimiter_end, Keyword.Constant),
|
2027
|
+
|
2028
|
+
# Conditionals / flow control
|
2029
|
+
(r'(eq|ne|ge|gt|le|lt|and|or|not|if|ifelse|for|forall)'
|
2030
|
+
+ delimiter_end, Keyword.Reserved),
|
2031
|
+
|
2032
|
+
('(abs|add|aload|arc|arcn|array|atan|begin|bind|ceiling|charpath|'
|
2033
|
+
'clip|closepath|concat|concatmatrix|copy|cos|currentlinewidth|'
|
2034
|
+
'currentmatrix|currentpoint|curveto|cvi|cvs|def|defaultmatrix|'
|
2035
|
+
'dict|dictstackoverflow|div|dtransform|dup|end|exch|exec|exit|exp|'
|
2036
|
+
'fill|findfont|floor|get|getinterval|grestore|gsave|gt|'
|
2037
|
+
'identmatrix|idiv|idtransform|index|invertmatrix|itransform|'
|
2038
|
+
'length|lineto|ln|load|log|loop|matrix|mod|moveto|mul|neg|newpath|'
|
2039
|
+
'pathforall|pathbbox|pop|print|pstack|put|quit|rand|rangecheck|'
|
2040
|
+
'rcurveto|repeat|restore|rlineto|rmoveto|roll|rotate|round|run|'
|
2041
|
+
'save|scale|scalefont|setdash|setfont|setgray|setlinecap|'
|
2042
|
+
'setlinejoin|setlinewidth|setmatrix|setrgbcolor|shfill|show|'
|
2043
|
+
'showpage|sin|sqrt|stack|stringwidth|stroke|strokepath|sub|'
|
2044
|
+
'syntaxerror|transform|translate|truncate|typecheck|undefined|'
|
2045
|
+
'undefinedfilename|undefinedresult)' + delimiter_end,
|
2046
|
+
Name.Builtin),
|
2047
|
+
|
2048
|
+
(r'\s+', Text),
|
2049
|
+
],
|
2050
|
+
|
2051
|
+
'stringliteral': [
|
2052
|
+
(r'[^\(\)\\]+', String),
|
2053
|
+
(r'\\', String.Escape, 'escape'),
|
2054
|
+
(r'\(', String, '#push'),
|
2055
|
+
(r'\)', String, '#pop'),
|
2056
|
+
],
|
2057
|
+
|
2058
|
+
'escape': [
|
2059
|
+
(r'([0-8]{3}|n|r|t|b|f|\\|\(|\))?', String.Escape, '#pop'),
|
2060
|
+
],
|
2061
|
+
}
|
2062
|
+
|
2063
|
+
|
2064
|
+
class AutohotkeyLexer(RegexLexer):
|
2065
|
+
"""
|
2066
|
+
For `autohotkey <http://www.autohotkey.com/>`_ source code.
|
2067
|
+
|
2068
|
+
*New in Pygments 1.4.*
|
2069
|
+
"""
|
2070
|
+
name = 'autohotkey'
|
2071
|
+
aliases = ['ahk', 'autohotkey']
|
2072
|
+
filenames = ['*.ahk', '*.ahkl']
|
2073
|
+
mimetypes = ['text/x-autohotkey']
|
2074
|
+
|
2075
|
+
tokens = {
|
2076
|
+
'root': [
|
2077
|
+
(r'^(\s*)(/\*)', bygroups(Text, Comment.Multiline),
|
2078
|
+
'incomment'),
|
2079
|
+
(r'^(\s*)(\()', bygroups(Text, Generic), 'incontinuation'),
|
2080
|
+
(r'\s+;.*?$', Comment.Singleline),
|
2081
|
+
(r'^;.*?$', Comment.Singleline),
|
2082
|
+
(r'[]{}(),;[]', Punctuation),
|
2083
|
+
(r'(in|is|and|or|not)\b', Operator.Word),
|
2084
|
+
(r'\%[a-zA-Z_#@$][a-zA-Z0-9_#@$]*\%', Name.Variable),
|
2085
|
+
(r'!=|==|:=|\.=|<<|>>|[-~+/*%=<>&^|?:!.]', Operator),
|
2086
|
+
include('commands'),
|
2087
|
+
include('labels'),
|
2088
|
+
include('builtInFunctions'),
|
2089
|
+
include('builtInVariables'),
|
2090
|
+
(r'"', String, combined('stringescape', 'dqs')),
|
2091
|
+
include('numbers'),
|
2092
|
+
(r'[a-zA-Z_#@$][a-zA-Z0-9_#@$]*', Name),
|
2093
|
+
(r'\\|\'', Text),
|
2094
|
+
(r'\`([\,\%\`abfnrtv\-\+;])', String.Escape),
|
2095
|
+
include('garbage'),
|
2096
|
+
],
|
2097
|
+
'incomment': [
|
2098
|
+
(r'^\s*\*/', Comment.Multiline, '#pop'),
|
2099
|
+
(r'[^*/]', Comment.Multiline),
|
2100
|
+
(r'[*/]', Comment.Multiline)
|
2101
|
+
],
|
2102
|
+
'incontinuation': [
|
2103
|
+
(r'^\s*\)', Generic, '#pop'),
|
2104
|
+
(r'[^)]', Generic),
|
2105
|
+
(r'[)]', Generic),
|
2106
|
+
],
|
2107
|
+
'commands': [
|
2108
|
+
(r'(?i)^(\s*)(global|local|static|'
|
2109
|
+
r'#AllowSameLineComments|#ClipboardTimeout|#CommentFlag|'
|
2110
|
+
r'#ErrorStdOut|#EscapeChar|#HotkeyInterval|#HotkeyModifierTimeout|'
|
2111
|
+
r'#Hotstring|#IfWinActive|#IfWinExist|#IfWinNotActive|'
|
2112
|
+
r'#IfWinNotExist|#IncludeAgain|#Include|#InstallKeybdHook|'
|
2113
|
+
r'#InstallMouseHook|#KeyHistory|#LTrim|#MaxHotkeysPerInterval|'
|
2114
|
+
r'#MaxMem|#MaxThreads|#MaxThreadsBuffer|#MaxThreadsPerHotkey|'
|
2115
|
+
r'#NoEnv|#NoTrayIcon|#Persistent|#SingleInstance|#UseHook|'
|
2116
|
+
r'#WinActivateForce|AutoTrim|BlockInput|Break|Click|ClipWait|'
|
2117
|
+
r'Continue|Control|ControlClick|ControlFocus|ControlGetFocus|'
|
2118
|
+
r'ControlGetPos|ControlGetText|ControlGet|ControlMove|ControlSend|'
|
2119
|
+
r'ControlSendRaw|ControlSetText|CoordMode|Critical|'
|
2120
|
+
r'DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|'
|
2121
|
+
r'DriveSpaceFree|Edit|Else|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|'
|
2122
|
+
r'EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|'
|
2123
|
+
r'FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|'
|
2124
|
+
r'FileDelete|FileGetAttrib|FileGetShortcut|FileGetSize|'
|
2125
|
+
r'FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|'
|
2126
|
+
r'FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|'
|
2127
|
+
r'FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|'
|
2128
|
+
r'FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|'
|
2129
|
+
r'GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|'
|
2130
|
+
r'GuiControlGet|Hotkey|IfEqual|IfExist|IfGreaterOrEqual|IfGreater|'
|
2131
|
+
r'IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|'
|
2132
|
+
r'IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|'
|
2133
|
+
r'IfWinNotExist|If |ImageSearch|IniDelete|IniRead|IniWrite|'
|
2134
|
+
r'InputBox|Input|KeyHistory|KeyWait|ListHotkeys|ListLines|'
|
2135
|
+
r'ListVars|Loop|Menu|MouseClickDrag|MouseClick|MouseGetPos|'
|
2136
|
+
r'MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|'
|
2137
|
+
r'PixelSearch|PostMessage|Process|Progress|Random|RegDelete|'
|
2138
|
+
r'RegRead|RegWrite|Reload|Repeat|Return|RunAs|RunWait|Run|'
|
2139
|
+
r'SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|Send|'
|
2140
|
+
r'SetBatchLines|SetCapslockState|SetControlDelay|'
|
2141
|
+
r'SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|'
|
2142
|
+
r'SetMouseDelay|SetNumlockState|SetScrollLockState|'
|
2143
|
+
r'SetStoreCapslockMode|SetTimer|SetTitleMatchMode|'
|
2144
|
+
r'SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|'
|
2145
|
+
r'SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|'
|
2146
|
+
r'SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|'
|
2147
|
+
r'SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|'
|
2148
|
+
r'StringGetPos|StringLeft|StringLen|StringLower|StringMid|'
|
2149
|
+
r'StringReplace|StringRight|StringSplit|StringTrimLeft|'
|
2150
|
+
r'StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|'
|
2151
|
+
r'Transform|TrayTip|URLDownloadToFile|While|WinActivate|'
|
2152
|
+
r'WinActivateBottom|WinClose|WinGetActiveStats|WinGetActiveTitle|'
|
2153
|
+
r'WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinGet|WinHide|'
|
2154
|
+
r'WinKill|WinMaximize|WinMenuSelectItem|WinMinimizeAllUndo|'
|
2155
|
+
r'WinMinimizeAll|WinMinimize|WinMove|WinRestore|WinSetTitle|'
|
2156
|
+
r'WinSet|WinShow|WinWaitActive|WinWaitClose|WinWaitNotActive|'
|
2157
|
+
r'WinWait)\b', bygroups(Text, Name.Builtin)),
|
2158
|
+
],
|
2159
|
+
'builtInFunctions': [
|
2160
|
+
(r'(?i)(Abs|ACos|Asc|ASin|ATan|Ceil|Chr|Cos|DllCall|Exp|FileExist|'
|
2161
|
+
r'Floor|GetKeyState|IL_Add|IL_Create|IL_Destroy|InStr|IsFunc|'
|
2162
|
+
r'IsLabel|Ln|Log|LV_Add|LV_Delete|LV_DeleteCol|LV_GetCount|'
|
2163
|
+
r'LV_GetNext|LV_GetText|LV_Insert|LV_InsertCol|LV_Modify|'
|
2164
|
+
r'LV_ModifyCol|LV_SetImageList|Mod|NumGet|NumPut|OnMessage|'
|
2165
|
+
r'RegExMatch|RegExReplace|RegisterCallback|Round|SB_SetIcon|'
|
2166
|
+
r'SB_SetParts|SB_SetText|Sin|Sqrt|StrLen|SubStr|Tan|TV_Add|'
|
2167
|
+
r'TV_Delete|TV_GetChild|TV_GetCount|TV_GetNext|TV_Get|'
|
2168
|
+
r'TV_GetParent|TV_GetPrev|TV_GetSelection|TV_GetText|TV_Modify|'
|
2169
|
+
r'VarSetCapacity|WinActive|WinExist|Object|ComObjActive|'
|
2170
|
+
r'ComObjArray|ComObjEnwrap|ComObjUnwrap|ComObjParameter|'
|
2171
|
+
r'ComObjType|ComObjConnect|ComObjCreate|ComObjGet|ComObjError|'
|
2172
|
+
r'ComObjValue|Insert|MinIndex|MaxIndex|Remove|SetCapacity|'
|
2173
|
+
r'GetCapacity|GetAddress|_NewEnum|FileOpen|Read|Write|ReadLine|'
|
2174
|
+
r'WriteLine|ReadNumType|WriteNumType|RawRead|RawWrite|Seek|Tell|'
|
2175
|
+
r'Close|Next|IsObject|StrPut|StrGet|Trim|LTrim|RTrim)\b',
|
2176
|
+
Name.Function),
|
2177
|
+
],
|
2178
|
+
'builtInVariables': [
|
2179
|
+
(r'(?i)(A_AhkPath|A_AhkVersion|A_AppData|A_AppDataCommon|'
|
2180
|
+
r'A_AutoTrim|A_BatchLines|A_CaretX|A_CaretY|A_ComputerName|'
|
2181
|
+
r'A_ControlDelay|A_Cursor|A_DDDD|A_DDD|A_DD|A_DefaultMouseSpeed|'
|
2182
|
+
r'A_Desktop|A_DesktopCommon|A_DetectHiddenText|'
|
2183
|
+
r'A_DetectHiddenWindows|A_EndChar|A_EventInfo|A_ExitReason|'
|
2184
|
+
r'A_FormatFloat|A_FormatInteger|A_Gui|A_GuiEvent|A_GuiControl|'
|
2185
|
+
r'A_GuiControlEvent|A_GuiHeight|A_GuiWidth|A_GuiX|A_GuiY|A_Hour|'
|
2186
|
+
r'A_IconFile|A_IconHidden|A_IconNumber|A_IconTip|A_Index|'
|
2187
|
+
r'A_IPAddress1|A_IPAddress2|A_IPAddress3|A_IPAddress4|A_ISAdmin|'
|
2188
|
+
r'A_IsCompiled|A_IsCritical|A_IsPaused|A_IsSuspended|A_KeyDelay|'
|
2189
|
+
r'A_Language|A_LastError|A_LineFile|A_LineNumber|A_LoopField|'
|
2190
|
+
r'A_LoopFileAttrib|A_LoopFileDir|A_LoopFileExt|A_LoopFileFullPath|'
|
2191
|
+
r'A_LoopFileLongPath|A_LoopFileName|A_LoopFileShortName|'
|
2192
|
+
r'A_LoopFileShortPath|A_LoopFileSize|A_LoopFileSizeKB|'
|
2193
|
+
r'A_LoopFileSizeMB|A_LoopFileTimeAccessed|A_LoopFileTimeCreated|'
|
2194
|
+
r'A_LoopFileTimeModified|A_LoopReadLine|A_LoopRegKey|'
|
2195
|
+
r'A_LoopRegName|A_LoopRegSubkey|A_LoopRegTimeModified|'
|
2196
|
+
r'A_LoopRegType|A_MDAY|A_Min|A_MM|A_MMM|A_MMMM|A_Mon|A_MouseDelay|'
|
2197
|
+
r'A_MSec|A_MyDocuments|A_Now|A_NowUTC|A_NumBatchLines|A_OSType|'
|
2198
|
+
r'A_OSVersion|A_PriorHotkey|A_ProgramFiles|A_Programs|'
|
2199
|
+
r'A_ProgramsCommon|A_ScreenHeight|A_ScreenWidth|A_ScriptDir|'
|
2200
|
+
r'A_ScriptFullPath|A_ScriptName|A_Sec|A_Space|A_StartMenu|'
|
2201
|
+
r'A_StartMenuCommon|A_Startup|A_StartupCommon|A_StringCaseSense|'
|
2202
|
+
r'A_Tab|A_Temp|A_ThisFunc|A_ThisHotkey|A_ThisLabel|A_ThisMenu|'
|
2203
|
+
r'A_ThisMenuItem|A_ThisMenuItemPos|A_TickCount|A_TimeIdle|'
|
2204
|
+
r'A_TimeIdlePhysical|A_TimeSincePriorHotkey|A_TimeSinceThisHotkey|'
|
2205
|
+
r'A_TitleMatchMode|A_TitleMatchModeSpeed|A_UserName|A_WDay|'
|
2206
|
+
r'A_WinDelay|A_WinDir|A_WorkingDir|A_YDay|A_YEAR|A_YWeek|A_YYYY|'
|
2207
|
+
r'Clipboard|ClipboardAll|ComSpec|ErrorLevel|ProgramFiles|True|'
|
2208
|
+
r'False|A_IsUnicode|A_FileEncoding|A_OSVersion|A_PtrSize)\b',
|
2209
|
+
Name.Variable),
|
2210
|
+
],
|
2211
|
+
'labels': [
|
2212
|
+
# hotkeys and labels
|
2213
|
+
# technically, hotkey names are limited to named keys and buttons
|
2214
|
+
(r'(^\s*)([^:\s\(\"]+?:{1,2})', bygroups(Text, Name.Label)),
|
2215
|
+
(r'(^\s*)(::[^:\s]+?::)', bygroups(Text, Name.Label)),
|
2216
|
+
],
|
2217
|
+
'numbers': [
|
2218
|
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
2219
|
+
(r'\d+[eE][+-]?[0-9]+', Number.Float),
|
2220
|
+
(r'0\d+', Number.Oct),
|
2221
|
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
2222
|
+
(r'\d+L', Number.Integer.Long),
|
2223
|
+
(r'\d+', Number.Integer)
|
2224
|
+
],
|
2225
|
+
'stringescape': [
|
2226
|
+
(r'\"\"|\`([\,\%\`abfnrtv])', String.Escape),
|
2227
|
+
],
|
2228
|
+
'strings': [
|
2229
|
+
(r'[^"\n]+', String),
|
2230
|
+
],
|
2231
|
+
'dqs': [
|
2232
|
+
(r'"', String, '#pop'),
|
2233
|
+
include('strings')
|
2234
|
+
],
|
2235
|
+
'garbage': [
|
2236
|
+
(r'[^\S\n]', Text),
|
2237
|
+
# (r'.', Text), # no cheating
|
2238
|
+
],
|
2239
|
+
}
|
2240
|
+
|
2241
|
+
|
2242
|
+
class MaqlLexer(RegexLexer):
|
2243
|
+
"""
|
2244
|
+
Lexer for `GoodData MAQL
|
2245
|
+
<https://secure.gooddata.com/docs/html/advanced.metric.tutorial.html>`_
|
2246
|
+
scripts.
|
2247
|
+
|
2248
|
+
*New in Pygments 1.4.*
|
2249
|
+
"""
|
2250
|
+
|
2251
|
+
name = 'MAQL'
|
2252
|
+
aliases = ['maql']
|
2253
|
+
filenames = ['*.maql']
|
2254
|
+
mimetypes = ['text/x-gooddata-maql','application/x-gooddata-maql']
|
2255
|
+
|
2256
|
+
flags = re.IGNORECASE
|
2257
|
+
tokens = {
|
2258
|
+
'root': [
|
2259
|
+
# IDENTITY
|
2260
|
+
(r'IDENTIFIER\b', Name.Builtin),
|
2261
|
+
# IDENTIFIER
|
2262
|
+
(r'\{[^}]+\}', Name.Variable),
|
2263
|
+
# NUMBER
|
2264
|
+
(r'[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]{1,3})?', Literal.Number),
|
2265
|
+
# STRING
|
2266
|
+
(r'"', Literal.String, 'string-literal'),
|
2267
|
+
# RELATION
|
2268
|
+
(r'\<\>|\!\=', Operator),
|
2269
|
+
(r'\=|\>\=|\>|\<\=|\<', Operator),
|
2270
|
+
# :=
|
2271
|
+
(r'\:\=', Operator),
|
2272
|
+
# OBJECT
|
2273
|
+
(r'\[[^]]+\]', Name.Variable.Class),
|
2274
|
+
# keywords
|
2275
|
+
(r'(DIMENSIONS?|BOTTOM|METRIC|COUNT|OTHER|FACT|WITH|TOP|OR|'
|
2276
|
+
r'ATTRIBUTE|CREATE|PARENT|FALSE|ROWS?|FROM|ALL|AS|PF|'
|
2277
|
+
r'COLUMNS?|DEFINE|REPORT|LIMIT|TABLE|LIKE|AND|BY|'
|
2278
|
+
r'BETWEEN|EXCEPT|SELECT|MATCH|WHERE|TRUE|FOR|IN|'
|
2279
|
+
r'WITHOUT|FILTER|ALIAS|ORDER|FACT|WHEN|NOT|ON|'
|
2280
|
+
r'KEYS|KEY|FULLSET|PRIMARY|LABELS|LABEL|VISUAL|'
|
2281
|
+
r'TITLE|DESCRIPTION|FOLDER|ALTER|DROP|ADD|DATASET|'
|
2282
|
+
r'DATATYPE|INT|BIGINT|DOUBLE|DATE|VARCHAR|DECIMAL|'
|
2283
|
+
r'SYNCHRONIZE|TYPE|DEFAULT|ORDER|ASC|DESC|HYPERLINK|'
|
2284
|
+
r'INCLUDE|TEMPLATE|MODIFY)\b', Keyword),
|
2285
|
+
# FUNCNAME
|
2286
|
+
(r'[a-zA-Z]\w*\b', Name.Function),
|
2287
|
+
# Comments
|
2288
|
+
(r'#.*', Comment.Single),
|
2289
|
+
# Punctuation
|
2290
|
+
(r'[,;\(\)]', Token.Punctuation),
|
2291
|
+
# Space is not significant
|
2292
|
+
(r'\s+', Text)
|
2293
|
+
],
|
2294
|
+
'string-literal': [
|
2295
|
+
(r'\\[tnrfbae"\\]', String.Escape),
|
2296
|
+
(r'"', Literal.String, '#pop'),
|
2297
|
+
(r'[^\\"]+', Literal.String)
|
2298
|
+
],
|
2299
|
+
}
|
2300
|
+
|
2301
|
+
|
2302
|
+
class GoodDataCLLexer(RegexLexer):
|
2303
|
+
"""
|
2304
|
+
Lexer for `GoodData-CL <http://github.com/gooddata/GoodData-CL/raw/master/cli/src/main/resources/com/gooddata/processor/COMMANDS.txt>`_
|
2305
|
+
script files.
|
2306
|
+
|
2307
|
+
*New in Pygments 1.4.*
|
2308
|
+
"""
|
2309
|
+
|
2310
|
+
name = 'GoodData-CL'
|
2311
|
+
aliases = ['gooddata-cl']
|
2312
|
+
filenames = ['*.gdc']
|
2313
|
+
mimetypes = ['text/x-gooddata-cl']
|
2314
|
+
|
2315
|
+
flags = re.IGNORECASE
|
2316
|
+
tokens = {
|
2317
|
+
'root': [
|
2318
|
+
# Comments
|
2319
|
+
(r'#.*', Comment.Single),
|
2320
|
+
# Function call
|
2321
|
+
(r'[a-zA-Z]\w*', Name.Function),
|
2322
|
+
# Argument list
|
2323
|
+
(r'\(', Token.Punctuation, 'args-list'),
|
2324
|
+
# Punctuation
|
2325
|
+
(r';', Token.Punctuation),
|
2326
|
+
# Space is not significant
|
2327
|
+
(r'\s+', Text)
|
2328
|
+
],
|
2329
|
+
'args-list': [
|
2330
|
+
(r'\)', Token.Punctuation, '#pop'),
|
2331
|
+
(r',', Token.Punctuation),
|
2332
|
+
(r'[a-zA-Z]\w*', Name.Variable),
|
2333
|
+
(r'=', Operator),
|
2334
|
+
(r'"', Literal.String, 'string-literal'),
|
2335
|
+
(r'[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]{1,3})?', Literal.Number),
|
2336
|
+
# Space is not significant
|
2337
|
+
(r'\s', Text)
|
2338
|
+
],
|
2339
|
+
'string-literal': [
|
2340
|
+
(r'\\[tnrfbae"\\]', String.Escape),
|
2341
|
+
(r'"', Literal.String, '#pop'),
|
2342
|
+
(r'[^\\"]+', Literal.String)
|
2343
|
+
]
|
2344
|
+
}
|
2345
|
+
|
2346
|
+
|
2347
|
+
class ProtoBufLexer(RegexLexer):
|
2348
|
+
"""
|
2349
|
+
Lexer for `Protocol Buffer <http://code.google.com/p/protobuf/>`_
|
2350
|
+
definition files.
|
2351
|
+
|
2352
|
+
*New in Pygments 1.4.*
|
2353
|
+
"""
|
2354
|
+
|
2355
|
+
name = 'Protocol Buffer'
|
2356
|
+
aliases = ['protobuf', 'proto']
|
2357
|
+
filenames = ['*.proto']
|
2358
|
+
|
2359
|
+
tokens = {
|
2360
|
+
'root': [
|
2361
|
+
(r'[ \t]+', Text),
|
2362
|
+
(r'[,;{}\[\]\(\)]', Punctuation),
|
2363
|
+
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
2364
|
+
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
|
2365
|
+
(r'\b(import|option|optional|required|repeated|default|packed|'
|
2366
|
+
r'ctype|extensions|to|max|rpc|returns)\b', Keyword),
|
2367
|
+
(r'(int32|int64|uint32|uint64|sint32|sint64|'
|
2368
|
+
r'fixed32|fixed64|sfixed32|sfixed64|'
|
2369
|
+
r'float|double|bool|string|bytes)\b', Keyword.Type),
|
2370
|
+
(r'(true|false)\b', Keyword.Constant),
|
2371
|
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text), 'package'),
|
2372
|
+
(r'(message|extend)(\s+)',
|
2373
|
+
bygroups(Keyword.Declaration, Text), 'message'),
|
2374
|
+
(r'(enum|group|service)(\s+)',
|
2375
|
+
bygroups(Keyword.Declaration, Text), 'type'),
|
2376
|
+
(r'\".*\"', String),
|
2377
|
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
|
2378
|
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
2379
|
+
(r'(\-?(inf|nan))', Number.Float),
|
2380
|
+
(r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
|
2381
|
+
(r'0[0-7]+[LlUu]*', Number.Oct),
|
2382
|
+
(r'\d+[LlUu]*', Number.Integer),
|
2383
|
+
(r'[+-=]', Operator),
|
2384
|
+
(r'([a-zA-Z_][a-zA-Z0-9_\.]*)([ \t]*)(=)',
|
2385
|
+
bygroups(Name.Attribute, Text, Operator)),
|
2386
|
+
('[a-zA-Z_][a-zA-Z0-9_\.]*', Name),
|
2387
|
+
],
|
2388
|
+
'package': [
|
2389
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Namespace, '#pop')
|
2390
|
+
],
|
2391
|
+
'message': [
|
2392
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
|
2393
|
+
],
|
2394
|
+
'type': [
|
2395
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name, '#pop')
|
2396
|
+
],
|
2397
|
+
}
|
2398
|
+
|
2399
|
+
|
2400
|
+
class HybrisLexer(RegexLexer):
|
2401
|
+
"""
|
2402
|
+
For `Hybris <http://www.hybris-lang.org>`_ source code.
|
2403
|
+
|
2404
|
+
*New in Pygments 1.4.*
|
2405
|
+
"""
|
2406
|
+
|
2407
|
+
name = 'Hybris'
|
2408
|
+
aliases = ['hybris', 'hy']
|
2409
|
+
filenames = ['*.hy', '*.hyb']
|
2410
|
+
mimetypes = ['text/x-hybris', 'application/x-hybris']
|
2411
|
+
|
2412
|
+
flags = re.MULTILINE | re.DOTALL
|
2413
|
+
|
2414
|
+
tokens = {
|
2415
|
+
'root': [
|
2416
|
+
# method names
|
2417
|
+
(r'^(\s*(?:function|method|operator\s+)+?)'
|
2418
|
+
r'([a-zA-Z_][a-zA-Z0-9_]*)'
|
2419
|
+
r'(\s*)(\()', bygroups(Keyword, Name.Function, Text, Operator)),
|
2420
|
+
(r'[^\S\n]+', Text),
|
2421
|
+
(r'//.*?\n', Comment.Single),
|
2422
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
2423
|
+
(r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
|
2424
|
+
(r'(break|case|catch|next|default|do|else|finally|for|foreach|of|'
|
2425
|
+
r'unless|if|new|return|switch|me|throw|try|while)\b', Keyword),
|
2426
|
+
(r'(extends|private|protected|public|static|throws|function|method|'
|
2427
|
+
r'operator)\b', Keyword.Declaration),
|
2428
|
+
(r'(true|false|null|__FILE__|__LINE__|__VERSION__|__LIB_PATH__|'
|
2429
|
+
r'__INC_PATH__)\b', Keyword.Constant),
|
2430
|
+
(r'(class|struct)(\s+)',
|
2431
|
+
bygroups(Keyword.Declaration, Text), 'class'),
|
2432
|
+
(r'(import|include)(\s+)',
|
2433
|
+
bygroups(Keyword.Namespace, Text), 'import'),
|
2434
|
+
(r'(gc_collect|gc_mm_items|gc_mm_usage|gc_collect_threshold|'
|
2435
|
+
r'urlencode|urldecode|base64encode|base64decode|sha1|crc32|sha2|'
|
2436
|
+
r'md5|md5_file|acos|asin|atan|atan2|ceil|cos|cosh|exp|fabs|floor|'
|
2437
|
+
r'fmod|log|log10|pow|sin|sinh|sqrt|tan|tanh|isint|isfloat|ischar|'
|
2438
|
+
r'isstring|isarray|ismap|isalias|typeof|sizeof|toint|tostring|'
|
2439
|
+
r'fromxml|toxml|binary|pack|load|eval|var_names|var_values|'
|
2440
|
+
r'user_functions|dyn_functions|methods|call|call_method|mknod|'
|
2441
|
+
r'mkfifo|mount|umount2|umount|ticks|usleep|sleep|time|strtime|'
|
2442
|
+
r'strdate|dllopen|dlllink|dllcall|dllcall_argv|dllclose|env|exec|'
|
2443
|
+
r'fork|getpid|wait|popen|pclose|exit|kill|pthread_create|'
|
2444
|
+
r'pthread_create_argv|pthread_exit|pthread_join|pthread_kill|'
|
2445
|
+
r'smtp_send|http_get|http_post|http_download|socket|bind|listen|'
|
2446
|
+
r'accept|getsockname|getpeername|settimeout|connect|server|recv|'
|
2447
|
+
r'send|close|print|println|printf|input|readline|serial_open|'
|
2448
|
+
r'serial_fcntl|serial_get_attr|serial_get_ispeed|serial_get_ospeed|'
|
2449
|
+
r'serial_set_attr|serial_set_ispeed|serial_set_ospeed|serial_write|'
|
2450
|
+
r'serial_read|serial_close|xml_load|xml_parse|fopen|fseek|ftell|'
|
2451
|
+
r'fsize|fread|fwrite|fgets|fclose|file|readdir|pcre_replace|size|'
|
2452
|
+
r'pop|unmap|has|keys|values|length|find|substr|replace|split|trim|'
|
2453
|
+
r'remove|contains|join)\b', Name.Builtin),
|
2454
|
+
(r'(MethodReference|Runner|Dll|Thread|Pipe|Process|Runnable|'
|
2455
|
+
r'CGI|ClientSocket|Socket|ServerSocket|File|Console|Directory|'
|
2456
|
+
r'Exception)\b', Keyword.Type),
|
2457
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
2458
|
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
|
2459
|
+
(r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)',
|
2460
|
+
bygroups(Operator, Name.Attribute)),
|
2461
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
|
2462
|
+
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
|
2463
|
+
(r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?\-@]+', Operator),
|
2464
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
2465
|
+
(r'0x[0-9a-f]+', Number.Hex),
|
2466
|
+
(r'[0-9]+L?', Number.Integer),
|
2467
|
+
(r'\n', Text),
|
2468
|
+
],
|
2469
|
+
'class': [
|
2470
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
|
2471
|
+
],
|
2472
|
+
'import': [
|
2473
|
+
(r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
|
2474
|
+
],
|
2475
|
+
}
|
2476
|
+
|
2477
|
+
|
2478
|
+
class AwkLexer(RegexLexer):
|
2479
|
+
"""
|
2480
|
+
For Awk scripts.
|
2481
|
+
|
2482
|
+
*New in Pygments 1.5.*
|
2483
|
+
"""
|
2484
|
+
|
2485
|
+
name = 'Awk'
|
2486
|
+
aliases = ['awk', 'gawk', 'mawk', 'nawk']
|
2487
|
+
filenames = ['*.awk']
|
2488
|
+
mimetypes = ['application/x-awk']
|
2489
|
+
|
2490
|
+
tokens = {
|
2491
|
+
'commentsandwhitespace': [
|
2492
|
+
(r'\s+', Text),
|
2493
|
+
(r'#.*$', Comment.Single)
|
2494
|
+
],
|
2495
|
+
'slashstartsregex': [
|
2496
|
+
include('commentsandwhitespace'),
|
2497
|
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
2498
|
+
r'\B', String.Regex, '#pop'),
|
2499
|
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
2500
|
+
(r'', Text, '#pop')
|
2501
|
+
],
|
2502
|
+
'badregex': [
|
2503
|
+
(r'\n', Text, '#pop')
|
2504
|
+
],
|
2505
|
+
'root': [
|
2506
|
+
(r'^(?=\s|/)', Text, 'slashstartsregex'),
|
2507
|
+
include('commentsandwhitespace'),
|
2508
|
+
(r'\+\+|--|\|\||&&|in|\$|!?~|'
|
2509
|
+
r'(\*\*|[-<>+*%\^/!=])=?', Operator, 'slashstartsregex'),
|
2510
|
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
2511
|
+
(r'[})\].]', Punctuation),
|
2512
|
+
(r'(break|continue|do|while|exit|for|if|'
|
2513
|
+
r'return)\b', Keyword, 'slashstartsregex'),
|
2514
|
+
(r'function\b', Keyword.Declaration, 'slashstartsregex'),
|
2515
|
+
(r'(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gensub|gsub|index|'
|
2516
|
+
r'length|match|split|sprintf|sub|substr|tolower|toupper|close|'
|
2517
|
+
r'fflush|getline|next|nextfile|print|printf|strftime|systime|'
|
2518
|
+
r'delete|system)\b', Keyword.Reserved),
|
2519
|
+
(r'(ARGC|ARGIND|ARGV|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS|FILENAME|FNR|FS|'
|
2520
|
+
r'IGNORECASE|NF|NR|OFMT|OFS|ORFS|RLENGTH|RS|RSTART|RT|'
|
2521
|
+
r'SUBSEP)\b', Name.Builtin),
|
2522
|
+
(r'[$a-zA-Z_][a-zA-Z0-9_]*', Name.Other),
|
2523
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
2524
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
2525
|
+
(r'[0-9]+', Number.Integer),
|
2526
|
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
2527
|
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
2528
|
+
]
|
2529
|
+
}
|
2530
|
+
|
2531
|
+
|
2532
|
+
class Cfengine3Lexer(RegexLexer):
|
2533
|
+
"""
|
2534
|
+
Lexer for `CFEngine3 <http://cfengine.org>`_ policy files.
|
2535
|
+
|
2536
|
+
*New in Pygments 1.5.*
|
2537
|
+
"""
|
2538
|
+
|
2539
|
+
name = 'CFEngine3'
|
2540
|
+
aliases = ['cfengine3', 'cf3']
|
2541
|
+
filenames = ['*.cf']
|
2542
|
+
mimetypes = []
|
2543
|
+
|
2544
|
+
tokens = {
|
2545
|
+
'root': [
|
2546
|
+
(r'#.*?\n', Comment),
|
2547
|
+
(r'(body)(\s+)(\S+)(\s+)(control)',
|
2548
|
+
bygroups(Keyword, Text, Keyword, Text, Keyword)),
|
2549
|
+
(r'(body|bundle)(\s+)(\S+)(\s+)(\w+)(\()',
|
2550
|
+
bygroups(Keyword, Text, Keyword, Text, Name.Function, Punctuation),
|
2551
|
+
'arglist'),
|
2552
|
+
(r'(body|bundle)(\s+)(\S+)(\s+)(\w+)',
|
2553
|
+
bygroups(Keyword, Text, Keyword, Text, Name.Function)),
|
2554
|
+
(r'(")([^"]+)(")(\s+)(string|slist|int|real)(\s*)(=>)(\s*)',
|
2555
|
+
bygroups(Punctuation,Name.Variable,Punctuation,
|
2556
|
+
Text,Keyword.Type,Text,Operator,Text)),
|
2557
|
+
(r'(\S+)(\s*)(=>)(\s*)',
|
2558
|
+
bygroups(Keyword.Reserved,Text,Operator,Text)),
|
2559
|
+
(r'"', String, 'string'),
|
2560
|
+
(r'(\w+)(\()', bygroups(Name.Function, Punctuation)),
|
2561
|
+
(r'([\w.!&|\(\)]+)(::)', bygroups(Name.Class, Punctuation)),
|
2562
|
+
(r'(\w+)(:)', bygroups(Keyword.Declaration,Punctuation)),
|
2563
|
+
(r'@[\{\(][^\)\}]+[\}\)]', Name.Variable),
|
2564
|
+
(r'[(){},;]', Punctuation),
|
2565
|
+
(r'=>', Operator),
|
2566
|
+
(r'->', Operator),
|
2567
|
+
(r'\d+\.\d+', Number.Float),
|
2568
|
+
(r'\d+', Number.Integer),
|
2569
|
+
(r'\w+', Name.Function),
|
2570
|
+
(r'\s+', Text),
|
2571
|
+
],
|
2572
|
+
'string': [
|
2573
|
+
(r'\$[\{\(]', String.Interpol, 'interpol'),
|
2574
|
+
(r'\\.', String.Escape),
|
2575
|
+
(r'"', String, '#pop'),
|
2576
|
+
(r'\n', String),
|
2577
|
+
(r'.', String),
|
2578
|
+
],
|
2579
|
+
'interpol': [
|
2580
|
+
(r'\$[\{\(]', String.Interpol, '#push'),
|
2581
|
+
(r'[\}\)]', String.Interpol, '#pop'),
|
2582
|
+
(r'[^\$\{\(\)\}]+', String.Interpol),
|
2583
|
+
],
|
2584
|
+
'arglist': [
|
2585
|
+
(r'\)', Punctuation, '#pop'),
|
2586
|
+
(r',', Punctuation),
|
2587
|
+
(r'\w+', Name.Variable),
|
2588
|
+
(r'\s+', Text),
|
2589
|
+
],
|
2590
|
+
}
|
2591
|
+
|
2592
|
+
|
2593
|
+
class SnobolLexer(RegexLexer):
|
2594
|
+
"""
|
2595
|
+
Lexer for the SNOBOL4 programming language.
|
2596
|
+
|
2597
|
+
Recognizes the common ASCII equivalents of the original SNOBOL4 operators.
|
2598
|
+
Does not require spaces around binary operators.
|
2599
|
+
|
2600
|
+
*New in Pygments 1.5.*
|
2601
|
+
"""
|
2602
|
+
|
2603
|
+
name = "Snobol"
|
2604
|
+
aliases = ["snobol"]
|
2605
|
+
filenames = ['*.snobol']
|
2606
|
+
mimetypes = ['text/x-snobol']
|
2607
|
+
|
2608
|
+
tokens = {
|
2609
|
+
# root state, start of line
|
2610
|
+
# comments, continuation lines, and directives start in column 1
|
2611
|
+
# as do labels
|
2612
|
+
'root': [
|
2613
|
+
(r'\*.*\n', Comment),
|
2614
|
+
(r'[\+\.] ', Punctuation, 'statement'),
|
2615
|
+
(r'-.*\n', Comment),
|
2616
|
+
(r'END\s*\n', Name.Label, 'heredoc'),
|
2617
|
+
(r'[A-Za-z\$][\w$]*', Name.Label, 'statement'),
|
2618
|
+
(r'\s+', Text, 'statement'),
|
2619
|
+
],
|
2620
|
+
# statement state, line after continuation or label
|
2621
|
+
'statement': [
|
2622
|
+
(r'\s*\n', Text, '#pop'),
|
2623
|
+
(r'\s+', Text),
|
2624
|
+
(r'(?<=[^\w.])(LT|LE|EQ|NE|GE|GT|INTEGER|IDENT|DIFFER|LGT|SIZE|'
|
2625
|
+
r'REPLACE|TRIM|DUPL|REMDR|DATE|TIME|EVAL|APPLY|OPSYN|LOAD|UNLOAD|'
|
2626
|
+
r'LEN|SPAN|BREAK|ANY|NOTANY|TAB|RTAB|REM|POS|RPOS|FAIL|FENCE|'
|
2627
|
+
r'ABORT|ARB|ARBNO|BAL|SUCCEED|INPUT|OUTPUT|TERMINAL)(?=[^\w.])',
|
2628
|
+
Name.Builtin),
|
2629
|
+
(r'[A-Za-z][\w\.]*', Name),
|
2630
|
+
# ASCII equivalents of original operators
|
2631
|
+
# | for the EBCDIC equivalent, ! likewise
|
2632
|
+
# \ for EBCDIC negation
|
2633
|
+
(r'\*\*|[\?\$\.!%\*/#+\-@\|&\\=]', Operator),
|
2634
|
+
(r'"[^"]*"', String),
|
2635
|
+
(r"'[^']*'", String),
|
2636
|
+
# Accept SPITBOL syntax for real numbers
|
2637
|
+
# as well as Macro SNOBOL4
|
2638
|
+
(r'[0-9]+(?=[^\.EeDd])', Number.Integer),
|
2639
|
+
(r'[0-9]+(\.[0-9]*)?([EDed][-+]?[0-9]+)?', Number.Float),
|
2640
|
+
# Goto
|
2641
|
+
(r':', Punctuation, 'goto'),
|
2642
|
+
(r'[\(\)<>,;]', Punctuation),
|
2643
|
+
],
|
2644
|
+
# Goto block
|
2645
|
+
'goto': [
|
2646
|
+
(r'\s*\n', Text, "#pop:2"),
|
2647
|
+
(r'\s+', Text),
|
2648
|
+
(r'F|S', Keyword),
|
2649
|
+
(r'(\()([A-Za-z][\w.]*)(\))',
|
2650
|
+
bygroups(Punctuation, Name.Label, Punctuation))
|
2651
|
+
],
|
2652
|
+
# everything after the END statement is basically one
|
2653
|
+
# big heredoc.
|
2654
|
+
'heredoc': [
|
2655
|
+
(r'.*\n', String.Heredoc)
|
2656
|
+
]
|
2657
|
+
}
|
2658
|
+
|
2659
|
+
|
2660
|
+
class UrbiscriptLexer(ExtendedRegexLexer):
|
2661
|
+
"""
|
2662
|
+
For UrbiScript source code.
|
2663
|
+
|
2664
|
+
*New in Pygments 1.5.*
|
2665
|
+
"""
|
2666
|
+
|
2667
|
+
name = 'UrbiScript'
|
2668
|
+
aliases = ['urbiscript']
|
2669
|
+
filenames = ['*.u']
|
2670
|
+
mimetypes = ['application/x-urbiscript']
|
2671
|
+
|
2672
|
+
flags = re.DOTALL
|
2673
|
+
|
2674
|
+
## TODO
|
2675
|
+
# - handle Experimental and deprecated tags with specific tokens
|
2676
|
+
# - handle Angles and Durations with specific tokens
|
2677
|
+
|
2678
|
+
def blob_callback(lexer, match, ctx):
|
2679
|
+
text_before_blob = match.group(1)
|
2680
|
+
blob_start = match.group(2)
|
2681
|
+
blob_size_str = match.group(3)
|
2682
|
+
blob_size = int(blob_size_str)
|
2683
|
+
yield match.start(), String, text_before_blob
|
2684
|
+
ctx.pos += len(text_before_blob)
|
2685
|
+
|
2686
|
+
# if blob size doesn't match blob format (example : "\B(2)(aaa)")
|
2687
|
+
# yield blob as a string
|
2688
|
+
if ctx.text[match.end() + blob_size] != ")":
|
2689
|
+
result = "\\B(" + blob_size_str + ")("
|
2690
|
+
yield match.start(), String, result
|
2691
|
+
ctx.pos += len(result)
|
2692
|
+
return
|
2693
|
+
|
2694
|
+
# if blob is well formated, yield as Escape
|
2695
|
+
blob_text = blob_start + ctx.text[match.end():match.end()+blob_size] + ")"
|
2696
|
+
yield match.start(), String.Escape, blob_text
|
2697
|
+
ctx.pos = match.end() + blob_size + 1 # +1 is the ending ")"
|
2698
|
+
|
2699
|
+
tokens = {
|
2700
|
+
'root': [
|
2701
|
+
(r'\s+', Text),
|
2702
|
+
# comments
|
2703
|
+
(r'//.*?\n', Comment),
|
2704
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
2705
|
+
(r'(?:every|for|loop|while)(?:;|&|\||,)',Keyword),
|
2706
|
+
(r'(?:assert|at|break|case|catch|closure|compl|continue|'
|
2707
|
+
r'default|else|enum|every|external|finally|for|freezeif|if|new|'
|
2708
|
+
r'onleave|return|stopif|switch|this|throw|timeout|try|'
|
2709
|
+
r'waituntil|whenever|while)\b', Keyword),
|
2710
|
+
(r'(?:asm|auto|bool|char|const_cast|delete|double|dynamic_cast|'
|
2711
|
+
r'explicit|export|extern|float|friend|goto|inline|int|'
|
2712
|
+
r'long|mutable|namespace|register|reinterpret_cast|short|'
|
2713
|
+
r'signed|sizeof|static_cast|struct|template|typedef|typeid|'
|
2714
|
+
r'typename|union|unsigned|using|virtual|volatile|'
|
2715
|
+
r'wchar_t)\b', Keyword.Reserved),
|
2716
|
+
# deprecated keywords, use a meaningfull token when available
|
2717
|
+
(r'(?:emit|foreach|internal|loopn|static)\b', Keyword),
|
2718
|
+
# ignored keywords, use a meaningfull token when available
|
2719
|
+
(r'(?:private|protected|public)\b', Keyword),
|
2720
|
+
(r'(?:var|do|const|function|class)\b', Keyword.Declaration),
|
2721
|
+
(r'(?:true|false|nil|void)\b', Keyword.Constant),
|
2722
|
+
(r'(?:Barrier|Binary|Boolean|CallMessage|Channel|Code|'
|
2723
|
+
r'Comparable|Container|Control|Date|Dictionary|Directory|'
|
2724
|
+
r'Duration|Enumeration|Event|Exception|Executable|File|Finalizable|'
|
2725
|
+
r'Float|FormatInfo|Formatter|Global|Group|Hash|InputStream|'
|
2726
|
+
r'IoService|Job|Kernel|Lazy|List|Loadable|Lobby|Location|Logger|Math|'
|
2727
|
+
r'Mutex|nil|Object|Orderable|OutputStream|Pair|Path|Pattern|Position|'
|
2728
|
+
r'Primitive|Process|Profile|PseudoLazy|PubSub|RangeIterable|Regexp|'
|
2729
|
+
r'Semaphore|Server|Singleton|Socket|StackFrame|Stream|String|System|'
|
2730
|
+
r'Tag|Timeout|Traceable|TrajectoryGenerator|Triplet|Tuple'
|
2731
|
+
r'|UObject|UValue|UVar)\b', Name.Builtin),
|
2732
|
+
(r'(?:this)\b', Name.Builtin.Pseudo),
|
2733
|
+
# don't match single | and &
|
2734
|
+
(r'(?:[-=+*%/<>~^:]+|\.&?|\|\||&&)', Operator),
|
2735
|
+
(r'(?:and_eq|and|bitand|bitor|in|not|not_eq|or_eq|or|xor_eq|xor)\b',
|
2736
|
+
Operator.Word),
|
2737
|
+
(r'[{}\[\]()]+', Punctuation),
|
2738
|
+
(r'(?:;|\||,|&|\?|!)+', Punctuation),
|
2739
|
+
(r'[$a-zA-Z_][a-zA-Z0-9_]*', Name.Other),
|
2740
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
2741
|
+
# Float, Integer, Angle and Duration
|
2742
|
+
(r'(?:[0-9]+(?:(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)?'
|
2743
|
+
r'((?:rad|deg|grad)|(?:ms|s|min|h|d))?)\b', Number.Float),
|
2744
|
+
# handle binary blob in strings
|
2745
|
+
(r'"', String.Double, "string.double"),
|
2746
|
+
(r"'", String.Single, "string.single"),
|
2747
|
+
],
|
2748
|
+
'string.double': [
|
2749
|
+
(r'((?:\\\\|\\"|[^"])*?)(\\B\((\d+)\)\()', blob_callback),
|
2750
|
+
(r'(\\\\|\\"|[^"])*?"', String.Double, '#pop'),
|
2751
|
+
],
|
2752
|
+
'string.single': [
|
2753
|
+
(r"((?:\\\\|\\'|[^'])*?)(\\B\((\d+)\)\()", blob_callback),
|
2754
|
+
(r"(\\\\|\\'|[^'])*?'", String.Single, '#pop'),
|
2755
|
+
],
|
2756
|
+
# from http://pygments.org/docs/lexerdevelopment/#changing-states
|
2757
|
+
'comment': [
|
2758
|
+
(r'[^*/]', Comment.Multiline),
|
2759
|
+
(r'/\*', Comment.Multiline, '#push'),
|
2760
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
2761
|
+
(r'[*/]', Comment.Multiline),
|
2762
|
+
]
|
2763
|
+
}
|
2764
|
+
|
2765
|
+
|
2766
|
+
class OpenEdgeLexer(RegexLexer):
|
2767
|
+
"""
|
2768
|
+
Lexer for `OpenEdge ABL (formerly Progress)
|
2769
|
+
<http://web.progress.com/en/openedge/abl.html>`_ source code.
|
2770
|
+
|
2771
|
+
*New in Pygments 1.5.*
|
2772
|
+
"""
|
2773
|
+
name = 'OpenEdge ABL'
|
2774
|
+
aliases = ['openedge', 'abl', 'progress']
|
2775
|
+
filenames = ['*.p', '*.cls']
|
2776
|
+
mimetypes = ['text/x-openedge', 'application/x-openedge']
|
2777
|
+
|
2778
|
+
types = (r'(?i)(^|(?<=[^0-9a-z_\-]))(CHARACTER|CHAR|CHARA|CHARAC|CHARACT|CHARACTE|'
|
2779
|
+
r'COM-HANDLE|DATE|DATETIME|DATETIME-TZ|'
|
2780
|
+
r'DECIMAL|DEC|DECI|DECIM|DECIMA|HANDLE|'
|
2781
|
+
r'INT64|INTEGER|INT|INTE|INTEG|INTEGE|'
|
2782
|
+
r'LOGICAL|LONGCHAR|MEMPTR|RAW|RECID|ROWID)\s*($|(?=[^0-9a-z_\-]))')
|
2783
|
+
|
2784
|
+
keywords = (r'(?i)(^|(?<=[^0-9a-z_\-]))(' +
|
2785
|
+
r'|'.join(OPENEDGEKEYWORDS) +
|
2786
|
+
r')\s*($|(?=[^0-9a-z_\-]))')
|
2787
|
+
tokens = {
|
2788
|
+
'root': [
|
2789
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
2790
|
+
(r'\{', Comment.Preproc, 'preprocessor'),
|
2791
|
+
(r'\s*&.*', Comment.Preproc),
|
2792
|
+
(r'0[xX][0-9a-fA-F]+[LlUu]*', Number.Hex),
|
2793
|
+
(r'(?i)(DEFINE|DEF|DEFI|DEFIN)\b', Keyword.Declaration),
|
2794
|
+
(types, Keyword.Type),
|
2795
|
+
(keywords, Name.Builtin),
|
2796
|
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
2797
|
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
2798
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
2799
|
+
(r'[0-9]+', Number.Integer),
|
2800
|
+
(r'\s+', Text),
|
2801
|
+
(r'[+*/=-]', Operator),
|
2802
|
+
(r'[.:()]', Punctuation),
|
2803
|
+
(r'.', Name.Variable), # Lazy catch-all
|
2804
|
+
],
|
2805
|
+
'comment': [
|
2806
|
+
(r'[^*/]', Comment.Multiline),
|
2807
|
+
(r'/\*', Comment.Multiline, '#push'),
|
2808
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
2809
|
+
(r'[*/]', Comment.Multiline)
|
2810
|
+
],
|
2811
|
+
'preprocessor': [
|
2812
|
+
(r'[^{}]', Comment.Preproc),
|
2813
|
+
(r'{', Comment.Preproc, '#push'),
|
2814
|
+
(r'}', Comment.Preproc, '#pop'),
|
2815
|
+
],
|
2816
|
+
}
|
2817
|
+
|
2818
|
+
|
2819
|
+
class BroLexer(RegexLexer):
|
2820
|
+
"""
|
2821
|
+
For `Bro <http://bro-ids.org/>`_ scripts.
|
2822
|
+
|
2823
|
+
*New in Pygments 1.5.*
|
2824
|
+
"""
|
2825
|
+
name = 'Bro'
|
2826
|
+
aliases = ['bro']
|
2827
|
+
filenames = ['*.bro']
|
2828
|
+
|
2829
|
+
_hex = r'[0-9a-fA-F_]+'
|
2830
|
+
_float = r'((\d*\.?\d+)|(\d+\.?\d*))([eE][-+]?\d+)?'
|
2831
|
+
_h = r'[A-Za-z0-9][-A-Za-z0-9]*'
|
2832
|
+
|
2833
|
+
tokens = {
|
2834
|
+
'root': [
|
2835
|
+
# Whitespace
|
2836
|
+
(r'^@.*?\n', Comment.Preproc),
|
2837
|
+
(r'#.*?\n', Comment.Single),
|
2838
|
+
(r'\n', Text),
|
2839
|
+
(r'\s+', Text),
|
2840
|
+
(r'\\\n', Text),
|
2841
|
+
# Keywords
|
2842
|
+
(r'(add|alarm|break|case|const|continue|delete|do|else|enum|event'
|
2843
|
+
r'|export|for|function|if|global|hook|local|module|next'
|
2844
|
+
r'|of|print|redef|return|schedule|switch|type|when|while)\b', Keyword),
|
2845
|
+
(r'(addr|any|bool|count|counter|double|file|int|interval|net'
|
2846
|
+
r'|pattern|port|record|set|string|subnet|table|time|timer'
|
2847
|
+
r'|vector)\b', Keyword.Type),
|
2848
|
+
(r'(T|F)\b', Keyword.Constant),
|
2849
|
+
(r'(&)((?:add|delete|expire)_func|attr|(?:create|read|write)_expire'
|
2850
|
+
r'|default|disable_print_hook|raw_output|encrypt|group|log'
|
2851
|
+
r'|mergeable|optional|persistent|priority|redef'
|
2852
|
+
r'|rotate_(?:interval|size)|synchronized)\b', bygroups(Punctuation,
|
2853
|
+
Keyword)),
|
2854
|
+
(r'\s+module\b', Keyword.Namespace),
|
2855
|
+
# Addresses, ports and networks
|
2856
|
+
(r'\d+/(tcp|udp|icmp|unknown)\b', Number),
|
2857
|
+
(r'(\d+\.){3}\d+', Number),
|
2858
|
+
(r'(' + _hex + r'){7}' + _hex, Number),
|
2859
|
+
(r'0x' + _hex + r'(' + _hex + r'|:)*::(' + _hex + r'|:)*', Number),
|
2860
|
+
(r'((\d+|:)(' + _hex + r'|:)*)?::(' + _hex + r'|:)*', Number),
|
2861
|
+
(r'(\d+\.\d+\.|(\d+\.){2}\d+)', Number),
|
2862
|
+
# Hostnames
|
2863
|
+
(_h + r'(\.' + _h + r')+', String),
|
2864
|
+
# Numeric
|
2865
|
+
(_float + r'\s+(day|hr|min|sec|msec|usec)s?\b', Literal.Date),
|
2866
|
+
(r'0[xX]' + _hex, Number.Hex),
|
2867
|
+
(_float, Number.Float),
|
2868
|
+
(r'\d+', Number.Integer),
|
2869
|
+
(r'/', String.Regex, 'regex'),
|
2870
|
+
(r'"', String, 'string'),
|
2871
|
+
# Operators
|
2872
|
+
(r'[!%*/+:<=>?~|-]', Operator),
|
2873
|
+
(r'([-+=&|]{2}|[+=!><-]=)', Operator),
|
2874
|
+
(r'(in|match)\b', Operator.Word),
|
2875
|
+
(r'[{}()\[\]$.,;]', Punctuation),
|
2876
|
+
# Identfier
|
2877
|
+
(r'([_a-zA-Z]\w*)(::)', bygroups(Name, Name.Namespace)),
|
2878
|
+
(r'[a-zA-Z_][a-zA-Z_0-9]*', Name)
|
2879
|
+
],
|
2880
|
+
'string': [
|
2881
|
+
(r'"', String, '#pop'),
|
2882
|
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
2883
|
+
(r'[^\\"\n]+', String),
|
2884
|
+
(r'\\\n', String),
|
2885
|
+
(r'\\', String)
|
2886
|
+
],
|
2887
|
+
'regex': [
|
2888
|
+
(r'/', String.Regex, '#pop'),
|
2889
|
+
(r'\\[\\nt/]', String.Regex), # String.Escape is too intense here.
|
2890
|
+
(r'[^\\/\n]+', String.Regex),
|
2891
|
+
(r'\\\n', String.Regex),
|
2892
|
+
(r'\\', String.Regex)
|
2893
|
+
]
|
2894
|
+
}
|
2895
|
+
|
2896
|
+
|
2897
|
+
class CbmBasicV2Lexer(RegexLexer):
|
2898
|
+
"""
|
2899
|
+
For CBM BASIC V2 sources.
|
2900
|
+
|
2901
|
+
*New in Pygments 1.6.*
|
2902
|
+
"""
|
2903
|
+
name = 'CBM BASIC V2'
|
2904
|
+
aliases = ['cbmbas']
|
2905
|
+
filenames = ['*.bas']
|
2906
|
+
|
2907
|
+
flags = re.IGNORECASE
|
2908
|
+
|
2909
|
+
tokens = {
|
2910
|
+
'root': [
|
2911
|
+
(r'rem.*\n', Comment.Single),
|
2912
|
+
(r'\s+', Text),
|
2913
|
+
(r'new|run|end|for|to|next|step|go(to|sub)?|on|return|stop|cont'
|
2914
|
+
r'|if|then|input#?|read|wait|load|save|verify|poke|sys|print#?'
|
2915
|
+
r'|list|clr|cmd|open|close|get#?', Keyword.Reserved),
|
2916
|
+
(r'data|restore|dim|let|def|fn', Keyword.Declaration),
|
2917
|
+
(r'tab|spc|sgn|int|abs|usr|fre|pos|sqr|rnd|log|exp|cos|sin|tan|atn'
|
2918
|
+
r'|peek|len|val|asc|(str|chr|left|right|mid)\$', Name.Builtin),
|
2919
|
+
(r'[-+*/^<>=]', Operator),
|
2920
|
+
(r'not|and|or', Operator.Word),
|
2921
|
+
(r'"[^"\n]*.', String),
|
2922
|
+
(r'\d+|[-+]?\d*\.\d*(e[-+]?\d+)?', Number.Float),
|
2923
|
+
(r'[\(\),:;]', Punctuation),
|
2924
|
+
(r'\w+[$%]?', Name),
|
2925
|
+
]
|
2926
|
+
}
|
2927
|
+
|
2928
|
+
def analyse_text(self, text):
|
2929
|
+
# if it starts with a line number, it shouldn't be a "modern" Basic
|
2930
|
+
# like VB.net
|
2931
|
+
if re.match(r'\d+', text):
|
2932
|
+
return True
|
2933
|
+
|
2934
|
+
|
2935
|
+
class MscgenLexer(RegexLexer):
|
2936
|
+
"""
|
2937
|
+
For `Mscgen <http://www.mcternan.me.uk/mscgen/>`_ files.
|
2938
|
+
|
2939
|
+
*New in Pygments 1.6.*
|
2940
|
+
"""
|
2941
|
+
name = 'Mscgen'
|
2942
|
+
aliases = ['mscgen', 'msc']
|
2943
|
+
filenames = ['*.msc']
|
2944
|
+
|
2945
|
+
_var = r'([a-zA-Z0-9_]+|"(?:\\"|[^"])*")'
|
2946
|
+
|
2947
|
+
tokens = {
|
2948
|
+
'root': [
|
2949
|
+
(r'msc\b', Keyword.Type),
|
2950
|
+
# Options
|
2951
|
+
(r'(hscale|HSCALE|width|WIDTH|wordwraparcs|WORDWRAPARCS'
|
2952
|
+
r'|arcgradient|ARCGRADIENT)\b', Name.Property),
|
2953
|
+
# Operators
|
2954
|
+
(r'(abox|ABOX|rbox|RBOX|box|BOX|note|NOTE)\b', Operator.Word),
|
2955
|
+
(r'(\.|-|\|){3}', Keyword),
|
2956
|
+
(r'(?:-|=|\.|:){2}'
|
2957
|
+
r'|<<=>>|<->|<=>|<<>>|<:>'
|
2958
|
+
r'|->|=>>|>>|=>|:>|-x|-X'
|
2959
|
+
r'|<-|<<=|<<|<=|<:|x-|X-|=', Operator),
|
2960
|
+
# Names
|
2961
|
+
(r'\*', Name.Builtin),
|
2962
|
+
(_var, Name.Variable),
|
2963
|
+
# Other
|
2964
|
+
(r'\[', Punctuation, 'attrs'),
|
2965
|
+
(r'\{|\}|,|;', Punctuation),
|
2966
|
+
include('comments')
|
2967
|
+
],
|
2968
|
+
'attrs': [
|
2969
|
+
(r'\]', Punctuation, '#pop'),
|
2970
|
+
(_var + r'(\s*)(=)(\s*)' + _var,
|
2971
|
+
bygroups(Name.Attribute, Text.Whitespace, Operator, Text.Whitespace,
|
2972
|
+
String)),
|
2973
|
+
(r',', Punctuation),
|
2974
|
+
include('comments')
|
2975
|
+
],
|
2976
|
+
'comments': [
|
2977
|
+
(r'(?://|#).*?\n', Comment.Single),
|
2978
|
+
(r'/\*(?:.|\n)*?\*/', Comment.Multiline),
|
2979
|
+
(r'[ \t\r\n]+', Text.Whitespace)
|
2980
|
+
]
|
2981
|
+
}
|
2982
|
+
|
2983
|
+
|
2984
|
+
def _rx_indent(level):
|
2985
|
+
# Kconfig *always* interprets a tab as 8 spaces, so this is the default.
|
2986
|
+
# Edit this if you are in an environment where KconfigLexer gets expanded
|
2987
|
+
# input (tabs expanded to spaces) and the expansion tab width is != 8,
|
2988
|
+
# e.g. in connection with Trac (trac.ini, [mimeviewer], tab_width).
|
2989
|
+
# Value range here is 2 <= {tab_width} <= 8.
|
2990
|
+
tab_width = 8
|
2991
|
+
# Regex matching a given indentation {level}, assuming that indentation is
|
2992
|
+
# a multiple of {tab_width}. In other cases there might be problems.
|
2993
|
+
return r'(?:\t| {1,%s}\t| {%s}){%s}.*\n' % (tab_width-1, tab_width, level)
|
2994
|
+
|
2995
|
+
|
2996
|
+
class KconfigLexer(RegexLexer):
|
2997
|
+
"""
|
2998
|
+
For Linux-style Kconfig files.
|
2999
|
+
|
3000
|
+
*New in Pygments 1.6.*
|
3001
|
+
"""
|
3002
|
+
|
3003
|
+
name = 'Kconfig'
|
3004
|
+
aliases = ['kconfig', 'menuconfig', 'linux-config', 'kernel-config']
|
3005
|
+
# Adjust this if new kconfig file names appear in your environment
|
3006
|
+
filenames = ['Kconfig', '*Config.in*', 'external.in*',
|
3007
|
+
'standard-modules.in']
|
3008
|
+
mimetypes = ['text/x-kconfig']
|
3009
|
+
# No re.MULTILINE, indentation-aware help text needs line-by-line handling
|
3010
|
+
flags = 0
|
3011
|
+
|
3012
|
+
def call_indent(level):
|
3013
|
+
# If indentation >= {level} is detected, enter state 'indent{level}'
|
3014
|
+
return (_rx_indent(level), String.Doc, 'indent%s' % level)
|
3015
|
+
|
3016
|
+
def do_indent(level):
|
3017
|
+
# Print paragraphs of indentation level >= {level} as String.Doc,
|
3018
|
+
# ignoring blank lines. Then return to 'root' state.
|
3019
|
+
return [
|
3020
|
+
(_rx_indent(level), String.Doc),
|
3021
|
+
(r'\s*\n', Text),
|
3022
|
+
(r'', Generic, '#pop:2')
|
3023
|
+
]
|
3024
|
+
|
3025
|
+
tokens = {
|
3026
|
+
'root': [
|
3027
|
+
(r'\s+', Text),
|
3028
|
+
(r'#.*?\n', Comment.Single),
|
3029
|
+
(r'(mainmenu|config|menuconfig|choice|endchoice|comment|menu|'
|
3030
|
+
r'endmenu|visible if|if|endif|source|prompt|select|depends on|'
|
3031
|
+
r'default|range|option)\b', Keyword),
|
3032
|
+
(r'(---help---|help)[\t ]*\n', Keyword, 'help'),
|
3033
|
+
(r'(bool|tristate|string|hex|int|defconfig_list|modules|env)\b',
|
3034
|
+
Name.Builtin),
|
3035
|
+
(r'[!=&|]', Operator),
|
3036
|
+
(r'[()]', Punctuation),
|
3037
|
+
(r'[0-9]+', Number.Integer),
|
3038
|
+
(r"'(''|[^'])*'", String.Single),
|
3039
|
+
(r'"(""|[^"])*"', String.Double),
|
3040
|
+
(r'\S+', Text),
|
3041
|
+
],
|
3042
|
+
# Help text is indented, multi-line and ends when a lower indentation
|
3043
|
+
# level is detected.
|
3044
|
+
'help': [
|
3045
|
+
# Skip blank lines after help token, if any
|
3046
|
+
(r'\s*\n', Text),
|
3047
|
+
# Determine the first help line's indentation level heuristically(!).
|
3048
|
+
# Attention: this is not perfect, but works for 99% of "normal"
|
3049
|
+
# indentation schemes up to a max. indentation level of 7.
|
3050
|
+
call_indent(7),
|
3051
|
+
call_indent(6),
|
3052
|
+
call_indent(5),
|
3053
|
+
call_indent(4),
|
3054
|
+
call_indent(3),
|
3055
|
+
call_indent(2),
|
3056
|
+
call_indent(1),
|
3057
|
+
('', Text, '#pop'), # for incomplete help sections without text
|
3058
|
+
],
|
3059
|
+
# Handle text for indentation levels 7 to 1
|
3060
|
+
'indent7': do_indent(7),
|
3061
|
+
'indent6': do_indent(6),
|
3062
|
+
'indent5': do_indent(5),
|
3063
|
+
'indent4': do_indent(4),
|
3064
|
+
'indent3': do_indent(3),
|
3065
|
+
'indent2': do_indent(2),
|
3066
|
+
'indent1': do_indent(1),
|
3067
|
+
}
|
3068
|
+
|
3069
|
+
|
3070
|
+
class VGLLexer(RegexLexer):
|
3071
|
+
"""
|
3072
|
+
For `SampleManager VGL <http://www.thermoscientific.com/samplemanager>`_
|
3073
|
+
source code.
|
3074
|
+
|
3075
|
+
*New in Pygments 1.6.*
|
3076
|
+
"""
|
3077
|
+
name = 'VGL'
|
3078
|
+
aliases = ['vgl']
|
3079
|
+
filenames = ['*.rpf']
|
3080
|
+
|
3081
|
+
flags = re.MULTILINE | re.DOTALL | re.IGNORECASE
|
3082
|
+
|
3083
|
+
tokens = {
|
3084
|
+
'root': [
|
3085
|
+
(r'\{[^\}]*\}', Comment.Multiline),
|
3086
|
+
(r'declare', Keyword.Constant),
|
3087
|
+
(r'(if|then|else|endif|while|do|endwhile|and|or|prompt|object'
|
3088
|
+
r'|create|on|line|with|global|routine|value|endroutine|constant'
|
3089
|
+
r'|global|set|join|library|compile_option|file|exists|create|copy'
|
3090
|
+
r'|delete|enable|windows|name|notprotected)(?! *[=<>.,()])',
|
3091
|
+
Keyword),
|
3092
|
+
(r'(true|false|null|empty|error|locked)', Keyword.Constant),
|
3093
|
+
(r'[~\^\*\#!%&\[\]\(\)<>\|+=:;,./?-]', Operator),
|
3094
|
+
(r'"[^"]*"', String),
|
3095
|
+
(r'(\.)([a-z_\$][a-z0-9_\$]*)', bygroups(Operator, Name.Attribute)),
|
3096
|
+
(r'[0-9][0-9]*(\.[0-9]+(e[+\-]?[0-9]+)?)?', Number),
|
3097
|
+
(r'[a-z_\$][a-z0-9_\$]*', Name),
|
3098
|
+
(r'[\r\n]+', Text),
|
3099
|
+
(r'\s+', Text)
|
3100
|
+
]
|
3101
|
+
}
|
3102
|
+
|
3103
|
+
|
3104
|
+
class SourcePawnLexer(RegexLexer):
|
3105
|
+
"""
|
3106
|
+
For SourcePawn source code with preprocessor directives.
|
3107
|
+
|
3108
|
+
*New in Pygments 1.6.*
|
3109
|
+
"""
|
3110
|
+
name = 'SourcePawn'
|
3111
|
+
aliases = ['sp']
|
3112
|
+
filenames = ['*.sp']
|
3113
|
+
mimetypes = ['text/x-sourcepawn']
|
3114
|
+
|
3115
|
+
#: optional Comment or Whitespace
|
3116
|
+
_ws = r'(?:\s|//.*?\n|/\*.*?\*/)+'
|
3117
|
+
|
3118
|
+
tokens = {
|
3119
|
+
'root': [
|
3120
|
+
# preprocessor directives: without whitespace
|
3121
|
+
('^#if\s+0', Comment.Preproc, 'if0'),
|
3122
|
+
('^#', Comment.Preproc, 'macro'),
|
3123
|
+
# or with whitespace
|
3124
|
+
('^' + _ws + r'#if\s+0', Comment.Preproc, 'if0'),
|
3125
|
+
('^' + _ws + '#', Comment.Preproc, 'macro'),
|
3126
|
+
(r'\n', Text),
|
3127
|
+
(r'\s+', Text),
|
3128
|
+
(r'\\\n', Text), # line continuation
|
3129
|
+
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
3130
|
+
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
|
3131
|
+
(r'[{}]', Punctuation),
|
3132
|
+
(r'L?"', String, 'string'),
|
3133
|
+
(r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
|
3134
|
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
|
3135
|
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
3136
|
+
(r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
|
3137
|
+
(r'0[0-7]+[LlUu]*', Number.Oct),
|
3138
|
+
(r'\d+[LlUu]*', Number.Integer),
|
3139
|
+
(r'\*/', Error),
|
3140
|
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
3141
|
+
(r'[()\[\],.;]', Punctuation),
|
3142
|
+
(r'(case|const|continue|native|'
|
3143
|
+
r'default|else|enum|for|if|new|operator|'
|
3144
|
+
r'public|return|sizeof|static|decl|struct|switch)\b', Keyword),
|
3145
|
+
(r'(bool|Float)\b', Keyword.Type),
|
3146
|
+
(r'(true|false)\b', Keyword.Constant),
|
3147
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
3148
|
+
],
|
3149
|
+
'string': [
|
3150
|
+
(r'"', String, '#pop'),
|
3151
|
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
3152
|
+
(r'[^\\"\n]+', String), # all other characters
|
3153
|
+
(r'\\\n', String), # line continuation
|
3154
|
+
(r'\\', String), # stray backslash
|
3155
|
+
],
|
3156
|
+
'macro': [
|
3157
|
+
(r'[^/\n]+', Comment.Preproc),
|
3158
|
+
(r'/\*(.|\n)*?\*/', Comment.Multiline),
|
3159
|
+
(r'//.*?\n', Comment.Single, '#pop'),
|
3160
|
+
(r'/', Comment.Preproc),
|
3161
|
+
(r'(?<=\\)\n', Comment.Preproc),
|
3162
|
+
(r'\n', Comment.Preproc, '#pop'),
|
3163
|
+
],
|
3164
|
+
'if0': [
|
3165
|
+
(r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
|
3166
|
+
(r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
|
3167
|
+
(r'.*?\n', Comment),
|
3168
|
+
]
|
3169
|
+
}
|
3170
|
+
|
3171
|
+
SM_TYPES = ['Action', 'bool', 'Float', 'Plugin', 'String', 'any',
|
3172
|
+
'AdminFlag', 'OverrideType', 'OverrideRule', 'ImmunityType',
|
3173
|
+
'GroupId', 'AdminId', 'AdmAccessMode', 'AdminCachePart',
|
3174
|
+
'CookieAccess', 'CookieMenu', 'CookieMenuAction', 'NetFlow',
|
3175
|
+
'ConVarBounds', 'QueryCookie', 'ReplySource',
|
3176
|
+
'ConVarQueryResult', 'ConVarQueryFinished', 'Function',
|
3177
|
+
'Action', 'Identity', 'PluginStatus', 'PluginInfo', 'DBResult',
|
3178
|
+
'DBBindType', 'DBPriority', 'PropType', 'PropFieldType',
|
3179
|
+
'MoveType', 'RenderMode', 'RenderFx', 'EventHookMode',
|
3180
|
+
'EventHook', 'FileType', 'FileTimeMode', 'PathType',
|
3181
|
+
'ParamType', 'ExecType', 'DialogType', 'Handle', 'KvDataTypes',
|
3182
|
+
'NominateResult', 'MapChange', 'MenuStyle', 'MenuAction',
|
3183
|
+
'MenuSource', 'RegexError', 'SDKCallType', 'SDKLibrary',
|
3184
|
+
'SDKFuncConfSource', 'SDKType', 'SDKPassMethod', 'RayType',
|
3185
|
+
'TraceEntityFilter', 'ListenOverride', 'SortOrder', 'SortType',
|
3186
|
+
'SortFunc2D', 'APLRes', 'FeatureType', 'FeatureStatus',
|
3187
|
+
'SMCResult', 'SMCError', 'TFClassType', 'TFTeam', 'TFCond',
|
3188
|
+
'TFResourceType', 'Timer', 'TopMenuAction', 'TopMenuObjectType',
|
3189
|
+
'TopMenuPosition', 'TopMenuObject', 'UserMsg']
|
3190
|
+
|
3191
|
+
def __init__(self, **options):
|
3192
|
+
self.smhighlighting = get_bool_opt(options,
|
3193
|
+
'sourcemod', True)
|
3194
|
+
|
3195
|
+
self._functions = []
|
3196
|
+
if self.smhighlighting:
|
3197
|
+
from pygments.lexers._sourcemodbuiltins import FUNCTIONS
|
3198
|
+
self._functions.extend(FUNCTIONS)
|
3199
|
+
RegexLexer.__init__(self, **options)
|
3200
|
+
|
3201
|
+
def get_tokens_unprocessed(self, text):
|
3202
|
+
for index, token, value in \
|
3203
|
+
RegexLexer.get_tokens_unprocessed(self, text):
|
3204
|
+
if token is Name:
|
3205
|
+
if self.smhighlighting:
|
3206
|
+
if value in self.SM_TYPES:
|
3207
|
+
token = Keyword.Type
|
3208
|
+
elif value in self._functions:
|
3209
|
+
token = Name.Builtin
|
3210
|
+
yield index, token, value
|
3211
|
+
|
3212
|
+
|
3213
|
+
class PuppetLexer(RegexLexer):
|
3214
|
+
"""
|
3215
|
+
For `Puppet <http://puppetlabs.com/>`__ configuration DSL.
|
3216
|
+
|
3217
|
+
*New in Pygments 1.6.*
|
3218
|
+
"""
|
3219
|
+
name = 'Puppet'
|
3220
|
+
aliases = ['puppet']
|
3221
|
+
filenames = ['*.pp']
|
3222
|
+
|
3223
|
+
tokens = {
|
3224
|
+
'root': [
|
3225
|
+
include('comments'),
|
3226
|
+
include('keywords'),
|
3227
|
+
include('names'),
|
3228
|
+
include('numbers'),
|
3229
|
+
include('operators'),
|
3230
|
+
include('strings'),
|
3231
|
+
|
3232
|
+
(r'[]{}:(),;[]', Punctuation),
|
3233
|
+
(r'[^\S\n]+', Text),
|
3234
|
+
],
|
3235
|
+
|
3236
|
+
'comments': [
|
3237
|
+
(r'\s*#.*$', Comment),
|
3238
|
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
3239
|
+
],
|
3240
|
+
|
3241
|
+
'operators': [
|
3242
|
+
(r'(=>|\?|<|>|=|\+|-|/|\*|~|!|\|)', Operator),
|
3243
|
+
(r'(in|and|or|not)\b', Operator.Word),
|
3244
|
+
],
|
3245
|
+
|
3246
|
+
'names': [
|
3247
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name.Attribute),
|
3248
|
+
(r'(\$\S+)(\[)(\S+)(\])', bygroups(Name.Variable, Punctuation,
|
3249
|
+
String, Punctuation)),
|
3250
|
+
(r'\$\S+', Name.Variable),
|
3251
|
+
],
|
3252
|
+
|
3253
|
+
'numbers': [
|
3254
|
+
# Copypasta from the Python lexer
|
3255
|
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
|
3256
|
+
(r'\d+[eE][+-]?[0-9]+j?', Number.Float),
|
3257
|
+
(r'0[0-7]+j?', Number.Oct),
|
3258
|
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
3259
|
+
(r'\d+L', Number.Integer.Long),
|
3260
|
+
(r'\d+j?', Number.Integer)
|
3261
|
+
],
|
3262
|
+
|
3263
|
+
'keywords': [
|
3264
|
+
# Left out 'group' and 'require'
|
3265
|
+
# Since they're often used as attributes
|
3266
|
+
(r'(?i)(absent|alert|alias|audit|augeas|before|case|check|class|'
|
3267
|
+
r'computer|configured|contained|create_resources|crit|cron|debug|'
|
3268
|
+
r'default|define|defined|directory|else|elsif|emerg|err|exec|'
|
3269
|
+
r'extlookup|fail|false|file|filebucket|fqdn_rand|generate|host|if|'
|
3270
|
+
r'import|include|info|inherits|inline_template|installed|'
|
3271
|
+
r'interface|k5login|latest|link|loglevel|macauthorization|'
|
3272
|
+
r'mailalias|maillist|mcx|md5|mount|mounted|nagios_command|'
|
3273
|
+
r'nagios_contact|nagios_contactgroup|nagios_host|'
|
3274
|
+
r'nagios_hostdependency|nagios_hostescalation|nagios_hostextinfo|'
|
3275
|
+
r'nagios_hostgroup|nagios_service|nagios_servicedependency|'
|
3276
|
+
r'nagios_serviceescalation|nagios_serviceextinfo|'
|
3277
|
+
r'nagios_servicegroup|nagios_timeperiod|node|noop|notice|notify|'
|
3278
|
+
r'package|present|purged|realize|regsubst|resources|role|router|'
|
3279
|
+
r'running|schedule|scheduled_task|search|selboolean|selmodule|'
|
3280
|
+
r'service|sha1|shellquote|split|sprintf|ssh_authorized_key|sshkey|'
|
3281
|
+
r'stage|stopped|subscribe|tag|tagged|template|tidy|true|undef|'
|
3282
|
+
r'unmounted|user|versioncmp|vlan|warning|yumrepo|zfs|zone|'
|
3283
|
+
r'zpool)\b', Keyword),
|
3284
|
+
],
|
3285
|
+
|
3286
|
+
'strings': [
|
3287
|
+
(r'"([^"])*"', String),
|
3288
|
+
(r'\'([^\'])*\'', String),
|
3289
|
+
],
|
3290
|
+
|
3291
|
+
}
|
3292
|
+
|
3293
|
+
|
3294
|
+
class NSISLexer(RegexLexer):
|
3295
|
+
"""
|
3296
|
+
For `NSIS <http://nsis.sourceforge.net/>`_ scripts.
|
3297
|
+
|
3298
|
+
*New in Pygments 1.6.*
|
3299
|
+
"""
|
3300
|
+
name = 'NSIS'
|
3301
|
+
aliases = ['nsis', 'nsi', 'nsh']
|
3302
|
+
filenames = ['*.nsi', '*.nsh']
|
3303
|
+
mimetypes = ['text/x-nsis']
|
3304
|
+
|
3305
|
+
flags = re.IGNORECASE
|
3306
|
+
|
3307
|
+
tokens = {
|
3308
|
+
'root': [
|
3309
|
+
(r'[;\#].*\n', Comment),
|
3310
|
+
(r"'.*?'", String.Single),
|
3311
|
+
(r'"', String.Double, 'str_double'),
|
3312
|
+
(r'`', String.Backtick, 'str_backtick'),
|
3313
|
+
include('macro'),
|
3314
|
+
include('interpol'),
|
3315
|
+
include('basic'),
|
3316
|
+
(r'\$\{[a-z_|][\w|]*\}', Keyword.Pseudo),
|
3317
|
+
(r'/[a-z_]\w*', Name.Attribute),
|
3318
|
+
('.', Text),
|
3319
|
+
],
|
3320
|
+
'basic': [
|
3321
|
+
(r'(\n)(Function)(\s+)([._a-z][.\w]*)\b',
|
3322
|
+
bygroups(Text, Keyword, Text, Name.Function)),
|
3323
|
+
(r'\b([_a-z]\w*)(::)([a-z][a-z0-9]*)\b',
|
3324
|
+
bygroups(Keyword.Namespace, Punctuation, Name.Function)),
|
3325
|
+
(r'\b([_a-z]\w*)(:)', bygroups(Name.Label, Punctuation)),
|
3326
|
+
(r'(\b[ULS]|\B)([\!\<\>=]?=|\<\>?|\>)\B', Operator),
|
3327
|
+
(r'[|+-]', Operator),
|
3328
|
+
(r'\\', Punctuation),
|
3329
|
+
(r'\b(Abort|Add(?:BrandingImage|Size)|'
|
3330
|
+
r'Allow(?:RootDirInstall|SkipFiles)|AutoCloseWindow|'
|
3331
|
+
r'BG(?:Font|Gradient)|BrandingText|BringToFront|Call(?:InstDLL)?|'
|
3332
|
+
r'(?:Sub)?Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|'
|
3333
|
+
r'ComponentText|CopyFiles|CRCCheck|'
|
3334
|
+
r'Create(?:Directory|Font|Shortcut)|Delete(?:INI(?:Sec|Str)|'
|
3335
|
+
r'Reg(?:Key|Value))?|DetailPrint|DetailsButtonText|'
|
3336
|
+
r'Dir(?:Show|Text|Var|Verify)|(?:Disabled|Enabled)Bitmap|'
|
3337
|
+
r'EnableWindow|EnumReg(?:Key|Value)|Exch|Exec(?:Shell|Wait)?|'
|
3338
|
+
r'ExpandEnvStrings|File(?:BufSize|Close|ErrorText|Open|'
|
3339
|
+
r'Read(?:Byte)?|Seek|Write(?:Byte)?)?|'
|
3340
|
+
r'Find(?:Close|First|Next|Window)|FlushINI|Function(?:End)?|'
|
3341
|
+
r'Get(?:CurInstType|CurrentAddress|DlgItem|DLLVersion(?:Local)?|'
|
3342
|
+
r'ErrorLevel|FileTime(?:Local)?|FullPathName|FunctionAddress|'
|
3343
|
+
r'InstDirError|LabelAddress|TempFileName)|'
|
3344
|
+
r'Goto|HideWindow|Icon|'
|
3345
|
+
r'If(?:Abort|Errors|FileExists|RebootFlag|Silent)|'
|
3346
|
+
r'InitPluginsDir|Install(?:ButtonText|Colors|Dir(?:RegKey)?)|'
|
3347
|
+
r'Inst(?:ProgressFlags|Type(?:[GS]etText)?)|Int(?:CmpU?|Fmt|Op)|'
|
3348
|
+
r'IsWindow|LangString(?:UP)?|'
|
3349
|
+
r'License(?:BkColor|Data|ForceSelection|LangString|Text)|'
|
3350
|
+
r'LoadLanguageFile|LockWindow|Log(?:Set|Text)|MessageBox|'
|
3351
|
+
r'MiscButtonText|Name|Nop|OutFile|(?:Uninst)?Page(?:Ex(?:End)?)?|'
|
3352
|
+
r'PluginDir|Pop|Push|Quit|Read(?:(?:Env|INI|Reg)Str|RegDWORD)|'
|
3353
|
+
r'Reboot|(?:Un)?RegDLL|Rename|RequestExecutionLevel|ReserveFile|'
|
3354
|
+
r'Return|RMDir|SearchPath|Section(?:Divider|End|'
|
3355
|
+
r'(?:(?:Get|Set)(?:Flags|InstTypes|Size|Text))|Group(?:End)?|In)?|'
|
3356
|
+
r'SendMessage|Set(?:AutoClose|BrandingImage|Compress(?:ionLevel|'
|
3357
|
+
r'or(?:DictSize)?)?|CtlColors|CurInstType|DatablockOptimize|'
|
3358
|
+
r'DateSave|Details(?:Print|View)|Error(?:s|Level)|FileAttributes|'
|
3359
|
+
r'Font|OutPath|Overwrite|PluginUnload|RebootFlag|ShellVarContext|'
|
3360
|
+
r'Silent|StaticBkColor)|'
|
3361
|
+
r'Show(?:(?:I|Uni)nstDetails|Window)|Silent(?:Un)?Install|Sleep|'
|
3362
|
+
r'SpaceTexts|Str(?:CmpS?|Cpy|Len)|SubSection(?:End)?|'
|
3363
|
+
r'Uninstall(?:ButtonText|(?:Sub)?Caption|EXEName|Icon|Text)|'
|
3364
|
+
r'UninstPage|Var|VI(?:AddVersionKey|ProductVersion)|WindowIcon|'
|
3365
|
+
r'Write(?:INIStr|Reg(:?Bin|DWORD|(?:Expand)?Str)|Uninstaller)|'
|
3366
|
+
r'XPStyle)\b', Keyword),
|
3367
|
+
(r'\b(CUR|END|(?:FILE_ATTRIBUTE_)?'
|
3368
|
+
r'(?:ARCHIVE|HIDDEN|NORMAL|OFFLINE|READONLY|SYSTEM|TEMPORARY)|'
|
3369
|
+
r'HK(CC|CR|CU|DD|LM|PD|U)|'
|
3370
|
+
r'HKEY_(?:CLASSES_ROOT|CURRENT_(?:CONFIG|USER)|DYN_DATA|'
|
3371
|
+
r'LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|'
|
3372
|
+
r'ID(?:ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|'
|
3373
|
+
r'MB_(?:ABORTRETRYIGNORE|DEFBUTTON[1-4]|'
|
3374
|
+
r'ICON(?:EXCLAMATION|INFORMATION|QUESTION|STOP)|'
|
3375
|
+
r'OK(?:CANCEL)?|RETRYCANCEL|RIGHT|SETFOREGROUND|TOPMOST|USERICON|'
|
3376
|
+
r'YESNO(?:CANCEL)?)|SET|SHCTX|'
|
3377
|
+
r'SW_(?:HIDE|SHOW(?:MAXIMIZED|MINIMIZED|NORMAL))|'
|
3378
|
+
r'admin|all|auto|both|bottom|bzip2|checkbox|colored|current|false|'
|
3379
|
+
r'force|hide|highest|if(?:diff|newer)|lastused|leave|left|'
|
3380
|
+
r'listonly|lzma|nevershow|none|normal|off|on|pop|push|'
|
3381
|
+
r'radiobuttons|right|show|silent|silentlog|smooth|textonly|top|'
|
3382
|
+
r'true|try|user|zlib)\b', Name.Constant),
|
3383
|
+
],
|
3384
|
+
'macro': [
|
3385
|
+
(r'\!(addincludedir(?:dir)?|addplugindir|appendfile|cd|define|'
|
3386
|
+
r'delfilefile|echo(?:message)?|else|endif|error|execute|'
|
3387
|
+
r'if(?:macro)?n?(?:def)?|include|insertmacro|macro(?:end)?|packhdr|'
|
3388
|
+
r'search(?:parse|replace)|system|tempfilesymbol|undef|verbose|'
|
3389
|
+
r'warning)\b', Comment.Preproc),
|
3390
|
+
],
|
3391
|
+
'interpol': [
|
3392
|
+
(r'\$(R?[0-9])', Name.Builtin.Pseudo), # registers
|
3393
|
+
(r'\$(ADMINTOOLS|APPDATA|CDBURN_AREA|COOKIES|COMMONFILES(?:32|64)|'
|
3394
|
+
r'DESKTOP|DOCUMENTS|EXE(?:DIR|FILE|PATH)|FAVORITES|FONTS|HISTORY|'
|
3395
|
+
r'HWNDPARENT|INTERNET_CACHE|LOCALAPPDATA|MUSIC|NETHOOD|PICTURES|'
|
3396
|
+
r'PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES(?:32|64)|QUICKLAUNCH|'
|
3397
|
+
r'RECENT|RESOURCES(?:_LOCALIZED)?|SENDTO|SM(?:PROGRAMS|STARTUP)|'
|
3398
|
+
r'STARTMENU|SYSDIR|TEMP(?:LATES)?|VIDEOS|WINDIR|\{NSISDIR\})',
|
3399
|
+
Name.Builtin),
|
3400
|
+
(r'\$(CMDLINE|INSTDIR|OUTDIR|LANGUAGE)', Name.Variable.Global),
|
3401
|
+
(r'\$[a-z_]\w*', Name.Variable),
|
3402
|
+
],
|
3403
|
+
'str_double': [
|
3404
|
+
(r'"', String, '#pop'),
|
3405
|
+
(r'\$(\\[nrt"]|\$)', String.Escape),
|
3406
|
+
include('interpol'),
|
3407
|
+
(r'.', String.Double),
|
3408
|
+
],
|
3409
|
+
'str_backtick': [
|
3410
|
+
(r'`', String, '#pop'),
|
3411
|
+
(r'\$(\\[nrt"]|\$)', String.Escape),
|
3412
|
+
include('interpol'),
|
3413
|
+
(r'.', String.Double),
|
3414
|
+
],
|
3415
|
+
}
|
3416
|
+
|
3417
|
+
|
3418
|
+
class RPMSpecLexer(RegexLexer):
|
3419
|
+
"""
|
3420
|
+
For RPM *.spec files
|
3421
|
+
|
3422
|
+
*New in Pygments 1.6.*
|
3423
|
+
"""
|
3424
|
+
|
3425
|
+
name = 'RPMSpec'
|
3426
|
+
aliases = ['spec']
|
3427
|
+
filenames = ['*.spec']
|
3428
|
+
mimetypes = ['text/x-rpm-spec']
|
3429
|
+
|
3430
|
+
_directives = ('(?:package|prep|build|install|clean|check|pre[a-z]*|'
|
3431
|
+
'post[a-z]*|trigger[a-z]*|files)')
|
3432
|
+
|
3433
|
+
tokens = {
|
3434
|
+
'root': [
|
3435
|
+
(r'#.*\n', Comment),
|
3436
|
+
include('basic'),
|
3437
|
+
],
|
3438
|
+
'description': [
|
3439
|
+
(r'^(%' + _directives + ')(.*)$',
|
3440
|
+
bygroups(Name.Decorator, Text), '#pop'),
|
3441
|
+
(r'\n', Text),
|
3442
|
+
(r'.', Text),
|
3443
|
+
],
|
3444
|
+
'changelog': [
|
3445
|
+
(r'\*.*\n', Generic.Subheading),
|
3446
|
+
(r'^(%' + _directives + ')(.*)$',
|
3447
|
+
bygroups(Name.Decorator, Text), '#pop'),
|
3448
|
+
(r'\n', Text),
|
3449
|
+
(r'.', Text),
|
3450
|
+
],
|
3451
|
+
'string': [
|
3452
|
+
(r'"', String.Double, '#pop'),
|
3453
|
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
3454
|
+
include('interpol'),
|
3455
|
+
(r'.', String.Double),
|
3456
|
+
],
|
3457
|
+
'basic': [
|
3458
|
+
include('macro'),
|
3459
|
+
(r'(?i)^(Name|Version|Release|Epoch|Summary|Group|License|Packager|'
|
3460
|
+
r'Vendor|Icon|URL|Distribution|Prefix|Patch[0-9]*|Source[0-9]*|'
|
3461
|
+
r'Requires\(?[a-z]*\)?|[a-z]+Req|Obsoletes|Suggests|Provides|Conflicts|'
|
3462
|
+
r'Build[a-z]+|[a-z]+Arch|Auto[a-z]+)(:)(.*)$',
|
3463
|
+
bygroups(Generic.Heading, Punctuation, using(this))),
|
3464
|
+
(r'^%description', Name.Decorator, 'description'),
|
3465
|
+
(r'^%changelog', Name.Decorator, 'changelog'),
|
3466
|
+
(r'^(%' + _directives + ')(.*)$', bygroups(Name.Decorator, Text)),
|
3467
|
+
(r'%(attr|defattr|dir|doc(?:dir)?|setup|config(?:ure)?|'
|
3468
|
+
r'make(?:install)|ghost|patch[0-9]+|find_lang|exclude|verify)',
|
3469
|
+
Keyword),
|
3470
|
+
include('interpol'),
|
3471
|
+
(r"'.*?'", String.Single),
|
3472
|
+
(r'"', String.Double, 'string'),
|
3473
|
+
(r'.', Text),
|
3474
|
+
],
|
3475
|
+
'macro': [
|
3476
|
+
(r'%define.*\n', Comment.Preproc),
|
3477
|
+
(r'%\{\!\?.*%define.*\}', Comment.Preproc),
|
3478
|
+
(r'(%(?:if(?:n?arch)?|else(?:if)?|endif))(.*)$',
|
3479
|
+
bygroups(Comment.Preproc, Text)),
|
3480
|
+
],
|
3481
|
+
'interpol': [
|
3482
|
+
(r'%\{?__[a-z_]+\}?', Name.Function),
|
3483
|
+
(r'%\{?_([a-z_]+dir|[a-z_]+path|prefix)\}?', Keyword.Pseudo),
|
3484
|
+
(r'%\{\?[A-Za-z0-9_]+\}', Name.Variable),
|
3485
|
+
(r'\$\{?RPM_[A-Z0-9_]+\}?', Name.Variable.Global),
|
3486
|
+
(r'%\{[a-zA-Z][a-zA-Z0-9_]+\}', Keyword.Constant),
|
3487
|
+
]
|
3488
|
+
}
|
3489
|
+
|
3490
|
+
|
3491
|
+
class AutoItLexer(RegexLexer):
|
3492
|
+
"""
|
3493
|
+
For `AutoIt <http://www.autoitscript.com/site/autoit/>`_ files.
|
3494
|
+
|
3495
|
+
AutoIt is a freeware BASIC-like scripting language
|
3496
|
+
designed for automating the Windows GUI and general scripting
|
3497
|
+
|
3498
|
+
*New in Pygments 1.6.*
|
3499
|
+
"""
|
3500
|
+
name = 'AutoIt'
|
3501
|
+
aliases = ['autoit', 'Autoit']
|
3502
|
+
filenames = ['*.au3']
|
3503
|
+
mimetypes = ['text/x-autoit']
|
3504
|
+
|
3505
|
+
# Keywords, functions, macros from au3.keywords.properties
|
3506
|
+
# which can be found in AutoIt installed directory, e.g.
|
3507
|
+
# c:\Program Files (x86)\AutoIt3\SciTE\au3.keywords.properties
|
3508
|
+
|
3509
|
+
keywords = """\
|
3510
|
+
#include-once #include #endregion #forcedef #forceref #region
|
3511
|
+
and byref case continueloop dim do else elseif endfunc endif
|
3512
|
+
endselect exit exitloop for func global
|
3513
|
+
if local next not or return select step
|
3514
|
+
then to until wend while exit""".split()
|
3515
|
+
|
3516
|
+
functions = """\
|
3517
|
+
abs acos adlibregister adlibunregister asc ascw asin assign atan
|
3518
|
+
autoitsetoption autoitwingettitle autoitwinsettitle beep binary binarylen
|
3519
|
+
binarymid binarytostring bitand bitnot bitor bitrotate bitshift bitxor
|
3520
|
+
blockinput break call cdtray ceiling chr chrw clipget clipput consoleread
|
3521
|
+
consolewrite consolewriteerror controlclick controlcommand controldisable
|
3522
|
+
controlenable controlfocus controlgetfocus controlgethandle controlgetpos
|
3523
|
+
controlgettext controlhide controllistview controlmove controlsend
|
3524
|
+
controlsettext controlshow controltreeview cos dec dircopy dircreate
|
3525
|
+
dirgetsize dirmove dirremove dllcall dllcalladdress dllcallbackfree
|
3526
|
+
dllcallbackgetptr dllcallbackregister dllclose dllopen dllstructcreate
|
3527
|
+
dllstructgetdata dllstructgetptr dllstructgetsize dllstructsetdata
|
3528
|
+
drivegetdrive drivegetfilesystem drivegetlabel drivegetserial drivegettype
|
3529
|
+
drivemapadd drivemapdel drivemapget drivesetlabel drivespacefree
|
3530
|
+
drivespacetotal drivestatus envget envset envupdate eval execute exp
|
3531
|
+
filechangedir fileclose filecopy filecreatentfslink filecreateshortcut
|
3532
|
+
filedelete fileexists filefindfirstfile filefindnextfile fileflush
|
3533
|
+
filegetattrib filegetencoding filegetlongname filegetpos filegetshortcut
|
3534
|
+
filegetshortname filegetsize filegettime filegetversion fileinstall filemove
|
3535
|
+
fileopen fileopendialog fileread filereadline filerecycle filerecycleempty
|
3536
|
+
filesavedialog fileselectfolder filesetattrib filesetpos filesettime
|
3537
|
+
filewrite filewriteline floor ftpsetproxy guicreate guictrlcreateavi
|
3538
|
+
guictrlcreatebutton guictrlcreatecheckbox guictrlcreatecombo
|
3539
|
+
guictrlcreatecontextmenu guictrlcreatedate guictrlcreatedummy
|
3540
|
+
guictrlcreateedit guictrlcreategraphic guictrlcreategroup guictrlcreateicon
|
3541
|
+
guictrlcreateinput guictrlcreatelabel guictrlcreatelist
|
3542
|
+
guictrlcreatelistview guictrlcreatelistviewitem guictrlcreatemenu
|
3543
|
+
guictrlcreatemenuitem guictrlcreatemonthcal guictrlcreateobj
|
3544
|
+
guictrlcreatepic guictrlcreateprogress guictrlcreateradio
|
3545
|
+
guictrlcreateslider guictrlcreatetab guictrlcreatetabitem
|
3546
|
+
guictrlcreatetreeview guictrlcreatetreeviewitem guictrlcreateupdown
|
3547
|
+
guictrldelete guictrlgethandle guictrlgetstate guictrlread guictrlrecvmsg
|
3548
|
+
guictrlregisterlistviewsort guictrlsendmsg guictrlsendtodummy
|
3549
|
+
guictrlsetbkcolor guictrlsetcolor guictrlsetcursor guictrlsetdata
|
3550
|
+
guictrlsetdefbkcolor guictrlsetdefcolor guictrlsetfont guictrlsetgraphic
|
3551
|
+
guictrlsetimage guictrlsetlimit guictrlsetonevent guictrlsetpos
|
3552
|
+
guictrlsetresizing guictrlsetstate guictrlsetstyle guictrlsettip guidelete
|
3553
|
+
guigetcursorinfo guigetmsg guigetstyle guiregistermsg guisetaccelerators
|
3554
|
+
guisetbkcolor guisetcoord guisetcursor guisetfont guisethelp guiseticon
|
3555
|
+
guisetonevent guisetstate guisetstyle guistartgroup guiswitch hex hotkeyset
|
3556
|
+
httpsetproxy httpsetuseragent hwnd inetclose inetget inetgetinfo inetgetsize
|
3557
|
+
inetread inidelete iniread inireadsection inireadsectionnames
|
3558
|
+
inirenamesection iniwrite iniwritesection inputbox int isadmin isarray
|
3559
|
+
isbinary isbool isdeclared isdllstruct isfloat ishwnd isint iskeyword
|
3560
|
+
isnumber isobj isptr isstring log memgetstats mod mouseclick mouseclickdrag
|
3561
|
+
mousedown mousegetcursor mousegetpos mousemove mouseup mousewheel msgbox
|
3562
|
+
number objcreate objcreateinterface objevent objevent objget objname
|
3563
|
+
onautoitexitregister onautoitexitunregister opt ping pixelchecksum
|
3564
|
+
pixelgetcolor pixelsearch pluginclose pluginopen processclose processexists
|
3565
|
+
processgetstats processlist processsetpriority processwait processwaitclose
|
3566
|
+
progressoff progresson progressset ptr random regdelete regenumkey
|
3567
|
+
regenumval regread regwrite round run runas runaswait runwait send
|
3568
|
+
sendkeepactive seterror setextended shellexecute shellexecutewait shutdown
|
3569
|
+
sin sleep soundplay soundsetwavevolume splashimageon splashoff splashtexton
|
3570
|
+
sqrt srandom statusbargettext stderrread stdinwrite stdioclose stdoutread
|
3571
|
+
string stringaddcr stringcompare stringformat stringfromasciiarray
|
3572
|
+
stringinstr stringisalnum stringisalpha stringisascii stringisdigit
|
3573
|
+
stringisfloat stringisint stringislower stringisspace stringisupper
|
3574
|
+
stringisxdigit stringleft stringlen stringlower stringmid stringregexp
|
3575
|
+
stringregexpreplace stringreplace stringright stringsplit stringstripcr
|
3576
|
+
stringstripws stringtoasciiarray stringtobinary stringtrimleft
|
3577
|
+
stringtrimright stringupper tan tcpaccept tcpclosesocket tcpconnect
|
3578
|
+
tcplisten tcpnametoip tcprecv tcpsend tcpshutdown tcpstartup timerdiff
|
3579
|
+
timerinit tooltip traycreateitem traycreatemenu traygetmsg trayitemdelete
|
3580
|
+
trayitemgethandle trayitemgetstate trayitemgettext trayitemsetonevent
|
3581
|
+
trayitemsetstate trayitemsettext traysetclick trayseticon traysetonevent
|
3582
|
+
traysetpauseicon traysetstate traysettooltip traytip ubound udpbind
|
3583
|
+
udpclosesocket udpopen udprecv udpsend udpshutdown udpstartup vargettype
|
3584
|
+
winactivate winactive winclose winexists winflash wingetcaretpos
|
3585
|
+
wingetclasslist wingetclientsize wingethandle wingetpos wingetprocess
|
3586
|
+
wingetstate wingettext wingettitle winkill winlist winmenuselectitem
|
3587
|
+
winminimizeall winminimizeallundo winmove winsetontop winsetstate
|
3588
|
+
winsettitle winsettrans winwait winwaitactive winwaitclose
|
3589
|
+
winwaitnotactive""".split()
|
3590
|
+
|
3591
|
+
macros = """\
|
3592
|
+
@appdatacommondir @appdatadir @autoitexe @autoitpid @autoitversion
|
3593
|
+
@autoitx64 @com_eventobj @commonfilesdir @compiled @computername @comspec
|
3594
|
+
@cpuarch @cr @crlf @desktopcommondir @desktopdepth @desktopdir
|
3595
|
+
@desktopheight @desktoprefresh @desktopwidth @documentscommondir @error
|
3596
|
+
@exitcode @exitmethod @extended @favoritescommondir @favoritesdir
|
3597
|
+
@gui_ctrlhandle @gui_ctrlid @gui_dragfile @gui_dragid @gui_dropid
|
3598
|
+
@gui_winhandle @homedrive @homepath @homeshare @hotkeypressed @hour
|
3599
|
+
@ipaddress1 @ipaddress2 @ipaddress3 @ipaddress4 @kblayout @lf
|
3600
|
+
@logondnsdomain @logondomain @logonserver @mday @min @mon @msec @muilang
|
3601
|
+
@mydocumentsdir @numparams @osarch @osbuild @oslang @osservicepack @ostype
|
3602
|
+
@osversion @programfilesdir @programscommondir @programsdir @scriptdir
|
3603
|
+
@scriptfullpath @scriptlinenumber @scriptname @sec @startmenucommondir
|
3604
|
+
@startmenudir @startupcommondir @startupdir @sw_disable @sw_enable @sw_hide
|
3605
|
+
@sw_lock @sw_maximize @sw_minimize @sw_restore @sw_show @sw_showdefault
|
3606
|
+
@sw_showmaximized @sw_showminimized @sw_showminnoactive @sw_showna
|
3607
|
+
@sw_shownoactivate @sw_shownormal @sw_unlock @systemdir @tab @tempdir
|
3608
|
+
@tray_id @trayiconflashing @trayiconvisible @username @userprofiledir @wday
|
3609
|
+
@windowsdir @workingdir @yday @year""".split()
|
3610
|
+
|
3611
|
+
tokens = {
|
3612
|
+
'root': [
|
3613
|
+
(r';.*\n', Comment.Single),
|
3614
|
+
(r'(#comments-start|#cs).*?(#comments-end|#ce)', Comment.Multiline),
|
3615
|
+
(r'[\[\]{}(),;]', Punctuation),
|
3616
|
+
(r'(and|or|not)\b', Operator.Word),
|
3617
|
+
(r'[\$|@][a-zA-Z_][a-zA-Z0-9_]*', Name.Variable),
|
3618
|
+
(r'!=|==|:=|\.=|<<|>>|[-~+/*%=<>&^|?:!.]', Operator),
|
3619
|
+
include('commands'),
|
3620
|
+
include('labels'),
|
3621
|
+
include('builtInFunctions'),
|
3622
|
+
include('builtInMarcros'),
|
3623
|
+
(r'"', String, combined('stringescape', 'dqs')),
|
3624
|
+
include('numbers'),
|
3625
|
+
(r'[a-zA-Z_#@$][a-zA-Z0-9_#@$]*', Name),
|
3626
|
+
(r'\\|\'', Text),
|
3627
|
+
(r'\`([\,\%\`abfnrtv\-\+;])', String.Escape),
|
3628
|
+
(r'_\n', Text), # Line continuation
|
3629
|
+
include('garbage'),
|
3630
|
+
],
|
3631
|
+
'commands': [
|
3632
|
+
(r'(?i)(\s*)(%s)\b' % '|'.join(keywords),
|
3633
|
+
bygroups(Text, Name.Builtin)),
|
3634
|
+
],
|
3635
|
+
'builtInFunctions': [
|
3636
|
+
(r'(?i)(%s)\b' % '|'.join(functions),
|
3637
|
+
Name.Function),
|
3638
|
+
],
|
3639
|
+
'builtInMarcros': [
|
3640
|
+
(r'(?i)(%s)\b' % '|'.join(macros),
|
3641
|
+
Name.Variable.Global),
|
3642
|
+
],
|
3643
|
+
'labels': [
|
3644
|
+
# sendkeys
|
3645
|
+
(r'(^\s*)({\S+?})', bygroups(Text, Name.Label)),
|
3646
|
+
],
|
3647
|
+
'numbers': [
|
3648
|
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
3649
|
+
(r'\d+[eE][+-]?[0-9]+', Number.Float),
|
3650
|
+
(r'0\d+', Number.Oct),
|
3651
|
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
3652
|
+
(r'\d+L', Number.Integer.Long),
|
3653
|
+
(r'\d+', Number.Integer)
|
3654
|
+
],
|
3655
|
+
'stringescape': [
|
3656
|
+
(r'\"\"|\`([\,\%\`abfnrtv])', String.Escape),
|
3657
|
+
],
|
3658
|
+
'strings': [
|
3659
|
+
(r'[^"\n]+', String),
|
3660
|
+
],
|
3661
|
+
'dqs': [
|
3662
|
+
(r'"', String, '#pop'),
|
3663
|
+
include('strings')
|
3664
|
+
],
|
3665
|
+
'garbage': [
|
3666
|
+
(r'[^\S\n]', Text),
|
3667
|
+
],
|
3668
|
+
}
|
3669
|
+
|
3670
|
+
|
3671
|
+
class RexxLexer(RegexLexer):
|
3672
|
+
"""
|
3673
|
+
`Rexx <http://www.rexxinfo.org/>`_ is a scripting language available for
|
3674
|
+
a wide range of different platforms with its roots found on mainframe
|
3675
|
+
systems. It is popular for I/O- and data based tasks and can act as glue
|
3676
|
+
language to bind different applications together.
|
3677
|
+
|
3678
|
+
*New in Pygments 1.7.*
|
3679
|
+
"""
|
3680
|
+
name = 'Rexx'
|
3681
|
+
aliases = ['rexx', 'ARexx', 'arexx']
|
3682
|
+
filenames = ['*.rexx', '*.rex', '*.rx', '*.arexx']
|
3683
|
+
mimetypes = ['text/x-rexx']
|
3684
|
+
flags = re.IGNORECASE
|
3685
|
+
|
3686
|
+
tokens = {
|
3687
|
+
'root': [
|
3688
|
+
(r'\s', Whitespace),
|
3689
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
3690
|
+
(r'"', String, 'string_double'),
|
3691
|
+
(r"'", String, 'string_single'),
|
3692
|
+
(r'[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?', Number),
|
3693
|
+
(r'([a-z_][a-z0-9_]*)(\s*)(:)(\s*)(procedure)\b',
|
3694
|
+
bygroups(Name.Function, Whitespace, Operator, Whitespace,
|
3695
|
+
Keyword.Declaration)),
|
3696
|
+
(r'([a-z_][a-z0-9_]*)(\s*)(:)',
|
3697
|
+
bygroups(Name.Label, Whitespace, Operator)),
|
3698
|
+
include('function'),
|
3699
|
+
include('keyword'),
|
3700
|
+
include('operator'),
|
3701
|
+
(r'[a-z_][a-z0-9_]*', Text),
|
3702
|
+
],
|
3703
|
+
'function': [
|
3704
|
+
(r'(abbrev|abs|address|arg|b2x|bitand|bitor|bitxor|c2d|c2x|'
|
3705
|
+
r'center|charin|charout|chars|compare|condition|copies|d2c|'
|
3706
|
+
r'd2x|datatype|date|delstr|delword|digits|errortext|form|'
|
3707
|
+
r'format|fuzz|insert|lastpos|left|length|linein|lineout|lines|'
|
3708
|
+
r'max|min|overlay|pos|queued|random|reverse|right|sign|'
|
3709
|
+
r'sourceline|space|stream|strip|substr|subword|symbol|time|'
|
3710
|
+
r'trace|translate|trunc|value|verify|word|wordindex|'
|
3711
|
+
r'wordlength|wordpos|words|x2b|x2c|x2d|xrange)(\s*)(\()',
|
3712
|
+
bygroups(Name.Builtin, Whitespace, Operator)),
|
3713
|
+
],
|
3714
|
+
'keyword': [
|
3715
|
+
(r'(address|arg|by|call|do|drop|else|end|exit|for|forever|if|'
|
3716
|
+
r'interpret|iterate|leave|nop|numeric|off|on|options|parse|'
|
3717
|
+
r'pull|push|queue|return|say|select|signal|to|then|trace|until|'
|
3718
|
+
r'while)\b', Keyword.Reserved),
|
3719
|
+
],
|
3720
|
+
'operator': [
|
3721
|
+
(ur'(-|//|/|\(|\)|\*\*|\*|\\<<|\\<|\\==|\\=|\\>>|\\>|\\|\|\||\||'
|
3722
|
+
ur'&&|&|%|\+|<<=|<<|<=|<>|<|==|=|><|>=|>>=|>>|>|¬<<|¬<|¬==|¬=|'
|
3723
|
+
ur'¬>>|¬>|¬|\.|,)', Operator),
|
3724
|
+
],
|
3725
|
+
'string_double': [
|
3726
|
+
(r'[^"\n]+', String),
|
3727
|
+
(r'""', String),
|
3728
|
+
(r'"', String, '#pop'),
|
3729
|
+
(r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
|
3730
|
+
],
|
3731
|
+
'string_single': [
|
3732
|
+
(r'[^\'\n]', String),
|
3733
|
+
(r'\'\'', String),
|
3734
|
+
(r'\'', String, '#pop'),
|
3735
|
+
(r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
|
3736
|
+
],
|
3737
|
+
'comment': [
|
3738
|
+
(r'[^*]+', Comment.Multiline),
|
3739
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
3740
|
+
(r'\*', Comment.Multiline),
|
3741
|
+
]
|
3742
|
+
}
|
3743
|
+
|
3744
|
+
_c = lambda s: re.compile(s, re.MULTILINE)
|
3745
|
+
_ADDRESS_COMMAND_PATTERN = _c(r'^\s*address\s+command\b')
|
3746
|
+
_ADDRESS_PATTERN = _c(r'^\s*address\s+')
|
3747
|
+
_DO_WHILE_PATTERN = _c(r'^\s*do\s+while\b')
|
3748
|
+
_IF_THEN_DO_PATTERN = _c(r'^\s*if\b.+\bthen\s+do\s*$')
|
3749
|
+
_PROCEDURE_PATTERN = _c(r'^\s*([a-z_][a-z0-9_]*)(\s*)(:)(\s*)(procedure)\b')
|
3750
|
+
_ELSE_DO_PATTERN = _c(r'\belse\s+do\s*$')
|
3751
|
+
_PARSE_ARG_PATTERN = _c(r'^\s*parse\s+(upper\s+)?(arg|value)\b')
|
3752
|
+
PATTERNS_AND_WEIGHTS = (
|
3753
|
+
(_ADDRESS_COMMAND_PATTERN, 0.2),
|
3754
|
+
(_ADDRESS_PATTERN, 0.05),
|
3755
|
+
(_DO_WHILE_PATTERN, 0.1),
|
3756
|
+
(_ELSE_DO_PATTERN, 0.1),
|
3757
|
+
(_IF_THEN_DO_PATTERN, 0.1),
|
3758
|
+
(_PROCEDURE_PATTERN, 0.5),
|
3759
|
+
(_PARSE_ARG_PATTERN, 0.2),
|
3760
|
+
)
|
3761
|
+
|
3762
|
+
def analyse_text(text):
|
3763
|
+
"""
|
3764
|
+
Check for inital comment and patterns that distinguish Rexx from other
|
3765
|
+
C-like languages.
|
3766
|
+
"""
|
3767
|
+
if re.search(r'/\*\**\s*rexx', text, re.IGNORECASE):
|
3768
|
+
# Header matches MVS Rexx requirements, this is certainly a Rexx
|
3769
|
+
# script.
|
3770
|
+
return 1.0
|
3771
|
+
elif text.startswith('/*'):
|
3772
|
+
# Header matches general Rexx requirements; the source code might
|
3773
|
+
# still be any language using C comments such as C++, C# or Java.
|
3774
|
+
lowerText = text.lower()
|
3775
|
+
result = sum(weight
|
3776
|
+
for (pattern, weight) in RexxLexer.PATTERNS_AND_WEIGHTS
|
3777
|
+
if pattern.search(lowerText)) + 0.01
|
3778
|
+
return min(result, 1.0)
|