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,360 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers._stan_builtins
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
This file contains the names of functions for Stan used by
|
7
|
+
``pygments.lexers.math.StanLexer.
|
8
|
+
|
9
|
+
:copyright: Copyright 2013 by the Pygments team, see AUTHORS.
|
10
|
+
:license: BSD, see LICENSE for details.
|
11
|
+
"""
|
12
|
+
|
13
|
+
KEYWORDS = ['else', 'for', 'if', 'in', 'lower', 'lp__', 'print', 'upper', 'while']
|
14
|
+
|
15
|
+
TYPES = [ 'corr_matrix',
|
16
|
+
'cov_matrix',
|
17
|
+
'int',
|
18
|
+
'matrix',
|
19
|
+
'ordered',
|
20
|
+
'positive_ordered',
|
21
|
+
'real',
|
22
|
+
'row_vector',
|
23
|
+
'simplex',
|
24
|
+
'unit_vector',
|
25
|
+
'vector']
|
26
|
+
|
27
|
+
FUNCTIONS = [ 'Phi',
|
28
|
+
'Phi_approx',
|
29
|
+
'abs',
|
30
|
+
'acos',
|
31
|
+
'acosh',
|
32
|
+
'asin',
|
33
|
+
'asinh',
|
34
|
+
'atan',
|
35
|
+
'atan2',
|
36
|
+
'atanh',
|
37
|
+
'bernoulli_cdf',
|
38
|
+
'bernoulli_log',
|
39
|
+
'bernoulli_logit_log',
|
40
|
+
'bernoulli_rng',
|
41
|
+
'beta_binomial_cdf',
|
42
|
+
'beta_binomial_log',
|
43
|
+
'beta_binomial_rng',
|
44
|
+
'beta_cdf',
|
45
|
+
'beta_log',
|
46
|
+
'beta_rng',
|
47
|
+
'binary_log_loss',
|
48
|
+
'binomial_cdf',
|
49
|
+
'binomial_coefficient_log',
|
50
|
+
'binomial_log',
|
51
|
+
'binomial_logit_log',
|
52
|
+
'binomial_rng',
|
53
|
+
'block',
|
54
|
+
'categorical_log',
|
55
|
+
'categorical_rng',
|
56
|
+
'cauchy_cdf',
|
57
|
+
'cauchy_log',
|
58
|
+
'cauchy_rng',
|
59
|
+
'cbrt',
|
60
|
+
'ceil',
|
61
|
+
'chi_square_log',
|
62
|
+
'chi_square_rng',
|
63
|
+
'cholesky_decompose',
|
64
|
+
'col',
|
65
|
+
'cols',
|
66
|
+
'cos',
|
67
|
+
'cosh',
|
68
|
+
'crossprod',
|
69
|
+
'cumulative_sum',
|
70
|
+
'determinant',
|
71
|
+
'diag_matrix',
|
72
|
+
'diag_post_multiply',
|
73
|
+
'diag_pre_multiply',
|
74
|
+
'diagonal',
|
75
|
+
'dims',
|
76
|
+
'dirichlet_log',
|
77
|
+
'dirichlet_rng',
|
78
|
+
'dot_product',
|
79
|
+
'dot_self',
|
80
|
+
'double_exponential_log',
|
81
|
+
'double_exponential_rng',
|
82
|
+
'e',
|
83
|
+
'eigenvalues_sym',
|
84
|
+
'eigenvectors_sym',
|
85
|
+
'epsilon',
|
86
|
+
'erf',
|
87
|
+
'erfc',
|
88
|
+
'exp',
|
89
|
+
'exp2',
|
90
|
+
'exp_mod_normal_cdf',
|
91
|
+
'exp_mod_normal_log',
|
92
|
+
'exp_mod_normal_rng',
|
93
|
+
'expm1',
|
94
|
+
'exponential_cdf',
|
95
|
+
'exponential_log',
|
96
|
+
'exponential_rng',
|
97
|
+
'fabs',
|
98
|
+
'fdim',
|
99
|
+
'floor',
|
100
|
+
'fma',
|
101
|
+
'fmax',
|
102
|
+
'fmin',
|
103
|
+
'fmod',
|
104
|
+
'gamma_log',
|
105
|
+
'gamma_rng',
|
106
|
+
'gumbel_cdf',
|
107
|
+
'gumbel_log',
|
108
|
+
'gumbel_rng',
|
109
|
+
'hypergeometric_log',
|
110
|
+
'hypergeometric_rng',
|
111
|
+
'hypot',
|
112
|
+
'if_else',
|
113
|
+
'int_step',
|
114
|
+
'inv_chi_square_cdf',
|
115
|
+
'inv_chi_square_log',
|
116
|
+
'inv_chi_square_rng',
|
117
|
+
'inv_cloglog',
|
118
|
+
'inv_gamma_cdf',
|
119
|
+
'inv_gamma_log',
|
120
|
+
'inv_gamma_rng',
|
121
|
+
'inv_logit',
|
122
|
+
'inv_wishart_log',
|
123
|
+
'inv_wishart_rng',
|
124
|
+
'inverse',
|
125
|
+
'lbeta',
|
126
|
+
'lgamma',
|
127
|
+
'lkj_corr_cholesky_log',
|
128
|
+
'lkj_corr_cholesky_rng',
|
129
|
+
'lkj_corr_log',
|
130
|
+
'lkj_corr_rng',
|
131
|
+
'lkj_cov_log',
|
132
|
+
'lmgamma',
|
133
|
+
'log',
|
134
|
+
'log10',
|
135
|
+
'log1m',
|
136
|
+
'log1m_inv_logit',
|
137
|
+
'log1p',
|
138
|
+
'log1p_exp',
|
139
|
+
'log2',
|
140
|
+
'log_determinant',
|
141
|
+
'log_inv_logit',
|
142
|
+
'log_sum_exp',
|
143
|
+
'logistic_cdf',
|
144
|
+
'logistic_log',
|
145
|
+
'logistic_rng',
|
146
|
+
'logit',
|
147
|
+
'lognormal_cdf',
|
148
|
+
'lognormal_log',
|
149
|
+
'lognormal_rng',
|
150
|
+
'max',
|
151
|
+
'mdivide_left_tri_low',
|
152
|
+
'mdivide_right_tri_low',
|
153
|
+
'mean',
|
154
|
+
'min',
|
155
|
+
'multi_normal_cholesky_log',
|
156
|
+
'multi_normal_log',
|
157
|
+
'multi_normal_prec_log',
|
158
|
+
'multi_normal_rng',
|
159
|
+
'multi_student_t_log',
|
160
|
+
'multi_student_t_rng',
|
161
|
+
'multinomial_cdf',
|
162
|
+
'multinomial_log',
|
163
|
+
'multinomial_rng',
|
164
|
+
'multiply_log',
|
165
|
+
'multiply_lower_tri_self_transpose',
|
166
|
+
'neg_binomial_cdf',
|
167
|
+
'neg_binomial_log',
|
168
|
+
'neg_binomial_rng',
|
169
|
+
'negative_epsilon',
|
170
|
+
'negative_infinity',
|
171
|
+
'normal_cdf',
|
172
|
+
'normal_log',
|
173
|
+
'normal_rng',
|
174
|
+
'not_a_number',
|
175
|
+
'ordered_logistic_log',
|
176
|
+
'ordered_logistic_rng',
|
177
|
+
'owens_t',
|
178
|
+
'pareto_cdf',
|
179
|
+
'pareto_log',
|
180
|
+
'pareto_rng',
|
181
|
+
'pi',
|
182
|
+
'poisson_cdf',
|
183
|
+
'poisson_log',
|
184
|
+
'poisson_log_log',
|
185
|
+
'poisson_rng',
|
186
|
+
'positive_infinity',
|
187
|
+
'pow',
|
188
|
+
'prod',
|
189
|
+
'rep_array',
|
190
|
+
'rep_matrix',
|
191
|
+
'rep_row_vector',
|
192
|
+
'rep_vector',
|
193
|
+
'round',
|
194
|
+
'row',
|
195
|
+
'rows',
|
196
|
+
'scaled_inv_chi_square_cdf',
|
197
|
+
'scaled_inv_chi_square_log',
|
198
|
+
'scaled_inv_chi_square_rng',
|
199
|
+
'sd',
|
200
|
+
'sin',
|
201
|
+
'singular_values',
|
202
|
+
'sinh',
|
203
|
+
'size',
|
204
|
+
'skew_normal_cdf',
|
205
|
+
'skew_normal_log',
|
206
|
+
'skew_normal_rng',
|
207
|
+
'softmax',
|
208
|
+
'sqrt',
|
209
|
+
'sqrt2',
|
210
|
+
'square',
|
211
|
+
'step',
|
212
|
+
'student_t_cdf',
|
213
|
+
'student_t_log',
|
214
|
+
'student_t_rng',
|
215
|
+
'sum',
|
216
|
+
'tan',
|
217
|
+
'tanh',
|
218
|
+
'tcrossprod',
|
219
|
+
'tgamma',
|
220
|
+
'trace',
|
221
|
+
'trunc',
|
222
|
+
'uniform_log',
|
223
|
+
'uniform_rng',
|
224
|
+
'variance',
|
225
|
+
'weibull_cdf',
|
226
|
+
'weibull_log',
|
227
|
+
'weibull_rng',
|
228
|
+
'wishart_log',
|
229
|
+
'wishart_rng']
|
230
|
+
|
231
|
+
DISTRIBUTIONS = [ 'bernoulli',
|
232
|
+
'bernoulli_logit',
|
233
|
+
'beta',
|
234
|
+
'beta_binomial',
|
235
|
+
'binomial',
|
236
|
+
'binomial_coefficient',
|
237
|
+
'binomial_logit',
|
238
|
+
'categorical',
|
239
|
+
'cauchy',
|
240
|
+
'chi_square',
|
241
|
+
'dirichlet',
|
242
|
+
'double_exponential',
|
243
|
+
'exp_mod_normal',
|
244
|
+
'exponential',
|
245
|
+
'gamma',
|
246
|
+
'gumbel',
|
247
|
+
'hypergeometric',
|
248
|
+
'inv_chi_square',
|
249
|
+
'inv_gamma',
|
250
|
+
'inv_wishart',
|
251
|
+
'lkj_corr',
|
252
|
+
'lkj_corr_cholesky',
|
253
|
+
'lkj_cov',
|
254
|
+
'logistic',
|
255
|
+
'lognormal',
|
256
|
+
'multi_normal',
|
257
|
+
'multi_normal_cholesky',
|
258
|
+
'multi_normal_prec',
|
259
|
+
'multi_student_t',
|
260
|
+
'multinomial',
|
261
|
+
'multiply',
|
262
|
+
'neg_binomial',
|
263
|
+
'normal',
|
264
|
+
'ordered_logistic',
|
265
|
+
'pareto',
|
266
|
+
'poisson',
|
267
|
+
'poisson_log',
|
268
|
+
'scaled_inv_chi_square',
|
269
|
+
'skew_normal',
|
270
|
+
'student_t',
|
271
|
+
'uniform',
|
272
|
+
'weibull',
|
273
|
+
'wishart']
|
274
|
+
|
275
|
+
RESERVED = [ 'alignas',
|
276
|
+
'alignof',
|
277
|
+
'and',
|
278
|
+
'and_eq',
|
279
|
+
'asm',
|
280
|
+
'auto',
|
281
|
+
'bitand',
|
282
|
+
'bitor',
|
283
|
+
'bool',
|
284
|
+
'break',
|
285
|
+
'case',
|
286
|
+
'catch',
|
287
|
+
'char',
|
288
|
+
'char16_t',
|
289
|
+
'char32_t',
|
290
|
+
'class',
|
291
|
+
'compl',
|
292
|
+
'const',
|
293
|
+
'const_cast',
|
294
|
+
'constexpr',
|
295
|
+
'continue',
|
296
|
+
'decltype',
|
297
|
+
'default',
|
298
|
+
'delete',
|
299
|
+
'do',
|
300
|
+
'double',
|
301
|
+
'dynamic_cast',
|
302
|
+
'enum',
|
303
|
+
'explicit',
|
304
|
+
'export',
|
305
|
+
'extern',
|
306
|
+
'false',
|
307
|
+
'false',
|
308
|
+
'float',
|
309
|
+
'friend',
|
310
|
+
'goto',
|
311
|
+
'inline',
|
312
|
+
'int',
|
313
|
+
'long',
|
314
|
+
'mutable',
|
315
|
+
'namespace',
|
316
|
+
'new',
|
317
|
+
'noexcept',
|
318
|
+
'not',
|
319
|
+
'not_eq',
|
320
|
+
'nullptr',
|
321
|
+
'operator',
|
322
|
+
'or',
|
323
|
+
'or_eq',
|
324
|
+
'private',
|
325
|
+
'protected',
|
326
|
+
'public',
|
327
|
+
'register',
|
328
|
+
'reinterpret_cast',
|
329
|
+
'repeat',
|
330
|
+
'return',
|
331
|
+
'short',
|
332
|
+
'signed',
|
333
|
+
'sizeof',
|
334
|
+
'static',
|
335
|
+
'static_assert',
|
336
|
+
'static_cast',
|
337
|
+
'struct',
|
338
|
+
'switch',
|
339
|
+
'template',
|
340
|
+
'then',
|
341
|
+
'this',
|
342
|
+
'thread_local',
|
343
|
+
'throw',
|
344
|
+
'true',
|
345
|
+
'true',
|
346
|
+
'try',
|
347
|
+
'typedef',
|
348
|
+
'typeid',
|
349
|
+
'typename',
|
350
|
+
'union',
|
351
|
+
'unsigned',
|
352
|
+
'until',
|
353
|
+
'using',
|
354
|
+
'virtual',
|
355
|
+
'void',
|
356
|
+
'volatile',
|
357
|
+
'wchar_t',
|
358
|
+
'xor',
|
359
|
+
'xor_eq']
|
360
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Split up in multiple functions so it's importable by jython, which has a
|
2
|
+
# per-method size limit.
|
3
|
+
|
4
|
+
def _getauto():
|
5
|
+
return [('BufAdd','BufAdd'),('BufCreate','BufCreate'),('BufDelete','BufDelete'),('BufEnter','BufEnter'),('BufFilePost','BufFilePost'),('BufFilePre','BufFilePre'),('BufHidden','BufHidden'),('BufLeave','BufLeave'),('BufNew','BufNew'),('BufNewFile','BufNewFile'),('BufRead','BufRead'),('BufReadCmd','BufReadCmd'),('BufReadPost','BufReadPost'),('BufReadPre','BufReadPre'),('BufUnload','BufUnload'),('BufWinEnter','BufWinEnter'),('BufWinLeave','BufWinLeave'),('BufWipeout','BufWipeout'),('BufWrite','BufWrite'),('BufWriteCmd','BufWriteCmd'),('BufWritePost','BufWritePost'),('BufWritePre','BufWritePre'),('Cmd','Cmd'),('CmdwinEnter','CmdwinEnter'),('CmdwinLeave','CmdwinLeave'),('ColorScheme','ColorScheme'),('CursorHold','CursorHold'),('CursorHoldI','CursorHoldI'),('CursorMoved','CursorMoved'),('CursorMovedI','CursorMovedI'),('EncodingChanged','EncodingChanged'),('FileAppendCmd','FileAppendCmd'),('FileAppendPost','FileAppendPost'),('FileAppendPre','FileAppendPre'),('FileChangedRO','FileChangedRO'),('FileChangedShell','FileChangedShell'),('FileChangedShellPost','FileChangedShellPost'),('FileEncoding','FileEncoding'),('FileReadCmd','FileReadCmd'),('FileReadPost','FileReadPost'),('FileReadPre','FileReadPre'),('FileType','FileType'),('FileWriteCmd','FileWriteCmd'),('FileWritePost','FileWritePost'),('FileWritePre','FileWritePre'),('FilterReadPost','FilterReadPost'),('FilterReadPre','FilterReadPre'),('FilterWritePost','FilterWritePost'),('FilterWritePre','FilterWritePre'),('FocusGained','FocusGained'),('FocusLost','FocusLost'),('FuncUndefined','FuncUndefined'),('GUIEnter','GUIEnter'),('GUIFailed','GUIFailed'),('InsertChange','InsertChange'),('InsertCharPre','InsertCharPre'),('InsertEnter','InsertEnter'),('InsertLeave','InsertLeave'),('MenuPopup','MenuPopup'),('QuickFixCmdPost','QuickFixCmdPost'),('QuickFixCmdPre','QuickFixCmdPre'),('RemoteReply','RemoteReply'),('SessionLoadPost','SessionLoadPost'),('ShellCmdPost','ShellCmdPost'),('ShellFilterPost','ShellFilterPost'),('SourceCmd','SourceCmd'),('SourcePre','SourcePre'),('SpellFileMissing','SpellFileMissing'),('StdinReadPost','StdinReadPost'),('StdinReadPre','StdinReadPre'),('SwapExists','SwapExists'),('Syntax','Syntax'),('TabEnter','TabEnter'),('TabLeave','TabLeave'),('TermChanged','TermChanged'),('TermResponse','TermResponse'),('User','User'),('UserGettingBored','UserGettingBored'),('VimEnter','VimEnter'),('VimLeave','VimLeave'),('VimLeavePre','VimLeavePre'),('VimResized','VimResized'),('WinEnter','WinEnter'),('WinLeave','WinLeave'),('event','event')]
|
6
|
+
def _getcommand():
|
7
|
+
return [('Allargs','Allargs'),('DiffOrig','DiffOrig'),('Error','Error'),('Man','Man'),('MyCommand','MyCommand'),('Mycmd','Mycmd'),('N','N'),('N','Next'),('P','P'),('P','Print'),('Ren','Ren'),('Rena','Rena'),('Renu','Renu'),('TOhtml','TOhtml'),('X','X'),('XMLent','XMLent'),('XMLns','XMLns'),('a','a'),('ab','ab'),('abc','abclear'),('abo','aboveleft'),('al','all'),('ar','ar'),('ar','args'),('arga','argadd'),('argd','argdelete'),('argdo','argdo'),('arge','argedit'),('argg','argglobal'),('argl','arglocal'),('argu','argument'),('as','ascii'),('au','au'),('b','buffer'),('bN','bNext'),('ba','ball'),('bad','badd'),('bar','bar'),('bd','bdelete'),('bel','belowright'),('bf','bfirst'),('bl','blast'),('bm','bmodified'),('bn','bnext'),('bo','botright'),('bp','bprevious'),('br','br'),('br','brewind'),('brea','break'),('breaka','breakadd'),('breakd','breakdel'),('breakl','breaklist'),('bro','browse'),('browseset','browseset'),('bu','bu'),('buf','buf'),('bufdo','bufdo'),('buffers','buffers'),('bun','bunload'),('bw','bwipeout'),('c','c'),('c','change'),('cN','cN'),('cN','cNext'),('cNf','cNf'),('cNf','cNfile'),('cabc','cabclear'),('cad','cad'),('cad','caddexpr'),('caddb','caddbuffer'),('caddf','caddfile'),('cal','call'),('cat','catch'),('cb','cbuffer'),('cc','cc'),('ccl','cclose'),('cd','cd'),('ce','center'),('cex','cexpr'),('cf','cfile'),('cfir','cfirst'),('cg','cgetfile'),('cgetb','cgetbuffer'),('cgete','cgetexpr'),('changes','changes'),('chd','chdir'),('che','checkpath'),('checkt','checktime'),('cl','cl'),('cl','clist'),('cla','clast'),('clo','close'),('cmapc','cmapclear'),('cmdname','cmdname'),('cn','cn'),('cn','cnext'),('cnew','cnewer'),('cnf','cnf'),('cnf','cnfile'),('co','copy'),('col','colder'),('colo','colorscheme'),('com','com'),('comc','comclear'),('comment','comment'),('comp','compiler'),('con','con'),('con','continue'),('conf','confirm'),('cope','copen'),('count','count'),('cp','cprevious'),('cpf','cpfile'),('cq','cquit'),('cr','crewind'),('cs','cs'),('cscope','cscope'),('cstag','cstag'),('cuna','cunabbrev'),('cw','cwindow'),('d','d'),('d','delete'),('de','de'),('debug','debug'),('debugg','debuggreedy'),('del','del'),('delc','delcommand'),('delf','delf'),('delf','delfunction'),('delm','delmarks'),('di','di'),('di','display'),('diffg','diffget'),('diffo','diffo'),('diffoff','diffoff'),('diffp','diffp'),('diffpatch','diffpatch'),('diffpu','diffput'),('diffsplit','diffsplit'),('difft','difft'),('diffthis','diffthis'),('diffu','diffupdate'),('dig','dig'),('dig','digraphs'),('dj','djump'),('dl','dlist'),('do','do'),('doau','doau'),('dr','drop'),('ds','dsearch'),('dsp','dsplit'),('dwim','dwim'),('e','e'),('e','e'),('e','e'),('e','e'),('e','e'),('e','e'),('e','e'),('e','e'),('e','e'),('e','edit'),('ea','ea'),('earlier','earlier'),('ec','ec'),('echoe','echoerr'),('echom','echomsg'),('echon','echon'),('el','else'),('elsei','elseif'),('em','emenu'),('emenu','emenu'),('en','en'),('en','endif'),('endf','endf'),('endf','endfunction'),('endfo','endfor'),('endfun','endfun'),('endt','endtry'),('endw','endwhile'),('ene','enew'),('ex','ex'),('exi','exit'),('exu','exusage'),('f','f'),('f','file'),('filename','filename'),('files','files'),('filet','filet'),('filetype','filetype'),('fin','fin'),('fin','find'),('fina','finally'),('fini','finish'),('fir','first'),('fix','fixdel'),('fo','fold'),('foldc','foldclose'),('foldd','folddoopen'),('folddoc','folddoclosed'),('foldo','foldopen'),('for','for'),('fu','fu'),('fu','function'),('fun','fun'),('g','g'),('get','get'),('go','goto'),('gr','grep'),('grepa','grepadd'),('gs','gs'),('gs','gs'),('gui','gui'),('gvim','gvim'),('h','h'),('h','h'),('h','h'),('h','h'),('h','help'),('ha','hardcopy'),('helpf','helpfind'),('helpg','helpgrep'),('helpt','helptags'),('hi','hi'),('hid','hide'),('his','history'),('i','i'),('ia','ia'),('iabc','iabclear'),('if','if'),('ij','ijump'),('il','ilist'),('imapc','imapclear'),('in','in'),('index','index'),('intro','intro'),('is','isearch'),('isp','isplit'),('iuna','iunabbrev'),('j','join'),('ju','jumps'),('k','k'),('kee','keepmarks'),('keepa','keepa'),('keepalt','keepalt'),('keepj','keepjumps'),('l','l'),('l','list'),('lN','lN'),('lN','lNext'),('lNf','lNf'),('lNf','lNfile'),('la','la'),('la','last'),('lad','lad'),('lad','laddexpr'),('laddb','laddbuffer'),('laddf','laddfile'),('lan','lan'),('lan','language'),('lat','lat'),('later','later'),('lb','lbuffer'),('lc','lcd'),('lch','lchdir'),('lcl','lclose'),('lcs','lcs'),('lcscope','lcscope'),('le','left'),('lefta','leftabove'),('let','let'),('lex','lexpr'),('lf','lfile'),('lfir','lfirst'),('lg','lgetfile'),('lgetb','lgetbuffer'),('lgete','lgetexpr'),('lgr','lgrep'),('lgrepa','lgrepadd'),('lh','lhelpgrep'),('ll','ll'),('lla','llast'),('lli','llist'),('lmak','lmake'),('lmapc','lmapclear'),('lne','lne'),('lne','lnext'),('lnew','lnewer'),('lnf','lnf'),('lnf','lnfile'),('lo','lo'),('lo','loadview'),('loadk','loadk'),('loadkeymap','loadkeymap'),('loc','lockmarks'),('locale','locale'),('lockv','lockvar'),('lol','lolder'),('lop','lopen'),('lp','lprevious'),('lpf','lpfile'),('lr','lrewind'),('ls','ls'),('lt','ltag'),('lua','lua'),('luado','luado'),('luafile','luafile'),('lv','lvimgrep'),('lvimgrepa','lvimgrepadd'),('lw','lwindow'),('m','move'),('ma','ma'),('ma','mark'),('main','main'),('main','main'),('mak','make'),('marks','marks'),('mat','match'),('menut','menut'),('menut','menutranslate'),('mes','mes'),('messages','messages'),('mk','mk'),('mk','mkexrc'),('mkdir','mkdir'),('mks','mksession'),('mksp','mkspell'),('mkv','mkv'),('mkv','mkvimrc'),('mkvie','mkview'),('mo','mo'),('mod','mode'),('mv','mv'),('mz','mz'),('mz','mzscheme'),('mzf','mzfile'),('n','n'),('n','n'),('n','next'),('nb','nbkey'),('nbc','nbclose'),('nbs','nbstart'),('ne','ne'),('new','new'),('nkf','nkf'),('nmapc','nmapclear'),('noa','noa'),('noautocmd','noautocmd'),('noh','nohlsearch'),('nu','number'),('o','o'),('o','open'),('ol','oldfiles'),('omapc','omapclear'),('on','only'),('opt','options'),('ownsyntax','ownsyntax'),('p','p'),('p','p'),('p','p'),('p','p'),('p','p'),('p','p'),('p','p'),('p','p'),('p','p'),('p','print'),('pat','pat'),('pat','pat'),('pc','pclose'),('pe','pe'),('pe','perl'),('ped','pedit'),('perld','perldo'),('po','pop'),('popu','popu'),('popu','popup'),('pp','ppop'),('pr','pr'),('pre','preserve'),('prev','previous'),('pro','pro'),('prof','profile'),('profd','profdel'),('promptf','promptfind'),('promptr','promptrepl'),('ps','psearch'),('ptN','ptN'),('ptN','ptNext'),('pta','ptag'),('ptf','ptfirst'),('ptj','ptjump'),('ptl','ptlast'),('ptn','ptn'),('ptn','ptnext'),('ptp','ptprevious'),('ptr','ptrewind'),('pts','ptselect'),('pu','put'),('pw','pwd'),('py','py'),('py','python'),('py3','py3'),('py3','py3'),('py3file','py3file'),('pyf','pyfile'),('python3','python3'),('q','q'),('q','quit'),('qa','qall'),('quita','quitall'),('quote','quote'),('r','r'),('r','r'),('r','r'),('r','r'),('r','r'),('r','r'),('r','r'),('r','r'),('r','r'),('r','r'),('r','r'),('r','read'),('re','re'),('rec','recover'),('red','red'),('red','redo'),('redi','redir'),('redr','redraw'),('redraws','redrawstatus'),('reg','registers'),('res','resize'),('ret','retab'),('retu','return'),('rew','rewind'),('ri','right'),('rightb','rightbelow'),('ru','ru'),('ru','runtime'),('rub','ruby'),('rubyd','rubydo'),('rubyf','rubyfile'),('rundo','rundo'),('rv','rviminfo'),('s','s'),('s','s'),('s','s'),('s','s'),('sN','sNext'),('sa','sargument'),('sal','sall'),('san','sandbox'),('sav','saveas'),('sb','sbuffer'),('sbN','sbNext'),('sba','sball'),('sbf','sbfirst'),('sbl','sblast'),('sbm','sbmodified'),('sbn','sbnext'),('sbp','sbprevious'),('sbr','sbrewind'),('scrip','scrip'),('scrip','scriptnames'),('scripte','scriptencoding'),('scs','scs'),('scscope','scscope'),('se','set'),('setf','setfiletype'),('setg','setglobal'),('setl','setlocal'),('sf','sfind'),('sfir','sfirst'),('sh','shell'),('si','si'),('sig','sig'),('sign','sign'),('sil','silent'),('sim','simalt'),('sl','sl'),('sl','sleep'),('sla','slast'),('sm','smagic'),('sm','smap'),('sme','sme'),('smenu','smenu'),('sn','snext'),('sni','sniff'),('sno','snomagic'),('snoreme','snoreme'),('snoremenu','snoremenu'),('so','so'),('so','source'),('sor','sort'),('sp','split'),('spe','spe'),('spe','spellgood'),('spelld','spelldump'),('spelli','spellinfo'),('spellr','spellrepall'),('spellu','spellundo'),('spellw','spellwrong'),('spr','sprevious'),('sre','srewind'),('st','st'),('st','stop'),('sta','stag'),('star','star'),('star','startinsert'),('start','start'),('startg','startgreplace'),('startr','startreplace'),('stj','stjump'),('stopi','stopinsert'),('sts','stselect'),('sub','sub'),('sub','sub'),('sun','sunhide'),('sunme','sunme'),('sunmenu','sunmenu'),('sus','suspend'),('sv','sview'),('sw','swapname'),('sy','sy'),('syn','syn'),('sync','sync'),('syncbind','syncbind'),('synlist','synlist'),('t','t'),('t','t'),('t','t'),('tN','tN'),('tN','tNext'),('ta','ta'),('ta','tag'),('tab','tab'),('tabN','tabN'),('tabN','tabNext'),('tabc','tabclose'),('tabd','tabdo'),('tabe','tabedit'),('tabf','tabfind'),('tabfir','tabfirst'),('tabl','tablast'),('tabm','tabmove'),('tabn','tabnext'),('tabnew','tabnew'),('tabo','tabonly'),('tabp','tabprevious'),('tabr','tabrewind'),('tabs','tabs'),('tags','tags'),('tc','tcl'),('tcld','tcldo'),('tclf','tclfile'),('te','tearoff'),('tf','tfirst'),('th','throw'),('tj','tjump'),('tl','tlast'),('tm','tm'),('tm','tmenu'),('tn','tn'),('tn','tnext'),('to','topleft'),('tp','tprevious'),('tr','tr'),('tr','trewind'),('try','try'),('ts','tselect'),('tu','tu'),('tu','tunmenu'),('u','u'),('u','undo'),('un','un'),('una','unabbreviate'),('undoj','undojoin'),('undol','undolist'),('unh','unhide'),('unl','unl'),('unlo','unlockvar'),('uns','unsilent'),('up','update'),('v','v'),('ve','ve'),('ve','version'),('verb','verbose'),('version','version'),('version','version'),('vert','vertical'),('vi','vi'),('vi','visual'),('vie','view'),('vim','vimgrep'),('vimgrepa','vimgrepadd'),('viu','viusage'),('vmapc','vmapclear'),('vne','vnew'),('vs','vsplit'),('w','w'),('w','write'),('wN','wNext'),('wa','wall'),('wh','while'),('win','win'),('win','winsize'),('winc','wincmd'),('windo','windo'),('winp','winpos'),('wn','wnext'),('wp','wprevious'),('wq','wq'),('wqa','wqall'),('ws','wsverb'),('wundo','wundo'),('wv','wviminfo'),('x','x'),('x','xit'),('xa','xall'),('xmapc','xmapclear'),('xme','xme'),('xmenu','xmenu'),('xnoreme','xnoreme'),('xnoremenu','xnoremenu'),('xterm','xterm'),('xunme','xunme'),('xunmenu','xunmenu'),('xwininfo','xwininfo'),('y','yank')]
|
8
|
+
def _getoption():
|
9
|
+
return [('acd','acd'),('ai','ai'),('akm','akm'),('al','al'),('aleph','aleph'),('allowrevins','allowrevins'),('altkeymap','altkeymap'),('ambiwidth','ambiwidth'),('ambw','ambw'),('anti','anti'),('antialias','antialias'),('ar','ar'),('arab','arab'),('arabic','arabic'),('arabicshape','arabicshape'),('ari','ari'),('arshape','arshape'),('autochdir','autochdir'),('autoindent','autoindent'),('autoread','autoread'),('autowrite','autowrite'),('autowriteall','autowriteall'),('aw','aw'),('awa','awa'),('background','background'),('backspace','backspace'),('backup','backup'),('backupcopy','backupcopy'),('backupdir','backupdir'),('backupext','backupext'),('backupskip','backupskip'),('balloondelay','balloondelay'),('ballooneval','ballooneval'),('balloonexpr','balloonexpr'),('bdir','bdir'),('bdlay','bdlay'),('beval','beval'),('bex','bex'),('bexpr','bexpr'),('bg','bg'),('bh','bh'),('bin','bin'),('binary','binary'),('biosk','biosk'),('bioskey','bioskey'),('bk','bk'),('bkc','bkc'),('bl','bl'),('bomb','bomb'),('breakat','breakat'),('brk','brk'),('browsedir','browsedir'),('bs','bs'),('bsdir','bsdir'),('bsk','bsk'),('bt','bt'),('bufhidden','bufhidden'),('buflisted','buflisted'),('buftype','buftype'),('casemap','casemap'),('cb','cb'),('cc','cc'),('ccv','ccv'),('cd','cd'),('cdpath','cdpath'),('cedit','cedit'),('cf','cf'),('cfu','cfu'),('ch','ch'),('charconvert','charconvert'),('ci','ci'),('cin','cin'),('cindent','cindent'),('cink','cink'),('cinkeys','cinkeys'),('cino','cino'),('cinoptions','cinoptions'),('cinw','cinw'),('cinwords','cinwords'),('clipboard','clipboard'),('cmdheight','cmdheight'),('cmdwinheight','cmdwinheight'),('cmp','cmp'),('cms','cms'),('co','co'),('cocu','cocu'),('cole','cole'),('colorcolumn','colorcolumn'),('columns','columns'),('com','com'),('comments','comments'),('commentstring','commentstring'),('compatible','compatible'),('complete','complete'),('completefunc','completefunc'),('completeopt','completeopt'),('concealcursor','concealcursor'),('conceallevel','conceallevel'),('confirm','confirm'),('consk','consk'),('conskey','conskey'),('copyindent','copyindent'),('cot','cot'),('cp','cp'),('cpo','cpo'),('cpoptions','cpoptions'),('cpt','cpt'),('crb','crb'),('cryptmethod','cryptmethod'),('cscopepathcomp','cscopepathcomp'),('cscopeprg','cscopeprg'),('cscopequickfix','cscopequickfix'),('cscoperelative','cscoperelative'),('cscopetag','cscopetag'),('cscopetagorder','cscopetagorder'),('cscopeverbose','cscopeverbose'),('cspc','cspc'),('csprg','csprg'),('csqf','csqf'),('csre','csre'),('cst','cst'),('csto','csto'),('csverb','csverb'),('cuc','cuc'),('cul','cul'),('cursorbind','cursorbind'),('cursorcolumn','cursorcolumn'),('cursorline','cursorline'),('cwh','cwh'),('debug','debug'),('deco','deco'),('def','def'),('define','define'),('delcombine','delcombine'),('dex','dex'),('dg','dg'),('dict','dict'),('dictionary','dictionary'),('diff','diff'),('diffexpr','diffexpr'),('diffopt','diffopt'),('digraph','digraph'),('dip','dip'),('dir','dir'),('directory','directory'),('display','display'),('dy','dy'),('ea','ea'),('ead','ead'),('eadirection','eadirection'),('eb','eb'),('ed','ed'),('edcompatible','edcompatible'),('ef','ef'),('efm','efm'),('ei','ei'),('ek','ek'),('enc','enc'),('encoding','encoding'),('endofline','endofline'),('eol','eol'),('ep','ep'),('equalalways','equalalways'),('equalprg','equalprg'),('errorbells','errorbells'),('errorfile','errorfile'),('errorformat','errorformat'),('esckeys','esckeys'),('et','et'),('eventignore','eventignore'),('ex','ex'),('expandtab','expandtab'),('exrc','exrc'),('fcl','fcl'),('fcs','fcs'),('fdc','fdc'),('fde','fde'),('fdi','fdi'),('fdl','fdl'),('fdls','fdls'),('fdm','fdm'),('fdn','fdn'),('fdo','fdo'),('fdt','fdt'),('fen','fen'),('fenc','fenc'),('fencs','fencs'),('fex','fex'),('ff','ff'),('ffs','ffs'),('fileencoding','fileencoding'),('fileencodings','fileencodings'),('fileformat','fileformat'),('fileformats','fileformats'),('filetype','filetype'),('fillchars','fillchars'),('fk','fk'),('fkmap','fkmap'),('flp','flp'),('fml','fml'),('fmr','fmr'),('fo','fo'),('foldclose','foldclose'),('foldcolumn','foldcolumn'),('foldenable','foldenable'),('foldexpr','foldexpr'),('foldignore','foldignore'),('foldlevel','foldlevel'),('foldlevelstart','foldlevelstart'),('foldmarker','foldmarker'),('foldmethod','foldmethod'),('foldminlines','foldminlines'),('foldnestmax','foldnestmax'),('foldopen','foldopen'),('foldtext','foldtext'),('formatexpr','formatexpr'),('formatlistpat','formatlistpat'),('formatoptions','formatoptions'),('formatprg','formatprg'),('fp','fp'),('fs','fs'),('fsync','fsync'),('ft','ft'),('gcr','gcr'),('gd','gd'),('gdefault','gdefault'),('gfm','gfm'),('gfn','gfn'),('gfs','gfs'),('gfw','gfw'),('ghr','ghr'),('go','go'),('gp','gp'),('grepformat','grepformat'),('grepprg','grepprg'),('gtl','gtl'),('gtt','gtt'),('guicursor','guicursor'),('guifont','guifont'),('guifontset','guifontset'),('guifontwide','guifontwide'),('guiheadroom','guiheadroom'),('guioptions','guioptions'),('guipty','guipty'),('guitablabel','guitablabel'),('guitabtooltip','guitabtooltip'),('helpfile','helpfile'),('helpheight','helpheight'),('helplang','helplang'),('hf','hf'),('hh','hh'),('hi','hi'),('hid','hid'),('hidden','hidden'),('highlight','highlight'),('history','history'),('hk','hk'),('hkmap','hkmap'),('hkmapp','hkmapp'),('hkp','hkp'),('hl','hl'),('hlg','hlg'),('hls','hls'),('hlsearch','hlsearch'),('ic','ic'),('icon','icon'),('iconstring','iconstring'),('ignorecase','ignorecase'),('im','im'),('imactivatekey','imactivatekey'),('imak','imak'),('imc','imc'),('imcmdline','imcmdline'),('imd','imd'),('imdisable','imdisable'),('imi','imi'),('iminsert','iminsert'),('ims','ims'),('imsearch','imsearch'),('inc','inc'),('include','include'),('includeexpr','includeexpr'),('incsearch','incsearch'),('inde','inde'),('indentexpr','indentexpr'),('indentkeys','indentkeys'),('indk','indk'),('inex','inex'),('inf','inf'),('infercase','infercase'),('inoremap','inoremap'),('insertmode','insertmode'),('invacd','invacd'),('invai','invai'),('invakm','invakm'),('invallowrevins','invallowrevins'),('invaltkeymap','invaltkeymap'),('invanti','invanti'),('invantialias','invantialias'),('invar','invar'),('invarab','invarab'),('invarabic','invarabic'),('invarabicshape','invarabicshape'),('invari','invari'),('invarshape','invarshape'),('invautochdir','invautochdir'),('invautoindent','invautoindent'),('invautoread','invautoread'),('invautowrite','invautowrite'),('invautowriteall','invautowriteall'),('invaw','invaw'),('invawa','invawa'),('invbackup','invbackup'),('invballooneval','invballooneval'),('invbeval','invbeval'),('invbin','invbin'),('invbinary','invbinary'),('invbiosk','invbiosk'),('invbioskey','invbioskey'),('invbk','invbk'),('invbl','invbl'),('invbomb','invbomb'),('invbuflisted','invbuflisted'),('invcf','invcf'),('invci','invci'),('invcin','invcin'),('invcindent','invcindent'),('invcompatible','invcompatible'),('invconfirm','invconfirm'),('invconsk','invconsk'),('invconskey','invconskey'),('invcopyindent','invcopyindent'),('invcp','invcp'),('invcrb','invcrb'),('invcscopetag','invcscopetag'),('invcscopeverbose','invcscopeverbose'),('invcst','invcst'),('invcsverb','invcsverb'),('invcuc','invcuc'),('invcul','invcul'),('invcursorbind','invcursorbind'),('invcursorcolumn','invcursorcolumn'),('invcursorline','invcursorline'),('invdeco','invdeco'),('invdelcombine','invdelcombine'),('invdg','invdg'),('invdiff','invdiff'),('invdigraph','invdigraph'),('invea','invea'),('inveb','inveb'),('inved','inved'),('invedcompatible','invedcompatible'),('invek','invek'),('invendofline','invendofline'),('inveol','inveol'),('invequalalways','invequalalways'),('inverrorbells','inverrorbells'),('invesckeys','invesckeys'),('invet','invet'),('invex','invex'),('invexpandtab','invexpandtab'),('invexrc','invexrc'),('invfen','invfen'),('invfk','invfk'),('invfkmap','invfkmap'),('invfoldenable','invfoldenable'),('invgd','invgd'),('invgdefault','invgdefault'),('invguipty','invguipty'),('invhid','invhid'),('invhidden','invhidden'),('invhk','invhk'),('invhkmap','invhkmap'),('invhkmapp','invhkmapp'),('invhkp','invhkp'),('invhls','invhls'),('invhlsearch','invhlsearch'),('invic','invic'),('invicon','invicon'),('invignorecase','invignorecase'),('invim','invim'),('invimc','invimc'),('invimcmdline','invimcmdline'),('invimd','invimd'),('invimdisable','invimdisable'),('invincsearch','invincsearch'),('invinf','invinf'),('invinfercase','invinfercase'),('invinsertmode','invinsertmode'),('invis','invis'),('invjoinspaces','invjoinspaces'),('invjs','invjs'),('invlazyredraw','invlazyredraw'),('invlbr','invlbr'),('invlinebreak','invlinebreak'),('invlisp','invlisp'),('invlist','invlist'),('invloadplugins','invloadplugins'),('invlpl','invlpl'),('invlz','invlz'),('invma','invma'),('invmacatsui','invmacatsui'),('invmagic','invmagic'),('invmh','invmh'),('invml','invml'),('invmod','invmod'),('invmodeline','invmodeline'),('invmodifiable','invmodifiable'),('invmodified','invmodified'),('invmore','invmore'),('invmousef','invmousef'),('invmousefocus','invmousefocus'),('invmousehide','invmousehide'),('invnu','invnu'),('invnumber','invnumber'),('invodev','invodev'),('invopendevice','invopendevice'),('invpaste','invpaste'),('invpi','invpi'),('invpreserveindent','invpreserveindent'),('invpreviewwindow','invpreviewwindow'),('invprompt','invprompt'),('invpvw','invpvw'),('invreadonly','invreadonly'),('invrelativenumber','invrelativenumber'),('invremap','invremap'),('invrestorescreen','invrestorescreen'),('invrevins','invrevins'),('invri','invri'),('invrightleft','invrightleft'),('invrl','invrl'),('invrnu','invrnu'),('invro','invro'),('invrs','invrs'),('invru','invru'),('invruler','invruler'),('invsb','invsb'),('invsc','invsc'),('invscb','invscb'),('invscrollbind','invscrollbind'),('invscs','invscs'),('invsecure','invsecure'),('invsft','invsft'),('invshellslash','invshellslash'),('invshelltemp','invshelltemp'),('invshiftround','invshiftround'),('invshortname','invshortname'),('invshowcmd','invshowcmd'),('invshowfulltag','invshowfulltag'),('invshowmatch','invshowmatch'),('invshowmode','invshowmode'),('invsi','invsi'),('invsm','invsm'),('invsmartcase','invsmartcase'),('invsmartindent','invsmartindent'),('invsmarttab','invsmarttab'),('invsmd','invsmd'),('invsn','invsn'),('invsol','invsol'),('invspell','invspell'),('invsplitbelow','invsplitbelow'),('invsplitright','invsplitright'),('invspr','invspr'),('invsr','invsr'),('invssl','invssl'),('invsta','invsta'),('invstartofline','invstartofline'),('invstmp','invstmp'),('invswapfile','invswapfile'),('invswf','invswf'),('invta','invta'),('invtagbsearch','invtagbsearch'),('invtagrelative','invtagrelative'),('invtagstack','invtagstack'),('invtbi','invtbi'),('invtbidi','invtbidi'),('invtbs','invtbs'),('invtermbidi','invtermbidi'),('invterse','invterse'),('invtextauto','invtextauto'),('invtextmode','invtextmode'),('invtf','invtf'),('invtgst','invtgst'),('invtildeop','invtildeop'),('invtimeout','invtimeout'),('invtitle','invtitle'),('invto','invto'),('invtop','invtop'),('invtr','invtr'),('invttimeout','invttimeout'),('invttybuiltin','invttybuiltin'),('invttyfast','invttyfast'),('invtx','invtx'),('invvb','invvb'),('invvisualbell','invvisualbell'),('invwa','invwa'),('invwarn','invwarn'),('invwb','invwb'),('invweirdinvert','invweirdinvert'),('invwfh','invwfh'),('invwfw','invwfw'),('invwildignorecase','invwildignorecase'),('invwildmenu','invwildmenu'),('invwinfixheight','invwinfixheight'),('invwinfixwidth','invwinfixwidth'),('invwiv','invwiv'),('invwmnu','invwmnu'),('invwrap','invwrap'),('invwrapscan','invwrapscan'),('invwrite','invwrite'),('invwriteany','invwriteany'),('invwritebackup','invwritebackup'),('invws','invws'),('is','is'),('isf','isf'),('isfname','isfname'),('isi','isi'),('isident','isident'),('isk','isk'),('iskeyword','iskeyword'),('isp','isp'),('isprint','isprint'),('joinspaces','joinspaces'),('js','js'),('key','key'),('keymap','keymap'),('keymodel','keymodel'),('keywordprg','keywordprg'),('km','km'),('kmp','kmp'),('kp','kp'),('langmap','langmap'),('langmenu','langmenu'),('laststatus','laststatus'),('lazyredraw','lazyredraw'),('lbr','lbr'),('lcs','lcs'),('linebreak','linebreak'),('lines','lines'),('linespace','linespace'),('lisp','lisp'),('lispwords','lispwords'),('list','list'),('listchars','listchars'),('lm','lm'),('lmap','lmap'),('loadplugins','loadplugins'),('lpl','lpl'),('ls','ls'),('lsp','lsp'),('lw','lw'),('lz','lz'),('ma','ma'),('macatsui','macatsui'),('magic','magic'),('makeef','makeef'),('makeprg','makeprg'),('mat','mat'),('matchpairs','matchpairs'),('matchtime','matchtime'),('maxcombine','maxcombine'),('maxfuncdepth','maxfuncdepth'),('maxmapdepth','maxmapdepth'),('maxmem','maxmem'),('maxmempattern','maxmempattern'),('maxmemtot','maxmemtot'),('mco','mco'),('mef','mef'),('menuitems','menuitems'),('mfd','mfd'),('mh','mh'),('mis','mis'),('mkspellmem','mkspellmem'),('ml','ml'),('mls','mls'),('mm','mm'),('mmd','mmd'),('mmp','mmp'),('mmt','mmt'),('mod','mod'),('modeline','modeline'),('modelines','modelines'),('modifiable','modifiable'),('modified','modified'),('more','more'),('mouse','mouse'),('mousef','mousef'),('mousefocus','mousefocus'),('mousehide','mousehide'),('mousem','mousem'),('mousemodel','mousemodel'),('mouses','mouses'),('mouseshape','mouseshape'),('mouset','mouset'),('mousetime','mousetime'),('mp','mp'),('mps','mps'),('msm','msm'),('mzq','mzq'),('mzquantum','mzquantum'),('nf','nf'),('nnoremap','nnoremap'),('noacd','noacd'),('noai','noai'),('noakm','noakm'),('noallowrevins','noallowrevins'),('noaltkeymap','noaltkeymap'),('noanti','noanti'),('noantialias','noantialias'),('noar','noar'),('noarab','noarab'),('noarabic','noarabic'),('noarabicshape','noarabicshape'),('noari','noari'),('noarshape','noarshape'),('noautochdir','noautochdir'),('noautoindent','noautoindent'),('noautoread','noautoread'),('noautowrite','noautowrite'),('noautowriteall','noautowriteall'),('noaw','noaw'),('noawa','noawa'),('nobackup','nobackup'),('noballooneval','noballooneval'),('nobeval','nobeval'),('nobin','nobin'),('nobinary','nobinary'),('nobiosk','nobiosk'),('nobioskey','nobioskey'),('nobk','nobk'),('nobl','nobl'),('nobomb','nobomb'),('nobuflisted','nobuflisted'),('nocf','nocf'),('noci','noci'),('nocin','nocin'),('nocindent','nocindent'),('nocompatible','nocompatible'),('noconfirm','noconfirm'),('noconsk','noconsk'),('noconskey','noconskey'),('nocopyindent','nocopyindent'),('nocp','nocp'),('nocrb','nocrb'),('nocscopetag','nocscopetag'),('nocscopeverbose','nocscopeverbose'),('nocst','nocst'),('nocsverb','nocsverb'),('nocuc','nocuc'),('nocul','nocul'),('nocursorbind','nocursorbind'),('nocursorcolumn','nocursorcolumn'),('nocursorline','nocursorline'),('nodeco','nodeco'),('nodelcombine','nodelcombine'),('nodg','nodg'),('nodiff','nodiff'),('nodigraph','nodigraph'),('noea','noea'),('noeb','noeb'),('noed','noed'),('noedcompatible','noedcompatible'),('noek','noek'),('noendofline','noendofline'),('noeol','noeol'),('noequalalways','noequalalways'),('noerrorbells','noerrorbells'),('noesckeys','noesckeys'),('noet','noet'),('noex','noex'),('noexpandtab','noexpandtab'),('noexrc','noexrc'),('nofen','nofen'),('nofk','nofk'),('nofkmap','nofkmap'),('nofoldenable','nofoldenable'),('nogd','nogd'),('nogdefault','nogdefault'),('noguipty','noguipty'),('nohid','nohid'),('nohidden','nohidden'),('nohk','nohk'),('nohkmap','nohkmap'),('nohkmapp','nohkmapp'),('nohkp','nohkp'),('nohls','nohls'),('nohlsearch','nohlsearch'),('noic','noic'),('noicon','noicon'),('noignorecase','noignorecase'),('noim','noim'),('noimc','noimc'),('noimcmdline','noimcmdline'),('noimd','noimd'),('noimdisable','noimdisable'),('noincsearch','noincsearch'),('noinf','noinf'),('noinfercase','noinfercase'),('noinsertmode','noinsertmode'),('nois','nois'),('nojoinspaces','nojoinspaces'),('nojs','nojs'),('nolazyredraw','nolazyredraw'),('nolbr','nolbr'),('nolinebreak','nolinebreak'),('nolisp','nolisp'),('nolist','nolist'),('noloadplugins','noloadplugins'),('nolpl','nolpl'),('nolz','nolz'),('noma','noma'),('nomacatsui','nomacatsui'),('nomagic','nomagic'),('nomh','nomh'),('noml','noml'),('nomod','nomod'),('nomodeline','nomodeline'),('nomodifiable','nomodifiable'),('nomodified','nomodified'),('nomore','nomore'),('nomousef','nomousef'),('nomousefocus','nomousefocus'),('nomousehide','nomousehide'),('nonu','nonu'),('nonumber','nonumber'),('noodev','noodev'),('noopendevice','noopendevice'),('nopaste','nopaste'),('nopi','nopi'),('nopreserveindent','nopreserveindent'),('nopreviewwindow','nopreviewwindow'),('noprompt','noprompt'),('nopvw','nopvw'),('noreadonly','noreadonly'),('norelativenumber','norelativenumber'),('noremap','noremap'),('norestorescreen','norestorescreen'),('norevins','norevins'),('nori','nori'),('norightleft','norightleft'),('norl','norl'),('nornu','nornu'),('noro','noro'),('nors','nors'),('noru','noru'),('noruler','noruler'),('nosb','nosb'),('nosc','nosc'),('noscb','noscb'),('noscrollbind','noscrollbind'),('noscs','noscs'),('nosecure','nosecure'),('nosft','nosft'),('noshellslash','noshellslash'),('noshelltemp','noshelltemp'),('noshiftround','noshiftround'),('noshortname','noshortname'),('noshowcmd','noshowcmd'),('noshowfulltag','noshowfulltag'),('noshowmatch','noshowmatch'),('noshowmode','noshowmode'),('nosi','nosi'),('nosm','nosm'),('nosmartcase','nosmartcase'),('nosmartindent','nosmartindent'),('nosmarttab','nosmarttab'),('nosmd','nosmd'),('nosn','nosn'),('nosol','nosol'),('nospell','nospell'),('nosplitbelow','nosplitbelow'),('nosplitright','nosplitright'),('nospr','nospr'),('nosr','nosr'),('nossl','nossl'),('nosta','nosta'),('nostartofline','nostartofline'),('nostmp','nostmp'),('noswapfile','noswapfile'),('noswf','noswf'),('nota','nota'),('notagbsearch','notagbsearch'),('notagrelative','notagrelative'),('notagstack','notagstack'),('notbi','notbi'),('notbidi','notbidi'),('notbs','notbs'),('notermbidi','notermbidi'),('noterse','noterse'),('notextauto','notextauto'),('notextmode','notextmode'),('notf','notf'),('notgst','notgst'),('notildeop','notildeop'),('notimeout','notimeout'),('notitle','notitle'),('noto','noto'),('notop','notop'),('notr','notr'),('nottimeout','nottimeout'),('nottybuiltin','nottybuiltin'),('nottyfast','nottyfast'),('notx','notx'),('novb','novb'),('novisualbell','novisualbell'),('nowa','nowa'),('nowarn','nowarn'),('nowb','nowb'),('noweirdinvert','noweirdinvert'),('nowfh','nowfh'),('nowfw','nowfw'),('nowildignorecase','nowildignorecase'),('nowildmenu','nowildmenu'),('nowinfixheight','nowinfixheight'),('nowinfixwidth','nowinfixwidth'),('nowiv','nowiv'),('nowmnu','nowmnu'),('nowrap','nowrap'),('nowrapscan','nowrapscan'),('nowrite','nowrite'),('nowriteany','nowriteany'),('nowritebackup','nowritebackup'),('nows','nows'),('nrformats','nrformats'),('nu','nu'),('number','number'),('numberwidth','numberwidth'),('nuw','nuw'),('odev','odev'),('oft','oft'),('ofu','ofu'),('omnifunc','omnifunc'),('opendevice','opendevice'),('operatorfunc','operatorfunc'),('opfunc','opfunc'),('osfiletype','osfiletype'),('pa','pa'),('para','para'),('paragraphs','paragraphs'),('paste','paste'),('pastetoggle','pastetoggle'),('patchexpr','patchexpr'),('patchmode','patchmode'),('path','path'),('pdev','pdev'),('penc','penc'),('pex','pex'),('pexpr','pexpr'),('pfn','pfn'),('ph','ph'),('pheader','pheader'),('pi','pi'),('pm','pm'),('pmbcs','pmbcs'),('pmbfn','pmbfn'),('popt','popt'),('preserveindent','preserveindent'),('previewheight','previewheight'),('previewwindow','previewwindow'),('printdevice','printdevice'),('printencoding','printencoding'),('printexpr','printexpr'),('printfont','printfont'),('printheader','printheader'),('printmbcharset','printmbcharset'),('printmbfont','printmbfont'),('printoptions','printoptions'),('prompt','prompt'),('pt','pt'),('pumheight','pumheight'),('pvh','pvh'),('pvw','pvw'),('qe','qe'),('quoteescape','quoteescape'),('rdt','rdt'),('readonly','readonly'),('redrawtime','redrawtime'),('relativenumber','relativenumber'),('remap','remap'),('report','report'),('restorescreen','restorescreen'),('revins','revins'),('ri','ri'),('rightleft','rightleft'),('rightleftcmd','rightleftcmd'),('rl','rl'),('rlc','rlc'),('rnu','rnu'),('ro','ro'),('rs','rs'),('rtp','rtp'),('ru','ru'),('ruf','ruf'),('ruler','ruler'),('rulerformat','rulerformat'),('runtimepath','runtimepath'),('sb','sb'),('sbo','sbo'),('sbr','sbr'),('sc','sc'),('scb','scb'),('scr','scr'),('scroll','scroll'),('scrollbind','scrollbind'),('scrolljump','scrolljump'),('scrolloff','scrolloff'),('scrollopt','scrollopt'),('scs','scs'),('sect','sect'),('sections','sections'),('secure','secure'),('sel','sel'),('selection','selection'),('selectmode','selectmode'),('sessionoptions','sessionoptions'),('sft','sft'),('sh','sh'),('shcf','shcf'),('shell','shell'),('shellcmdflag','shellcmdflag'),('shellpipe','shellpipe'),('shellquote','shellquote'),('shellredir','shellredir'),('shellslash','shellslash'),('shelltemp','shelltemp'),('shelltype','shelltype'),('shellxquote','shellxquote'),('shiftround','shiftround'),('shiftwidth','shiftwidth'),('shm','shm'),('shortmess','shortmess'),('shortname','shortname'),('showbreak','showbreak'),('showcmd','showcmd'),('showfulltag','showfulltag'),('showmatch','showmatch'),('showmode','showmode'),('showtabline','showtabline'),('shq','shq'),('si','si'),('sidescroll','sidescroll'),('sidescrolloff','sidescrolloff'),('siso','siso'),('sj','sj'),('slm','slm'),('sm','sm'),('smartcase','smartcase'),('smartindent','smartindent'),('smarttab','smarttab'),('smc','smc'),('smd','smd'),('sn','sn'),('so','so'),('softtabstop','softtabstop'),('sol','sol'),('sp','sp'),('spc','spc'),('spell','spell'),('spellcapcheck','spellcapcheck'),('spellfile','spellfile'),('spelllang','spelllang'),('spellsuggest','spellsuggest'),('spf','spf'),('spl','spl'),('splitbelow','splitbelow'),('splitright','splitright'),('spr','spr'),('sps','sps'),('sr','sr'),('srr','srr'),('ss','ss'),('ssl','ssl'),('ssop','ssop'),('st','st'),('sta','sta'),('stal','stal'),('startofline','startofline'),('statusline','statusline'),('stl','stl'),('stmp','stmp'),('sts','sts'),('su','su'),('sua','sua'),('suffixes','suffixes'),('suffixesadd','suffixesadd'),('sw','sw'),('swapfile','swapfile'),('swapsync','swapsync'),('swb','swb'),('swf','swf'),('switchbuf','switchbuf'),('sws','sws'),('sxq','sxq'),('syn','syn'),('synmaxcol','synmaxcol'),('syntax','syntax'),('t_AB','t_AB'),('t_AF','t_AF'),('t_AL','t_AL'),('t_CS','t_CS'),('t_CV','t_CV'),('t_Ce','t_Ce'),('t_Co','t_Co'),('t_Cs','t_Cs'),('t_DL','t_DL'),('t_EI','t_EI'),('t_F1','t_F1'),('t_F2','t_F2'),('t_F3','t_F3'),('t_F4','t_F4'),('t_F5','t_F5'),('t_F6','t_F6'),('t_F7','t_F7'),('t_F8','t_F8'),('t_F9','t_F9'),('t_IE','t_IE'),('t_IS','t_IS'),('t_K1','t_K1'),('t_K3','t_K3'),('t_K4','t_K4'),('t_K5','t_K5'),('t_K6','t_K6'),('t_K7','t_K7'),('t_K8','t_K8'),('t_K9','t_K9'),('t_KA','t_KA'),('t_KB','t_KB'),('t_KC','t_KC'),('t_KD','t_KD'),('t_KE','t_KE'),('t_KF','t_KF'),('t_KG','t_KG'),('t_KH','t_KH'),('t_KI','t_KI'),('t_KJ','t_KJ'),('t_KK','t_KK'),('t_KL','t_KL'),('t_RI','t_RI'),('t_RV','t_RV'),('t_SI','t_SI'),('t_Sb','t_Sb'),('t_Sf','t_Sf'),('t_WP','t_WP'),('t_WS','t_WS'),('t_ZH','t_ZH'),('t_ZR','t_ZR'),('t_al','t_al'),('t_bc','t_bc'),('t_cd','t_cd'),('t_ce','t_ce'),('t_cl','t_cl'),('t_cm','t_cm'),('t_cs','t_cs'),('t_da','t_da'),('t_db','t_db'),('t_dl','t_dl'),('t_fs','t_fs'),('t_k1','t_k1'),('t_k2','t_k2'),('t_k3','t_k3'),('t_k4','t_k4'),('t_k5','t_k5'),('t_k6','t_k6'),('t_k7','t_k7'),('t_k8','t_k8'),('t_k9','t_k9'),('t_kB','t_kB'),('t_kD','t_kD'),('t_kI','t_kI'),('t_kN','t_kN'),('t_kP','t_kP'),('t_kb','t_kb'),('t_kd','t_kd'),('t_ke','t_ke'),('t_kh','t_kh'),('t_kl','t_kl'),('t_kr','t_kr'),('t_ks','t_ks'),('t_ku','t_ku'),('t_le','t_le'),('t_mb','t_mb'),('t_md','t_md'),('t_me','t_me'),('t_mr','t_mr'),('t_ms','t_ms'),('t_nd','t_nd'),('t_op','t_op'),('t_se','t_se'),('t_so','t_so'),('t_sr','t_sr'),('t_te','t_te'),('t_ti','t_ti'),('t_ts','t_ts'),('t_ue','t_ue'),('t_us','t_us'),('t_ut','t_ut'),('t_vb','t_vb'),('t_ve','t_ve'),('t_vi','t_vi'),('t_vs','t_vs'),('t_xs','t_xs'),('ta','ta'),('tabline','tabline'),('tabpagemax','tabpagemax'),('tabstop','tabstop'),('tag','tag'),('tagbsearch','tagbsearch'),('taglength','taglength'),('tagrelative','tagrelative'),('tags','tags'),('tagstack','tagstack'),('tal','tal'),('tb','tb'),('tbi','tbi'),('tbidi','tbidi'),('tbis','tbis'),('tbs','tbs'),('tenc','tenc'),('term','term'),('termbidi','termbidi'),('termencoding','termencoding'),('terse','terse'),('textauto','textauto'),('textmode','textmode'),('textwidth','textwidth'),('tf','tf'),('tgst','tgst'),('thesaurus','thesaurus'),('tildeop','tildeop'),('timeout','timeout'),('timeoutlen','timeoutlen'),('title','title'),('titlelen','titlelen'),('titleold','titleold'),('titlestring','titlestring'),('tl','tl'),('tm','tm'),('to','to'),('toolbar','toolbar'),('toolbariconsize','toolbariconsize'),('top','top'),('tpm','tpm'),('tr','tr'),('ts','ts'),('tsl','tsl'),('tsr','tsr'),('ttimeout','ttimeout'),('ttimeoutlen','ttimeoutlen'),('ttm','ttm'),('tty','tty'),('ttybuiltin','ttybuiltin'),('ttyfast','ttyfast'),('ttym','ttym'),('ttymouse','ttymouse'),('ttyscroll','ttyscroll'),('ttytype','ttytype'),('tw','tw'),('tx','tx'),('uc','uc'),('udf','udf'),('udir','udir'),('ul','ul'),('undodir','undodir'),('undofile','undofile'),('undolevels','undolevels'),('undoreload','undoreload'),('updatecount','updatecount'),('updatetime','updatetime'),('ur','ur'),('ut','ut'),('vb','vb'),('vbs','vbs'),('vdir','vdir'),('ve','ve'),('verbose','verbose'),('verbosefile','verbosefile'),('vfile','vfile'),('vi','vi'),('viewdir','viewdir'),('viewoptions','viewoptions'),('viminfo','viminfo'),('virtualedit','virtualedit'),('visualbell','visualbell'),('vnoremap','vnoremap'),('vop','vop'),('wa','wa'),('wak','wak'),('warn','warn'),('wb','wb'),('wc','wc'),('wcm','wcm'),('wd','wd'),('weirdinvert','weirdinvert'),('wfh','wfh'),('wfw','wfw'),('wh','wh'),('whichwrap','whichwrap'),('wi','wi'),('wic','wic'),('wig','wig'),('wildchar','wildchar'),('wildcharm','wildcharm'),('wildignore','wildignore'),('wildignorecase','wildignorecase'),('wildmenu','wildmenu'),('wildmode','wildmode'),('wildoptions','wildoptions'),('wim','wim'),('winaltkeys','winaltkeys'),('window','window'),('winfixheight','winfixheight'),('winfixwidth','winfixwidth'),('winheight','winheight'),('winminheight','winminheight'),('winminwidth','winminwidth'),('winwidth','winwidth'),('wiv','wiv'),('wiw','wiw'),('wm','wm'),('wmh','wmh'),('wmnu','wmnu'),('wmw','wmw'),('wop','wop'),('wrap','wrap'),('wrapmargin','wrapmargin'),('wrapscan','wrapscan'),('write','write'),('writeany','writeany'),('writebackup','writebackup'),('writedelay','writedelay'),('ws','ws'),('ww','ww')]
|
10
|
+
|
11
|
+
option = _getoption()
|
12
|
+
command = _getcommand()
|
13
|
+
auto = _getauto()
|
@@ -0,0 +1,2290 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.agile
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Lexers for agile 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 Lexer, RegexLexer, ExtendedRegexLexer, \
|
15
|
+
LexerContext, include, combined, do_insertions, bygroups, using, this
|
16
|
+
from pygments.token import Error, Text, Other, \
|
17
|
+
Comment, Operator, Keyword, Name, String, Number, Generic, Punctuation
|
18
|
+
from pygments.util import get_bool_opt, get_list_opt, shebang_matches
|
19
|
+
from pygments import unistring as uni
|
20
|
+
|
21
|
+
|
22
|
+
__all__ = ['PythonLexer', 'PythonConsoleLexer', 'PythonTracebackLexer',
|
23
|
+
'Python3Lexer', 'Python3TracebackLexer', 'RubyLexer',
|
24
|
+
'RubyConsoleLexer', 'PerlLexer', 'LuaLexer', 'MoonScriptLexer',
|
25
|
+
'CrocLexer', 'MiniDLexer', 'IoLexer', 'TclLexer', 'FactorLexer',
|
26
|
+
'FancyLexer', 'DgLexer', 'Perl6Lexer']
|
27
|
+
|
28
|
+
# b/w compatibility
|
29
|
+
from pygments.lexers.functional import SchemeLexer
|
30
|
+
from pygments.lexers.jvm import IokeLexer, ClojureLexer
|
31
|
+
|
32
|
+
line_re = re.compile('.*?\n')
|
33
|
+
|
34
|
+
|
35
|
+
class PythonLexer(RegexLexer):
|
36
|
+
"""
|
37
|
+
For `Python <http://www.python.org>`_ source code.
|
38
|
+
"""
|
39
|
+
|
40
|
+
name = 'Python'
|
41
|
+
aliases = ['python', 'py', 'sage']
|
42
|
+
filenames = ['*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript', '*.tac', '*.sage']
|
43
|
+
mimetypes = ['text/x-python', 'application/x-python']
|
44
|
+
|
45
|
+
tokens = {
|
46
|
+
'root': [
|
47
|
+
(r'\n', Text),
|
48
|
+
(r'^(\s*)([rRuU]{,2}"""(?:.|\n)*?""")', bygroups(Text, String.Doc)),
|
49
|
+
(r"^(\s*)([rRuU]{,2}'''(?:.|\n)*?''')", bygroups(Text, String.Doc)),
|
50
|
+
(r'[^\S\n]+', Text),
|
51
|
+
(r'#.*$', Comment),
|
52
|
+
(r'[]{}:(),;[]', Punctuation),
|
53
|
+
(r'\\\n', Text),
|
54
|
+
(r'\\', Text),
|
55
|
+
(r'(in|is|and|or|not)\b', Operator.Word),
|
56
|
+
(r'!=|==|<<|>>|[-~+/*%=<>&^|.]', Operator),
|
57
|
+
include('keywords'),
|
58
|
+
(r'(def)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'funcname'),
|
59
|
+
(r'(class)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'classname'),
|
60
|
+
(r'(from)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Text),
|
61
|
+
'fromimport'),
|
62
|
+
(r'(import)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Text),
|
63
|
+
'import'),
|
64
|
+
include('builtins'),
|
65
|
+
include('backtick'),
|
66
|
+
('(?:[rR]|[uU][rR]|[rR][uU])"""', String, 'tdqs'),
|
67
|
+
("(?:[rR]|[uU][rR]|[rR][uU])'''", String, 'tsqs'),
|
68
|
+
('(?:[rR]|[uU][rR]|[rR][uU])"', String, 'dqs'),
|
69
|
+
("(?:[rR]|[uU][rR]|[rR][uU])'", String, 'sqs'),
|
70
|
+
('[uU]?"""', String, combined('stringescape', 'tdqs')),
|
71
|
+
("[uU]?'''", String, combined('stringescape', 'tsqs')),
|
72
|
+
('[uU]?"', String, combined('stringescape', 'dqs')),
|
73
|
+
("[uU]?'", String, combined('stringescape', 'sqs')),
|
74
|
+
include('name'),
|
75
|
+
include('numbers'),
|
76
|
+
],
|
77
|
+
'keywords': [
|
78
|
+
(r'(assert|break|continue|del|elif|else|except|exec|'
|
79
|
+
r'finally|for|global|if|lambda|pass|print|raise|'
|
80
|
+
r'return|try|while|yield(\s+from)?|as|with)\b', Keyword),
|
81
|
+
],
|
82
|
+
'builtins': [
|
83
|
+
(r'(?<!\.)(__import__|abs|all|any|apply|basestring|bin|bool|buffer|'
|
84
|
+
r'bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|'
|
85
|
+
r'complex|delattr|dict|dir|divmod|enumerate|eval|execfile|exit|'
|
86
|
+
r'file|filter|float|frozenset|getattr|globals|hasattr|hash|hex|id|'
|
87
|
+
r'input|int|intern|isinstance|issubclass|iter|len|list|locals|'
|
88
|
+
r'long|map|max|min|next|object|oct|open|ord|pow|property|range|'
|
89
|
+
r'raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|'
|
90
|
+
r'sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|'
|
91
|
+
r'vars|xrange|zip)\b', Name.Builtin),
|
92
|
+
(r'(?<!\.)(self|None|Ellipsis|NotImplemented|False|True'
|
93
|
+
r')\b', Name.Builtin.Pseudo),
|
94
|
+
(r'(?<!\.)(ArithmeticError|AssertionError|AttributeError|'
|
95
|
+
r'BaseException|DeprecationWarning|EOFError|EnvironmentError|'
|
96
|
+
r'Exception|FloatingPointError|FutureWarning|GeneratorExit|IOError|'
|
97
|
+
r'ImportError|ImportWarning|IndentationError|IndexError|KeyError|'
|
98
|
+
r'KeyboardInterrupt|LookupError|MemoryError|NameError|'
|
99
|
+
r'NotImplemented|NotImplementedError|OSError|OverflowError|'
|
100
|
+
r'OverflowWarning|PendingDeprecationWarning|ReferenceError|'
|
101
|
+
r'RuntimeError|RuntimeWarning|StandardError|StopIteration|'
|
102
|
+
r'SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|'
|
103
|
+
r'TypeError|UnboundLocalError|UnicodeDecodeError|'
|
104
|
+
r'UnicodeEncodeError|UnicodeError|UnicodeTranslateError|'
|
105
|
+
r'UnicodeWarning|UserWarning|ValueError|VMSError|Warning|'
|
106
|
+
r'WindowsError|ZeroDivisionError)\b', Name.Exception),
|
107
|
+
],
|
108
|
+
'numbers': [
|
109
|
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
|
110
|
+
(r'\d+[eE][+-]?[0-9]+j?', Number.Float),
|
111
|
+
(r'0[0-7]+j?', Number.Oct),
|
112
|
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
113
|
+
(r'\d+L', Number.Integer.Long),
|
114
|
+
(r'\d+j?', Number.Integer)
|
115
|
+
],
|
116
|
+
'backtick': [
|
117
|
+
('`.*?`', String.Backtick),
|
118
|
+
],
|
119
|
+
'name': [
|
120
|
+
(r'@[a-zA-Z0-9_.]+', Name.Decorator),
|
121
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
122
|
+
],
|
123
|
+
'funcname': [
|
124
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name.Function, '#pop')
|
125
|
+
],
|
126
|
+
'classname': [
|
127
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
|
128
|
+
],
|
129
|
+
'import': [
|
130
|
+
(r'(?:[ \t]|\\\n)+', Text),
|
131
|
+
(r'as\b', Keyword.Namespace),
|
132
|
+
(r',', Operator),
|
133
|
+
(r'[a-zA-Z_][a-zA-Z0-9_.]*', Name.Namespace),
|
134
|
+
(r'', Text, '#pop') # all else: go back
|
135
|
+
],
|
136
|
+
'fromimport': [
|
137
|
+
(r'(?:[ \t]|\\\n)+', Text),
|
138
|
+
(r'import\b', Keyword.Namespace, '#pop'),
|
139
|
+
# if None occurs here, it's "raise x from None", since None can
|
140
|
+
# never be a module name
|
141
|
+
(r'None\b', Name.Builtin.Pseudo, '#pop'),
|
142
|
+
# sadly, in "raise x from y" y will be highlighted as namespace too
|
143
|
+
(r'[a-zA-Z_.][a-zA-Z0-9_.]*', Name.Namespace),
|
144
|
+
# anything else here also means "raise x from y" and is therefore
|
145
|
+
# not an error
|
146
|
+
(r'', Text, '#pop'),
|
147
|
+
],
|
148
|
+
'stringescape': [
|
149
|
+
(r'\\([\\abfnrtv"\']|\n|N{.*?}|u[a-fA-F0-9]{4}|'
|
150
|
+
r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
151
|
+
],
|
152
|
+
'strings': [
|
153
|
+
(r'%(\([a-zA-Z0-9_]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
|
154
|
+
'[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
|
155
|
+
(r'[^\\\'"%\n]+', String),
|
156
|
+
# quotes, percents and backslashes must be parsed one at a time
|
157
|
+
(r'[\'"\\]', String),
|
158
|
+
# unhandled string formatting sign
|
159
|
+
(r'%', String)
|
160
|
+
# newlines are an error (use "nl" state)
|
161
|
+
],
|
162
|
+
'nl': [
|
163
|
+
(r'\n', String)
|
164
|
+
],
|
165
|
+
'dqs': [
|
166
|
+
(r'"', String, '#pop'),
|
167
|
+
(r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
|
168
|
+
include('strings')
|
169
|
+
],
|
170
|
+
'sqs': [
|
171
|
+
(r"'", String, '#pop'),
|
172
|
+
(r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
|
173
|
+
include('strings')
|
174
|
+
],
|
175
|
+
'tdqs': [
|
176
|
+
(r'"""', String, '#pop'),
|
177
|
+
include('strings'),
|
178
|
+
include('nl')
|
179
|
+
],
|
180
|
+
'tsqs': [
|
181
|
+
(r"'''", String, '#pop'),
|
182
|
+
include('strings'),
|
183
|
+
include('nl')
|
184
|
+
],
|
185
|
+
}
|
186
|
+
|
187
|
+
def analyse_text(text):
|
188
|
+
return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \
|
189
|
+
'import ' in text[:1000]
|
190
|
+
|
191
|
+
|
192
|
+
class Python3Lexer(RegexLexer):
|
193
|
+
"""
|
194
|
+
For `Python <http://www.python.org>`_ source code (version 3.0).
|
195
|
+
|
196
|
+
*New in Pygments 0.10.*
|
197
|
+
"""
|
198
|
+
|
199
|
+
name = 'Python 3'
|
200
|
+
aliases = ['python3', 'py3']
|
201
|
+
filenames = [] # Nothing until Python 3 gets widespread
|
202
|
+
mimetypes = ['text/x-python3', 'application/x-python3']
|
203
|
+
|
204
|
+
flags = re.MULTILINE | re.UNICODE
|
205
|
+
|
206
|
+
uni_name = "[%s][%s]*" % (uni.xid_start, uni.xid_continue)
|
207
|
+
|
208
|
+
tokens = PythonLexer.tokens.copy()
|
209
|
+
tokens['keywords'] = [
|
210
|
+
(r'(assert|break|continue|del|elif|else|except|'
|
211
|
+
r'finally|for|global|if|lambda|pass|raise|nonlocal|'
|
212
|
+
r'return|try|while|yield(\s+from)?|as|with|True|False|None)\b',
|
213
|
+
Keyword),
|
214
|
+
]
|
215
|
+
tokens['builtins'] = [
|
216
|
+
(r'(?<!\.)(__import__|abs|all|any|bin|bool|bytearray|bytes|'
|
217
|
+
r'chr|classmethod|cmp|compile|complex|delattr|dict|dir|'
|
218
|
+
r'divmod|enumerate|eval|filter|float|format|frozenset|getattr|'
|
219
|
+
r'globals|hasattr|hash|hex|id|input|int|isinstance|issubclass|'
|
220
|
+
r'iter|len|list|locals|map|max|memoryview|min|next|object|oct|'
|
221
|
+
r'open|ord|pow|print|property|range|repr|reversed|round|'
|
222
|
+
r'set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|'
|
223
|
+
r'vars|zip)\b', Name.Builtin),
|
224
|
+
(r'(?<!\.)(self|Ellipsis|NotImplemented)\b', Name.Builtin.Pseudo),
|
225
|
+
(r'(?<!\.)(ArithmeticError|AssertionError|AttributeError|'
|
226
|
+
r'BaseException|BufferError|BytesWarning|DeprecationWarning|'
|
227
|
+
r'EOFError|EnvironmentError|Exception|FloatingPointError|'
|
228
|
+
r'FutureWarning|GeneratorExit|IOError|ImportError|'
|
229
|
+
r'ImportWarning|IndentationError|IndexError|KeyError|'
|
230
|
+
r'KeyboardInterrupt|LookupError|MemoryError|NameError|'
|
231
|
+
r'NotImplementedError|OSError|OverflowError|'
|
232
|
+
r'PendingDeprecationWarning|ReferenceError|'
|
233
|
+
r'RuntimeError|RuntimeWarning|StopIteration|'
|
234
|
+
r'SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|'
|
235
|
+
r'TypeError|UnboundLocalError|UnicodeDecodeError|'
|
236
|
+
r'UnicodeEncodeError|UnicodeError|UnicodeTranslateError|'
|
237
|
+
r'UnicodeWarning|UserWarning|ValueError|VMSError|Warning|'
|
238
|
+
r'WindowsError|ZeroDivisionError|'
|
239
|
+
# new builtin exceptions from PEP 3151
|
240
|
+
r'BlockingIOError|ChildProcessError|ConnectionError|'
|
241
|
+
r'BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|'
|
242
|
+
r'ConnectionResetError|FileExistsError|FileNotFoundError|'
|
243
|
+
r'InterruptedError|IsADirectoryError|NotADirectoryError|'
|
244
|
+
r'PermissionError|ProcessLookupError|TimeoutError)\b',
|
245
|
+
Name.Exception),
|
246
|
+
]
|
247
|
+
tokens['numbers'] = [
|
248
|
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
249
|
+
(r'0[oO][0-7]+', Number.Oct),
|
250
|
+
(r'0[bB][01]+', Number.Bin),
|
251
|
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
252
|
+
(r'\d+', Number.Integer)
|
253
|
+
]
|
254
|
+
tokens['backtick'] = []
|
255
|
+
tokens['name'] = [
|
256
|
+
(r'@[a-zA-Z0-9_]+', Name.Decorator),
|
257
|
+
(uni_name, Name),
|
258
|
+
]
|
259
|
+
tokens['funcname'] = [
|
260
|
+
(uni_name, Name.Function, '#pop')
|
261
|
+
]
|
262
|
+
tokens['classname'] = [
|
263
|
+
(uni_name, Name.Class, '#pop')
|
264
|
+
]
|
265
|
+
tokens['import'] = [
|
266
|
+
(r'(\s+)(as)(\s+)', bygroups(Text, Keyword, Text)),
|
267
|
+
(r'\.', Name.Namespace),
|
268
|
+
(uni_name, Name.Namespace),
|
269
|
+
(r'(\s*)(,)(\s*)', bygroups(Text, Operator, Text)),
|
270
|
+
(r'', Text, '#pop') # all else: go back
|
271
|
+
]
|
272
|
+
tokens['fromimport'] = [
|
273
|
+
(r'(\s+)(import)\b', bygroups(Text, Keyword), '#pop'),
|
274
|
+
(r'\.', Name.Namespace),
|
275
|
+
(uni_name, Name.Namespace),
|
276
|
+
(r'', Text, '#pop'),
|
277
|
+
]
|
278
|
+
# don't highlight "%s" substitutions
|
279
|
+
tokens['strings'] = [
|
280
|
+
(r'[^\\\'"%\n]+', String),
|
281
|
+
# quotes, percents and backslashes must be parsed one at a time
|
282
|
+
(r'[\'"\\]', String),
|
283
|
+
# unhandled string formatting sign
|
284
|
+
(r'%', String)
|
285
|
+
# newlines are an error (use "nl" state)
|
286
|
+
]
|
287
|
+
|
288
|
+
def analyse_text(text):
|
289
|
+
return shebang_matches(text, r'pythonw?3(\.\d)?')
|
290
|
+
|
291
|
+
|
292
|
+
class PythonConsoleLexer(Lexer):
|
293
|
+
"""
|
294
|
+
For Python console output or doctests, such as:
|
295
|
+
|
296
|
+
.. sourcecode:: pycon
|
297
|
+
|
298
|
+
>>> a = 'foo'
|
299
|
+
>>> print a
|
300
|
+
foo
|
301
|
+
>>> 1 / 0
|
302
|
+
Traceback (most recent call last):
|
303
|
+
File "<stdin>", line 1, in <module>
|
304
|
+
ZeroDivisionError: integer division or modulo by zero
|
305
|
+
|
306
|
+
Additional options:
|
307
|
+
|
308
|
+
`python3`
|
309
|
+
Use Python 3 lexer for code. Default is ``False``.
|
310
|
+
*New in Pygments 1.0.*
|
311
|
+
"""
|
312
|
+
name = 'Python console session'
|
313
|
+
aliases = ['pycon']
|
314
|
+
mimetypes = ['text/x-python-doctest']
|
315
|
+
|
316
|
+
def __init__(self, **options):
|
317
|
+
self.python3 = get_bool_opt(options, 'python3', False)
|
318
|
+
Lexer.__init__(self, **options)
|
319
|
+
|
320
|
+
def get_tokens_unprocessed(self, text):
|
321
|
+
if self.python3:
|
322
|
+
pylexer = Python3Lexer(**self.options)
|
323
|
+
tblexer = Python3TracebackLexer(**self.options)
|
324
|
+
else:
|
325
|
+
pylexer = PythonLexer(**self.options)
|
326
|
+
tblexer = PythonTracebackLexer(**self.options)
|
327
|
+
|
328
|
+
curcode = ''
|
329
|
+
insertions = []
|
330
|
+
curtb = ''
|
331
|
+
tbindex = 0
|
332
|
+
tb = 0
|
333
|
+
for match in line_re.finditer(text):
|
334
|
+
line = match.group()
|
335
|
+
if line.startswith(u'>>> ') or line.startswith(u'... '):
|
336
|
+
tb = 0
|
337
|
+
insertions.append((len(curcode),
|
338
|
+
[(0, Generic.Prompt, line[:4])]))
|
339
|
+
curcode += line[4:]
|
340
|
+
elif line.rstrip() == u'...' and not tb:
|
341
|
+
# only a new >>> prompt can end an exception block
|
342
|
+
# otherwise an ellipsis in place of the traceback frames
|
343
|
+
# will be mishandled
|
344
|
+
insertions.append((len(curcode),
|
345
|
+
[(0, Generic.Prompt, u'...')]))
|
346
|
+
curcode += line[3:]
|
347
|
+
else:
|
348
|
+
if curcode:
|
349
|
+
for item in do_insertions(insertions,
|
350
|
+
pylexer.get_tokens_unprocessed(curcode)):
|
351
|
+
yield item
|
352
|
+
curcode = ''
|
353
|
+
insertions = []
|
354
|
+
if (line.startswith(u'Traceback (most recent call last):') or
|
355
|
+
re.match(ur' File "[^"]+", line \d+\n$', line)):
|
356
|
+
tb = 1
|
357
|
+
curtb = line
|
358
|
+
tbindex = match.start()
|
359
|
+
elif line == 'KeyboardInterrupt\n':
|
360
|
+
yield match.start(), Name.Class, line
|
361
|
+
elif tb:
|
362
|
+
curtb += line
|
363
|
+
if not (line.startswith(' ') or line.strip() == u'...'):
|
364
|
+
tb = 0
|
365
|
+
for i, t, v in tblexer.get_tokens_unprocessed(curtb):
|
366
|
+
yield tbindex+i, t, v
|
367
|
+
else:
|
368
|
+
yield match.start(), Generic.Output, line
|
369
|
+
if curcode:
|
370
|
+
for item in do_insertions(insertions,
|
371
|
+
pylexer.get_tokens_unprocessed(curcode)):
|
372
|
+
yield item
|
373
|
+
|
374
|
+
|
375
|
+
class PythonTracebackLexer(RegexLexer):
|
376
|
+
"""
|
377
|
+
For Python tracebacks.
|
378
|
+
|
379
|
+
*New in Pygments 0.7.*
|
380
|
+
"""
|
381
|
+
|
382
|
+
name = 'Python Traceback'
|
383
|
+
aliases = ['pytb']
|
384
|
+
filenames = ['*.pytb']
|
385
|
+
mimetypes = ['text/x-python-traceback']
|
386
|
+
|
387
|
+
tokens = {
|
388
|
+
'root': [
|
389
|
+
(r'^Traceback \(most recent call last\):\n',
|
390
|
+
Generic.Traceback, 'intb'),
|
391
|
+
# SyntaxError starts with this.
|
392
|
+
(r'^(?= File "[^"]+", line \d+)', Generic.Traceback, 'intb'),
|
393
|
+
(r'^.*\n', Other),
|
394
|
+
],
|
395
|
+
'intb': [
|
396
|
+
(r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)',
|
397
|
+
bygroups(Text, Name.Builtin, Text, Number, Text, Name, Text)),
|
398
|
+
(r'^( File )("[^"]+")(, line )(\d+)(\n)',
|
399
|
+
bygroups(Text, Name.Builtin, Text, Number, Text)),
|
400
|
+
(r'^( )(.+)(\n)',
|
401
|
+
bygroups(Text, using(PythonLexer), Text)),
|
402
|
+
(r'^([ \t]*)(\.\.\.)(\n)',
|
403
|
+
bygroups(Text, Comment, Text)), # for doctests...
|
404
|
+
(r'^([^:]+)(: )(.+)(\n)',
|
405
|
+
bygroups(Generic.Error, Text, Name, Text), '#pop'),
|
406
|
+
(r'^([a-zA-Z_][a-zA-Z0-9_]*)(:?\n)',
|
407
|
+
bygroups(Generic.Error, Text), '#pop')
|
408
|
+
],
|
409
|
+
}
|
410
|
+
|
411
|
+
|
412
|
+
class Python3TracebackLexer(RegexLexer):
|
413
|
+
"""
|
414
|
+
For Python 3.0 tracebacks, with support for chained exceptions.
|
415
|
+
|
416
|
+
*New in Pygments 1.0.*
|
417
|
+
"""
|
418
|
+
|
419
|
+
name = 'Python 3.0 Traceback'
|
420
|
+
aliases = ['py3tb']
|
421
|
+
filenames = ['*.py3tb']
|
422
|
+
mimetypes = ['text/x-python3-traceback']
|
423
|
+
|
424
|
+
tokens = {
|
425
|
+
'root': [
|
426
|
+
(r'\n', Text),
|
427
|
+
(r'^Traceback \(most recent call last\):\n', Generic.Traceback, 'intb'),
|
428
|
+
(r'^During handling of the above exception, another '
|
429
|
+
r'exception occurred:\n\n', Generic.Traceback),
|
430
|
+
(r'^The above exception was the direct cause of the '
|
431
|
+
r'following exception:\n\n', Generic.Traceback),
|
432
|
+
(r'^(?= File "[^"]+", line \d+)', Generic.Traceback, 'intb'),
|
433
|
+
],
|
434
|
+
'intb': [
|
435
|
+
(r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)',
|
436
|
+
bygroups(Text, Name.Builtin, Text, Number, Text, Name, Text)),
|
437
|
+
(r'^( File )("[^"]+")(, line )(\d+)(\n)',
|
438
|
+
bygroups(Text, Name.Builtin, Text, Number, Text)),
|
439
|
+
(r'^( )(.+)(\n)',
|
440
|
+
bygroups(Text, using(Python3Lexer), Text)),
|
441
|
+
(r'^([ \t]*)(\.\.\.)(\n)',
|
442
|
+
bygroups(Text, Comment, Text)), # for doctests...
|
443
|
+
(r'^([^:]+)(: )(.+)(\n)',
|
444
|
+
bygroups(Generic.Error, Text, Name, Text), '#pop'),
|
445
|
+
(r'^([a-zA-Z_][a-zA-Z0-9_]*)(:?\n)',
|
446
|
+
bygroups(Generic.Error, Text), '#pop')
|
447
|
+
],
|
448
|
+
}
|
449
|
+
|
450
|
+
|
451
|
+
class RubyLexer(ExtendedRegexLexer):
|
452
|
+
"""
|
453
|
+
For `Ruby <http://www.ruby-lang.org>`_ source code.
|
454
|
+
"""
|
455
|
+
|
456
|
+
name = 'Ruby'
|
457
|
+
aliases = ['rb', 'ruby', 'duby']
|
458
|
+
filenames = ['*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec',
|
459
|
+
'*.rbx', '*.duby']
|
460
|
+
mimetypes = ['text/x-ruby', 'application/x-ruby']
|
461
|
+
|
462
|
+
flags = re.DOTALL | re.MULTILINE
|
463
|
+
|
464
|
+
def heredoc_callback(self, match, ctx):
|
465
|
+
# okay, this is the hardest part of parsing Ruby...
|
466
|
+
# match: 1 = <<-?, 2 = quote? 3 = name 4 = quote? 5 = rest of line
|
467
|
+
|
468
|
+
start = match.start(1)
|
469
|
+
yield start, Operator, match.group(1) # <<-?
|
470
|
+
yield match.start(2), String.Heredoc, match.group(2) # quote ", ', `
|
471
|
+
yield match.start(3), Name.Constant, match.group(3) # heredoc name
|
472
|
+
yield match.start(4), String.Heredoc, match.group(4) # quote again
|
473
|
+
|
474
|
+
heredocstack = ctx.__dict__.setdefault('heredocstack', [])
|
475
|
+
outermost = not bool(heredocstack)
|
476
|
+
heredocstack.append((match.group(1) == '<<-', match.group(3)))
|
477
|
+
|
478
|
+
ctx.pos = match.start(5)
|
479
|
+
ctx.end = match.end(5)
|
480
|
+
# this may find other heredocs
|
481
|
+
for i, t, v in self.get_tokens_unprocessed(context=ctx):
|
482
|
+
yield i, t, v
|
483
|
+
ctx.pos = match.end()
|
484
|
+
|
485
|
+
if outermost:
|
486
|
+
# this is the outer heredoc again, now we can process them all
|
487
|
+
for tolerant, hdname in heredocstack:
|
488
|
+
lines = []
|
489
|
+
for match in line_re.finditer(ctx.text, ctx.pos):
|
490
|
+
if tolerant:
|
491
|
+
check = match.group().strip()
|
492
|
+
else:
|
493
|
+
check = match.group().rstrip()
|
494
|
+
if check == hdname:
|
495
|
+
for amatch in lines:
|
496
|
+
yield amatch.start(), String.Heredoc, amatch.group()
|
497
|
+
yield match.start(), Name.Constant, match.group()
|
498
|
+
ctx.pos = match.end()
|
499
|
+
break
|
500
|
+
else:
|
501
|
+
lines.append(match)
|
502
|
+
else:
|
503
|
+
# end of heredoc not found -- error!
|
504
|
+
for amatch in lines:
|
505
|
+
yield amatch.start(), Error, amatch.group()
|
506
|
+
ctx.end = len(ctx.text)
|
507
|
+
del heredocstack[:]
|
508
|
+
|
509
|
+
|
510
|
+
def gen_rubystrings_rules():
|
511
|
+
def intp_regex_callback(self, match, ctx):
|
512
|
+
yield match.start(1), String.Regex, match.group(1) # begin
|
513
|
+
nctx = LexerContext(match.group(3), 0, ['interpolated-regex'])
|
514
|
+
for i, t, v in self.get_tokens_unprocessed(context=nctx):
|
515
|
+
yield match.start(3)+i, t, v
|
516
|
+
yield match.start(4), String.Regex, match.group(4) # end[mixounse]*
|
517
|
+
ctx.pos = match.end()
|
518
|
+
|
519
|
+
def intp_string_callback(self, match, ctx):
|
520
|
+
yield match.start(1), String.Other, match.group(1)
|
521
|
+
nctx = LexerContext(match.group(3), 0, ['interpolated-string'])
|
522
|
+
for i, t, v in self.get_tokens_unprocessed(context=nctx):
|
523
|
+
yield match.start(3)+i, t, v
|
524
|
+
yield match.start(4), String.Other, match.group(4) # end
|
525
|
+
ctx.pos = match.end()
|
526
|
+
|
527
|
+
states = {}
|
528
|
+
states['strings'] = [
|
529
|
+
# easy ones
|
530
|
+
(r'\:@{0,2}([a-zA-Z_]\w*[\!\?]?|\*\*?|[-+]@?|'
|
531
|
+
r'[/%&|^`~]|\[\]=?|<<|>>|<=?>|>=?|===?)', String.Symbol),
|
532
|
+
(r":'(\\\\|\\'|[^'])*'", String.Symbol),
|
533
|
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
534
|
+
(r':"', String.Symbol, 'simple-sym'),
|
535
|
+
(r'([a-zA-Z_][a-zA-Z0-9]*)(:)(?!:)',
|
536
|
+
bygroups(String.Symbol, Punctuation)), # Since Ruby 1.9
|
537
|
+
(r'"', String.Double, 'simple-string'),
|
538
|
+
(r'(?<!\.)`', String.Backtick, 'simple-backtick'),
|
539
|
+
]
|
540
|
+
|
541
|
+
# double-quoted string and symbol
|
542
|
+
for name, ttype, end in ('string', String.Double, '"'), \
|
543
|
+
('sym', String.Symbol, '"'), \
|
544
|
+
('backtick', String.Backtick, '`'):
|
545
|
+
states['simple-'+name] = [
|
546
|
+
include('string-intp-escaped'),
|
547
|
+
(r'[^\\%s#]+' % end, ttype),
|
548
|
+
(r'[\\#]', ttype),
|
549
|
+
(end, ttype, '#pop'),
|
550
|
+
]
|
551
|
+
|
552
|
+
# braced quoted strings
|
553
|
+
for lbrace, rbrace, name in ('\\{', '\\}', 'cb'), \
|
554
|
+
('\\[', '\\]', 'sb'), \
|
555
|
+
('\\(', '\\)', 'pa'), \
|
556
|
+
('<', '>', 'ab'):
|
557
|
+
states[name+'-intp-string'] = [
|
558
|
+
(r'\\[\\' + lbrace + rbrace + ']', String.Other),
|
559
|
+
(r'(?<!\\)' + lbrace, String.Other, '#push'),
|
560
|
+
(r'(?<!\\)' + rbrace, String.Other, '#pop'),
|
561
|
+
include('string-intp-escaped'),
|
562
|
+
(r'[\\#' + lbrace + rbrace + ']', String.Other),
|
563
|
+
(r'[^\\#' + lbrace + rbrace + ']+', String.Other),
|
564
|
+
]
|
565
|
+
states['strings'].append((r'%[QWx]?' + lbrace, String.Other,
|
566
|
+
name+'-intp-string'))
|
567
|
+
states[name+'-string'] = [
|
568
|
+
(r'\\[\\' + lbrace + rbrace + ']', String.Other),
|
569
|
+
(r'(?<!\\)' + lbrace, String.Other, '#push'),
|
570
|
+
(r'(?<!\\)' + rbrace, String.Other, '#pop'),
|
571
|
+
(r'[\\#' + lbrace + rbrace + ']', String.Other),
|
572
|
+
(r'[^\\#' + lbrace + rbrace + ']+', String.Other),
|
573
|
+
]
|
574
|
+
states['strings'].append((r'%[qsw]' + lbrace, String.Other,
|
575
|
+
name+'-string'))
|
576
|
+
states[name+'-regex'] = [
|
577
|
+
(r'\\[\\' + lbrace + rbrace + ']', String.Regex),
|
578
|
+
(r'(?<!\\)' + lbrace, String.Regex, '#push'),
|
579
|
+
(r'(?<!\\)' + rbrace + '[mixounse]*', String.Regex, '#pop'),
|
580
|
+
include('string-intp'),
|
581
|
+
(r'[\\#' + lbrace + rbrace + ']', String.Regex),
|
582
|
+
(r'[^\\#' + lbrace + rbrace + ']+', String.Regex),
|
583
|
+
]
|
584
|
+
states['strings'].append((r'%r' + lbrace, String.Regex,
|
585
|
+
name+'-regex'))
|
586
|
+
|
587
|
+
# these must come after %<brace>!
|
588
|
+
states['strings'] += [
|
589
|
+
# %r regex
|
590
|
+
(r'(%r([^a-zA-Z0-9]))((?:\\\2|(?!\2).)*)(\2[mixounse]*)',
|
591
|
+
intp_regex_callback),
|
592
|
+
# regular fancy strings with qsw
|
593
|
+
(r'%[qsw]([^a-zA-Z0-9])((?:\\\1|(?!\1).)*)\1', String.Other),
|
594
|
+
(r'(%[QWx]([^a-zA-Z0-9]))((?:\\\2|(?!\2).)*)(\2)',
|
595
|
+
intp_string_callback),
|
596
|
+
# special forms of fancy strings after operators or
|
597
|
+
# in method calls with braces
|
598
|
+
(r'(?<=[-+/*%=<>&!^|~,(])(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)',
|
599
|
+
bygroups(Text, String.Other, None)),
|
600
|
+
# and because of fixed width lookbehinds the whole thing a
|
601
|
+
# second time for line startings...
|
602
|
+
(r'^(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)',
|
603
|
+
bygroups(Text, String.Other, None)),
|
604
|
+
# all regular fancy strings without qsw
|
605
|
+
(r'(%([^a-zA-Z0-9\s]))((?:\\\2|(?!\2).)*)(\2)',
|
606
|
+
intp_string_callback),
|
607
|
+
]
|
608
|
+
|
609
|
+
return states
|
610
|
+
|
611
|
+
tokens = {
|
612
|
+
'root': [
|
613
|
+
(r'#.*?$', Comment.Single),
|
614
|
+
(r'=begin\s.*?\n=end.*?$', Comment.Multiline),
|
615
|
+
# keywords
|
616
|
+
(r'(BEGIN|END|alias|begin|break|case|defined\?|'
|
617
|
+
r'do|else|elsif|end|ensure|for|if|in|next|redo|'
|
618
|
+
r'rescue|raise|retry|return|super|then|undef|unless|until|when|'
|
619
|
+
r'while|yield)\b', Keyword),
|
620
|
+
# start of function, class and module names
|
621
|
+
(r'(module)(\s+)([a-zA-Z_][a-zA-Z0-9_]*'
|
622
|
+
r'(?:::[a-zA-Z_][a-zA-Z0-9_]*)*)',
|
623
|
+
bygroups(Keyword, Text, Name.Namespace)),
|
624
|
+
(r'(def)(\s+)', bygroups(Keyword, Text), 'funcname'),
|
625
|
+
(r'def(?=[*%&^`~+-/\[<>=])', Keyword, 'funcname'),
|
626
|
+
(r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
|
627
|
+
# special methods
|
628
|
+
(r'(initialize|new|loop|include|extend|raise|attr_reader|'
|
629
|
+
r'attr_writer|attr_accessor|attr|catch|throw|private|'
|
630
|
+
r'module_function|public|protected|true|false|nil)\b',
|
631
|
+
Keyword.Pseudo),
|
632
|
+
(r'(not|and|or)\b', Operator.Word),
|
633
|
+
(r'(autoload|block_given|const_defined|eql|equal|frozen|include|'
|
634
|
+
r'instance_of|is_a|iterator|kind_of|method_defined|nil|'
|
635
|
+
r'private_method_defined|protected_method_defined|'
|
636
|
+
r'public_method_defined|respond_to|tainted)\?', Name.Builtin),
|
637
|
+
(r'(chomp|chop|exit|gsub|sub)!', Name.Builtin),
|
638
|
+
(r'(?<!\.)(Array|Float|Integer|String|__id__|__send__|abort|'
|
639
|
+
r'ancestors|at_exit|autoload|binding|callcc|caller|'
|
640
|
+
r'catch|chomp|chop|class_eval|class_variables|'
|
641
|
+
r'clone|const_defined\?|const_get|const_missing|const_set|'
|
642
|
+
r'constants|display|dup|eval|exec|exit|extend|fail|fork|'
|
643
|
+
r'format|freeze|getc|gets|global_variables|gsub|'
|
644
|
+
r'hash|id|included_modules|inspect|instance_eval|'
|
645
|
+
r'instance_method|instance_methods|'
|
646
|
+
r'instance_variable_get|instance_variable_set|instance_variables|'
|
647
|
+
r'lambda|load|local_variables|loop|'
|
648
|
+
r'method|method_missing|methods|module_eval|name|'
|
649
|
+
r'object_id|open|p|print|printf|private_class_method|'
|
650
|
+
r'private_instance_methods|'
|
651
|
+
r'private_methods|proc|protected_instance_methods|'
|
652
|
+
r'protected_methods|public_class_method|'
|
653
|
+
r'public_instance_methods|public_methods|'
|
654
|
+
r'putc|puts|raise|rand|readline|readlines|require|'
|
655
|
+
r'scan|select|self|send|set_trace_func|singleton_methods|sleep|'
|
656
|
+
r'split|sprintf|srand|sub|syscall|system|taint|'
|
657
|
+
r'test|throw|to_a|to_s|trace_var|trap|untaint|untrace_var|'
|
658
|
+
r'warn)\b', Name.Builtin),
|
659
|
+
(r'__(FILE|LINE)__\b', Name.Builtin.Pseudo),
|
660
|
+
# normal heredocs
|
661
|
+
(r'(?<!\w)(<<-?)(["`\']?)([a-zA-Z_]\w*)(\2)(.*?\n)',
|
662
|
+
heredoc_callback),
|
663
|
+
# empty string heredocs
|
664
|
+
(r'(<<-?)("|\')()(\2)(.*?\n)', heredoc_callback),
|
665
|
+
(r'__END__', Comment.Preproc, 'end-part'),
|
666
|
+
# multiline regex (after keywords or assignments)
|
667
|
+
(r'(?:^|(?<=[=<>~!:])|'
|
668
|
+
r'(?<=(?:\s|;)when\s)|'
|
669
|
+
r'(?<=(?:\s|;)or\s)|'
|
670
|
+
r'(?<=(?:\s|;)and\s)|'
|
671
|
+
r'(?<=(?:\s|;|\.)index\s)|'
|
672
|
+
r'(?<=(?:\s|;|\.)scan\s)|'
|
673
|
+
r'(?<=(?:\s|;|\.)sub\s)|'
|
674
|
+
r'(?<=(?:\s|;|\.)sub!\s)|'
|
675
|
+
r'(?<=(?:\s|;|\.)gsub\s)|'
|
676
|
+
r'(?<=(?:\s|;|\.)gsub!\s)|'
|
677
|
+
r'(?<=(?:\s|;|\.)match\s)|'
|
678
|
+
r'(?<=(?:\s|;)if\s)|'
|
679
|
+
r'(?<=(?:\s|;)elsif\s)|'
|
680
|
+
r'(?<=^when\s)|'
|
681
|
+
r'(?<=^index\s)|'
|
682
|
+
r'(?<=^scan\s)|'
|
683
|
+
r'(?<=^sub\s)|'
|
684
|
+
r'(?<=^gsub\s)|'
|
685
|
+
r'(?<=^sub!\s)|'
|
686
|
+
r'(?<=^gsub!\s)|'
|
687
|
+
r'(?<=^match\s)|'
|
688
|
+
r'(?<=^if\s)|'
|
689
|
+
r'(?<=^elsif\s)'
|
690
|
+
r')(\s*)(/)', bygroups(Text, String.Regex), 'multiline-regex'),
|
691
|
+
# multiline regex (in method calls or subscripts)
|
692
|
+
(r'(?<=\(|,|\[)/', String.Regex, 'multiline-regex'),
|
693
|
+
# multiline regex (this time the funny no whitespace rule)
|
694
|
+
(r'(\s+)(/)(?![\s=])', bygroups(Text, String.Regex),
|
695
|
+
'multiline-regex'),
|
696
|
+
# lex numbers and ignore following regular expressions which
|
697
|
+
# are division operators in fact (grrrr. i hate that. any
|
698
|
+
# better ideas?)
|
699
|
+
# since pygments 0.7 we also eat a "?" operator after numbers
|
700
|
+
# so that the char operator does not work. Chars are not allowed
|
701
|
+
# there so that you can use the ternary operator.
|
702
|
+
# stupid example:
|
703
|
+
# x>=0?n[x]:""
|
704
|
+
(r'(0_?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?',
|
705
|
+
bygroups(Number.Oct, Text, Operator)),
|
706
|
+
(r'(0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?',
|
707
|
+
bygroups(Number.Hex, Text, Operator)),
|
708
|
+
(r'(0b[01]+(?:_[01]+)*)(\s*)([/?])?',
|
709
|
+
bygroups(Number.Bin, Text, Operator)),
|
710
|
+
(r'([\d]+(?:_\d+)*)(\s*)([/?])?',
|
711
|
+
bygroups(Number.Integer, Text, Operator)),
|
712
|
+
# Names
|
713
|
+
(r'@@[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable.Class),
|
714
|
+
(r'@[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable.Instance),
|
715
|
+
(r'\$[a-zA-Z0-9_]+', Name.Variable.Global),
|
716
|
+
(r'\$[!@&`\'+~=/\\,;.<>_*$?:"]', Name.Variable.Global),
|
717
|
+
(r'\$-[0adFiIlpvw]', Name.Variable.Global),
|
718
|
+
(r'::', Operator),
|
719
|
+
include('strings'),
|
720
|
+
# chars
|
721
|
+
(r'\?(\\[MC]-)*' # modifiers
|
722
|
+
r'(\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})|\S)'
|
723
|
+
r'(?!\w)',
|
724
|
+
String.Char),
|
725
|
+
(r'[A-Z][a-zA-Z0-9_]+', Name.Constant),
|
726
|
+
# this is needed because ruby attributes can look
|
727
|
+
# like keywords (class) or like this: ` ?!?
|
728
|
+
(r'(\.|::)([a-zA-Z_]\w*[\!\?]?|[*%&^`~+-/\[<>=])',
|
729
|
+
bygroups(Operator, Name)),
|
730
|
+
(r'[a-zA-Z_]\w*[\!\?]?', Name),
|
731
|
+
(r'(\[|\]|\*\*|<<?|>>?|>=|<=|<=>|=~|={3}|'
|
732
|
+
r'!~|&&?|\|\||\.{1,3})', Operator),
|
733
|
+
(r'[-+/*%=<>&!^|~]=?', Operator),
|
734
|
+
(r'[(){};,/?:\\]', Punctuation),
|
735
|
+
(r'\s+', Text)
|
736
|
+
],
|
737
|
+
'funcname': [
|
738
|
+
(r'\(', Punctuation, 'defexpr'),
|
739
|
+
(r'(?:([a-zA-Z_][a-zA-Z0-9_]*)(\.))?'
|
740
|
+
r'([a-zA-Z_]\w*[\!\?]?|\*\*?|[-+]@?|'
|
741
|
+
r'[/%&|^`~]|\[\]=?|<<|>>|<=?>|>=?|===?)',
|
742
|
+
bygroups(Name.Class, Operator, Name.Function), '#pop'),
|
743
|
+
(r'', Text, '#pop')
|
744
|
+
],
|
745
|
+
'classname': [
|
746
|
+
(r'\(', Punctuation, 'defexpr'),
|
747
|
+
(r'<<', Operator, '#pop'),
|
748
|
+
(r'[A-Z_]\w*', Name.Class, '#pop'),
|
749
|
+
(r'', Text, '#pop')
|
750
|
+
],
|
751
|
+
'defexpr': [
|
752
|
+
(r'(\))(\.|::)?', bygroups(Punctuation, Operator), '#pop'),
|
753
|
+
(r'\(', Operator, '#push'),
|
754
|
+
include('root')
|
755
|
+
],
|
756
|
+
'in-intp': [
|
757
|
+
('}', String.Interpol, '#pop'),
|
758
|
+
include('root'),
|
759
|
+
],
|
760
|
+
'string-intp': [
|
761
|
+
(r'#{', String.Interpol, 'in-intp'),
|
762
|
+
(r'#@@?[a-zA-Z_][a-zA-Z0-9_]*', String.Interpol),
|
763
|
+
(r'#\$[a-zA-Z_][a-zA-Z0-9_]*', String.Interpol)
|
764
|
+
],
|
765
|
+
'string-intp-escaped': [
|
766
|
+
include('string-intp'),
|
767
|
+
(r'\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})',
|
768
|
+
String.Escape)
|
769
|
+
],
|
770
|
+
'interpolated-regex': [
|
771
|
+
include('string-intp'),
|
772
|
+
(r'[\\#]', String.Regex),
|
773
|
+
(r'[^\\#]+', String.Regex),
|
774
|
+
],
|
775
|
+
'interpolated-string': [
|
776
|
+
include('string-intp'),
|
777
|
+
(r'[\\#]', String.Other),
|
778
|
+
(r'[^\\#]+', String.Other),
|
779
|
+
],
|
780
|
+
'multiline-regex': [
|
781
|
+
include('string-intp'),
|
782
|
+
(r'\\\\', String.Regex),
|
783
|
+
(r'\\/', String.Regex),
|
784
|
+
(r'[\\#]', String.Regex),
|
785
|
+
(r'[^\\/#]+', String.Regex),
|
786
|
+
(r'/[mixounse]*', String.Regex, '#pop'),
|
787
|
+
],
|
788
|
+
'end-part': [
|
789
|
+
(r'.+', Comment.Preproc, '#pop')
|
790
|
+
]
|
791
|
+
}
|
792
|
+
tokens.update(gen_rubystrings_rules())
|
793
|
+
|
794
|
+
def analyse_text(text):
|
795
|
+
return shebang_matches(text, r'ruby(1\.\d)?')
|
796
|
+
|
797
|
+
|
798
|
+
class RubyConsoleLexer(Lexer):
|
799
|
+
"""
|
800
|
+
For Ruby interactive console (**irb**) output like:
|
801
|
+
|
802
|
+
.. sourcecode:: rbcon
|
803
|
+
|
804
|
+
irb(main):001:0> a = 1
|
805
|
+
=> 1
|
806
|
+
irb(main):002:0> puts a
|
807
|
+
1
|
808
|
+
=> nil
|
809
|
+
"""
|
810
|
+
name = 'Ruby irb session'
|
811
|
+
aliases = ['rbcon', 'irb']
|
812
|
+
mimetypes = ['text/x-ruby-shellsession']
|
813
|
+
|
814
|
+
_prompt_re = re.compile('irb\([a-zA-Z_][a-zA-Z0-9_]*\):\d{3}:\d+[>*"\'] '
|
815
|
+
'|>> |\?> ')
|
816
|
+
|
817
|
+
def get_tokens_unprocessed(self, text):
|
818
|
+
rblexer = RubyLexer(**self.options)
|
819
|
+
|
820
|
+
curcode = ''
|
821
|
+
insertions = []
|
822
|
+
for match in line_re.finditer(text):
|
823
|
+
line = match.group()
|
824
|
+
m = self._prompt_re.match(line)
|
825
|
+
if m is not None:
|
826
|
+
end = m.end()
|
827
|
+
insertions.append((len(curcode),
|
828
|
+
[(0, Generic.Prompt, line[:end])]))
|
829
|
+
curcode += line[end:]
|
830
|
+
else:
|
831
|
+
if curcode:
|
832
|
+
for item in do_insertions(insertions,
|
833
|
+
rblexer.get_tokens_unprocessed(curcode)):
|
834
|
+
yield item
|
835
|
+
curcode = ''
|
836
|
+
insertions = []
|
837
|
+
yield match.start(), Generic.Output, line
|
838
|
+
if curcode:
|
839
|
+
for item in do_insertions(insertions,
|
840
|
+
rblexer.get_tokens_unprocessed(curcode)):
|
841
|
+
yield item
|
842
|
+
|
843
|
+
|
844
|
+
class PerlLexer(RegexLexer):
|
845
|
+
"""
|
846
|
+
For `Perl <http://www.perl.org>`_ source code.
|
847
|
+
"""
|
848
|
+
|
849
|
+
name = 'Perl'
|
850
|
+
aliases = ['perl', 'pl']
|
851
|
+
filenames = ['*.pl', '*.pm']
|
852
|
+
mimetypes = ['text/x-perl', 'application/x-perl']
|
853
|
+
|
854
|
+
flags = re.DOTALL | re.MULTILINE
|
855
|
+
# TODO: give this to a perl guy who knows how to parse perl...
|
856
|
+
tokens = {
|
857
|
+
'balanced-regex': [
|
858
|
+
(r'/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*', String.Regex, '#pop'),
|
859
|
+
(r'!(\\\\|\\[^\\]|[^\\!])*![egimosx]*', String.Regex, '#pop'),
|
860
|
+
(r'\\(\\\\|[^\\])*\\[egimosx]*', String.Regex, '#pop'),
|
861
|
+
(r'{(\\\\|\\[^\\]|[^\\}])*}[egimosx]*', String.Regex, '#pop'),
|
862
|
+
(r'<(\\\\|\\[^\\]|[^\\>])*>[egimosx]*', String.Regex, '#pop'),
|
863
|
+
(r'\[(\\\\|\\[^\\]|[^\\\]])*\][egimosx]*', String.Regex, '#pop'),
|
864
|
+
(r'\((\\\\|\\[^\\]|[^\\\)])*\)[egimosx]*', String.Regex, '#pop'),
|
865
|
+
(r'@(\\\\|\\[^\\]|[^\\\@])*@[egimosx]*', String.Regex, '#pop'),
|
866
|
+
(r'%(\\\\|\\[^\\]|[^\\\%])*%[egimosx]*', String.Regex, '#pop'),
|
867
|
+
(r'\$(\\\\|\\[^\\]|[^\\\$])*\$[egimosx]*', String.Regex, '#pop'),
|
868
|
+
],
|
869
|
+
'root': [
|
870
|
+
(r'\#.*?$', Comment.Single),
|
871
|
+
(r'^=[a-zA-Z0-9]+\s+.*?\n=cut', Comment.Multiline),
|
872
|
+
(r'(case|continue|do|else|elsif|for|foreach|if|last|my|'
|
873
|
+
r'next|our|redo|reset|then|unless|until|while|use|'
|
874
|
+
r'print|new|BEGIN|CHECK|INIT|END|return)\b', Keyword),
|
875
|
+
(r'(format)(\s+)([a-zA-Z0-9_]+)(\s*)(=)(\s*\n)',
|
876
|
+
bygroups(Keyword, Text, Name, Text, Punctuation, Text), 'format'),
|
877
|
+
(r'(eq|lt|gt|le|ge|ne|not|and|or|cmp)\b', Operator.Word),
|
878
|
+
# common delimiters
|
879
|
+
(r's/(\\\\|\\[^\\]|[^\\/])*/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*',
|
880
|
+
String.Regex),
|
881
|
+
(r's!(\\\\|\\!|[^!])*!(\\\\|\\!|[^!])*![egimosx]*', String.Regex),
|
882
|
+
(r's\\(\\\\|[^\\])*\\(\\\\|[^\\])*\\[egimosx]*', String.Regex),
|
883
|
+
(r's@(\\\\|\\[^\\]|[^\\@])*@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*',
|
884
|
+
String.Regex),
|
885
|
+
(r's%(\\\\|\\[^\\]|[^\\%])*%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*',
|
886
|
+
String.Regex),
|
887
|
+
# balanced delimiters
|
888
|
+
(r's{(\\\\|\\[^\\]|[^\\}])*}\s*', String.Regex, 'balanced-regex'),
|
889
|
+
(r's<(\\\\|\\[^\\]|[^\\>])*>\s*', String.Regex, 'balanced-regex'),
|
890
|
+
(r's\[(\\\\|\\[^\\]|[^\\\]])*\]\s*', String.Regex,
|
891
|
+
'balanced-regex'),
|
892
|
+
(r's\((\\\\|\\[^\\]|[^\\\)])*\)\s*', String.Regex,
|
893
|
+
'balanced-regex'),
|
894
|
+
|
895
|
+
(r'm?/(\\\\|\\[^\\]|[^\\/\n])*/[gcimosx]*', String.Regex),
|
896
|
+
(r'm(?=[/!\\{<\[\(@%\$])', String.Regex, 'balanced-regex'),
|
897
|
+
(r'((?<==~)|(?<=\())\s*/(\\\\|\\[^\\]|[^\\/])*/[gcimosx]*',
|
898
|
+
String.Regex),
|
899
|
+
(r'\s+', Text),
|
900
|
+
(r'(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|'
|
901
|
+
r'chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|'
|
902
|
+
r'continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|'
|
903
|
+
r'dump|each|endgrent|endhostent|endnetent|endprotoent|'
|
904
|
+
r'endpwent|endservent|eof|eval|exec|exists|exit|exp|fcntl|'
|
905
|
+
r'fileno|flock|fork|format|formline|getc|getgrent|getgrgid|'
|
906
|
+
r'getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|'
|
907
|
+
r'getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|'
|
908
|
+
r'getppid|getpriority|getprotobyname|getprotobynumber|'
|
909
|
+
r'getprotoent|getpwent|getpwnam|getpwuid|getservbyname|'
|
910
|
+
r'getservbyport|getservent|getsockname|getsockopt|glob|gmtime|'
|
911
|
+
r'goto|grep|hex|import|index|int|ioctl|join|keys|kill|last|'
|
912
|
+
r'lc|lcfirst|length|link|listen|local|localtime|log|lstat|'
|
913
|
+
r'map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|'
|
914
|
+
r'opendir|ord|our|pack|package|pipe|pop|pos|printf|'
|
915
|
+
r'prototype|push|quotemeta|rand|read|readdir|'
|
916
|
+
r'readline|readlink|readpipe|recv|redo|ref|rename|require|'
|
917
|
+
r'reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|'
|
918
|
+
r'select|semctl|semget|semop|send|setgrent|sethostent|setnetent|'
|
919
|
+
r'setpgrp|setpriority|setprotoent|setpwent|setservent|'
|
920
|
+
r'setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|'
|
921
|
+
r'sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|'
|
922
|
+
r'srand|stat|study|substr|symlink|syscall|sysopen|sysread|'
|
923
|
+
r'sysseek|system|syswrite|tell|telldir|tie|tied|time|times|tr|'
|
924
|
+
r'truncate|uc|ucfirst|umask|undef|unlink|unpack|unshift|untie|'
|
925
|
+
r'utime|values|vec|wait|waitpid|wantarray|warn|write'
|
926
|
+
r')\b', Name.Builtin),
|
927
|
+
(r'((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b', Name.Builtin.Pseudo),
|
928
|
+
(r'<<([\'"]?)([a-zA-Z_][a-zA-Z0-9_]*)\1;?\n.*?\n\2\n', String),
|
929
|
+
(r'__END__', Comment.Preproc, 'end-part'),
|
930
|
+
(r'\$\^[ADEFHILMOPSTWX]', Name.Variable.Global),
|
931
|
+
(r"\$[\\\"\[\]'&`+*.,;=%~?@$!<>(^|/-](?!\w)", Name.Variable.Global),
|
932
|
+
(r'[$@%#]+', Name.Variable, 'varname'),
|
933
|
+
(r'0_?[0-7]+(_[0-7]+)*', Number.Oct),
|
934
|
+
(r'0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*', Number.Hex),
|
935
|
+
(r'0b[01]+(_[01]+)*', Number.Bin),
|
936
|
+
(r'(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?',
|
937
|
+
Number.Float),
|
938
|
+
(r'(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*', Number.Float),
|
939
|
+
(r'\d+(_\d+)*', Number.Integer),
|
940
|
+
(r"'(\\\\|\\[^\\]|[^'\\])*'", String),
|
941
|
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String),
|
942
|
+
(r'`(\\\\|\\[^\\]|[^`\\])*`', String.Backtick),
|
943
|
+
(r'<([^\s>]+)>', String.Regex),
|
944
|
+
(r'(q|qq|qw|qr|qx)\{', String.Other, 'cb-string'),
|
945
|
+
(r'(q|qq|qw|qr|qx)\(', String.Other, 'rb-string'),
|
946
|
+
(r'(q|qq|qw|qr|qx)\[', String.Other, 'sb-string'),
|
947
|
+
(r'(q|qq|qw|qr|qx)\<', String.Other, 'lt-string'),
|
948
|
+
(r'(q|qq|qw|qr|qx)([^a-zA-Z0-9])(.|\n)*?\2', String.Other),
|
949
|
+
(r'package\s+', Keyword, 'modulename'),
|
950
|
+
(r'sub\s+', Keyword, 'funcname'),
|
951
|
+
(r'(\[\]|\*\*|::|<<|>>|>=|<=>|<=|={3}|!=|=~|'
|
952
|
+
r'!~|&&?|\|\||\.{1,3})', Operator),
|
953
|
+
(r'[-+/*%=<>&^|!\\~]=?', Operator),
|
954
|
+
(r'[\(\)\[\]:;,<>/\?\{\}]', Punctuation), # yes, there's no shortage
|
955
|
+
# of punctuation in Perl!
|
956
|
+
(r'(?=\w)', Name, 'name'),
|
957
|
+
],
|
958
|
+
'format': [
|
959
|
+
(r'\.\n', String.Interpol, '#pop'),
|
960
|
+
(r'[^\n]*\n', String.Interpol),
|
961
|
+
],
|
962
|
+
'varname': [
|
963
|
+
(r'\s+', Text),
|
964
|
+
(r'\{', Punctuation, '#pop'), # hash syntax?
|
965
|
+
(r'\)|,', Punctuation, '#pop'), # argument specifier
|
966
|
+
(r'[a-zA-Z0-9_]+::', Name.Namespace),
|
967
|
+
(r'[a-zA-Z0-9_:]+', Name.Variable, '#pop'),
|
968
|
+
],
|
969
|
+
'name': [
|
970
|
+
(r'[a-zA-Z0-9_]+::', Name.Namespace),
|
971
|
+
(r'[a-zA-Z0-9_:]+', Name, '#pop'),
|
972
|
+
(r'[A-Z_]+(?=[^a-zA-Z0-9_])', Name.Constant, '#pop'),
|
973
|
+
(r'(?=[^a-zA-Z0-9_])', Text, '#pop'),
|
974
|
+
],
|
975
|
+
'modulename': [
|
976
|
+
(r'[a-zA-Z_]\w*', Name.Namespace, '#pop')
|
977
|
+
],
|
978
|
+
'funcname': [
|
979
|
+
(r'[a-zA-Z_]\w*[\!\?]?', Name.Function),
|
980
|
+
(r'\s+', Text),
|
981
|
+
# argument declaration
|
982
|
+
(r'(\([$@%]*\))(\s*)', bygroups(Punctuation, Text)),
|
983
|
+
(r'.*?{', Punctuation, '#pop'),
|
984
|
+
(r';', Punctuation, '#pop'),
|
985
|
+
],
|
986
|
+
'cb-string': [
|
987
|
+
(r'\\[\{\}\\]', String.Other),
|
988
|
+
(r'\\', String.Other),
|
989
|
+
(r'\{', String.Other, 'cb-string'),
|
990
|
+
(r'\}', String.Other, '#pop'),
|
991
|
+
(r'[^\{\}\\]+', String.Other)
|
992
|
+
],
|
993
|
+
'rb-string': [
|
994
|
+
(r'\\[\(\)\\]', String.Other),
|
995
|
+
(r'\\', String.Other),
|
996
|
+
(r'\(', String.Other, 'rb-string'),
|
997
|
+
(r'\)', String.Other, '#pop'),
|
998
|
+
(r'[^\(\)]+', String.Other)
|
999
|
+
],
|
1000
|
+
'sb-string': [
|
1001
|
+
(r'\\[\[\]\\]', String.Other),
|
1002
|
+
(r'\\', String.Other),
|
1003
|
+
(r'\[', String.Other, 'sb-string'),
|
1004
|
+
(r'\]', String.Other, '#pop'),
|
1005
|
+
(r'[^\[\]]+', String.Other)
|
1006
|
+
],
|
1007
|
+
'lt-string': [
|
1008
|
+
(r'\\[\<\>\\]', String.Other),
|
1009
|
+
(r'\\', String.Other),
|
1010
|
+
(r'\<', String.Other, 'lt-string'),
|
1011
|
+
(r'\>', String.Other, '#pop'),
|
1012
|
+
(r'[^\<\>]+', String.Other)
|
1013
|
+
],
|
1014
|
+
'end-part': [
|
1015
|
+
(r'.+', Comment.Preproc, '#pop')
|
1016
|
+
]
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
def analyse_text(text):
|
1020
|
+
if shebang_matches(text, r'perl'):
|
1021
|
+
return True
|
1022
|
+
if 'my $' in text:
|
1023
|
+
return 0.9
|
1024
|
+
return 0.1 # who knows, might still be perl!
|
1025
|
+
|
1026
|
+
|
1027
|
+
class LuaLexer(RegexLexer):
|
1028
|
+
"""
|
1029
|
+
For `Lua <http://www.lua.org>`_ source code.
|
1030
|
+
|
1031
|
+
Additional options accepted:
|
1032
|
+
|
1033
|
+
`func_name_highlighting`
|
1034
|
+
If given and ``True``, highlight builtin function names
|
1035
|
+
(default: ``True``).
|
1036
|
+
`disabled_modules`
|
1037
|
+
If given, must be a list of module names whose function names
|
1038
|
+
should not be highlighted. By default all modules are highlighted.
|
1039
|
+
|
1040
|
+
To get a list of allowed modules have a look into the
|
1041
|
+
`_luabuiltins` module:
|
1042
|
+
|
1043
|
+
.. sourcecode:: pycon
|
1044
|
+
|
1045
|
+
>>> from pygments.lexers._luabuiltins import MODULES
|
1046
|
+
>>> MODULES.keys()
|
1047
|
+
['string', 'coroutine', 'modules', 'io', 'basic', ...]
|
1048
|
+
"""
|
1049
|
+
|
1050
|
+
name = 'Lua'
|
1051
|
+
aliases = ['lua']
|
1052
|
+
filenames = ['*.lua', '*.wlua']
|
1053
|
+
mimetypes = ['text/x-lua', 'application/x-lua']
|
1054
|
+
|
1055
|
+
tokens = {
|
1056
|
+
'root': [
|
1057
|
+
# lua allows a file to start with a shebang
|
1058
|
+
(r'#!(.*?)$', Comment.Preproc),
|
1059
|
+
(r'', Text, 'base'),
|
1060
|
+
],
|
1061
|
+
'base': [
|
1062
|
+
(r'(?s)--\[(=*)\[.*?\]\1\]', Comment.Multiline),
|
1063
|
+
('--.*$', Comment.Single),
|
1064
|
+
|
1065
|
+
(r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float),
|
1066
|
+
(r'(?i)\d+e[+-]?\d+', Number.Float),
|
1067
|
+
('(?i)0x[0-9a-f]*', Number.Hex),
|
1068
|
+
(r'\d+', Number.Integer),
|
1069
|
+
|
1070
|
+
(r'\n', Text),
|
1071
|
+
(r'[^\S\n]', Text),
|
1072
|
+
# multiline strings
|
1073
|
+
(r'(?s)\[(=*)\[.*?\]\1\]', String),
|
1074
|
+
|
1075
|
+
(r'(==|~=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>#])', Operator),
|
1076
|
+
(r'[\[\]\{\}\(\)\.,:;]', Punctuation),
|
1077
|
+
(r'(and|or|not)\b', Operator.Word),
|
1078
|
+
|
1079
|
+
('(break|do|else|elseif|end|for|if|in|repeat|return|then|until|'
|
1080
|
+
r'while)\b', Keyword),
|
1081
|
+
(r'(local)\b', Keyword.Declaration),
|
1082
|
+
(r'(true|false|nil)\b', Keyword.Constant),
|
1083
|
+
|
1084
|
+
(r'(function)\b', Keyword, 'funcname'),
|
1085
|
+
|
1086
|
+
(r'[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?', Name),
|
1087
|
+
|
1088
|
+
("'", String.Single, combined('stringescape', 'sqs')),
|
1089
|
+
('"', String.Double, combined('stringescape', 'dqs'))
|
1090
|
+
],
|
1091
|
+
|
1092
|
+
'funcname': [
|
1093
|
+
(r'\s+', Text),
|
1094
|
+
('(?:([A-Za-z_][A-Za-z0-9_]*)(\.))?([A-Za-z_][A-Za-z0-9_]*)',
|
1095
|
+
bygroups(Name.Class, Punctuation, Name.Function), '#pop'),
|
1096
|
+
# inline function
|
1097
|
+
('\(', Punctuation, '#pop'),
|
1098
|
+
],
|
1099
|
+
|
1100
|
+
# if I understand correctly, every character is valid in a lua string,
|
1101
|
+
# so this state is only for later corrections
|
1102
|
+
'string': [
|
1103
|
+
('.', String)
|
1104
|
+
],
|
1105
|
+
|
1106
|
+
'stringescape': [
|
1107
|
+
(r'''\\([abfnrtv\\"']|\d{1,3})''', String.Escape)
|
1108
|
+
],
|
1109
|
+
|
1110
|
+
'sqs': [
|
1111
|
+
("'", String, '#pop'),
|
1112
|
+
include('string')
|
1113
|
+
],
|
1114
|
+
|
1115
|
+
'dqs': [
|
1116
|
+
('"', String, '#pop'),
|
1117
|
+
include('string')
|
1118
|
+
]
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
def __init__(self, **options):
|
1122
|
+
self.func_name_highlighting = get_bool_opt(
|
1123
|
+
options, 'func_name_highlighting', True)
|
1124
|
+
self.disabled_modules = get_list_opt(options, 'disabled_modules', [])
|
1125
|
+
|
1126
|
+
self._functions = set()
|
1127
|
+
if self.func_name_highlighting:
|
1128
|
+
from pygments.lexers._luabuiltins import MODULES
|
1129
|
+
for mod, func in MODULES.iteritems():
|
1130
|
+
if mod not in self.disabled_modules:
|
1131
|
+
self._functions.update(func)
|
1132
|
+
RegexLexer.__init__(self, **options)
|
1133
|
+
|
1134
|
+
def get_tokens_unprocessed(self, text):
|
1135
|
+
for index, token, value in \
|
1136
|
+
RegexLexer.get_tokens_unprocessed(self, text):
|
1137
|
+
if token is Name:
|
1138
|
+
if value in self._functions:
|
1139
|
+
yield index, Name.Builtin, value
|
1140
|
+
continue
|
1141
|
+
elif '.' in value:
|
1142
|
+
a, b = value.split('.')
|
1143
|
+
yield index, Name, a
|
1144
|
+
yield index + len(a), Punctuation, u'.'
|
1145
|
+
yield index + len(a) + 1, Name, b
|
1146
|
+
continue
|
1147
|
+
yield index, token, value
|
1148
|
+
|
1149
|
+
|
1150
|
+
class MoonScriptLexer(LuaLexer):
|
1151
|
+
"""
|
1152
|
+
For `MoonScript <http://moonscript.org.org>`_ source code.
|
1153
|
+
|
1154
|
+
*New in Pygments 1.5.*
|
1155
|
+
"""
|
1156
|
+
|
1157
|
+
name = "MoonScript"
|
1158
|
+
aliases = ["moon", "moonscript"]
|
1159
|
+
filenames = ["*.moon"]
|
1160
|
+
mimetypes = ['text/x-moonscript', 'application/x-moonscript']
|
1161
|
+
|
1162
|
+
tokens = {
|
1163
|
+
'root': [
|
1164
|
+
(r'#!(.*?)$', Comment.Preproc),
|
1165
|
+
(r'', Text, 'base'),
|
1166
|
+
],
|
1167
|
+
'base': [
|
1168
|
+
('--.*$', Comment.Single),
|
1169
|
+
(r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float),
|
1170
|
+
(r'(?i)\d+e[+-]?\d+', Number.Float),
|
1171
|
+
(r'(?i)0x[0-9a-f]*', Number.Hex),
|
1172
|
+
(r'\d+', Number.Integer),
|
1173
|
+
(r'\n', Text),
|
1174
|
+
(r'[^\S\n]+', Text),
|
1175
|
+
(r'(?s)\[(=*)\[.*?\]\1\]', String),
|
1176
|
+
(r'(->|=>)', Name.Function),
|
1177
|
+
(r':[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable),
|
1178
|
+
(r'(==|!=|~=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>#!.\\:])', Operator),
|
1179
|
+
(r'[;,]', Punctuation),
|
1180
|
+
(r'[\[\]\{\}\(\)]', Keyword.Type),
|
1181
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Variable),
|
1182
|
+
(r"(class|extends|if|then|super|do|with|import|export|"
|
1183
|
+
r"while|elseif|return|for|in|from|when|using|else|"
|
1184
|
+
r"and|or|not|switch|break)\b", Keyword),
|
1185
|
+
(r'(true|false|nil)\b', Keyword.Constant),
|
1186
|
+
(r'(and|or|not)\b', Operator.Word),
|
1187
|
+
(r'(self)\b', Name.Builtin.Pseudo),
|
1188
|
+
(r'@@?([a-zA-Z_][a-zA-Z0-9_]*)?', Name.Variable.Class),
|
1189
|
+
(r'[A-Z]\w*', Name.Class), # proper name
|
1190
|
+
(r'[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?', Name),
|
1191
|
+
("'", String.Single, combined('stringescape', 'sqs')),
|
1192
|
+
('"', String.Double, combined('stringescape', 'dqs'))
|
1193
|
+
],
|
1194
|
+
'stringescape': [
|
1195
|
+
(r'''\\([abfnrtv\\"']|\d{1,3})''', String.Escape)
|
1196
|
+
],
|
1197
|
+
'sqs': [
|
1198
|
+
("'", String.Single, '#pop'),
|
1199
|
+
(".", String)
|
1200
|
+
],
|
1201
|
+
'dqs': [
|
1202
|
+
('"', String.Double, '#pop'),
|
1203
|
+
(".", String)
|
1204
|
+
]
|
1205
|
+
}
|
1206
|
+
|
1207
|
+
def get_tokens_unprocessed(self, text):
|
1208
|
+
# set . as Operator instead of Punctuation
|
1209
|
+
for index, token, value in \
|
1210
|
+
LuaLexer.get_tokens_unprocessed(self, text):
|
1211
|
+
if token == Punctuation and value == ".":
|
1212
|
+
token = Operator
|
1213
|
+
yield index, token, value
|
1214
|
+
|
1215
|
+
|
1216
|
+
class CrocLexer(RegexLexer):
|
1217
|
+
"""
|
1218
|
+
For `Croc <http://jfbillingsley.com/croc>`_ source.
|
1219
|
+
"""
|
1220
|
+
name = 'Croc'
|
1221
|
+
filenames = ['*.croc']
|
1222
|
+
aliases = ['croc']
|
1223
|
+
mimetypes = ['text/x-crocsrc']
|
1224
|
+
|
1225
|
+
tokens = {
|
1226
|
+
'root': [
|
1227
|
+
(r'\n', Text),
|
1228
|
+
(r'\s+', Text),
|
1229
|
+
# Comments
|
1230
|
+
(r'//(.*?)\n', Comment.Single),
|
1231
|
+
(r'/\*', Comment.Multiline, 'nestedcomment'),
|
1232
|
+
# Keywords
|
1233
|
+
(r'(as|assert|break|case|catch|class|continue|default'
|
1234
|
+
r'|do|else|finally|for|foreach|function|global|namespace'
|
1235
|
+
r'|if|import|in|is|local|module|return|scope|super|switch'
|
1236
|
+
r'|this|throw|try|vararg|while|with|yield)\b', Keyword),
|
1237
|
+
(r'(false|true|null)\b', Keyword.Constant),
|
1238
|
+
# FloatLiteral
|
1239
|
+
(r'([0-9][0-9_]*)(?=[.eE])(\.[0-9][0-9_]*)?([eE][+\-]?[0-9_]+)?',
|
1240
|
+
Number.Float),
|
1241
|
+
# IntegerLiteral
|
1242
|
+
# -- Binary
|
1243
|
+
(r'0[bB][01][01_]*', Number),
|
1244
|
+
# -- Hexadecimal
|
1245
|
+
(r'0[xX][0-9a-fA-F][0-9a-fA-F_]*', Number.Hex),
|
1246
|
+
# -- Decimal
|
1247
|
+
(r'([0-9][0-9_]*)(?![.eE])', Number.Integer),
|
1248
|
+
# CharacterLiteral
|
1249
|
+
(r"""'(\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\[0-9]{1,3}"""
|
1250
|
+
r"""|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|.)'""",
|
1251
|
+
String.Char
|
1252
|
+
),
|
1253
|
+
# StringLiteral
|
1254
|
+
# -- WysiwygString
|
1255
|
+
(r'@"(""|[^"])*"', String),
|
1256
|
+
(r'@`(``|[^`])*`', String),
|
1257
|
+
(r"@'(''|[^'])*'", String),
|
1258
|
+
# -- DoubleQuotedString
|
1259
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
1260
|
+
# Tokens
|
1261
|
+
(
|
1262
|
+
r'(~=|\^=|%=|\*=|==|!=|>>>=|>>>|>>=|>>|>=|<=>|\?=|-\>'
|
1263
|
+
r'|<<=|<<|<=|\+\+|\+=|--|-=|\|\||\|=|&&|&=|\.\.|/=)'
|
1264
|
+
r'|[-/.&$@|\+<>!()\[\]{}?,;:=*%^~#\\]', Punctuation
|
1265
|
+
),
|
1266
|
+
# Identifier
|
1267
|
+
(r'[a-zA-Z_]\w*', Name),
|
1268
|
+
],
|
1269
|
+
'nestedcomment': [
|
1270
|
+
(r'[^*/]+', Comment.Multiline),
|
1271
|
+
(r'/\*', Comment.Multiline, '#push'),
|
1272
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
1273
|
+
(r'[*/]', Comment.Multiline),
|
1274
|
+
],
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
|
1278
|
+
class MiniDLexer(CrocLexer):
|
1279
|
+
"""
|
1280
|
+
For MiniD source. MiniD is now known as Croc.
|
1281
|
+
"""
|
1282
|
+
name = 'MiniD'
|
1283
|
+
filenames = ['*.md']
|
1284
|
+
aliases = ['minid']
|
1285
|
+
mimetypes = ['text/x-minidsrc']
|
1286
|
+
|
1287
|
+
|
1288
|
+
class IoLexer(RegexLexer):
|
1289
|
+
"""
|
1290
|
+
For `Io <http://iolanguage.com/>`_ (a small, prototype-based
|
1291
|
+
programming language) source.
|
1292
|
+
|
1293
|
+
*New in Pygments 0.10.*
|
1294
|
+
"""
|
1295
|
+
name = 'Io'
|
1296
|
+
filenames = ['*.io']
|
1297
|
+
aliases = ['io']
|
1298
|
+
mimetypes = ['text/x-iosrc']
|
1299
|
+
tokens = {
|
1300
|
+
'root': [
|
1301
|
+
(r'\n', Text),
|
1302
|
+
(r'\s+', Text),
|
1303
|
+
# Comments
|
1304
|
+
(r'//(.*?)\n', Comment.Single),
|
1305
|
+
(r'#(.*?)\n', Comment.Single),
|
1306
|
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
1307
|
+
(r'/\+', Comment.Multiline, 'nestedcomment'),
|
1308
|
+
# DoubleQuotedString
|
1309
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
1310
|
+
# Operators
|
1311
|
+
(r'::=|:=|=|\(|\)|;|,|\*|-|\+|>|<|@|!|/|\||\^|\.|%|&|\[|\]|\{|\}',
|
1312
|
+
Operator),
|
1313
|
+
# keywords
|
1314
|
+
(r'(clone|do|doFile|doString|method|for|if|else|elseif|then)\b',
|
1315
|
+
Keyword),
|
1316
|
+
# constants
|
1317
|
+
(r'(nil|false|true)\b', Name.Constant),
|
1318
|
+
# names
|
1319
|
+
(r'(Object|list|List|Map|args|Sequence|Coroutine|File)\b',
|
1320
|
+
Name.Builtin),
|
1321
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
1322
|
+
# numbers
|
1323
|
+
(r'(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
1324
|
+
(r'\d+', Number.Integer)
|
1325
|
+
],
|
1326
|
+
'nestedcomment': [
|
1327
|
+
(r'[^+/]+', Comment.Multiline),
|
1328
|
+
(r'/\+', Comment.Multiline, '#push'),
|
1329
|
+
(r'\+/', Comment.Multiline, '#pop'),
|
1330
|
+
(r'[+/]', Comment.Multiline),
|
1331
|
+
]
|
1332
|
+
}
|
1333
|
+
|
1334
|
+
|
1335
|
+
class TclLexer(RegexLexer):
|
1336
|
+
"""
|
1337
|
+
For Tcl source code.
|
1338
|
+
|
1339
|
+
*New in Pygments 0.10.*
|
1340
|
+
"""
|
1341
|
+
|
1342
|
+
keyword_cmds_re = (
|
1343
|
+
r'\b(after|apply|array|break|catch|continue|elseif|else|error|'
|
1344
|
+
r'eval|expr|for|foreach|global|if|namespace|proc|rename|return|'
|
1345
|
+
r'set|switch|then|trace|unset|update|uplevel|upvar|variable|'
|
1346
|
+
r'vwait|while)\b'
|
1347
|
+
)
|
1348
|
+
|
1349
|
+
builtin_cmds_re = (
|
1350
|
+
r'\b(append|bgerror|binary|cd|chan|clock|close|concat|dde|dict|'
|
1351
|
+
r'encoding|eof|exec|exit|fblocked|fconfigure|fcopy|file|'
|
1352
|
+
r'fileevent|flush|format|gets|glob|history|http|incr|info|interp|'
|
1353
|
+
r'join|lappend|lassign|lindex|linsert|list|llength|load|loadTk|'
|
1354
|
+
r'lrange|lrepeat|lreplace|lreverse|lsearch|lset|lsort|mathfunc|'
|
1355
|
+
r'mathop|memory|msgcat|open|package|pid|pkg::create|pkg_mkIndex|'
|
1356
|
+
r'platform|platform::shell|puts|pwd|re_syntax|read|refchan|'
|
1357
|
+
r'regexp|registry|regsub|scan|seek|socket|source|split|string|'
|
1358
|
+
r'subst|tell|time|tm|unknown|unload)\b'
|
1359
|
+
)
|
1360
|
+
|
1361
|
+
name = 'Tcl'
|
1362
|
+
aliases = ['tcl']
|
1363
|
+
filenames = ['*.tcl']
|
1364
|
+
mimetypes = ['text/x-tcl', 'text/x-script.tcl', 'application/x-tcl']
|
1365
|
+
|
1366
|
+
def _gen_command_rules(keyword_cmds_re, builtin_cmds_re, context=""):
|
1367
|
+
return [
|
1368
|
+
(keyword_cmds_re, Keyword, 'params' + context),
|
1369
|
+
(builtin_cmds_re, Name.Builtin, 'params' + context),
|
1370
|
+
(r'([\w\.\-]+)', Name.Variable, 'params' + context),
|
1371
|
+
(r'#', Comment, 'comment'),
|
1372
|
+
]
|
1373
|
+
|
1374
|
+
tokens = {
|
1375
|
+
'root': [
|
1376
|
+
include('command'),
|
1377
|
+
include('basic'),
|
1378
|
+
include('data'),
|
1379
|
+
(r'}', Keyword), # HACK: somehow we miscounted our braces
|
1380
|
+
],
|
1381
|
+
'command': _gen_command_rules(keyword_cmds_re, builtin_cmds_re),
|
1382
|
+
'command-in-brace': _gen_command_rules(keyword_cmds_re,
|
1383
|
+
builtin_cmds_re,
|
1384
|
+
"-in-brace"),
|
1385
|
+
'command-in-bracket': _gen_command_rules(keyword_cmds_re,
|
1386
|
+
builtin_cmds_re,
|
1387
|
+
"-in-bracket"),
|
1388
|
+
'command-in-paren': _gen_command_rules(keyword_cmds_re,
|
1389
|
+
builtin_cmds_re,
|
1390
|
+
"-in-paren"),
|
1391
|
+
'basic': [
|
1392
|
+
(r'\(', Keyword, 'paren'),
|
1393
|
+
(r'\[', Keyword, 'bracket'),
|
1394
|
+
(r'\{', Keyword, 'brace'),
|
1395
|
+
(r'"', String.Double, 'string'),
|
1396
|
+
(r'(eq|ne|in|ni)\b', Operator.Word),
|
1397
|
+
(r'!=|==|<<|>>|<=|>=|&&|\|\||\*\*|[-+~!*/%<>&^|?:]', Operator),
|
1398
|
+
],
|
1399
|
+
'data': [
|
1400
|
+
(r'\s+', Text),
|
1401
|
+
(r'0x[a-fA-F0-9]+', Number.Hex),
|
1402
|
+
(r'0[0-7]+', Number.Oct),
|
1403
|
+
(r'\d+\.\d+', Number.Float),
|
1404
|
+
(r'\d+', Number.Integer),
|
1405
|
+
(r'\$([\w\.\-\:]+)', Name.Variable),
|
1406
|
+
(r'([\w\.\-\:]+)', Text),
|
1407
|
+
],
|
1408
|
+
'params': [
|
1409
|
+
(r';', Keyword, '#pop'),
|
1410
|
+
(r'\n', Text, '#pop'),
|
1411
|
+
(r'(else|elseif|then)\b', Keyword),
|
1412
|
+
include('basic'),
|
1413
|
+
include('data'),
|
1414
|
+
],
|
1415
|
+
'params-in-brace': [
|
1416
|
+
(r'}', Keyword, ('#pop', '#pop')),
|
1417
|
+
include('params')
|
1418
|
+
],
|
1419
|
+
'params-in-paren': [
|
1420
|
+
(r'\)', Keyword, ('#pop', '#pop')),
|
1421
|
+
include('params')
|
1422
|
+
],
|
1423
|
+
'params-in-bracket': [
|
1424
|
+
(r'\]', Keyword, ('#pop', '#pop')),
|
1425
|
+
include('params')
|
1426
|
+
],
|
1427
|
+
'string': [
|
1428
|
+
(r'\[', String.Double, 'string-square'),
|
1429
|
+
(r'(?s)(\\\\|\\[0-7]+|\\.|[^"\\])', String.Double),
|
1430
|
+
(r'"', String.Double, '#pop')
|
1431
|
+
],
|
1432
|
+
'string-square': [
|
1433
|
+
(r'\[', String.Double, 'string-square'),
|
1434
|
+
(r'(?s)(\\\\|\\[0-7]+|\\.|\\\n|[^\]\\])', String.Double),
|
1435
|
+
(r'\]', String.Double, '#pop')
|
1436
|
+
],
|
1437
|
+
'brace': [
|
1438
|
+
(r'}', Keyword, '#pop'),
|
1439
|
+
include('command-in-brace'),
|
1440
|
+
include('basic'),
|
1441
|
+
include('data'),
|
1442
|
+
],
|
1443
|
+
'paren': [
|
1444
|
+
(r'\)', Keyword, '#pop'),
|
1445
|
+
include('command-in-paren'),
|
1446
|
+
include('basic'),
|
1447
|
+
include('data'),
|
1448
|
+
],
|
1449
|
+
'bracket': [
|
1450
|
+
(r'\]', Keyword, '#pop'),
|
1451
|
+
include('command-in-bracket'),
|
1452
|
+
include('basic'),
|
1453
|
+
include('data'),
|
1454
|
+
],
|
1455
|
+
'comment': [
|
1456
|
+
(r'.*[^\\]\n', Comment, '#pop'),
|
1457
|
+
(r'.*\\\n', Comment),
|
1458
|
+
],
|
1459
|
+
}
|
1460
|
+
|
1461
|
+
def analyse_text(text):
|
1462
|
+
return shebang_matches(text, r'(tcl)')
|
1463
|
+
|
1464
|
+
|
1465
|
+
class FactorLexer(RegexLexer):
|
1466
|
+
"""
|
1467
|
+
Lexer for the `Factor <http://factorcode.org>`_ language.
|
1468
|
+
|
1469
|
+
*New in Pygments 1.4.*
|
1470
|
+
"""
|
1471
|
+
name = 'Factor'
|
1472
|
+
aliases = ['factor']
|
1473
|
+
filenames = ['*.factor']
|
1474
|
+
mimetypes = ['text/x-factor']
|
1475
|
+
|
1476
|
+
flags = re.MULTILINE | re.UNICODE
|
1477
|
+
|
1478
|
+
builtin_kernel = (
|
1479
|
+
r'(?:or|2bi|2tri|while|wrapper|nip|4dip|wrapper\\?|bi\\*|'
|
1480
|
+
r'callstack>array|both\\?|hashcode|die|dupd|callstack|'
|
1481
|
+
r'callstack\\?|3dup|tri@|pick|curry|build|\\?execute|3bi|'
|
1482
|
+
r'prepose|>boolean|\\?if|clone|eq\\?|tri\\*|\\?|=|swapd|'
|
1483
|
+
r'2over|2keep|3keep|clear|2dup|when|not|tuple\\?|dup|2bi\\*|'
|
1484
|
+
r'2tri\\*|call|tri-curry|object|bi@|do|unless\\*|if\\*|loop|'
|
1485
|
+
r'bi-curry\\*|drop|when\\*|assert=|retainstack|assert\\?|-rot|'
|
1486
|
+
r'execute|2bi@|2tri@|boa|with|either\\?|3drop|bi|curry\\?|'
|
1487
|
+
r'datastack|until|3dip|over|3curry|tri-curry\\*|tri-curry@|swap|'
|
1488
|
+
r'and|2nip|throw|bi-curry|\\(clone\\)|hashcode\\*|compose|2dip|if|3tri|'
|
1489
|
+
r'unless|compose\\?|tuple|keep|2curry|equal\\?|assert|tri|2drop|'
|
1490
|
+
r'most|<wrapper>|boolean\\?|identity-hashcode|identity-tuple\\?|'
|
1491
|
+
r'null|new|dip|bi-curry@|rot|xor|identity-tuple|boolean)\s'
|
1492
|
+
)
|
1493
|
+
|
1494
|
+
builtin_assocs = (
|
1495
|
+
r'(?:\\?at|assoc\\?|assoc-clone-like|assoc=|delete-at\\*|'
|
1496
|
+
r'assoc-partition|extract-keys|new-assoc|value\\?|assoc-size|'
|
1497
|
+
r'map>assoc|push-at|assoc-like|key\\?|assoc-intersect|'
|
1498
|
+
r'assoc-refine|update|assoc-union|assoc-combine|at\\*|'
|
1499
|
+
r'assoc-empty\\?|at\\+|set-at|assoc-all\\?|assoc-subset\\?|'
|
1500
|
+
r'assoc-hashcode|change-at|assoc-each|assoc-diff|zip|values|'
|
1501
|
+
r'value-at|rename-at|inc-at|enum\\?|at|cache|assoc>map|<enum>|'
|
1502
|
+
r'assoc|assoc-map|enum|value-at\\*|assoc-map-as|>alist|'
|
1503
|
+
r'assoc-filter-as|clear-assoc|assoc-stack|maybe-set-at|'
|
1504
|
+
r'substitute|assoc-filter|2cache|delete-at|assoc-find|keys|'
|
1505
|
+
r'assoc-any\\?|unzip)\s'
|
1506
|
+
)
|
1507
|
+
|
1508
|
+
builtin_combinators = (
|
1509
|
+
r'(?:case|execute-effect|no-cond|no-case\\?|3cleave>quot|2cleave|'
|
1510
|
+
r'cond>quot|wrong-values\\?|no-cond\\?|cleave>quot|no-case|'
|
1511
|
+
r'case>quot|3cleave|wrong-values|to-fixed-point|alist>quot|'
|
1512
|
+
r'case-find|cond|cleave|call-effect|2cleave>quot|recursive-hashcode|'
|
1513
|
+
r'linear-case-quot|spread|spread>quot)\s'
|
1514
|
+
)
|
1515
|
+
|
1516
|
+
builtin_math = (
|
1517
|
+
r'(?:number=|if-zero|next-power-of-2|each-integer|\\?1\\+|'
|
1518
|
+
r'fp-special\\?|imaginary-part|unless-zero|float>bits|number\\?|'
|
1519
|
+
r'fp-infinity\\?|bignum\\?|fp-snan\\?|denominator|fp-bitwise=|\\*|'
|
1520
|
+
r'\\+|power-of-2\\?|-|u>=|/|>=|bitand|log2-expects-positive|<|'
|
1521
|
+
r'log2|>|integer\\?|number|bits>double|2/|zero\\?|(find-integer)|'
|
1522
|
+
r'bits>float|float\\?|shift|ratio\\?|even\\?|ratio|fp-sign|bitnot|'
|
1523
|
+
r'>fixnum|complex\\?|/i|/f|byte-array>bignum|when-zero|sgn|>bignum|'
|
1524
|
+
r'next-float|u<|u>|mod|recip|rational|find-last-integer|>float|'
|
1525
|
+
r'(all-integers\\?)|2^|times|integer|fixnum\\?|neg|fixnum|sq|'
|
1526
|
+
r'bignum|(each-integer)|bit\\?|fp-qnan\\?|find-integer|complex|'
|
1527
|
+
r'<fp-nan>|real|double>bits|bitor|rem|fp-nan-payload|all-integers\\?|'
|
1528
|
+
r'real-part|log2-expects-positive\\?|prev-float|align|unordered\\?|'
|
1529
|
+
r'float|fp-nan\\?|abs|bitxor|u<=|odd\\?|<=|/mod|rational\\?|>integer|'
|
1530
|
+
r'real\\?|numerator)\s'
|
1531
|
+
)
|
1532
|
+
|
1533
|
+
builtin_sequences = (
|
1534
|
+
r'(?:member-eq\\?|append|assert-sequence=|find-last-from|trim-head-slice|'
|
1535
|
+
r'clone-like|3sequence|assert-sequence\\?|map-as|last-index-from|'
|
1536
|
+
r'reversed|index-from|cut\\*|pad-tail|remove-eq!|concat-as|'
|
1537
|
+
r'but-last|snip|trim-tail|nths|nth|2selector|sequence|slice\\?|'
|
1538
|
+
r'<slice>|partition|remove-nth|tail-slice|empty\\?|tail\\*|'
|
1539
|
+
r'if-empty|find-from|virtual-sequence\\?|member\\?|set-length|'
|
1540
|
+
r'drop-prefix|unclip|unclip-last-slice|iota|map-sum|'
|
1541
|
+
r'bounds-error\\?|sequence-hashcode-step|selector-for|'
|
1542
|
+
r'accumulate-as|map|start|midpoint@|\\(accumulate\\)|rest-slice|'
|
1543
|
+
r'prepend|fourth|sift|accumulate!|new-sequence|follow|map!|'
|
1544
|
+
r'like|first4|1sequence|reverse|slice|unless-empty|padding|'
|
1545
|
+
r'virtual@|repetition\\?|set-last|index|4sequence|max-length|'
|
1546
|
+
r'set-second|immutable-sequence|first2|first3|replicate-as|'
|
1547
|
+
r'reduce-index|unclip-slice|supremum|suffix!|insert-nth|'
|
1548
|
+
r'trim-tail-slice|tail|3append|short|count|suffix|concat|'
|
1549
|
+
r'flip|filter|sum|immutable\\?|reverse!|2sequence|map-integers|'
|
1550
|
+
r'delete-all|start\\*|indices|snip-slice|check-slice|sequence\\?|'
|
1551
|
+
r'head|map-find|filter!|append-as|reduce|sequence=|halves|'
|
1552
|
+
r'collapse-slice|interleave|2map|filter-as|binary-reduce|'
|
1553
|
+
r'slice-error\\?|product|bounds-check\\?|bounds-check|harvest|'
|
1554
|
+
r'immutable|virtual-exemplar|find|produce|remove|pad-head|last|'
|
1555
|
+
r'replicate|set-fourth|remove-eq|shorten|reversed\\?|'
|
1556
|
+
r'map-find-last|3map-as|2unclip-slice|shorter\\?|3map|find-last|'
|
1557
|
+
r'head-slice|pop\\*|2map-as|tail-slice\\*|but-last-slice|'
|
1558
|
+
r'2map-reduce|iota\\?|collector-for|accumulate|each|selector|'
|
1559
|
+
r'append!|new-resizable|cut-slice|each-index|head-slice\\*|'
|
1560
|
+
r'2reverse-each|sequence-hashcode|pop|set-nth|\\?nth|'
|
1561
|
+
r'<flat-slice>|second|join|when-empty|collector|'
|
1562
|
+
r'immutable-sequence\\?|<reversed>|all\\?|3append-as|'
|
1563
|
+
r'virtual-sequence|subseq\\?|remove-nth!|push-either|new-like|'
|
1564
|
+
r'length|last-index|push-if|2all\\?|lengthen|assert-sequence|'
|
1565
|
+
r'copy|map-reduce|move|third|first|3each|tail\\?|set-first|'
|
1566
|
+
r'prefix|bounds-error|any\\?|<repetition>|trim-slice|exchange|'
|
1567
|
+
r'surround|2reduce|cut|change-nth|min-length|set-third|produce-as|'
|
1568
|
+
r'push-all|head\\?|delete-slice|rest|sum-lengths|2each|head\\*|'
|
1569
|
+
r'infimum|remove!|glue|slice-error|subseq|trim|replace-slice|'
|
1570
|
+
r'push|repetition|map-index|trim-head|unclip-last|mismatch)\s'
|
1571
|
+
)
|
1572
|
+
|
1573
|
+
builtin_namespaces = (
|
1574
|
+
r'(?:global|\\+@|change|set-namestack|change-global|init-namespaces|'
|
1575
|
+
r'on|off|set-global|namespace|set|with-scope|bind|with-variable|'
|
1576
|
+
r'inc|dec|counter|initialize|namestack|get|get-global|make-assoc)\s'
|
1577
|
+
)
|
1578
|
+
|
1579
|
+
builtin_arrays = (
|
1580
|
+
r'(?:<array>|2array|3array|pair|>array|1array|4array|pair\\?|'
|
1581
|
+
r'array|resize-array|array\\?)\s'
|
1582
|
+
)
|
1583
|
+
|
1584
|
+
builtin_io = (
|
1585
|
+
r'(?:\\+character\\+|bad-seek-type\\?|readln|each-morsel|stream-seek|'
|
1586
|
+
r'read|print|with-output-stream|contents|write1|stream-write1|'
|
1587
|
+
r'stream-copy|stream-element-type|with-input-stream|'
|
1588
|
+
r'stream-print|stream-read|stream-contents|stream-tell|'
|
1589
|
+
r'tell-output|bl|seek-output|bad-seek-type|nl|stream-nl|write|'
|
1590
|
+
r'flush|stream-lines|\\+byte\\+|stream-flush|read1|'
|
1591
|
+
r'seek-absolute\\?|stream-read1|lines|stream-readln|'
|
1592
|
+
r'stream-read-until|each-line|seek-end|with-output-stream\\*|'
|
1593
|
+
r'seek-absolute|with-streams|seek-input|seek-relative\\?|'
|
1594
|
+
r'input-stream|stream-write|read-partial|seek-end\\?|'
|
1595
|
+
r'seek-relative|error-stream|read-until|with-input-stream\\*|'
|
1596
|
+
r'with-streams\\*|tell-input|each-block|output-stream|'
|
1597
|
+
r'stream-read-partial|each-stream-block|each-stream-line)\s'
|
1598
|
+
)
|
1599
|
+
|
1600
|
+
builtin_strings = (
|
1601
|
+
r'(?:resize-string|>string|<string>|1string|string|string\\?)\s'
|
1602
|
+
)
|
1603
|
+
|
1604
|
+
builtin_vectors = (
|
1605
|
+
r'(?:vector\\?|<vector>|\\?push|vector|>vector|1vector)\s'
|
1606
|
+
)
|
1607
|
+
|
1608
|
+
builtin_continuations = (
|
1609
|
+
r'(?:with-return|restarts|return-continuation|with-datastack|'
|
1610
|
+
r'recover|rethrow-restarts|<restart>|ifcc|set-catchstack|'
|
1611
|
+
r'>continuation<|cleanup|ignore-errors|restart\\?|'
|
1612
|
+
r'compute-restarts|attempt-all-error|error-thread|continue|'
|
1613
|
+
r'<continuation>|attempt-all-error\\?|condition\\?|'
|
1614
|
+
r'<condition>|throw-restarts|error|catchstack|continue-with|'
|
1615
|
+
r'thread-error-hook|continuation|rethrow|callcc1|'
|
1616
|
+
r'error-continuation|callcc0|attempt-all|condition|'
|
1617
|
+
r'continuation\\?|restart|return)\s'
|
1618
|
+
)
|
1619
|
+
|
1620
|
+
tokens = {
|
1621
|
+
'root': [
|
1622
|
+
# TODO: (( inputs -- outputs ))
|
1623
|
+
# TODO: << ... >>
|
1624
|
+
|
1625
|
+
# defining words
|
1626
|
+
(r'(\s*)(:|::|MACRO:|MEMO:)(\s+)(\S+)',
|
1627
|
+
bygroups(Text, Keyword, Text, Name.Function)),
|
1628
|
+
(r'(\s*)(M:)(\s+)(\S+)(\s+)(\S+)',
|
1629
|
+
bygroups(Text, Keyword, Text, Name.Class, Text, Name.Function)),
|
1630
|
+
(r'(\s*)(GENERIC:)(\s+)(\S+)',
|
1631
|
+
bygroups(Text, Keyword, Text, Name.Function)),
|
1632
|
+
(r'(\s*)(HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)',
|
1633
|
+
bygroups(Text, Keyword, Text, Name.Function, Text, Name.Function)),
|
1634
|
+
(r'(\()(\s+)', bygroups(Name.Function, Text), 'stackeffect'),
|
1635
|
+
(r'\;\s', Keyword),
|
1636
|
+
|
1637
|
+
# imports and namespaces
|
1638
|
+
(r'(USING:)((?:\s|\\\s)+)',
|
1639
|
+
bygroups(Keyword.Namespace, Text), 'import'),
|
1640
|
+
(r'(USE:)(\s+)(\S+)',
|
1641
|
+
bygroups(Keyword.Namespace, Text, Name.Namespace)),
|
1642
|
+
(r'(UNUSE:)(\s+)(\S+)',
|
1643
|
+
bygroups(Keyword.Namespace, Text, Name.Namespace)),
|
1644
|
+
(r'(QUALIFIED:)(\s+)(\S+)',
|
1645
|
+
bygroups(Keyword.Namespace, Text, Name.Namespace)),
|
1646
|
+
(r'(QUALIFIED-WITH:)(\s+)(\S+)',
|
1647
|
+
bygroups(Keyword.Namespace, Text, Name.Namespace)),
|
1648
|
+
(r'(FROM:|EXCLUDE:)(\s+)(\S+)(\s+)(=>)',
|
1649
|
+
bygroups(Keyword.Namespace, Text, Name.Namespace, Text, Text)),
|
1650
|
+
(r'(IN:)(\s+)(\S+)',
|
1651
|
+
bygroups(Keyword.Namespace, Text, Name.Namespace)),
|
1652
|
+
(r'(?:ALIAS|DEFER|FORGET|POSTPONE):', Keyword.Namespace),
|
1653
|
+
|
1654
|
+
# tuples and classes
|
1655
|
+
(r'(TUPLE:)(\s+)(\S+)(\s+<\s+)(\S+)',
|
1656
|
+
bygroups(Keyword, Text, Name.Class, Text, Name.Class), 'slots'),
|
1657
|
+
(r'(TUPLE:)(\s+)(\S+)',
|
1658
|
+
bygroups(Keyword, Text, Name.Class), 'slots'),
|
1659
|
+
(r'(UNION:)(\s+)(\S+)', bygroups(Keyword, Text, Name.Class)),
|
1660
|
+
(r'(INTERSECTION:)(\s+)(\S+)', bygroups(Keyword, Text, Name.Class)),
|
1661
|
+
(r'(PREDICATE:)(\s+)(\S+)(\s+<\s+)(\S+)',
|
1662
|
+
bygroups(Keyword, Text, Name.Class, Text, Name.Class)),
|
1663
|
+
(r'(C:)(\s+)(\S+)(\s+)(\S+)',
|
1664
|
+
bygroups(Keyword, Text, Name.Function, Text, Name.Class)),
|
1665
|
+
(r'INSTANCE:', Keyword),
|
1666
|
+
(r'SLOT:', Keyword),
|
1667
|
+
(r'MIXIN:', Keyword),
|
1668
|
+
(r'(?:SINGLETON|SINGLETONS):', Keyword),
|
1669
|
+
|
1670
|
+
# other syntax
|
1671
|
+
(r'CONSTANT:', Keyword),
|
1672
|
+
(r'(?:SYMBOL|SYMBOLS):', Keyword),
|
1673
|
+
(r'ERROR:', Keyword),
|
1674
|
+
(r'SYNTAX:', Keyword),
|
1675
|
+
(r'(HELP:)(\s+)(\S+)', bygroups(Keyword, Text, Name.Function)),
|
1676
|
+
(r'(MAIN:)(\s+)(\S+)',
|
1677
|
+
bygroups(Keyword.Namespace, Text, Name.Function)),
|
1678
|
+
(r'(?:ALIEN|TYPEDEF|FUNCTION|STRUCT):', Keyword),
|
1679
|
+
|
1680
|
+
# vocab.private
|
1681
|
+
# TODO: words inside vocab.private should have red names?
|
1682
|
+
(r'(?:<PRIVATE|PRIVATE>)', Keyword.Namespace),
|
1683
|
+
|
1684
|
+
# strings
|
1685
|
+
(r'"""\s+(?:.|\n)*?\s+"""', String),
|
1686
|
+
(r'"(?:\\\\|\\"|[^"])*"', String),
|
1687
|
+
(r'CHAR:\s+(\\[\\abfnrstv]*|\S)\s', String.Char),
|
1688
|
+
|
1689
|
+
# comments
|
1690
|
+
(r'\!\s+.*$', Comment),
|
1691
|
+
(r'#\!\s+.*$', Comment),
|
1692
|
+
|
1693
|
+
# boolean constants
|
1694
|
+
(r'(t|f)\s', Name.Constant),
|
1695
|
+
|
1696
|
+
# numbers
|
1697
|
+
(r'-?\d+\.\d+\s', Number.Float),
|
1698
|
+
(r'-?\d+\s', Number.Integer),
|
1699
|
+
(r'HEX:\s+[a-fA-F\d]+\s', Number.Hex),
|
1700
|
+
(r'BIN:\s+[01]+\s', Number.Integer),
|
1701
|
+
(r'OCT:\s+[0-7]+\s', Number.Oct),
|
1702
|
+
|
1703
|
+
# operators
|
1704
|
+
(r'[-+/*=<>^]\s', Operator),
|
1705
|
+
|
1706
|
+
# keywords
|
1707
|
+
(r'(?:deprecated|final|foldable|flushable|inline|recursive)\s',
|
1708
|
+
Keyword),
|
1709
|
+
|
1710
|
+
# builtins
|
1711
|
+
(builtin_kernel, Name.Builtin),
|
1712
|
+
(builtin_assocs, Name.Builtin),
|
1713
|
+
(builtin_combinators, Name.Builtin),
|
1714
|
+
(builtin_math, Name.Builtin),
|
1715
|
+
(builtin_sequences, Name.Builtin),
|
1716
|
+
(builtin_namespaces, Name.Builtin),
|
1717
|
+
(builtin_arrays, Name.Builtin),
|
1718
|
+
(builtin_io, Name.Builtin),
|
1719
|
+
(builtin_strings, Name.Builtin),
|
1720
|
+
(builtin_vectors, Name.Builtin),
|
1721
|
+
(builtin_continuations, Name.Builtin),
|
1722
|
+
|
1723
|
+
# whitespaces - usually not relevant
|
1724
|
+
(r'\s+', Text),
|
1725
|
+
|
1726
|
+
# everything else is text
|
1727
|
+
(r'\S+', Text),
|
1728
|
+
],
|
1729
|
+
|
1730
|
+
'stackeffect': [
|
1731
|
+
(r'\s*\(', Name.Function, 'stackeffect'),
|
1732
|
+
(r'\)', Name.Function, '#pop'),
|
1733
|
+
(r'\-\-', Name.Function),
|
1734
|
+
(r'\s+', Text),
|
1735
|
+
(r'\S+', Name.Variable),
|
1736
|
+
],
|
1737
|
+
|
1738
|
+
'slots': [
|
1739
|
+
(r'\s+', Text),
|
1740
|
+
(r';\s', Keyword, '#pop'),
|
1741
|
+
(r'\S+', Name.Variable),
|
1742
|
+
],
|
1743
|
+
|
1744
|
+
'import': [
|
1745
|
+
(r';', Keyword, '#pop'),
|
1746
|
+
(r'\S+', Name.Namespace),
|
1747
|
+
(r'\s+', Text),
|
1748
|
+
],
|
1749
|
+
}
|
1750
|
+
|
1751
|
+
|
1752
|
+
class FancyLexer(RegexLexer):
|
1753
|
+
"""
|
1754
|
+
Pygments Lexer For `Fancy <http://www.fancy-lang.org/>`_.
|
1755
|
+
|
1756
|
+
Fancy is a self-hosted, pure object-oriented, dynamic,
|
1757
|
+
class-based, concurrent general-purpose programming language
|
1758
|
+
running on Rubinius, the Ruby VM.
|
1759
|
+
|
1760
|
+
*New in Pygments 1.5.*
|
1761
|
+
"""
|
1762
|
+
name = 'Fancy'
|
1763
|
+
filenames = ['*.fy', '*.fancypack']
|
1764
|
+
aliases = ['fancy', 'fy']
|
1765
|
+
mimetypes = ['text/x-fancysrc']
|
1766
|
+
|
1767
|
+
tokens = {
|
1768
|
+
# copied from PerlLexer:
|
1769
|
+
'balanced-regex': [
|
1770
|
+
(r'/(\\\\|\\/|[^/])*/[egimosx]*', String.Regex, '#pop'),
|
1771
|
+
(r'!(\\\\|\\!|[^!])*![egimosx]*', String.Regex, '#pop'),
|
1772
|
+
(r'\\(\\\\|[^\\])*\\[egimosx]*', String.Regex, '#pop'),
|
1773
|
+
(r'{(\\\\|\\}|[^}])*}[egimosx]*', String.Regex, '#pop'),
|
1774
|
+
(r'<(\\\\|\\>|[^>])*>[egimosx]*', String.Regex, '#pop'),
|
1775
|
+
(r'\[(\\\\|\\\]|[^\]])*\][egimosx]*', String.Regex, '#pop'),
|
1776
|
+
(r'\((\\\\|\\\)|[^\)])*\)[egimosx]*', String.Regex, '#pop'),
|
1777
|
+
(r'@(\\\\|\\\@|[^\@])*@[egimosx]*', String.Regex, '#pop'),
|
1778
|
+
(r'%(\\\\|\\\%|[^\%])*%[egimosx]*', String.Regex, '#pop'),
|
1779
|
+
(r'\$(\\\\|\\\$|[^\$])*\$[egimosx]*', String.Regex, '#pop'),
|
1780
|
+
],
|
1781
|
+
'root': [
|
1782
|
+
(r'\s+', Text),
|
1783
|
+
|
1784
|
+
# balanced delimiters (copied from PerlLexer):
|
1785
|
+
(r's{(\\\\|\\}|[^}])*}\s*', String.Regex, 'balanced-regex'),
|
1786
|
+
(r's<(\\\\|\\>|[^>])*>\s*', String.Regex, 'balanced-regex'),
|
1787
|
+
(r's\[(\\\\|\\\]|[^\]])*\]\s*', String.Regex, 'balanced-regex'),
|
1788
|
+
(r's\((\\\\|\\\)|[^\)])*\)\s*', String.Regex, 'balanced-regex'),
|
1789
|
+
(r'm?/(\\\\|\\/|[^/\n])*/[gcimosx]*', String.Regex),
|
1790
|
+
(r'm(?=[/!\\{<\[\(@%\$])', String.Regex, 'balanced-regex'),
|
1791
|
+
|
1792
|
+
# Comments
|
1793
|
+
(r'#(.*?)\n', Comment.Single),
|
1794
|
+
# Symbols
|
1795
|
+
(r'\'([^\'\s\[\]\(\)\{\}]+|\[\])', String.Symbol),
|
1796
|
+
# Multi-line DoubleQuotedString
|
1797
|
+
(r'"""(\\\\|\\"|[^"])*"""', String),
|
1798
|
+
# DoubleQuotedString
|
1799
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
1800
|
+
# keywords
|
1801
|
+
(r'(def|class|try|catch|finally|retry|return|return_local|match|'
|
1802
|
+
r'case|->|=>)\b', Keyword),
|
1803
|
+
# constants
|
1804
|
+
(r'(self|super|nil|false|true)\b', Name.Constant),
|
1805
|
+
(r'[(){};,/?\|:\\]', Punctuation),
|
1806
|
+
# names
|
1807
|
+
(r'(Object|Array|Hash|Directory|File|Class|String|Number|'
|
1808
|
+
r'Enumerable|FancyEnumerable|Block|TrueClass|NilClass|'
|
1809
|
+
r'FalseClass|Tuple|Symbol|Stack|Set|FancySpec|Method|Package|'
|
1810
|
+
r'Range)\b', Name.Builtin),
|
1811
|
+
# functions
|
1812
|
+
(r'[a-zA-Z]([a-zA-Z0-9_]|[-+?!=*/^><%])*:', Name.Function),
|
1813
|
+
# operators, must be below functions
|
1814
|
+
(r'[-+*/~,<>=&!?%^\[\]\.$]+', Operator),
|
1815
|
+
('[A-Z][a-zA-Z0-9_]*', Name.Constant),
|
1816
|
+
('@[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable.Instance),
|
1817
|
+
('@@[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable.Class),
|
1818
|
+
('@@?', Operator),
|
1819
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
1820
|
+
# numbers - / checks are necessary to avoid mismarking regexes,
|
1821
|
+
# see comment in RubyLexer
|
1822
|
+
(r'(0[oO]?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?',
|
1823
|
+
bygroups(Number.Oct, Text, Operator)),
|
1824
|
+
(r'(0[xX][0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?',
|
1825
|
+
bygroups(Number.Hex, Text, Operator)),
|
1826
|
+
(r'(0[bB][01]+(?:_[01]+)*)(\s*)([/?])?',
|
1827
|
+
bygroups(Number.Bin, Text, Operator)),
|
1828
|
+
(r'([\d]+(?:_\d+)*)(\s*)([/?])?',
|
1829
|
+
bygroups(Number.Integer, Text, Operator)),
|
1830
|
+
(r'\d+([eE][+-]?[0-9]+)|\d+\.\d+([eE][+-]?[0-9]+)?', Number.Float),
|
1831
|
+
(r'\d+', Number.Integer)
|
1832
|
+
]
|
1833
|
+
}
|
1834
|
+
|
1835
|
+
|
1836
|
+
class DgLexer(RegexLexer):
|
1837
|
+
"""
|
1838
|
+
Lexer for `dg <http://pyos.github.com/dg>`_,
|
1839
|
+
a functional and object-oriented programming language
|
1840
|
+
running on the CPython 3 VM.
|
1841
|
+
|
1842
|
+
*New in Pygments 1.6.*
|
1843
|
+
"""
|
1844
|
+
name = 'dg'
|
1845
|
+
aliases = ['dg']
|
1846
|
+
filenames = ['*.dg']
|
1847
|
+
mimetypes = ['text/x-dg']
|
1848
|
+
|
1849
|
+
tokens = {
|
1850
|
+
'root': [
|
1851
|
+
# Whitespace:
|
1852
|
+
(r'\s+', Text),
|
1853
|
+
(r'#.*?$', Comment.Single),
|
1854
|
+
# Lexemes:
|
1855
|
+
# Numbers
|
1856
|
+
(r'0[bB][01]+', Number.Bin),
|
1857
|
+
(r'0[oO][0-7]+', Number.Oct),
|
1858
|
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
1859
|
+
(r'[+-]?\d+\.\d+([eE][+-]?\d+)?[jJ]?', Number.Float),
|
1860
|
+
(r'[+-]?\d+[eE][+-]?\d+[jJ]?', Number.Float),
|
1861
|
+
(r'[+-]?\d+[jJ]?', Number.Integer),
|
1862
|
+
# Character/String Literals
|
1863
|
+
(r"[br]*'''", String, combined('stringescape', 'tsqs', 'string')),
|
1864
|
+
(r'[br]*"""', String, combined('stringescape', 'tdqs', 'string')),
|
1865
|
+
(r"[br]*'", String, combined('stringescape', 'sqs', 'string')),
|
1866
|
+
(r'[br]*"', String, combined('stringescape', 'dqs', 'string')),
|
1867
|
+
# Operators
|
1868
|
+
(r"`\w+'*`", Operator), # Infix links
|
1869
|
+
# Reserved infix links
|
1870
|
+
(r'\b(or|and|if|else|where|is|in)\b', Operator.Word),
|
1871
|
+
(r'[!$%&*+\-./:<-@\\^|~;,]+', Operator),
|
1872
|
+
# Identifiers
|
1873
|
+
# Python 3 types
|
1874
|
+
(r"(?<!\.)(bool|bytearray|bytes|classmethod|complex|dict'?|"
|
1875
|
+
r"float|frozenset|int|list'?|memoryview|object|property|range|"
|
1876
|
+
r"set'?|slice|staticmethod|str|super|tuple'?|type)"
|
1877
|
+
r"(?!['\w])", Name.Builtin),
|
1878
|
+
# Python 3 builtins + some more
|
1879
|
+
(r'(?<!\.)(__import__|abs|all|any|bin|bind|chr|cmp|compile|complex|'
|
1880
|
+
r'delattr|dir|divmod|drop|dropwhile|enumerate|eval|filter|flip|'
|
1881
|
+
r'foldl1?|format|fst|getattr|globals|hasattr|hash|head|hex|id|'
|
1882
|
+
r'init|input|isinstance|issubclass|iter|iterate|last|len|locals|'
|
1883
|
+
r'map|max|min|next|oct|open|ord|pow|print|repr|reversed|round|'
|
1884
|
+
r'setattr|scanl1?|snd|sorted|sum|tail|take|takewhile|vars|zip)'
|
1885
|
+
r"(?!['\w])", Name.Builtin),
|
1886
|
+
(r"(?<!\.)(self|Ellipsis|NotImplemented|None|True|False)(?!['\w])",
|
1887
|
+
Name.Builtin.Pseudo),
|
1888
|
+
(r"(?<!\.)[A-Z]\w*(Error|Exception|Warning)'*(?!['\w])",
|
1889
|
+
Name.Exception),
|
1890
|
+
(r"(?<!\.)(KeyboardInterrupt|SystemExit|StopIteration|"
|
1891
|
+
r"GeneratorExit)(?!['\w])", Name.Exception),
|
1892
|
+
# Compiler-defined identifiers
|
1893
|
+
(r"(?<![\.\w])(import|inherit|for|while|switch|not|raise|unsafe|"
|
1894
|
+
r"yield|with)(?!['\w])", Keyword.Reserved),
|
1895
|
+
# Other links
|
1896
|
+
(r"[A-Z_']+\b", Name),
|
1897
|
+
(r"[A-Z][\w']*\b", Keyword.Type),
|
1898
|
+
(r"\w+'*", Name),
|
1899
|
+
# Blocks
|
1900
|
+
(r'[()]', Punctuation),
|
1901
|
+
],
|
1902
|
+
'stringescape': [
|
1903
|
+
(r'\\([\\abfnrtv"\']|\n|N{.*?}|u[a-fA-F0-9]{4}|'
|
1904
|
+
r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
1905
|
+
],
|
1906
|
+
'string': [
|
1907
|
+
(r'%(\([a-zA-Z0-9_]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
|
1908
|
+
'[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
|
1909
|
+
(r'[^\\\'"%\n]+', String),
|
1910
|
+
# quotes, percents and backslashes must be parsed one at a time
|
1911
|
+
(r'[\'"\\]', String),
|
1912
|
+
# unhandled string formatting sign
|
1913
|
+
(r'%', String),
|
1914
|
+
(r'\n', String)
|
1915
|
+
],
|
1916
|
+
'dqs': [
|
1917
|
+
(r'"', String, '#pop')
|
1918
|
+
],
|
1919
|
+
'sqs': [
|
1920
|
+
(r"'", String, '#pop')
|
1921
|
+
],
|
1922
|
+
'tdqs': [
|
1923
|
+
(r'"""', String, '#pop')
|
1924
|
+
],
|
1925
|
+
'tsqs': [
|
1926
|
+
(r"'''", String, '#pop')
|
1927
|
+
],
|
1928
|
+
}
|
1929
|
+
|
1930
|
+
class Perl6Lexer(ExtendedRegexLexer):
|
1931
|
+
"""
|
1932
|
+
For `Perl 6 <http://www.perl6.org>`_ source code.
|
1933
|
+
|
1934
|
+
*New in Pygments 1.7.*
|
1935
|
+
"""
|
1936
|
+
|
1937
|
+
name = 'Perl6'
|
1938
|
+
aliases = ['perl6', 'pl6']
|
1939
|
+
filenames = ['*.pl', '*.pm', '*.nqp', '*.p6', '*.6pl', '*.p6l', '*.pl6',
|
1940
|
+
'*.6pm', '*.p6m', '*.pm6']
|
1941
|
+
mimetypes = ['text/x-perl6', 'application/x-perl6']
|
1942
|
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
1943
|
+
|
1944
|
+
PERL6_IDENTIFIER_RANGE = "['a-zA-Z0-9_:-]"
|
1945
|
+
|
1946
|
+
PERL6_KEYWORDS = (
|
1947
|
+
'BEGIN', 'CATCH', 'CHECK', 'CONTROL', 'END', 'ENTER', 'FIRST', 'INIT',
|
1948
|
+
'KEEP', 'LAST', 'LEAVE', 'NEXT', 'POST', 'PRE', 'START', 'TEMP',
|
1949
|
+
'UNDO', 'as', 'assoc', 'async', 'augment', 'binary', 'break', 'but',
|
1950
|
+
'cached', 'category', 'class', 'constant', 'contend', 'continue',
|
1951
|
+
'copy', 'deep', 'default', 'defequiv', 'defer', 'die', 'do', 'else',
|
1952
|
+
'elsif', 'enum', 'equiv', 'exit', 'export', 'fail', 'fatal', 'for',
|
1953
|
+
'gather', 'given', 'goto', 'grammar', 'handles', 'has', 'if', 'inline',
|
1954
|
+
'irs', 'is', 'last', 'leave', 'let', 'lift', 'loop', 'looser', 'macro',
|
1955
|
+
'make', 'maybe', 'method', 'module', 'multi', 'my', 'next', 'of',
|
1956
|
+
'ofs', 'only', 'oo', 'ors', 'our', 'package', 'parsed', 'prec',
|
1957
|
+
'proto', 'readonly', 'redo', 'ref', 'regex', 'reparsed', 'repeat',
|
1958
|
+
'require', 'required', 'return', 'returns', 'role', 'rule', 'rw',
|
1959
|
+
'self', 'slang', 'state', 'sub', 'submethod', 'subset', 'supersede',
|
1960
|
+
'take', 'temp', 'tighter', 'token', 'trusts', 'try', 'unary',
|
1961
|
+
'unless', 'until', 'use', 'warn', 'when', 'where', 'while', 'will',
|
1962
|
+
)
|
1963
|
+
|
1964
|
+
PERL6_BUILTINS = (
|
1965
|
+
'ACCEPTS', 'HOW', 'REJECTS', 'VAR', 'WHAT', 'WHENCE', 'WHERE', 'WHICH',
|
1966
|
+
'WHO', 'abs', 'acos', 'acosec', 'acosech', 'acosh', 'acotan', 'acotanh',
|
1967
|
+
'all', 'any', 'approx', 'arity', 'asec', 'asech', 'asin', 'asinh'
|
1968
|
+
'assuming', 'atan', 'atan2', 'atanh', 'attr', 'bless', 'body', 'by'
|
1969
|
+
'bytes', 'caller', 'callsame', 'callwith', 'can', 'capitalize', 'cat',
|
1970
|
+
'ceiling', 'chars', 'chmod', 'chomp', 'chop', 'chr', 'chroot',
|
1971
|
+
'circumfix', 'cis', 'classify', 'clone', 'close', 'cmp_ok', 'codes',
|
1972
|
+
'comb', 'connect', 'contains', 'context', 'cos', 'cosec', 'cosech',
|
1973
|
+
'cosh', 'cotan', 'cotanh', 'count', 'defined', 'delete', 'diag',
|
1974
|
+
'dies_ok', 'does', 'e', 'each', 'eager', 'elems', 'end', 'eof', 'eval',
|
1975
|
+
'eval_dies_ok', 'eval_elsewhere', 'eval_lives_ok', 'evalfile', 'exists',
|
1976
|
+
'exp', 'first', 'flip', 'floor', 'flunk', 'flush', 'fmt', 'force_todo',
|
1977
|
+
'fork', 'from', 'getc', 'gethost', 'getlogin', 'getpeername', 'getpw',
|
1978
|
+
'gmtime', 'graphs', 'grep', 'hints', 'hyper', 'im', 'index', 'infix',
|
1979
|
+
'invert', 'is_approx', 'is_deeply', 'isa', 'isa_ok', 'isnt', 'iterator',
|
1980
|
+
'join', 'key', 'keys', 'kill', 'kv', 'lastcall', 'lazy', 'lc', 'lcfirst',
|
1981
|
+
'like', 'lines', 'link', 'lives_ok', 'localtime', 'log', 'log10', 'map',
|
1982
|
+
'max', 'min', 'minmax', 'name', 'new', 'nextsame', 'nextwith', 'nfc',
|
1983
|
+
'nfd', 'nfkc', 'nfkd', 'nok_error', 'nonce', 'none', 'normalize', 'not',
|
1984
|
+
'nothing', 'ok', 'once', 'one', 'open', 'opendir', 'operator', 'ord',
|
1985
|
+
'p5chomp', 'p5chop', 'pack', 'pair', 'pairs', 'pass', 'perl', 'pi',
|
1986
|
+
'pick', 'plan', 'plan_ok', 'polar', 'pop', 'pos', 'postcircumfix',
|
1987
|
+
'postfix', 'pred', 'prefix', 'print', 'printf', 'push', 'quasi',
|
1988
|
+
'quotemeta', 'rand', 're', 'read', 'readdir', 'readline', 'reduce',
|
1989
|
+
'reverse', 'rewind', 'rewinddir', 'rindex', 'roots', 'round',
|
1990
|
+
'roundrobin', 'run', 'runinstead', 'sameaccent', 'samecase', 'say',
|
1991
|
+
'sec', 'sech', 'sech', 'seek', 'shape', 'shift', 'sign', 'signature',
|
1992
|
+
'sin', 'sinh', 'skip', 'skip_rest', 'sleep', 'slurp', 'sort', 'splice',
|
1993
|
+
'split', 'sprintf', 'sqrt', 'srand', 'strand', 'subst', 'substr', 'succ',
|
1994
|
+
'sum', 'symlink', 'tan', 'tanh', 'throws_ok', 'time', 'times', 'to',
|
1995
|
+
'todo', 'trim', 'trim_end', 'trim_start', 'true', 'truncate', 'uc',
|
1996
|
+
'ucfirst', 'undef', 'undefine', 'uniq', 'unlike', 'unlink', 'unpack',
|
1997
|
+
'unpolar', 'unshift', 'unwrap', 'use_ok', 'value', 'values', 'vec',
|
1998
|
+
'version_lt', 'void', 'wait', 'want', 'wrap', 'write', 'zip',
|
1999
|
+
)
|
2000
|
+
|
2001
|
+
PERL6_BUILTIN_CLASSES = (
|
2002
|
+
'Abstraction', 'Any', 'AnyChar', 'Array', 'Associative', 'Bag', 'Bit',
|
2003
|
+
'Blob', 'Block', 'Bool', 'Buf', 'Byte', 'Callable', 'Capture', 'Char', 'Class',
|
2004
|
+
'Code', 'Codepoint', 'Comparator', 'Complex', 'Decreasing', 'Exception',
|
2005
|
+
'Failure', 'False', 'Grammar', 'Grapheme', 'Hash', 'IO', 'Increasing',
|
2006
|
+
'Int', 'Junction', 'KeyBag', 'KeyExtractor', 'KeyHash', 'KeySet',
|
2007
|
+
'KitchenSink', 'List', 'Macro', 'Mapping', 'Match', 'Matcher', 'Method',
|
2008
|
+
'Module', 'Num', 'Object', 'Ordered', 'Ordering', 'OrderingPair',
|
2009
|
+
'Package', 'Pair', 'Positional', 'Proxy', 'Range', 'Rat', 'Regex',
|
2010
|
+
'Role', 'Routine', 'Scalar', 'Seq', 'Set', 'Signature', 'Str', 'StrLen',
|
2011
|
+
'StrPos', 'Sub', 'Submethod', 'True', 'UInt', 'Undef', 'Version', 'Void',
|
2012
|
+
'Whatever', 'bit', 'bool', 'buf', 'buf1', 'buf16', 'buf2', 'buf32',
|
2013
|
+
'buf4', 'buf64', 'buf8', 'complex', 'int', 'int1', 'int16', 'int2',
|
2014
|
+
'int32', 'int4', 'int64', 'int8', 'num', 'rat', 'rat1', 'rat16', 'rat2',
|
2015
|
+
'rat32', 'rat4', 'rat64', 'rat8', 'uint', 'uint1', 'uint16', 'uint2',
|
2016
|
+
'uint32', 'uint4', 'uint64', 'uint8', 'utf16', 'utf32', 'utf8',
|
2017
|
+
)
|
2018
|
+
|
2019
|
+
PERL6_OPERATORS = (
|
2020
|
+
'X', 'Z', 'after', 'also', 'and', 'andthen', 'before', 'cmp', 'div',
|
2021
|
+
'eq', 'eqv', 'extra', 'ff', 'fff', 'ge', 'gt', 'le', 'leg', 'lt', 'm',
|
2022
|
+
'mm', 'mod', 'ne', 'or', 'orelse', 'rx', 's', 'tr', 'x', 'xor', 'xx',
|
2023
|
+
'++', '--', '**', '!', '+', '-', '~', '?', '|', '||', '+^', '~^', '?^',
|
2024
|
+
'^', '*', '/', '%', '%%', '+&', '+<', '+>', '~&', '~<', '~>', '?&',
|
2025
|
+
'gcd', 'lcm', '+', '-', '+|', '+^', '~|', '~^', '?|', '?^',
|
2026
|
+
'~', '&', '^', 'but', 'does', '<=>', '..', '..^', '^..', '^..^',
|
2027
|
+
'!=', '==', '<', '<=', '>', '>=', '~~', '===', '!eqv',
|
2028
|
+
'&&', '||', '^^', '//', 'min', 'max', '??', '!!', 'ff', 'fff', 'so',
|
2029
|
+
'not', '<==', '==>', '<<==', '==>>',
|
2030
|
+
)
|
2031
|
+
|
2032
|
+
# Perl 6 has a *lot* of possible bracketing characters
|
2033
|
+
# this list was lifted from STD.pm6 (https://github.com/perl6/std)
|
2034
|
+
PERL6_BRACKETS = {
|
2035
|
+
u'\u0028' : u'\u0029', u'\u003c' : u'\u003e', u'\u005b' : u'\u005d', u'\u007b' : u'\u007d',
|
2036
|
+
u'\u00ab' : u'\u00bb', u'\u0f3a' : u'\u0f3b', u'\u0f3c' : u'\u0f3d', u'\u169b' : u'\u169c',
|
2037
|
+
u'\u2018' : u'\u2019', u'\u201a' : u'\u2019', u'\u201b' : u'\u2019', u'\u201c' : u'\u201d',
|
2038
|
+
u'\u201e' : u'\u201d', u'\u201f' : u'\u201d', u'\u2039' : u'\u203a', u'\u2045' : u'\u2046',
|
2039
|
+
u'\u207d' : u'\u207e', u'\u208d' : u'\u208e', u'\u2208' : u'\u220b', u'\u2209' : u'\u220c',
|
2040
|
+
u'\u220a' : u'\u220d', u'\u2215' : u'\u29f5', u'\u223c' : u'\u223d', u'\u2243' : u'\u22cd',
|
2041
|
+
u'\u2252' : u'\u2253', u'\u2254' : u'\u2255', u'\u2264' : u'\u2265', u'\u2266' : u'\u2267',
|
2042
|
+
u'\u2268' : u'\u2269', u'\u226a' : u'\u226b', u'\u226e' : u'\u226f', u'\u2270' : u'\u2271',
|
2043
|
+
u'\u2272' : u'\u2273', u'\u2274' : u'\u2275', u'\u2276' : u'\u2277', u'\u2278' : u'\u2279',
|
2044
|
+
u'\u227a' : u'\u227b', u'\u227c' : u'\u227d', u'\u227e' : u'\u227f', u'\u2280' : u'\u2281',
|
2045
|
+
u'\u2282' : u'\u2283', u'\u2284' : u'\u2285', u'\u2286' : u'\u2287', u'\u2288' : u'\u2289',
|
2046
|
+
u'\u228a' : u'\u228b', u'\u228f' : u'\u2290', u'\u2291' : u'\u2292', u'\u2298' : u'\u29b8',
|
2047
|
+
u'\u22a2' : u'\u22a3', u'\u22a6' : u'\u2ade', u'\u22a8' : u'\u2ae4', u'\u22a9' : u'\u2ae3',
|
2048
|
+
u'\u22ab' : u'\u2ae5', u'\u22b0' : u'\u22b1', u'\u22b2' : u'\u22b3', u'\u22b4' : u'\u22b5',
|
2049
|
+
u'\u22b6' : u'\u22b7', u'\u22c9' : u'\u22ca', u'\u22cb' : u'\u22cc', u'\u22d0' : u'\u22d1',
|
2050
|
+
u'\u22d6' : u'\u22d7', u'\u22d8' : u'\u22d9', u'\u22da' : u'\u22db', u'\u22dc' : u'\u22dd',
|
2051
|
+
u'\u22de' : u'\u22df', u'\u22e0' : u'\u22e1', u'\u22e2' : u'\u22e3', u'\u22e4' : u'\u22e5',
|
2052
|
+
u'\u22e6' : u'\u22e7', u'\u22e8' : u'\u22e9', u'\u22ea' : u'\u22eb', u'\u22ec' : u'\u22ed',
|
2053
|
+
u'\u22f0' : u'\u22f1', u'\u22f2' : u'\u22fa', u'\u22f3' : u'\u22fb', u'\u22f4' : u'\u22fc',
|
2054
|
+
u'\u22f6' : u'\u22fd', u'\u22f7' : u'\u22fe', u'\u2308' : u'\u2309', u'\u230a' : u'\u230b',
|
2055
|
+
u'\u2329' : u'\u232a', u'\u23b4' : u'\u23b5', u'\u2768' : u'\u2769', u'\u276a' : u'\u276b',
|
2056
|
+
u'\u276c' : u'\u276d', u'\u276e' : u'\u276f', u'\u2770' : u'\u2771', u'\u2772' : u'\u2773',
|
2057
|
+
u'\u2774' : u'\u2775', u'\u27c3' : u'\u27c4', u'\u27c5' : u'\u27c6', u'\u27d5' : u'\u27d6',
|
2058
|
+
u'\u27dd' : u'\u27de', u'\u27e2' : u'\u27e3', u'\u27e4' : u'\u27e5', u'\u27e6' : u'\u27e7',
|
2059
|
+
u'\u27e8' : u'\u27e9', u'\u27ea' : u'\u27eb', u'\u2983' : u'\u2984', u'\u2985' : u'\u2986',
|
2060
|
+
u'\u2987' : u'\u2988', u'\u2989' : u'\u298a', u'\u298b' : u'\u298c', u'\u298d' : u'\u298e',
|
2061
|
+
u'\u298f' : u'\u2990', u'\u2991' : u'\u2992', u'\u2993' : u'\u2994', u'\u2995' : u'\u2996',
|
2062
|
+
u'\u2997' : u'\u2998', u'\u29c0' : u'\u29c1', u'\u29c4' : u'\u29c5', u'\u29cf' : u'\u29d0',
|
2063
|
+
u'\u29d1' : u'\u29d2', u'\u29d4' : u'\u29d5', u'\u29d8' : u'\u29d9', u'\u29da' : u'\u29db',
|
2064
|
+
u'\u29f8' : u'\u29f9', u'\u29fc' : u'\u29fd', u'\u2a2b' : u'\u2a2c', u'\u2a2d' : u'\u2a2e',
|
2065
|
+
u'\u2a34' : u'\u2a35', u'\u2a3c' : u'\u2a3d', u'\u2a64' : u'\u2a65', u'\u2a79' : u'\u2a7a',
|
2066
|
+
u'\u2a7d' : u'\u2a7e', u'\u2a7f' : u'\u2a80', u'\u2a81' : u'\u2a82', u'\u2a83' : u'\u2a84',
|
2067
|
+
u'\u2a8b' : u'\u2a8c', u'\u2a91' : u'\u2a92', u'\u2a93' : u'\u2a94', u'\u2a95' : u'\u2a96',
|
2068
|
+
u'\u2a97' : u'\u2a98', u'\u2a99' : u'\u2a9a', u'\u2a9b' : u'\u2a9c', u'\u2aa1' : u'\u2aa2',
|
2069
|
+
u'\u2aa6' : u'\u2aa7', u'\u2aa8' : u'\u2aa9', u'\u2aaa' : u'\u2aab', u'\u2aac' : u'\u2aad',
|
2070
|
+
u'\u2aaf' : u'\u2ab0', u'\u2ab3' : u'\u2ab4', u'\u2abb' : u'\u2abc', u'\u2abd' : u'\u2abe',
|
2071
|
+
u'\u2abf' : u'\u2ac0', u'\u2ac1' : u'\u2ac2', u'\u2ac3' : u'\u2ac4', u'\u2ac5' : u'\u2ac6',
|
2072
|
+
u'\u2acd' : u'\u2ace', u'\u2acf' : u'\u2ad0', u'\u2ad1' : u'\u2ad2', u'\u2ad3' : u'\u2ad4',
|
2073
|
+
u'\u2ad5' : u'\u2ad6', u'\u2aec' : u'\u2aed', u'\u2af7' : u'\u2af8', u'\u2af9' : u'\u2afa',
|
2074
|
+
u'\u2e02' : u'\u2e03', u'\u2e04' : u'\u2e05', u'\u2e09' : u'\u2e0a', u'\u2e0c' : u'\u2e0d',
|
2075
|
+
u'\u2e1c' : u'\u2e1d', u'\u2e20' : u'\u2e21', u'\u3008' : u'\u3009', u'\u300a' : u'\u300b',
|
2076
|
+
u'\u300c' : u'\u300d', u'\u300e' : u'\u300f', u'\u3010' : u'\u3011', u'\u3014' : u'\u3015',
|
2077
|
+
u'\u3016' : u'\u3017', u'\u3018' : u'\u3019', u'\u301a' : u'\u301b', u'\u301d' : u'\u301e',
|
2078
|
+
u'\ufd3e' : u'\ufd3f', u'\ufe17' : u'\ufe18', u'\ufe35' : u'\ufe36', u'\ufe37' : u'\ufe38',
|
2079
|
+
u'\ufe39' : u'\ufe3a', u'\ufe3b' : u'\ufe3c', u'\ufe3d' : u'\ufe3e', u'\ufe3f' : u'\ufe40',
|
2080
|
+
u'\ufe41' : u'\ufe42', u'\ufe43' : u'\ufe44', u'\ufe47' : u'\ufe48', u'\ufe59' : u'\ufe5a',
|
2081
|
+
u'\ufe5b' : u'\ufe5c', u'\ufe5d' : u'\ufe5e', u'\uff08' : u'\uff09', u'\uff1c' : u'\uff1e',
|
2082
|
+
u'\uff3b' : u'\uff3d', u'\uff5b' : u'\uff5d', u'\uff5f' : u'\uff60', u'\uff62' : u'\uff63',
|
2083
|
+
}
|
2084
|
+
|
2085
|
+
def _build_word_match(words, boundary_regex_fragment = None, prefix = '', suffix = ''):
|
2086
|
+
if boundary_regex_fragment is None:
|
2087
|
+
return r'\b(' + prefix + r'|'.join([ re.escape(x) for x in words]) + suffix + r')\b'
|
2088
|
+
else:
|
2089
|
+
return r'(?<!' + boundary_regex_fragment + ')' + prefix + '(' + \
|
2090
|
+
r'|'.join([ re.escape(x) for x in words]) + r')' + suffix + '(?!' + boundary_regex_fragment + ')'
|
2091
|
+
|
2092
|
+
def brackets_callback(token_class):
|
2093
|
+
def callback(lexer, match, context):
|
2094
|
+
groups = match.groupdict()
|
2095
|
+
opening_chars = groups['delimiter']
|
2096
|
+
n_chars = len(opening_chars)
|
2097
|
+
adverbs = groups.get('adverbs')
|
2098
|
+
|
2099
|
+
closer = Perl6Lexer.PERL6_BRACKETS.get(opening_chars[0])
|
2100
|
+
text = context.text
|
2101
|
+
|
2102
|
+
if closer is None: # it's not a mirrored character, which means we
|
2103
|
+
# just need to look for the next occurrence
|
2104
|
+
|
2105
|
+
end_pos = text.find(opening_chars, match.start('delimiter') + n_chars)
|
2106
|
+
else: # we need to look for the corresponding closing character,
|
2107
|
+
# keep nesting in mind
|
2108
|
+
closing_chars = closer * n_chars
|
2109
|
+
nesting_level = 1
|
2110
|
+
|
2111
|
+
search_pos = match.start('delimiter')
|
2112
|
+
|
2113
|
+
while nesting_level > 0:
|
2114
|
+
next_open_pos = text.find(opening_chars, search_pos + n_chars)
|
2115
|
+
next_close_pos = text.find(closing_chars, search_pos + n_chars)
|
2116
|
+
|
2117
|
+
if next_close_pos == -1:
|
2118
|
+
next_close_pos = len(text)
|
2119
|
+
nesting_level = 0
|
2120
|
+
elif next_open_pos != -1 and next_open_pos < next_close_pos:
|
2121
|
+
nesting_level += 1
|
2122
|
+
search_pos = next_open_pos
|
2123
|
+
else: # next_close_pos < next_open_pos
|
2124
|
+
nesting_level -= 1
|
2125
|
+
search_pos = next_close_pos
|
2126
|
+
|
2127
|
+
end_pos = next_close_pos
|
2128
|
+
|
2129
|
+
if adverbs is not None and re.search(r':to\b', adverbs):
|
2130
|
+
heredoc_terminator = text[match.start('delimiter') + n_chars : end_pos]
|
2131
|
+
end_heredoc = re.search(r'^\s*' + re.escape(heredoc_terminator) + r'\s*$', text[ match.end('delimiter') : ], re.MULTILINE)
|
2132
|
+
|
2133
|
+
if end_heredoc:
|
2134
|
+
end_pos = match.end('delimiter') + end_heredoc.end()
|
2135
|
+
else:
|
2136
|
+
end_pos = len(text)
|
2137
|
+
|
2138
|
+
yield match.start(), token_class, text[match.start() : end_pos + n_chars]
|
2139
|
+
context.pos = end_pos + n_chars
|
2140
|
+
|
2141
|
+
return callback
|
2142
|
+
|
2143
|
+
def opening_brace_callback(lexer, match, context):
|
2144
|
+
stack = context.stack
|
2145
|
+
|
2146
|
+
yield match.start(), Text, context.text[match.start() : match.end()]
|
2147
|
+
context.pos = match.end()
|
2148
|
+
|
2149
|
+
# if we encounter an opening brace and we're one level
|
2150
|
+
# below a token state, it means we need to increment
|
2151
|
+
# the nesting level for braces so we know later when
|
2152
|
+
# we should return to the token rules.
|
2153
|
+
if len(stack) > 2 and stack[-2] == 'token':
|
2154
|
+
context.perl6_token_nesting_level += 1
|
2155
|
+
|
2156
|
+
def closing_brace_callback(lexer, match, context):
|
2157
|
+
stack = context.stack
|
2158
|
+
|
2159
|
+
yield match.start(), Text, context.text[match.start() : match.end()]
|
2160
|
+
context.pos = match.end()
|
2161
|
+
|
2162
|
+
# if we encounter a free closing brace and we're one level
|
2163
|
+
# below a token state, it means we need to check the nesting
|
2164
|
+
# level to see if we need to return to the token state.
|
2165
|
+
if len(stack) > 2 and stack[-2] == 'token':
|
2166
|
+
context.perl6_token_nesting_level -= 1
|
2167
|
+
if context.perl6_token_nesting_level == 0:
|
2168
|
+
stack.pop()
|
2169
|
+
|
2170
|
+
def embedded_perl6_callback(lexer, match, context):
|
2171
|
+
context.perl6_token_nesting_level = 1
|
2172
|
+
yield match.start(), Text, context.text[match.start() : match.end()]
|
2173
|
+
context.pos = match.end()
|
2174
|
+
context.stack.append('root')
|
2175
|
+
|
2176
|
+
# If you're modifying these rules, be careful if you need to process '{' or '}' characters.
|
2177
|
+
# We have special logic for processing these characters (due to the fact that you can nest
|
2178
|
+
# Perl 6 code in regex blocks), so if you need to process one of them, make sure you also
|
2179
|
+
# process the corresponding one!
|
2180
|
+
tokens = {
|
2181
|
+
'common' : [
|
2182
|
+
(r'#[`|=](?P<delimiter>(?P<first_char>[' + ''.join(PERL6_BRACKETS.keys()) + r'])(?P=first_char)*)', brackets_callback(Comment.Multiline)),
|
2183
|
+
(r'#[^\n]*$', Comment.Singleline),
|
2184
|
+
(r'^(\s*)=begin\s+(\w+)\b.*?^\1=end\s+\2', Comment.Multiline),
|
2185
|
+
(r'^(\s*)=for.*?\n\s*?\n', Comment.Multiline),
|
2186
|
+
(r'^=.*?\n\s*?\n', Comment.Multiline),
|
2187
|
+
(r'(regex|token|rule)(\s*' + PERL6_IDENTIFIER_RANGE + '+:sym)', bygroups(Keyword, Name), 'token-sym-brackets'),
|
2188
|
+
(r'(regex|token|rule)(?!' + PERL6_IDENTIFIER_RANGE + ')(\s*' + PERL6_IDENTIFIER_RANGE + '+)?', bygroups(Keyword, Name), 'pre-token'),
|
2189
|
+
# deal with a special case in the Perl 6 grammar (role q { ... })
|
2190
|
+
(r'(role)(\s+)(q)(\s*)', bygroups(Keyword, Text, Name, Text)),
|
2191
|
+
(_build_word_match(PERL6_KEYWORDS, PERL6_IDENTIFIER_RANGE), Keyword),
|
2192
|
+
(_build_word_match(PERL6_BUILTIN_CLASSES, PERL6_IDENTIFIER_RANGE, suffix = '(?::[UD])?'), Name.Builtin),
|
2193
|
+
(_build_word_match(PERL6_BUILTINS, PERL6_IDENTIFIER_RANGE), Name.Builtin),
|
2194
|
+
# copied from PerlLexer
|
2195
|
+
(r'[$@%&][.^:?=!~]?' + PERL6_IDENTIFIER_RANGE + u'+(?:<<.*?>>|<.*?>|«.*?»)*', Name.Variable),
|
2196
|
+
(r'\$[!/](?:<<.*?>>|<.*?>|«.*?»)*', Name.Variable.Global),
|
2197
|
+
(r'::\?\w+', Name.Variable.Global),
|
2198
|
+
(r'[$@%&]\*' + PERL6_IDENTIFIER_RANGE + u'+(?:<<.*?>>|<.*?>|«.*?»)*', Name.Variable.Global),
|
2199
|
+
(r'\$(?:<.*?>)+', Name.Variable),
|
2200
|
+
(r'(?:q|qq|Q)[a-zA-Z]?\s*(?P<adverbs>:[\w\s:]+)?\s*(?P<delimiter>(?P<first_char>[^0-9a-zA-Z:\s])(?P=first_char)*)', brackets_callback(String)),
|
2201
|
+
# copied from PerlLexer
|
2202
|
+
(r'0_?[0-7]+(_[0-7]+)*', Number.Oct),
|
2203
|
+
(r'0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*', Number.Hex),
|
2204
|
+
(r'0b[01]+(_[01]+)*', Number.Bin),
|
2205
|
+
(r'(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?', Number.Float),
|
2206
|
+
(r'(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*', Number.Float),
|
2207
|
+
(r'\d+(_\d+)*', Number.Integer),
|
2208
|
+
(r'(?<=~~)\s*/(?:\\\\|\\/|.)*?/', String.Regex),
|
2209
|
+
(r'(?<=[=(,])\s*/(?:\\\\|\\/|.)*?/', String.Regex),
|
2210
|
+
(r'm\w+(?=\()', Name),
|
2211
|
+
(r'(?:m|ms|rx)\s*(?P<adverbs>:[\w\s:]+)?\s*(?P<delimiter>(?P<first_char>[^0-9a-zA-Z:\s])(?P=first_char)*)', brackets_callback(String.Regex)),
|
2212
|
+
(r'(?:s|ss|tr)\s*(?::[\w\s:]+)?\s*/(?:\\\\|\\/|.)*?/(?:\\\\|\\/|.)*?/', String.Regex),
|
2213
|
+
(r'<[^\s=].*?\S>', String),
|
2214
|
+
(_build_word_match(PERL6_OPERATORS), Operator),
|
2215
|
+
(r'[0-9a-zA-Z_]' + PERL6_IDENTIFIER_RANGE + '*', Name),
|
2216
|
+
(r"'(\\\\|\\[^\\]|[^'\\])*'", String),
|
2217
|
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String),
|
2218
|
+
],
|
2219
|
+
'root' : [
|
2220
|
+
include('common'),
|
2221
|
+
(r'\{', opening_brace_callback),
|
2222
|
+
(r'\}', closing_brace_callback),
|
2223
|
+
(r'.+?', Text),
|
2224
|
+
],
|
2225
|
+
'pre-token' : [
|
2226
|
+
include('common'),
|
2227
|
+
(r'\{', Text, ('#pop', 'token')),
|
2228
|
+
(r'.+?', Text),
|
2229
|
+
],
|
2230
|
+
'token-sym-brackets' : [
|
2231
|
+
(r'(?P<delimiter>(?P<first_char>[' + ''.join(PERL6_BRACKETS.keys()) + '])(?P=first_char)*)', brackets_callback(Name), ('#pop', 'pre-token')),
|
2232
|
+
(r'', Name, ('#pop', 'pre-token')),
|
2233
|
+
],
|
2234
|
+
'token': [
|
2235
|
+
(r'}', Text, '#pop'),
|
2236
|
+
(r'(?<=:)(?:my|our|state|constant|temp|let).*?;', using(this)),
|
2237
|
+
# make sure that quotes in character classes aren't treated as strings
|
2238
|
+
(r'<(?:[-!?+.]\s*)?\[.*?\]>', String.Regex),
|
2239
|
+
# make sure that '#' characters in quotes aren't treated as comments
|
2240
|
+
(r"(?<!\\)'(\\\\|\\[^\\]|[^'\\])*'", String.Regex),
|
2241
|
+
(r'(?<!\\)"(\\\\|\\[^\\]|[^"\\])*"', String.Regex),
|
2242
|
+
(r'#.*?$', Comment.Singleline),
|
2243
|
+
(r'\{', embedded_perl6_callback),
|
2244
|
+
('.+?', String.Regex),
|
2245
|
+
],
|
2246
|
+
}
|
2247
|
+
|
2248
|
+
def analyse_text(text):
|
2249
|
+
def strip_pod(lines):
|
2250
|
+
in_pod = False
|
2251
|
+
stripped_lines = []
|
2252
|
+
|
2253
|
+
for line in lines:
|
2254
|
+
if re.match(r'^=(?:end|cut)', line):
|
2255
|
+
in_pod = False
|
2256
|
+
elif re.match(r'^=\w+', line):
|
2257
|
+
in_pod = True
|
2258
|
+
elif not in_pod:
|
2259
|
+
stripped_lines.append(line)
|
2260
|
+
|
2261
|
+
return stripped_lines
|
2262
|
+
|
2263
|
+
lines = text.splitlines()
|
2264
|
+
lines = strip_pod(lines)
|
2265
|
+
text = '\n'.join(lines)
|
2266
|
+
|
2267
|
+
if shebang_matches(text, r'perl6|rakudo|niecza'):
|
2268
|
+
return True
|
2269
|
+
|
2270
|
+
if 'use v6' in text:
|
2271
|
+
return 0.91 # 0.01 greater than Perl says for 'my $'
|
2272
|
+
if re.search(r'[$@%]\*[A-Z]+', text): # Perl 6-style globals ($*OS)
|
2273
|
+
return 0.91
|
2274
|
+
if re.search(r'[$@%]\?[A-Z]+', text): # Perl 6 compiler variables ($?PACKAGE)
|
2275
|
+
return 0.91
|
2276
|
+
if re.search(r'[$@%][!.][A-Za-z0-9_-]+', text): # Perl 6 member variables
|
2277
|
+
return 0.91
|
2278
|
+
|
2279
|
+
for line in text.splitlines():
|
2280
|
+
if re.match(r'\s*(?:my|our)?\s*module', line): # module declarations
|
2281
|
+
return 0.91
|
2282
|
+
if re.match(r'\s*(?:my|our)?\s*role', line): # role declarations
|
2283
|
+
return 0.91
|
2284
|
+
if re.match(r'\s*(?:my|our)?\s*class\b', line): # class declarations
|
2285
|
+
return 0.91
|
2286
|
+
return False
|
2287
|
+
|
2288
|
+
def __init__(self, **options):
|
2289
|
+
super(Perl6Lexer, self).__init__(**options)
|
2290
|
+
self.encoding = options.get('encoding', 'utf-8')
|