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,356 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.hdl
|
4
|
+
~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Lexers for hardware descriptor 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
|
+
from pygments.lexer import RegexLexer, bygroups, include, using, this
|
14
|
+
from pygments.token import \
|
15
|
+
Text, Comment, Operator, Keyword, Name, String, Number, Punctuation, \
|
16
|
+
Error
|
17
|
+
|
18
|
+
__all__ = ['VerilogLexer', 'SystemVerilogLexer', 'VhdlLexer']
|
19
|
+
|
20
|
+
|
21
|
+
class VerilogLexer(RegexLexer):
|
22
|
+
"""
|
23
|
+
For verilog source code with preprocessor directives.
|
24
|
+
|
25
|
+
*New in Pygments 1.4.*
|
26
|
+
"""
|
27
|
+
name = 'verilog'
|
28
|
+
aliases = ['verilog', 'v']
|
29
|
+
filenames = ['*.v']
|
30
|
+
mimetypes = ['text/x-verilog']
|
31
|
+
|
32
|
+
#: optional Comment or Whitespace
|
33
|
+
_ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
|
34
|
+
|
35
|
+
tokens = {
|
36
|
+
'root': [
|
37
|
+
(r'^\s*`define', Comment.Preproc, 'macro'),
|
38
|
+
(r'\n', Text),
|
39
|
+
(r'\s+', Text),
|
40
|
+
(r'\\\n', Text), # line continuation
|
41
|
+
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
42
|
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
43
|
+
(r'[{}#@]', Punctuation),
|
44
|
+
(r'L?"', String, 'string'),
|
45
|
+
(r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
|
46
|
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
|
47
|
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
48
|
+
(r'([0-9]+)|(\'h)[0-9a-fA-F]+', Number.Hex),
|
49
|
+
(r'([0-9]+)|(\'b)[0-1]+', Number.Hex), # should be binary
|
50
|
+
(r'([0-9]+)|(\'d)[0-9]+', Number.Integer),
|
51
|
+
(r'([0-9]+)|(\'o)[0-7]+', Number.Oct),
|
52
|
+
(r'\'[01xz]', Number),
|
53
|
+
(r'\d+[Ll]?', Number.Integer),
|
54
|
+
(r'\*/', Error),
|
55
|
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
56
|
+
(r'[()\[\],.;\']', Punctuation),
|
57
|
+
(r'`[a-zA-Z_][a-zA-Z0-9_]*', Name.Constant),
|
58
|
+
|
59
|
+
(r'^(\s*)(package)(\s+)', bygroups(Text, Keyword.Namespace, Text)),
|
60
|
+
(r'^(\s*)(import)(\s+)', bygroups(Text, Keyword.Namespace, Text),
|
61
|
+
'import'),
|
62
|
+
|
63
|
+
(r'(always|always_comb|always_ff|always_latch|and|assign|automatic|'
|
64
|
+
r'begin|break|buf|bufif0|bufif1|case|casex|casez|cmos|const|'
|
65
|
+
r'continue|deassign|default|defparam|disable|do|edge|else|end|endcase|'
|
66
|
+
r'endfunction|endgenerate|endmodule|endpackage|endprimitive|endspecify|'
|
67
|
+
r'endtable|endtask|enum|event|final|for|force|forever|fork|function|'
|
68
|
+
r'generate|genvar|highz0|highz1|if|initial|inout|input|'
|
69
|
+
r'integer|join|large|localparam|macromodule|medium|module|'
|
70
|
+
r'nand|negedge|nmos|nor|not|notif0|notif1|or|output|packed|'
|
71
|
+
r'parameter|pmos|posedge|primitive|pull0|pull1|pulldown|pullup|rcmos|'
|
72
|
+
r'ref|release|repeat|return|rnmos|rpmos|rtran|rtranif0|'
|
73
|
+
r'rtranif1|scalared|signed|small|specify|specparam|strength|'
|
74
|
+
r'string|strong0|strong1|struct|table|task|'
|
75
|
+
r'tran|tranif0|tranif1|type|typedef|'
|
76
|
+
r'unsigned|var|vectored|void|wait|weak0|weak1|while|'
|
77
|
+
r'xnor|xor)\b', Keyword),
|
78
|
+
|
79
|
+
(r'`(accelerate|autoexpand_vectornets|celldefine|default_nettype|'
|
80
|
+
r'else|elsif|endcelldefine|endif|endprotect|endprotected|'
|
81
|
+
r'expand_vectornets|ifdef|ifndef|include|noaccelerate|noexpand_vectornets|'
|
82
|
+
r'noremove_gatenames|noremove_netnames|nounconnected_drive|'
|
83
|
+
r'protect|protected|remove_gatenames|remove_netnames|resetall|'
|
84
|
+
r'timescale|unconnected_drive|undef)\b', Comment.Preproc),
|
85
|
+
|
86
|
+
(r'\$(bits|bitstoreal|bitstoshortreal|countdrivers|display|fclose|'
|
87
|
+
r'fdisplay|finish|floor|fmonitor|fopen|fstrobe|fwrite|'
|
88
|
+
r'getpattern|history|incsave|input|itor|key|list|log|'
|
89
|
+
r'monitor|monitoroff|monitoron|nokey|nolog|printtimescale|'
|
90
|
+
r'random|readmemb|readmemh|realtime|realtobits|reset|reset_count|'
|
91
|
+
r'reset_value|restart|rtoi|save|scale|scope|shortrealtobits|'
|
92
|
+
r'showscopes|showvariables|showvars|sreadmemb|sreadmemh|'
|
93
|
+
r'stime|stop|strobe|time|timeformat|write)\b', Name.Builtin),
|
94
|
+
|
95
|
+
(r'(byte|shortint|int|longint|integer|time|'
|
96
|
+
r'bit|logic|reg|'
|
97
|
+
r'supply0|supply1|tri|triand|trior|tri0|tri1|trireg|uwire|wire|wand|wor'
|
98
|
+
r'shortreal|real|realtime)\b', Keyword.Type),
|
99
|
+
('[a-zA-Z_][a-zA-Z0-9_]*:(?!:)', Name.Label),
|
100
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
101
|
+
],
|
102
|
+
'string': [
|
103
|
+
(r'"', String, '#pop'),
|
104
|
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
105
|
+
(r'[^\\"\n]+', String), # all other characters
|
106
|
+
(r'\\\n', String), # line continuation
|
107
|
+
(r'\\', String), # stray backslash
|
108
|
+
],
|
109
|
+
'macro': [
|
110
|
+
(r'[^/\n]+', Comment.Preproc),
|
111
|
+
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
|
112
|
+
(r'//.*?\n', Comment.Single, '#pop'),
|
113
|
+
(r'/', Comment.Preproc),
|
114
|
+
(r'(?<=\\)\n', Comment.Preproc),
|
115
|
+
(r'\n', Comment.Preproc, '#pop'),
|
116
|
+
],
|
117
|
+
'import': [
|
118
|
+
(r'[a-zA-Z0-9_:]+\*?', Name.Namespace, '#pop')
|
119
|
+
]
|
120
|
+
}
|
121
|
+
|
122
|
+
def get_tokens_unprocessed(self, text):
|
123
|
+
for index, token, value in \
|
124
|
+
RegexLexer.get_tokens_unprocessed(self, text):
|
125
|
+
# Convention: mark all upper case names as constants
|
126
|
+
if token is Name:
|
127
|
+
if value.isupper():
|
128
|
+
token = Name.Constant
|
129
|
+
yield index, token, value
|
130
|
+
|
131
|
+
|
132
|
+
class SystemVerilogLexer(RegexLexer):
|
133
|
+
"""
|
134
|
+
Extends verilog lexer to recognise all SystemVerilog keywords from IEEE
|
135
|
+
1800-2009 standard.
|
136
|
+
|
137
|
+
*New in Pygments 1.5.*
|
138
|
+
"""
|
139
|
+
name = 'systemverilog'
|
140
|
+
aliases = ['systemverilog', 'sv']
|
141
|
+
filenames = ['*.sv', '*.svh']
|
142
|
+
mimetypes = ['text/x-systemverilog']
|
143
|
+
|
144
|
+
#: optional Comment or Whitespace
|
145
|
+
_ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
|
146
|
+
|
147
|
+
tokens = {
|
148
|
+
'root': [
|
149
|
+
(r'^\s*`define', Comment.Preproc, 'macro'),
|
150
|
+
(r'^(\s*)(package)(\s+)', bygroups(Text, Keyword.Namespace, Text)),
|
151
|
+
(r'^(\s*)(import)(\s+)', bygroups(Text, Keyword.Namespace, Text), 'import'),
|
152
|
+
|
153
|
+
(r'\n', Text),
|
154
|
+
(r'\s+', Text),
|
155
|
+
(r'\\\n', Text), # line continuation
|
156
|
+
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
157
|
+
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
|
158
|
+
(r'[{}#@]', Punctuation),
|
159
|
+
(r'L?"', String, 'string'),
|
160
|
+
(r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
|
161
|
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
|
162
|
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
163
|
+
(r'([0-9]+)|(\'h)[0-9a-fA-F]+', Number.Hex),
|
164
|
+
(r'([0-9]+)|(\'b)[0-1]+', Number.Hex), # should be binary
|
165
|
+
(r'([0-9]+)|(\'d)[0-9]+', Number.Integer),
|
166
|
+
(r'([0-9]+)|(\'o)[0-7]+', Number.Oct),
|
167
|
+
(r'\'[01xz]', Number),
|
168
|
+
(r'\d+[Ll]?', Number.Integer),
|
169
|
+
(r'\*/', Error),
|
170
|
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
171
|
+
(r'[()\[\],.;\']', Punctuation),
|
172
|
+
(r'`[a-zA-Z_][a-zA-Z0-9_]*', Name.Constant),
|
173
|
+
|
174
|
+
(r'(accept_on|alias|always|always_comb|always_ff|always_latch|'
|
175
|
+
r'and|assert|assign|assume|automatic|before|begin|bind|bins|'
|
176
|
+
r'binsof|bit|break|buf|bufif0|bufif1|byte|case|casex|casez|'
|
177
|
+
r'cell|chandle|checker|class|clocking|cmos|config|const|constraint|'
|
178
|
+
r'context|continue|cover|covergroup|coverpoint|cross|deassign|'
|
179
|
+
r'default|defparam|design|disable|dist|do|edge|else|end|endcase|'
|
180
|
+
r'endchecker|endclass|endclocking|endconfig|endfunction|endgenerate|'
|
181
|
+
r'endgroup|endinterface|endmodule|endpackage|endprimitive|'
|
182
|
+
r'endprogram|endproperty|endsequence|endspecify|endtable|'
|
183
|
+
r'endtask|enum|event|eventually|expect|export|extends|extern|'
|
184
|
+
r'final|first_match|for|force|foreach|forever|fork|forkjoin|'
|
185
|
+
r'function|generate|genvar|global|highz0|highz1|if|iff|ifnone|'
|
186
|
+
r'ignore_bins|illegal_bins|implies|import|incdir|include|'
|
187
|
+
r'initial|inout|input|inside|instance|int|integer|interface|'
|
188
|
+
r'intersect|join|join_any|join_none|large|let|liblist|library|'
|
189
|
+
r'local|localparam|logic|longint|macromodule|matches|medium|'
|
190
|
+
r'modport|module|nand|negedge|new|nexttime|nmos|nor|noshowcancelled|'
|
191
|
+
r'not|notif0|notif1|null|or|output|package|packed|parameter|'
|
192
|
+
r'pmos|posedge|primitive|priority|program|property|protected|'
|
193
|
+
r'pull0|pull1|pulldown|pullup|pulsestyle_ondetect|pulsestyle_onevent|'
|
194
|
+
r'pure|rand|randc|randcase|randsequence|rcmos|real|realtime|'
|
195
|
+
r'ref|reg|reject_on|release|repeat|restrict|return|rnmos|'
|
196
|
+
r'rpmos|rtran|rtranif0|rtranif1|s_always|s_eventually|s_nexttime|'
|
197
|
+
r's_until|s_until_with|scalared|sequence|shortint|shortreal|'
|
198
|
+
r'showcancelled|signed|small|solve|specify|specparam|static|'
|
199
|
+
r'string|strong|strong0|strong1|struct|super|supply0|supply1|'
|
200
|
+
r'sync_accept_on|sync_reject_on|table|tagged|task|this|throughout|'
|
201
|
+
r'time|timeprecision|timeunit|tran|tranif0|tranif1|tri|tri0|'
|
202
|
+
r'tri1|triand|trior|trireg|type|typedef|union|unique|unique0|'
|
203
|
+
r'unsigned|until|until_with|untyped|use|uwire|var|vectored|'
|
204
|
+
r'virtual|void|wait|wait_order|wand|weak|weak0|weak1|while|'
|
205
|
+
r'wildcard|wire|with|within|wor|xnor|xor)\b', Keyword ),
|
206
|
+
|
207
|
+
(r'(`__FILE__|`__LINE__|`begin_keywords|`celldefine|`default_nettype|'
|
208
|
+
r'`define|`else|`elsif|`end_keywords|`endcelldefine|`endif|'
|
209
|
+
r'`ifdef|`ifndef|`include|`line|`nounconnected_drive|`pragma|'
|
210
|
+
r'`resetall|`timescale|`unconnected_drive|`undef|`undefineall)\b',
|
211
|
+
Comment.Preproc ),
|
212
|
+
|
213
|
+
(r'(\$display|\$displayb|\$displayh|\$displayo|\$dumpall|\$dumpfile|'
|
214
|
+
r'\$dumpflush|\$dumplimit|\$dumpoff|\$dumpon|\$dumpports|'
|
215
|
+
r'\$dumpportsall|\$dumpportsflush|\$dumpportslimit|\$dumpportsoff|'
|
216
|
+
r'\$dumpportson|\$dumpvars|\$fclose|\$fdisplay|\$fdisplayb|'
|
217
|
+
r'\$fdisplayh|\$fdisplayo|\$feof|\$ferror|\$fflush|\$fgetc|'
|
218
|
+
r'\$fgets|\$fmonitor|\$fmonitorb|\$fmonitorh|\$fmonitoro|'
|
219
|
+
r'\$fopen|\$fread|\$fscanf|\$fseek|\$fstrobe|\$fstrobeb|\$fstrobeh|'
|
220
|
+
r'\$fstrobeo|\$ftell|\$fwrite|\$fwriteb|\$fwriteh|\$fwriteo|'
|
221
|
+
r'\$monitor|\$monitorb|\$monitorh|\$monitoro|\$monitoroff|'
|
222
|
+
r'\$monitoron|\$plusargs|\$readmemb|\$readmemh|\$rewind|\$sformat|'
|
223
|
+
r'\$sformatf|\$sscanf|\$strobe|\$strobeb|\$strobeh|\$strobeo|'
|
224
|
+
r'\$swrite|\$swriteb|\$swriteh|\$swriteo|\$test|\$ungetc|'
|
225
|
+
r'\$value\$plusargs|\$write|\$writeb|\$writeh|\$writememb|'
|
226
|
+
r'\$writememh|\$writeo)\b' , Name.Builtin ),
|
227
|
+
|
228
|
+
(r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
|
229
|
+
(r'(byte|shortint|int|longint|integer|time|'
|
230
|
+
r'bit|logic|reg|'
|
231
|
+
r'supply0|supply1|tri|triand|trior|tri0|tri1|trireg|uwire|wire|wand|wor'
|
232
|
+
r'shortreal|real|realtime)\b', Keyword.Type),
|
233
|
+
('[a-zA-Z_][a-zA-Z0-9_]*:(?!:)', Name.Label),
|
234
|
+
('[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
235
|
+
],
|
236
|
+
'classname': [
|
237
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop'),
|
238
|
+
],
|
239
|
+
'string': [
|
240
|
+
(r'"', String, '#pop'),
|
241
|
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
242
|
+
(r'[^\\"\n]+', String), # all other characters
|
243
|
+
(r'\\\n', String), # line continuation
|
244
|
+
(r'\\', String), # stray backslash
|
245
|
+
],
|
246
|
+
'macro': [
|
247
|
+
(r'[^/\n]+', Comment.Preproc),
|
248
|
+
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
|
249
|
+
(r'//.*?\n', Comment.Single, '#pop'),
|
250
|
+
(r'/', Comment.Preproc),
|
251
|
+
(r'(?<=\\)\n', Comment.Preproc),
|
252
|
+
(r'\n', Comment.Preproc, '#pop'),
|
253
|
+
],
|
254
|
+
'import': [
|
255
|
+
(r'[a-zA-Z0-9_:]+\*?', Name.Namespace, '#pop')
|
256
|
+
]
|
257
|
+
}
|
258
|
+
|
259
|
+
def get_tokens_unprocessed(self, text):
|
260
|
+
for index, token, value in \
|
261
|
+
RegexLexer.get_tokens_unprocessed(self, text):
|
262
|
+
# Convention: mark all upper case names as constants
|
263
|
+
if token is Name:
|
264
|
+
if value.isupper():
|
265
|
+
token = Name.Constant
|
266
|
+
yield index, token, value
|
267
|
+
|
268
|
+
def analyse_text(text):
|
269
|
+
if text.startswith('//') or text.startswith('/*'):
|
270
|
+
return 0.5
|
271
|
+
|
272
|
+
|
273
|
+
class VhdlLexer(RegexLexer):
|
274
|
+
"""
|
275
|
+
For VHDL source code.
|
276
|
+
|
277
|
+
*New in Pygments 1.5.*
|
278
|
+
"""
|
279
|
+
name = 'vhdl'
|
280
|
+
aliases = ['vhdl']
|
281
|
+
filenames = ['*.vhdl', '*.vhd']
|
282
|
+
mimetypes = ['text/x-vhdl']
|
283
|
+
flags = re.MULTILINE | re.IGNORECASE
|
284
|
+
|
285
|
+
tokens = {
|
286
|
+
'root': [
|
287
|
+
(r'\n', Text),
|
288
|
+
(r'\s+', Text),
|
289
|
+
(r'\\\n', Text), # line continuation
|
290
|
+
(r'--(?![!#$%&*+./<=>?@\^|_~]).*?$', Comment.Single),
|
291
|
+
(r"'(U|X|0|1|Z|W|L|H|-)'", String.Char),
|
292
|
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
293
|
+
(r"'[a-zA-Z_][a-zA-Z0-9_]*", Name.Attribute),
|
294
|
+
(r'[()\[\],.;\']', Punctuation),
|
295
|
+
(r'"[^\n\\]*"', String),
|
296
|
+
|
297
|
+
(r'(library)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)',
|
298
|
+
bygroups(Keyword, Text, Name.Namespace)),
|
299
|
+
(r'(use)(\s+)(entity)', bygroups(Keyword, Text, Keyword)),
|
300
|
+
(r'(use)(\s+)([a-zA-Z_][\.a-zA-Z0-9_]*)',
|
301
|
+
bygroups(Keyword, Text, Name.Namespace)),
|
302
|
+
(r'(entity|component)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)',
|
303
|
+
bygroups(Keyword, Text, Name.Class)),
|
304
|
+
(r'(architecture|configuration)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)(\s+)'
|
305
|
+
r'(of)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)(\s+)(is)',
|
306
|
+
bygroups(Keyword, Text, Name.Class, Text, Keyword, Text,
|
307
|
+
Name.Class, Text, Keyword)),
|
308
|
+
|
309
|
+
(r'(end)(\s+)', bygroups(using(this), Text), 'endblock'),
|
310
|
+
|
311
|
+
include('types'),
|
312
|
+
include('keywords'),
|
313
|
+
include('numbers'),
|
314
|
+
|
315
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
316
|
+
],
|
317
|
+
'endblock': [
|
318
|
+
include('keywords'),
|
319
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class),
|
320
|
+
(r'(\s+)', Text),
|
321
|
+
(r';', Punctuation, '#pop'),
|
322
|
+
],
|
323
|
+
'types': [
|
324
|
+
(r'(boolean|bit|character|severity_level|integer|time|delay_length|'
|
325
|
+
r'natural|positive|string|bit_vector|file_open_kind|'
|
326
|
+
r'file_open_status|std_ulogic|std_ulogic_vector|std_logic|'
|
327
|
+
r'std_logic_vector)\b', Keyword.Type),
|
328
|
+
],
|
329
|
+
'keywords': [
|
330
|
+
(r'(abs|access|after|alias|all|and|'
|
331
|
+
r'architecture|array|assert|attribute|begin|block|'
|
332
|
+
r'body|buffer|bus|case|component|configuration|'
|
333
|
+
r'constant|disconnect|downto|else|elsif|end|'
|
334
|
+
r'entity|exit|file|for|function|generate|'
|
335
|
+
r'generic|group|guarded|if|impure|in|'
|
336
|
+
r'inertial|inout|is|label|library|linkage|'
|
337
|
+
r'literal|loop|map|mod|nand|new|'
|
338
|
+
r'next|nor|not|null|of|on|'
|
339
|
+
r'open|or|others|out|package|port|'
|
340
|
+
r'postponed|procedure|process|pure|range|record|'
|
341
|
+
r'register|reject|return|rol|ror|select|'
|
342
|
+
r'severity|signal|shared|sla|sli|sra|'
|
343
|
+
r'srl|subtype|then|to|transport|type|'
|
344
|
+
r'units|until|use|variable|wait|when|'
|
345
|
+
r'while|with|xnor|xor)\b', Keyword),
|
346
|
+
],
|
347
|
+
'numbers': [
|
348
|
+
(r'\d{1,2}#[0-9a-fA-F_]+#?', Number.Integer),
|
349
|
+
(r'[0-1_]+(\.[0-1_])', Number.Integer),
|
350
|
+
(r'\d+', Number.Integer),
|
351
|
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float),
|
352
|
+
(r'H"[0-9a-fA-F_]+"', Number.Oct),
|
353
|
+
(r'O"[0-7_]+"', Number.Oct),
|
354
|
+
(r'B"[0-1_]+"', Number.Oct),
|
355
|
+
],
|
356
|
+
}
|
@@ -0,0 +1,1112 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.jvm
|
4
|
+
~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Pygments lexers for JVM 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, include, bygroups, using, \
|
15
|
+
this
|
16
|
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
17
|
+
Number, Punctuation
|
18
|
+
from pygments.util import get_choice_opt
|
19
|
+
from pygments import unistring as uni
|
20
|
+
|
21
|
+
|
22
|
+
__all__ = ['JavaLexer', 'ScalaLexer', 'GosuLexer', 'GosuTemplateLexer',
|
23
|
+
'GroovyLexer', 'IokeLexer', 'ClojureLexer', 'KotlinLexer',
|
24
|
+
'XtendLexer', 'AspectJLexer', 'CeylonLexer']
|
25
|
+
|
26
|
+
|
27
|
+
class JavaLexer(RegexLexer):
|
28
|
+
"""
|
29
|
+
For `Java <http://www.sun.com/java/>`_ source code.
|
30
|
+
"""
|
31
|
+
|
32
|
+
name = 'Java'
|
33
|
+
aliases = ['java']
|
34
|
+
filenames = ['*.java']
|
35
|
+
mimetypes = ['text/x-java']
|
36
|
+
|
37
|
+
flags = re.MULTILINE | re.DOTALL
|
38
|
+
|
39
|
+
tokens = {
|
40
|
+
'root': [
|
41
|
+
# method names
|
42
|
+
(r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]<>]*\s+)+?)' # return arguments
|
43
|
+
r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
|
44
|
+
r'(\s*)(\()', # signature start
|
45
|
+
bygroups(using(this), Name.Function, Text, Operator)),
|
46
|
+
(r'[^\S\n]+', Text),
|
47
|
+
(r'//.*?\n', Comment.Single),
|
48
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
49
|
+
(r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
|
50
|
+
(r'(assert|break|case|catch|continue|default|do|else|finally|for|'
|
51
|
+
r'if|goto|instanceof|new|return|switch|this|throw|try|while)\b',
|
52
|
+
Keyword),
|
53
|
+
(r'(abstract|const|enum|extends|final|implements|native|private|'
|
54
|
+
r'protected|public|static|strictfp|super|synchronized|throws|'
|
55
|
+
r'transient|volatile)\b', Keyword.Declaration),
|
56
|
+
(r'(boolean|byte|char|double|float|int|long|short|void)\b',
|
57
|
+
Keyword.Type),
|
58
|
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
|
59
|
+
(r'(true|false|null)\b', Keyword.Constant),
|
60
|
+
(r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text), 'class'),
|
61
|
+
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
62
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
63
|
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
|
64
|
+
(r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
|
65
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
|
66
|
+
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
|
67
|
+
(r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
|
68
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
69
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
70
|
+
(r'[0-9]+L?', Number.Integer),
|
71
|
+
(r'\n', Text)
|
72
|
+
],
|
73
|
+
'class': [
|
74
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
|
75
|
+
],
|
76
|
+
'import': [
|
77
|
+
(r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
|
78
|
+
],
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
class AspectJLexer(JavaLexer):
|
83
|
+
"""
|
84
|
+
For `AspectJ <http://www.eclipse.org/aspectj/>`_ source code.
|
85
|
+
|
86
|
+
*New in Pygments 1.6.*
|
87
|
+
"""
|
88
|
+
|
89
|
+
name = 'AspectJ'
|
90
|
+
aliases = ['aspectj']
|
91
|
+
filenames = ['*.aj']
|
92
|
+
mimetypes = ['text/x-aspectj']
|
93
|
+
|
94
|
+
aj_keywords = [
|
95
|
+
'aspect', 'pointcut', 'privileged', 'call', 'execution',
|
96
|
+
'initialization', 'preinitialization', 'handler', 'get', 'set',
|
97
|
+
'staticinitialization', 'target', 'args', 'within', 'withincode',
|
98
|
+
'cflow', 'cflowbelow', 'annotation', 'before', 'after', 'around',
|
99
|
+
'proceed', 'throwing', 'returning', 'adviceexecution', 'declare',
|
100
|
+
'parents', 'warning', 'error', 'soft', 'precedence', 'thisJoinPoint',
|
101
|
+
'thisJoinPointStaticPart', 'thisEnclosingJoinPointStaticPart',
|
102
|
+
'issingleton', 'perthis', 'pertarget', 'percflow', 'percflowbelow',
|
103
|
+
'pertypewithin', 'lock', 'unlock', 'thisAspectInstance'
|
104
|
+
]
|
105
|
+
aj_inter_type = ['parents:', 'warning:', 'error:', 'soft:', 'precedence:']
|
106
|
+
aj_inter_type_annotation = ['@type', '@method', '@constructor', '@field']
|
107
|
+
|
108
|
+
def get_tokens_unprocessed(self, text):
|
109
|
+
for index, token, value in JavaLexer.get_tokens_unprocessed(self, text):
|
110
|
+
if token is Name and value in self.aj_keywords:
|
111
|
+
yield index, Keyword, value
|
112
|
+
elif token is Name.Label and value in self.aj_inter_type:
|
113
|
+
yield index, Keyword, value[:-1]
|
114
|
+
yield index, Operator, value[-1]
|
115
|
+
elif token is Name.Decorator and value in self.aj_inter_type_annotation:
|
116
|
+
yield index, Keyword, value
|
117
|
+
else:
|
118
|
+
yield index, token, value
|
119
|
+
|
120
|
+
|
121
|
+
class ScalaLexer(RegexLexer):
|
122
|
+
"""
|
123
|
+
For `Scala <http://www.scala-lang.org>`_ source code.
|
124
|
+
"""
|
125
|
+
|
126
|
+
name = 'Scala'
|
127
|
+
aliases = ['scala']
|
128
|
+
filenames = ['*.scala']
|
129
|
+
mimetypes = ['text/x-scala']
|
130
|
+
|
131
|
+
flags = re.MULTILINE | re.DOTALL
|
132
|
+
|
133
|
+
# don't use raw unicode strings!
|
134
|
+
op = (u'[-~\\^\\*!%&\\\\<>\\|+=:/?@\u00a6-\u00a7\u00a9\u00ac\u00ae\u00b0-\u00b1'
|
135
|
+
u'\u00b6\u00d7\u00f7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9'
|
136
|
+
u'\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2'
|
137
|
+
u'\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38'
|
138
|
+
u'\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940'
|
139
|
+
u'\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c'
|
140
|
+
u'\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118'
|
141
|
+
u'\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144'
|
142
|
+
u'\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767'
|
143
|
+
u'\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb'
|
144
|
+
u'\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020'
|
145
|
+
u'\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3'
|
146
|
+
u'\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff'
|
147
|
+
u'\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66'
|
148
|
+
u'\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+')
|
149
|
+
|
150
|
+
letter = (u'[a-zA-Z\\$_\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6'
|
151
|
+
u'\u00f8-\u02af\u0370-\u0373\u0376-\u0377\u037b-\u037d\u0386'
|
152
|
+
u'\u0388-\u03f5\u03f7-\u0481\u048a-\u0556\u0561-\u0587\u05d0-\u05f2'
|
153
|
+
u'\u0621-\u063f\u0641-\u064a\u066e-\u066f\u0671-\u06d3\u06d5'
|
154
|
+
u'\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5'
|
155
|
+
u'\u07b1\u07ca-\u07ea\u0904-\u0939\u093d\u0950\u0958-\u0961'
|
156
|
+
u'\u0972-\u097f\u0985-\u09b9\u09bd\u09ce\u09dc-\u09e1\u09f0-\u09f1'
|
157
|
+
u'\u0a05-\u0a39\u0a59-\u0a5e\u0a72-\u0a74\u0a85-\u0ab9\u0abd'
|
158
|
+
u'\u0ad0-\u0ae1\u0b05-\u0b39\u0b3d\u0b5c-\u0b61\u0b71\u0b83-\u0bb9'
|
159
|
+
u'\u0bd0\u0c05-\u0c3d\u0c58-\u0c61\u0c85-\u0cb9\u0cbd\u0cde-\u0ce1'
|
160
|
+
u'\u0d05-\u0d3d\u0d60-\u0d61\u0d7a-\u0d7f\u0d85-\u0dc6\u0e01-\u0e30'
|
161
|
+
u'\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0eb0\u0eb2-\u0eb3\u0ebd-\u0ec4'
|
162
|
+
u'\u0edc-\u0f00\u0f40-\u0f6c\u0f88-\u0f8b\u1000-\u102a\u103f'
|
163
|
+
u'\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070'
|
164
|
+
u'\u1075-\u1081\u108e\u10a0-\u10fa\u1100-\u135a\u1380-\u138f'
|
165
|
+
u'\u13a0-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u16ee-\u1711'
|
166
|
+
u'\u1720-\u1731\u1740-\u1751\u1760-\u1770\u1780-\u17b3\u17dc'
|
167
|
+
u'\u1820-\u1842\u1844-\u18a8\u18aa-\u191c\u1950-\u19a9\u19c1-\u19c7'
|
168
|
+
u'\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf'
|
169
|
+
u'\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c77\u1d00-\u1d2b\u1d62-\u1d77'
|
170
|
+
u'\u1d79-\u1d9a\u1e00-\u1fbc\u1fbe\u1fc2-\u1fcc\u1fd0-\u1fdb'
|
171
|
+
u'\u1fe0-\u1fec\u1ff2-\u1ffc\u2071\u207f\u2102\u2107\u210a-\u2113'
|
172
|
+
u'\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139'
|
173
|
+
u'\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c7c'
|
174
|
+
u'\u2c80-\u2ce4\u2d00-\u2d65\u2d80-\u2dde\u3006-\u3007\u3021-\u3029'
|
175
|
+
u'\u3038-\u303a\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff-\u318e'
|
176
|
+
u'\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\ua014\ua016-\ua48c'
|
177
|
+
u'\ua500-\ua60b\ua610-\ua61f\ua62a-\ua66e\ua680-\ua697\ua722-\ua76f'
|
178
|
+
u'\ua771-\ua787\ua78b-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822'
|
179
|
+
u'\ua840-\ua873\ua882-\ua8b3\ua90a-\ua925\ua930-\ua946\uaa00-\uaa28'
|
180
|
+
u'\uaa40-\uaa42\uaa44-\uaa4b\uac00-\ud7a3\uf900-\ufb1d\ufb1f-\ufb28'
|
181
|
+
u'\ufb2a-\ufd3d\ufd50-\ufdfb\ufe70-\ufefc\uff21-\uff3a\uff41-\uff5a'
|
182
|
+
u'\uff66-\uff6f\uff71-\uff9d\uffa0-\uffdc]')
|
183
|
+
|
184
|
+
upper = (u'[A-Z\\$_\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108'
|
185
|
+
u'\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c'
|
186
|
+
u'\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130'
|
187
|
+
u'\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145'
|
188
|
+
u'\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a'
|
189
|
+
u'\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e'
|
190
|
+
u'\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182'
|
191
|
+
u'\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194'
|
192
|
+
u'\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7'
|
193
|
+
u'\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc'
|
194
|
+
u'\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9'
|
195
|
+
u'\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee'
|
196
|
+
u'\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204'
|
197
|
+
u'\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218'
|
198
|
+
u'\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c'
|
199
|
+
u'\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246'
|
200
|
+
u'\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f'
|
201
|
+
u'\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0'
|
202
|
+
u'\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7'
|
203
|
+
u'\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a'
|
204
|
+
u'\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e'
|
205
|
+
u'\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a'
|
206
|
+
u'\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae'
|
207
|
+
u'\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1'
|
208
|
+
u'\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6'
|
209
|
+
u'\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea'
|
210
|
+
u'\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe'
|
211
|
+
u'\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512'
|
212
|
+
u'\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556'
|
213
|
+
u'\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e'
|
214
|
+
u'\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22'
|
215
|
+
u'\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36'
|
216
|
+
u'\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a'
|
217
|
+
u'\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e'
|
218
|
+
u'\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72'
|
219
|
+
u'\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86'
|
220
|
+
u'\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2'
|
221
|
+
u'\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6'
|
222
|
+
u'\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca'
|
223
|
+
u'\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede'
|
224
|
+
u'\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2'
|
225
|
+
u'\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d'
|
226
|
+
u'\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f'
|
227
|
+
u'\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb'
|
228
|
+
u'\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112'
|
229
|
+
u'\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133'
|
230
|
+
u'\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67'
|
231
|
+
u'\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86'
|
232
|
+
u'\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a'
|
233
|
+
u'\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae'
|
234
|
+
u'\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2'
|
235
|
+
u'\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6'
|
236
|
+
u'\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646'
|
237
|
+
u'\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a'
|
238
|
+
u'\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682'
|
239
|
+
u'\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696'
|
240
|
+
u'\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736'
|
241
|
+
u'\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a'
|
242
|
+
u'\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e'
|
243
|
+
u'\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b'
|
244
|
+
u'\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]')
|
245
|
+
|
246
|
+
idrest = ur'%s(?:%s|[0-9])*(?:(?<=_)%s)?' % (letter, letter, op)
|
247
|
+
|
248
|
+
tokens = {
|
249
|
+
'root': [
|
250
|
+
# method names
|
251
|
+
(r'(class|trait|object)(\s+)', bygroups(Keyword, Text), 'class'),
|
252
|
+
(ur"'%s" % idrest, Text.Symbol),
|
253
|
+
(r'[^\S\n]+', Text),
|
254
|
+
(r'//.*?\n', Comment.Single),
|
255
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
256
|
+
(ur'@%s' % idrest, Name.Decorator),
|
257
|
+
(ur'(abstract|ca(?:se|tch)|d(?:ef|o)|e(?:lse|xtends)|'
|
258
|
+
ur'f(?:inal(?:ly)?|or(?:Some)?)|i(?:f|mplicit)|'
|
259
|
+
ur'lazy|match|new|override|pr(?:ivate|otected)'
|
260
|
+
ur'|re(?:quires|turn)|s(?:ealed|uper)|'
|
261
|
+
ur't(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\b|'
|
262
|
+
u'(<[%:-]|=>|>:|[#=@_\u21D2\u2190])(\\b|(?=\\s)|$)', Keyword),
|
263
|
+
(ur':(?!%s)' % op, Keyword, 'type'),
|
264
|
+
(ur'%s%s\b' % (upper, idrest), Name.Class),
|
265
|
+
(r'(true|false|null)\b', Keyword.Constant),
|
266
|
+
(r'(import|package)(\s+)', bygroups(Keyword, Text), 'import'),
|
267
|
+
(r'(type)(\s+)', bygroups(Keyword, Text), 'type'),
|
268
|
+
(r'""".*?"""(?!")', String),
|
269
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
270
|
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
|
271
|
+
# (ur'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator,
|
272
|
+
# Name.Attribute)),
|
273
|
+
(idrest, Name),
|
274
|
+
(r'`[^`]+`', Name),
|
275
|
+
(r'\[', Operator, 'typeparam'),
|
276
|
+
(r'[\(\)\{\};,.#]', Operator),
|
277
|
+
(op, Operator),
|
278
|
+
(r'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?',
|
279
|
+
Number.Float),
|
280
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
281
|
+
(r'[0-9]+L?', Number.Integer),
|
282
|
+
(r'\n', Text)
|
283
|
+
],
|
284
|
+
'class': [
|
285
|
+
(ur'(%s|%s|`[^`]+`)(\s*)(\[)' % (idrest, op),
|
286
|
+
bygroups(Name.Class, Text, Operator), 'typeparam'),
|
287
|
+
(r'\s+', Text),
|
288
|
+
(r'{', Operator, '#pop'),
|
289
|
+
(r'\(', Operator, '#pop'),
|
290
|
+
(r'//.*?\n', Comment.Single, '#pop'),
|
291
|
+
(ur'%s|%s|`[^`]+`' % (idrest, op), Name.Class, '#pop'),
|
292
|
+
],
|
293
|
+
'type': [
|
294
|
+
(r'\s+', Text),
|
295
|
+
(u'<[%:]|>:|[#_\u21D2]|forSome|type', Keyword),
|
296
|
+
(r'([,\);}]|=>|=)(\s*)', bygroups(Operator, Text), '#pop'),
|
297
|
+
(r'[\(\{]', Operator, '#push'),
|
298
|
+
(ur'((?:%s|%s|`[^`]+`)(?:\.(?:%s|%s|`[^`]+`))*)(\s*)(\[)' %
|
299
|
+
(idrest, op, idrest, op),
|
300
|
+
bygroups(Keyword.Type, Text, Operator), ('#pop', 'typeparam')),
|
301
|
+
(ur'((?:%s|%s|`[^`]+`)(?:\.(?:%s|%s|`[^`]+`))*)(\s*)$' %
|
302
|
+
(idrest, op, idrest, op),
|
303
|
+
bygroups(Keyword.Type, Text), '#pop'),
|
304
|
+
(r'//.*?\n', Comment.Single, '#pop'),
|
305
|
+
(ur'\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
|
306
|
+
],
|
307
|
+
'typeparam': [
|
308
|
+
(r'[\s,]+', Text),
|
309
|
+
(u'<[%:]|=>|>:|[#_\u21D2]|forSome|type', Keyword),
|
310
|
+
(r'([\]\)\}])', Operator, '#pop'),
|
311
|
+
(r'[\(\[\{]', Operator, '#push'),
|
312
|
+
(ur'\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
|
313
|
+
],
|
314
|
+
'comment': [
|
315
|
+
(r'[^/\*]+', Comment.Multiline),
|
316
|
+
(r'/\*', Comment.Multiline, '#push'),
|
317
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
318
|
+
(r'[*/]', Comment.Multiline)
|
319
|
+
],
|
320
|
+
'import': [
|
321
|
+
(ur'(%s|\.)+' % idrest, Name.Namespace, '#pop')
|
322
|
+
],
|
323
|
+
}
|
324
|
+
|
325
|
+
|
326
|
+
class GosuLexer(RegexLexer):
|
327
|
+
"""
|
328
|
+
For Gosu source code.
|
329
|
+
|
330
|
+
*New in Pygments 1.5.*
|
331
|
+
"""
|
332
|
+
|
333
|
+
name = 'Gosu'
|
334
|
+
aliases = ['gosu']
|
335
|
+
filenames = ['*.gs', '*.gsx', '*.gsp', '*.vark']
|
336
|
+
mimetypes = ['text/x-gosu']
|
337
|
+
|
338
|
+
flags = re.MULTILINE | re.DOTALL
|
339
|
+
|
340
|
+
tokens = {
|
341
|
+
'root': [
|
342
|
+
# method names
|
343
|
+
(r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # modifiers etc.
|
344
|
+
r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
|
345
|
+
r'(\s*)(\()', # signature start
|
346
|
+
bygroups(using(this), Name.Function, Text, Operator)),
|
347
|
+
(r'[^\S\n]+', Text),
|
348
|
+
(r'//.*?\n', Comment.Single),
|
349
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
350
|
+
(r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
|
351
|
+
(r'(in|as|typeof|statictypeof|typeis|typeas|if|else|foreach|for|'
|
352
|
+
r'index|while|do|continue|break|return|try|catch|finally|this|'
|
353
|
+
r'throw|new|switch|case|default|eval|super|outer|classpath|'
|
354
|
+
r'using)\b', Keyword),
|
355
|
+
(r'(var|delegate|construct|function|private|internal|protected|'
|
356
|
+
r'public|abstract|override|final|static|extends|transient|'
|
357
|
+
r'implements|represents|readonly)\b', Keyword.Declaration),
|
358
|
+
(r'(property\s+)(get|set)?', Keyword.Declaration),
|
359
|
+
(r'(boolean|byte|char|double|float|int|long|short|void|block)\b',
|
360
|
+
Keyword.Type),
|
361
|
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
|
362
|
+
(r'(true|false|null|NaN|Infinity)\b', Keyword.Constant),
|
363
|
+
(r'(class|interface|enhancement|enum)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)',
|
364
|
+
bygroups(Keyword.Declaration, Text, Name.Class)),
|
365
|
+
(r'(uses)(\s+)([a-zA-Z0-9_.]+\*?)',
|
366
|
+
bygroups(Keyword.Namespace, Text, Name.Namespace)),
|
367
|
+
(r'"', String, 'string'),
|
368
|
+
(r'(\??[\.#])([a-zA-Z_][a-zA-Z0-9_]*)',
|
369
|
+
bygroups(Operator, Name.Attribute)),
|
370
|
+
(r'(:)([a-zA-Z_][a-zA-Z0-9_]*)',
|
371
|
+
bygroups(Operator, Name.Attribute)),
|
372
|
+
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
|
373
|
+
(r'and|or|not|[\\~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
|
374
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
375
|
+
(r'[0-9]+', Number.Integer),
|
376
|
+
(r'\n', Text)
|
377
|
+
],
|
378
|
+
'templateText': [
|
379
|
+
(r'(\\<)|(\\\$)', String),
|
380
|
+
(r'(<%@\s+)(extends|params)',
|
381
|
+
bygroups(Operator, Name.Decorator), 'stringTemplate'),
|
382
|
+
(r'<%!--.*?--%>', Comment.Multiline),
|
383
|
+
(r'(<%)|(<%=)', Operator, 'stringTemplate'),
|
384
|
+
(r'\$\{', Operator, 'stringTemplateShorthand'),
|
385
|
+
(r'.', String)
|
386
|
+
],
|
387
|
+
'string': [
|
388
|
+
(r'"', String, '#pop'),
|
389
|
+
include('templateText')
|
390
|
+
],
|
391
|
+
'stringTemplate': [
|
392
|
+
(r'"', String, 'string'),
|
393
|
+
(r'%>', Operator, '#pop'),
|
394
|
+
include('root')
|
395
|
+
],
|
396
|
+
'stringTemplateShorthand': [
|
397
|
+
(r'"', String, 'string'),
|
398
|
+
(r'\{', Operator, 'stringTemplateShorthand'),
|
399
|
+
(r'\}', Operator, '#pop'),
|
400
|
+
include('root')
|
401
|
+
],
|
402
|
+
}
|
403
|
+
|
404
|
+
|
405
|
+
class GosuTemplateLexer(Lexer):
|
406
|
+
"""
|
407
|
+
For Gosu templates.
|
408
|
+
|
409
|
+
*New in Pygments 1.5.*
|
410
|
+
"""
|
411
|
+
|
412
|
+
name = 'Gosu Template'
|
413
|
+
aliases = ['gst']
|
414
|
+
filenames = ['*.gst']
|
415
|
+
mimetypes = ['text/x-gosu-template']
|
416
|
+
lexer = GosuLexer()
|
417
|
+
|
418
|
+
def get_tokens_unprocessed(self, text):
|
419
|
+
stack = ['templateText']
|
420
|
+
for item in self.lexer.get_tokens_unprocessed(text, stack):
|
421
|
+
yield item
|
422
|
+
|
423
|
+
|
424
|
+
class GroovyLexer(RegexLexer):
|
425
|
+
"""
|
426
|
+
For `Groovy <http://groovy.codehaus.org/>`_ source code.
|
427
|
+
|
428
|
+
*New in Pygments 1.5.*
|
429
|
+
"""
|
430
|
+
|
431
|
+
name = 'Groovy'
|
432
|
+
aliases = ['groovy']
|
433
|
+
filenames = ['*.groovy']
|
434
|
+
mimetypes = ['text/x-groovy']
|
435
|
+
|
436
|
+
flags = re.MULTILINE | re.DOTALL
|
437
|
+
|
438
|
+
tokens = {
|
439
|
+
'root': [
|
440
|
+
# method names
|
441
|
+
(r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
|
442
|
+
r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
|
443
|
+
r'(\s*)(\()', # signature start
|
444
|
+
bygroups(using(this), Name.Function, Text, Operator)),
|
445
|
+
(r'[^\S\n]+', Text),
|
446
|
+
(r'//.*?\n', Comment.Single),
|
447
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
448
|
+
(r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
|
449
|
+
(r'(assert|break|case|catch|continue|default|do|else|finally|for|'
|
450
|
+
r'if|goto|instanceof|new|return|switch|this|throw|try|while|in|as)\b',
|
451
|
+
Keyword),
|
452
|
+
(r'(abstract|const|enum|extends|final|implements|native|private|'
|
453
|
+
r'protected|public|static|strictfp|super|synchronized|throws|'
|
454
|
+
r'transient|volatile)\b', Keyword.Declaration),
|
455
|
+
(r'(def|boolean|byte|char|double|float|int|long|short|void)\b',
|
456
|
+
Keyword.Type),
|
457
|
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
|
458
|
+
(r'(true|false|null)\b', Keyword.Constant),
|
459
|
+
(r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
|
460
|
+
'class'),
|
461
|
+
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
462
|
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
463
|
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
464
|
+
(r'\$/((?!/\$).)*/\$', String),
|
465
|
+
(r'/(\\\\|\\"|[^/])*/', String),
|
466
|
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
|
467
|
+
(r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
|
468
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
|
469
|
+
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
|
470
|
+
(r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
|
471
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
472
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
473
|
+
(r'[0-9]+L?', Number.Integer),
|
474
|
+
(r'\n', Text)
|
475
|
+
],
|
476
|
+
'class': [
|
477
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
|
478
|
+
],
|
479
|
+
'import': [
|
480
|
+
(r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
|
481
|
+
],
|
482
|
+
}
|
483
|
+
|
484
|
+
|
485
|
+
class IokeLexer(RegexLexer):
|
486
|
+
"""
|
487
|
+
For `Ioke <http://ioke.org/>`_ (a strongly typed, dynamic,
|
488
|
+
prototype based programming language) source.
|
489
|
+
|
490
|
+
*New in Pygments 1.4.*
|
491
|
+
"""
|
492
|
+
name = 'Ioke'
|
493
|
+
filenames = ['*.ik']
|
494
|
+
aliases = ['ioke', 'ik']
|
495
|
+
mimetypes = ['text/x-iokesrc']
|
496
|
+
tokens = {
|
497
|
+
'interpolatableText': [
|
498
|
+
(r'(\\b|\\e|\\t|\\n|\\f|\\r|\\"|\\\\|\\#|\\\Z|\\u[0-9a-fA-F]{1,4}'
|
499
|
+
r'|\\[0-3]?[0-7]?[0-7])', String.Escape),
|
500
|
+
(r'#{', Punctuation, 'textInterpolationRoot')
|
501
|
+
],
|
502
|
+
|
503
|
+
'text': [
|
504
|
+
(r'(?<!\\)"', String, '#pop'),
|
505
|
+
include('interpolatableText'),
|
506
|
+
(r'[^"]', String)
|
507
|
+
],
|
508
|
+
|
509
|
+
'documentation': [
|
510
|
+
(r'(?<!\\)"', String.Doc, '#pop'),
|
511
|
+
include('interpolatableText'),
|
512
|
+
(r'[^"]', String.Doc)
|
513
|
+
],
|
514
|
+
|
515
|
+
'textInterpolationRoot': [
|
516
|
+
(r'}', Punctuation, '#pop'),
|
517
|
+
include('root')
|
518
|
+
],
|
519
|
+
|
520
|
+
'slashRegexp': [
|
521
|
+
(r'(?<!\\)/[oxpniums]*', String.Regex, '#pop'),
|
522
|
+
include('interpolatableText'),
|
523
|
+
(r'\\/', String.Regex),
|
524
|
+
(r'[^/]', String.Regex)
|
525
|
+
],
|
526
|
+
|
527
|
+
'squareRegexp': [
|
528
|
+
(r'(?<!\\)][oxpniums]*', String.Regex, '#pop'),
|
529
|
+
include('interpolatableText'),
|
530
|
+
(r'\\]', String.Regex),
|
531
|
+
(r'[^\]]', String.Regex)
|
532
|
+
],
|
533
|
+
|
534
|
+
'squareText': [
|
535
|
+
(r'(?<!\\)]', String, '#pop'),
|
536
|
+
include('interpolatableText'),
|
537
|
+
(r'[^\]]', String)
|
538
|
+
],
|
539
|
+
|
540
|
+
'root': [
|
541
|
+
(r'\n', Text),
|
542
|
+
(r'\s+', Text),
|
543
|
+
|
544
|
+
# Comments
|
545
|
+
(r';(.*?)\n', Comment),
|
546
|
+
(r'\A#!(.*?)\n', Comment),
|
547
|
+
|
548
|
+
#Regexps
|
549
|
+
(r'#/', String.Regex, 'slashRegexp'),
|
550
|
+
(r'#r\[', String.Regex, 'squareRegexp'),
|
551
|
+
|
552
|
+
#Symbols
|
553
|
+
(r':[a-zA-Z0-9_!:?]+', String.Symbol),
|
554
|
+
(r'[a-zA-Z0-9_!:?]+:(?![a-zA-Z0-9_!?])', String.Other),
|
555
|
+
(r':"(\\\\|\\"|[^"])*"', String.Symbol),
|
556
|
+
|
557
|
+
#Documentation
|
558
|
+
(r'((?<=fn\()|(?<=fnx\()|(?<=method\()|(?<=macro\()|(?<=lecro\()'
|
559
|
+
r'|(?<=syntax\()|(?<=dmacro\()|(?<=dlecro\()|(?<=dlecrox\()'
|
560
|
+
r'|(?<=dsyntax\())\s*"', String.Doc, 'documentation'),
|
561
|
+
|
562
|
+
#Text
|
563
|
+
(r'"', String, 'text'),
|
564
|
+
(r'#\[', String, 'squareText'),
|
565
|
+
|
566
|
+
#Mimic
|
567
|
+
(r'[a-zA-Z0-9_][a-zA-Z0-9!?_:]+(?=\s*=.*mimic\s)', Name.Entity),
|
568
|
+
|
569
|
+
#Assignment
|
570
|
+
(r'[a-zA-Z_][a-zA-Z0-9_!:?]*(?=[\s]*[+*/-]?=[^=].*($|\.))',
|
571
|
+
Name.Variable),
|
572
|
+
|
573
|
+
# keywords
|
574
|
+
(r'(break|cond|continue|do|ensure|for|for:dict|for:set|if|let|'
|
575
|
+
r'loop|p:for|p:for:dict|p:for:set|return|unless|until|while|'
|
576
|
+
r'with)(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
|
577
|
+
|
578
|
+
# Origin
|
579
|
+
(r'(eval|mimic|print|println)(?![a-zA-Z0-9!:_?])', Keyword),
|
580
|
+
|
581
|
+
# Base
|
582
|
+
(r'(cell\?|cellNames|cellOwner\?|cellOwner|cells|cell|'
|
583
|
+
r'documentation|hash|identity|mimic|removeCell\!|undefineCell\!)'
|
584
|
+
r'(?![a-zA-Z0-9!:_?])', Keyword),
|
585
|
+
|
586
|
+
# Ground
|
587
|
+
(r'(stackTraceAsText)(?![a-zA-Z0-9!:_?])', Keyword),
|
588
|
+
|
589
|
+
#DefaultBehaviour Literals
|
590
|
+
(r'(dict|list|message|set)(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
|
591
|
+
|
592
|
+
#DefaultBehaviour Case
|
593
|
+
(r'(case|case:and|case:else|case:nand|case:nor|case:not|case:or|'
|
594
|
+
r'case:otherwise|case:xor)(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
|
595
|
+
|
596
|
+
#DefaultBehaviour Reflection
|
597
|
+
(r'(asText|become\!|derive|freeze\!|frozen\?|in\?|is\?|kind\?|'
|
598
|
+
r'mimic\!|mimics|mimics\?|prependMimic\!|removeAllMimics\!|'
|
599
|
+
r'removeMimic\!|same\?|send|thaw\!|uniqueHexId)'
|
600
|
+
r'(?![a-zA-Z0-9!:_?])', Keyword),
|
601
|
+
|
602
|
+
#DefaultBehaviour Aspects
|
603
|
+
(r'(after|around|before)(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
|
604
|
+
|
605
|
+
# DefaultBehaviour
|
606
|
+
(r'(kind|cellDescriptionDict|cellSummary|genSym|inspect|notice)'
|
607
|
+
r'(?![a-zA-Z0-9!:_?])', Keyword),
|
608
|
+
(r'(use|destructuring)', Keyword.Reserved),
|
609
|
+
|
610
|
+
#DefaultBehavior BaseBehavior
|
611
|
+
(r'(cell\?|cellOwner\?|cellOwner|cellNames|cells|cell|'
|
612
|
+
r'documentation|identity|removeCell!|undefineCell)'
|
613
|
+
r'(?![a-zA-Z0-9!:_?])', Keyword),
|
614
|
+
|
615
|
+
#DefaultBehavior Internal
|
616
|
+
(r'(internal:compositeRegexp|internal:concatenateText|'
|
617
|
+
r'internal:createDecimal|internal:createNumber|'
|
618
|
+
r'internal:createRegexp|internal:createText)'
|
619
|
+
r'(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
|
620
|
+
|
621
|
+
#DefaultBehaviour Conditions
|
622
|
+
(r'(availableRestarts|bind|error\!|findRestart|handle|'
|
623
|
+
r'invokeRestart|rescue|restart|signal\!|warn\!)'
|
624
|
+
r'(?![a-zA-Z0-9!:_?])', Keyword.Reserved),
|
625
|
+
|
626
|
+
# constants
|
627
|
+
(r'(nil|false|true)(?![a-zA-Z0-9!:_?])', Name.Constant),
|
628
|
+
|
629
|
+
# names
|
630
|
+
(r'(Arity|Base|Call|Condition|DateTime|Aspects|Pointcut|'
|
631
|
+
r'Assignment|BaseBehavior|Boolean|Case|AndCombiner|Else|'
|
632
|
+
r'NAndCombiner|NOrCombiner|NotCombiner|OrCombiner|XOrCombiner|'
|
633
|
+
r'Conditions|Definitions|FlowControl|Internal|Literals|'
|
634
|
+
r'Reflection|DefaultMacro|DefaultMethod|DefaultSyntax|Dict|'
|
635
|
+
r'FileSystem|Ground|Handler|Hook|IO|IokeGround|Struct|'
|
636
|
+
r'LexicalBlock|LexicalMacro|List|Message|Method|Mixins|'
|
637
|
+
r'NativeMethod|Number|Origin|Pair|Range|Reflector|Regexp Match|'
|
638
|
+
r'Regexp|Rescue|Restart|Runtime|Sequence|Set|Symbol|'
|
639
|
+
r'System|Text|Tuple)(?![a-zA-Z0-9!:_?])', Name.Builtin),
|
640
|
+
|
641
|
+
# functions
|
642
|
+
(ur'(generateMatchMethod|aliasMethod|\u03bb|\u028E|fnx|fn|method|'
|
643
|
+
ur'dmacro|dlecro|syntax|macro|dlecrox|lecrox|lecro|syntax)'
|
644
|
+
ur'(?![a-zA-Z0-9!:_?])', Name.Function),
|
645
|
+
|
646
|
+
# Numbers
|
647
|
+
(r'-?0[xX][0-9a-fA-F]+', Number.Hex),
|
648
|
+
(r'-?(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
649
|
+
(r'-?\d+', Number.Integer),
|
650
|
+
|
651
|
+
(r'#\(', Punctuation),
|
652
|
+
|
653
|
+
# Operators
|
654
|
+
(ur'(&&>>|\|\|>>|\*\*>>|:::|::|\.\.\.|===|\*\*>|\*\*=|&&>|&&=|'
|
655
|
+
ur'\|\|>|\|\|=|\->>|\+>>|!>>|<>>>|<>>|&>>|%>>|#>>|@>>|/>>|\*>>|'
|
656
|
+
ur'\?>>|\|>>|\^>>|~>>|\$>>|=>>|<<=|>>=|<=>|<\->|=~|!~|=>|\+\+|'
|
657
|
+
ur'\-\-|<=|>=|==|!=|&&|\.\.|\+=|\-=|\*=|\/=|%=|&=|\^=|\|=|<\-|'
|
658
|
+
ur'\+>|!>|<>|&>|%>|#>|\@>|\/>|\*>|\?>|\|>|\^>|~>|\$>|<\->|\->|'
|
659
|
+
ur'<<|>>|\*\*|\?\||\?&|\|\||>|<|\*|\/|%|\+|\-|&|\^|\||=|\$|!|~|'
|
660
|
+
ur'\?|#|\u2260|\u2218|\u2208|\u2209)', Operator),
|
661
|
+
(r'(and|nand|or|xor|nor|return|import)(?![a-zA-Z0-9_!?])',
|
662
|
+
Operator),
|
663
|
+
|
664
|
+
# Punctuation
|
665
|
+
(r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|{|})', Punctuation),
|
666
|
+
|
667
|
+
#kinds
|
668
|
+
(r'[A-Z][a-zA-Z0-9_!:?]*', Name.Class),
|
669
|
+
|
670
|
+
#default cellnames
|
671
|
+
(r'[a-z_][a-zA-Z0-9_!:?]*', Name)
|
672
|
+
]
|
673
|
+
}
|
674
|
+
|
675
|
+
|
676
|
+
class ClojureLexer(RegexLexer):
|
677
|
+
"""
|
678
|
+
Lexer for `Clojure <http://clojure.org/>`_ source code.
|
679
|
+
|
680
|
+
*New in Pygments 0.11.*
|
681
|
+
"""
|
682
|
+
name = 'Clojure'
|
683
|
+
aliases = ['clojure', 'clj']
|
684
|
+
filenames = ['*.clj']
|
685
|
+
mimetypes = ['text/x-clojure', 'application/x-clojure']
|
686
|
+
|
687
|
+
special_forms = [
|
688
|
+
'.', 'def', 'do', 'fn', 'if', 'let', 'new', 'quote', 'var', 'loop'
|
689
|
+
]
|
690
|
+
|
691
|
+
# It's safe to consider 'ns' a declaration thing because it defines a new
|
692
|
+
# namespace.
|
693
|
+
declarations = [
|
694
|
+
'def-', 'defn', 'defn-', 'defmacro', 'defmulti', 'defmethod',
|
695
|
+
'defstruct', 'defonce', 'declare', 'definline', 'definterface',
|
696
|
+
'defprotocol', 'defrecord', 'deftype', 'defproject', 'ns'
|
697
|
+
]
|
698
|
+
|
699
|
+
builtins = [
|
700
|
+
'*', '+', '-', '->', '/', '<', '<=', '=', '==', '>', '>=', '..',
|
701
|
+
'accessor', 'agent', 'agent-errors', 'aget', 'alength', 'all-ns',
|
702
|
+
'alter', 'and', 'append-child', 'apply', 'array-map', 'aset',
|
703
|
+
'aset-boolean', 'aset-byte', 'aset-char', 'aset-double', 'aset-float',
|
704
|
+
'aset-int', 'aset-long', 'aset-short', 'assert', 'assoc', 'await',
|
705
|
+
'await-for', 'bean', 'binding', 'bit-and', 'bit-not', 'bit-or',
|
706
|
+
'bit-shift-left', 'bit-shift-right', 'bit-xor', 'boolean', 'branch?',
|
707
|
+
'butlast', 'byte', 'cast', 'char', 'children', 'class',
|
708
|
+
'clear-agent-errors', 'comment', 'commute', 'comp', 'comparator',
|
709
|
+
'complement', 'concat', 'conj', 'cons', 'constantly', 'cond', 'if-not',
|
710
|
+
'construct-proxy', 'contains?', 'count', 'create-ns', 'create-struct',
|
711
|
+
'cycle', 'dec', 'deref', 'difference', 'disj', 'dissoc', 'distinct',
|
712
|
+
'doall', 'doc', 'dorun', 'doseq', 'dosync', 'dotimes', 'doto',
|
713
|
+
'double', 'down', 'drop', 'drop-while', 'edit', 'end?', 'ensure',
|
714
|
+
'eval', 'every?', 'false?', 'ffirst', 'file-seq', 'filter', 'find',
|
715
|
+
'find-doc', 'find-ns', 'find-var', 'first', 'float', 'flush', 'for',
|
716
|
+
'fnseq', 'frest', 'gensym', 'get-proxy-class', 'get',
|
717
|
+
'hash-map', 'hash-set', 'identical?', 'identity', 'if-let', 'import',
|
718
|
+
'in-ns', 'inc', 'index', 'insert-child', 'insert-left', 'insert-right',
|
719
|
+
'inspect-table', 'inspect-tree', 'instance?', 'int', 'interleave',
|
720
|
+
'intersection', 'into', 'into-array', 'iterate', 'join', 'key', 'keys',
|
721
|
+
'keyword', 'keyword?', 'last', 'lazy-cat', 'lazy-cons', 'left',
|
722
|
+
'lefts', 'line-seq', 'list*', 'list', 'load', 'load-file',
|
723
|
+
'locking', 'long', 'loop', 'macroexpand', 'macroexpand-1',
|
724
|
+
'make-array', 'make-node', 'map', 'map-invert', 'map?', 'mapcat',
|
725
|
+
'max', 'max-key', 'memfn', 'merge', 'merge-with', 'meta', 'min',
|
726
|
+
'min-key', 'name', 'namespace', 'neg?', 'new', 'newline', 'next',
|
727
|
+
'nil?', 'node', 'not', 'not-any?', 'not-every?', 'not=', 'ns-imports',
|
728
|
+
'ns-interns', 'ns-map', 'ns-name', 'ns-publics', 'ns-refers',
|
729
|
+
'ns-resolve', 'ns-unmap', 'nth', 'nthrest', 'or', 'parse', 'partial',
|
730
|
+
'path', 'peek', 'pop', 'pos?', 'pr', 'pr-str', 'print', 'print-str',
|
731
|
+
'println', 'println-str', 'prn', 'prn-str', 'project', 'proxy',
|
732
|
+
'proxy-mappings', 'quot', 'rand', 'rand-int', 'range', 're-find',
|
733
|
+
're-groups', 're-matcher', 're-matches', 're-pattern', 're-seq',
|
734
|
+
'read', 'read-line', 'reduce', 'ref', 'ref-set', 'refer', 'rem',
|
735
|
+
'remove', 'remove-method', 'remove-ns', 'rename', 'rename-keys',
|
736
|
+
'repeat', 'replace', 'replicate', 'resolve', 'rest', 'resultset-seq',
|
737
|
+
'reverse', 'rfirst', 'right', 'rights', 'root', 'rrest', 'rseq',
|
738
|
+
'second', 'select', 'select-keys', 'send', 'send-off', 'seq',
|
739
|
+
'seq-zip', 'seq?', 'set', 'short', 'slurp', 'some', 'sort',
|
740
|
+
'sort-by', 'sorted-map', 'sorted-map-by', 'sorted-set',
|
741
|
+
'special-symbol?', 'split-at', 'split-with', 'str', 'string?',
|
742
|
+
'struct', 'struct-map', 'subs', 'subvec', 'symbol', 'symbol?',
|
743
|
+
'sync', 'take', 'take-nth', 'take-while', 'test', 'time', 'to-array',
|
744
|
+
'to-array-2d', 'tree-seq', 'true?', 'union', 'up', 'update-proxy',
|
745
|
+
'val', 'vals', 'var-get', 'var-set', 'var?', 'vector', 'vector-zip',
|
746
|
+
'vector?', 'when', 'when-first', 'when-let', 'when-not',
|
747
|
+
'with-local-vars', 'with-meta', 'with-open', 'with-out-str',
|
748
|
+
'xml-seq', 'xml-zip', 'zero?', 'zipmap', 'zipper']
|
749
|
+
|
750
|
+
# valid names for identifiers
|
751
|
+
# well, names can only not consist fully of numbers
|
752
|
+
# but this should be good enough for now
|
753
|
+
|
754
|
+
# TODO / should divide keywords/symbols into namespace/rest
|
755
|
+
# but that's hard, so just pretend / is part of the name
|
756
|
+
valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+'
|
757
|
+
|
758
|
+
def _multi_escape(entries):
|
759
|
+
return '(%s)' % ('|'.join(re.escape(entry) + ' ' for entry in entries))
|
760
|
+
|
761
|
+
tokens = {
|
762
|
+
'root': [
|
763
|
+
# the comments - always starting with semicolon
|
764
|
+
# and going to the end of the line
|
765
|
+
(r';.*$', Comment.Single),
|
766
|
+
|
767
|
+
# whitespaces - usually not relevant
|
768
|
+
(r'[,\s]+', Text),
|
769
|
+
|
770
|
+
# numbers
|
771
|
+
(r'-?\d+\.\d+', Number.Float),
|
772
|
+
(r'-?\d+', Number.Integer),
|
773
|
+
(r'0x-?[abcdef\d]+', Number.Hex),
|
774
|
+
|
775
|
+
# strings, symbols and characters
|
776
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
777
|
+
(r"'" + valid_name, String.Symbol),
|
778
|
+
(r"\\(.|[a-z]+)", String.Char),
|
779
|
+
|
780
|
+
# keywords
|
781
|
+
(r'::?' + valid_name, String.Symbol),
|
782
|
+
|
783
|
+
# special operators
|
784
|
+
(r'~@|[`\'#^~&@]', Operator),
|
785
|
+
|
786
|
+
# highlight the special forms
|
787
|
+
(_multi_escape(special_forms), Keyword),
|
788
|
+
|
789
|
+
# Technically, only the special forms are 'keywords'. The problem
|
790
|
+
# is that only treating them as keywords means that things like
|
791
|
+
# 'defn' and 'ns' need to be highlighted as builtins. This is ugly
|
792
|
+
# and weird for most styles. So, as a compromise we're going to
|
793
|
+
# highlight them as Keyword.Declarations.
|
794
|
+
(_multi_escape(declarations), Keyword.Declaration),
|
795
|
+
|
796
|
+
# highlight the builtins
|
797
|
+
(_multi_escape(builtins), Name.Builtin),
|
798
|
+
|
799
|
+
# the remaining functions
|
800
|
+
(r'(?<=\()' + valid_name, Name.Function),
|
801
|
+
|
802
|
+
# find the remaining variables
|
803
|
+
(valid_name, Name.Variable),
|
804
|
+
|
805
|
+
# Clojure accepts vector notation
|
806
|
+
(r'(\[|\])', Punctuation),
|
807
|
+
|
808
|
+
# Clojure accepts map notation
|
809
|
+
(r'(\{|\})', Punctuation),
|
810
|
+
|
811
|
+
# the famous parentheses!
|
812
|
+
(r'(\(|\))', Punctuation),
|
813
|
+
],
|
814
|
+
}
|
815
|
+
|
816
|
+
|
817
|
+
class TeaLangLexer(RegexLexer):
|
818
|
+
"""
|
819
|
+
For `Tea <http://teatrove.org/>`_ source code. Only used within a
|
820
|
+
TeaTemplateLexer.
|
821
|
+
|
822
|
+
*New in Pygments 1.5.*
|
823
|
+
"""
|
824
|
+
|
825
|
+
flags = re.MULTILINE | re.DOTALL
|
826
|
+
|
827
|
+
tokens = {
|
828
|
+
'root': [
|
829
|
+
# method names
|
830
|
+
(r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
|
831
|
+
r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
|
832
|
+
r'(\s*)(\()', # signature start
|
833
|
+
bygroups(using(this), Name.Function, Text, Operator)),
|
834
|
+
(r'[^\S\n]+', Text),
|
835
|
+
(r'//.*?\n', Comment.Single),
|
836
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
837
|
+
(r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
|
838
|
+
(r'(and|break|else|foreach|if|in|not|or|reverse)\b',
|
839
|
+
Keyword),
|
840
|
+
(r'(as|call|define)\b', Keyword.Declaration),
|
841
|
+
(r'(true|false|null)\b', Keyword.Constant),
|
842
|
+
(r'(template)(\s+)', bygroups(Keyword.Declaration, Text), 'template'),
|
843
|
+
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
844
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
845
|
+
(r'\'(\\\\|\\\'|[^\'])*\'', String),
|
846
|
+
(r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
|
847
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
|
848
|
+
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
|
849
|
+
(r'(isa|[.]{3}|[.]{2}|[=#!<>+-/%&;,.\*\\\(\)\[\]\{\}])', Operator),
|
850
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
851
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
852
|
+
(r'[0-9]+L?', Number.Integer),
|
853
|
+
(r'\n', Text)
|
854
|
+
],
|
855
|
+
'template': [
|
856
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
|
857
|
+
],
|
858
|
+
'import': [
|
859
|
+
(r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
|
860
|
+
],
|
861
|
+
}
|
862
|
+
|
863
|
+
|
864
|
+
class CeylonLexer(RegexLexer):
|
865
|
+
"""
|
866
|
+
For `Ceylon <http://ceylon-lang.org/>`_ source code.
|
867
|
+
|
868
|
+
*New in Pygments 1.6.*
|
869
|
+
"""
|
870
|
+
|
871
|
+
name = 'Ceylon'
|
872
|
+
aliases = ['ceylon']
|
873
|
+
filenames = ['*.ceylon']
|
874
|
+
mimetypes = ['text/x-ceylon']
|
875
|
+
|
876
|
+
flags = re.MULTILINE | re.DOTALL
|
877
|
+
|
878
|
+
#: optional Comment or Whitespace
|
879
|
+
_ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
|
880
|
+
|
881
|
+
tokens = {
|
882
|
+
'root': [
|
883
|
+
# method names
|
884
|
+
(r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
|
885
|
+
r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name
|
886
|
+
r'(\s*)(\()', # signature start
|
887
|
+
bygroups(using(this), Name.Function, Text, Operator)),
|
888
|
+
(r'[^\S\n]+', Text),
|
889
|
+
(r'//.*?\n', Comment.Single),
|
890
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
891
|
+
(r'(variable|shared|abstract|doc|by|formal|actual|late|native)',
|
892
|
+
Name.Decorator),
|
893
|
+
(r'(break|case|catch|continue|default|else|finally|for|in|'
|
894
|
+
r'variable|if|return|switch|this|throw|try|while|is|exists|dynamic|'
|
895
|
+
r'nonempty|then|outer|assert)\b', Keyword),
|
896
|
+
(r'(abstracts|extends|satisfies|adapts|'
|
897
|
+
r'super|given|of|out|assign|'
|
898
|
+
r'transient|volatile)\b', Keyword.Declaration),
|
899
|
+
(r'(function|value|void)\b',
|
900
|
+
Keyword.Type),
|
901
|
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
|
902
|
+
(r'(true|false|null)\b', Keyword.Constant),
|
903
|
+
(r'(class|interface|object|alias)(\s+)',
|
904
|
+
bygroups(Keyword.Declaration, Text), 'class'),
|
905
|
+
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
906
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
907
|
+
(r"'\\.'|'[^\\]'|'\\\{#[0-9a-fA-F]{4}\}'", String.Char),
|
908
|
+
(r'".*``.*``.*"', String.Interpol),
|
909
|
+
(r'(\.)([a-z_][a-zA-Z0-9_]*)',
|
910
|
+
bygroups(Operator, Name.Attribute)),
|
911
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
|
912
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
|
913
|
+
(r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
|
914
|
+
(r'\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
|
915
|
+
(r'\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
|
916
|
+
Number.Float),
|
917
|
+
(r'[0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
|
918
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
|
919
|
+
Number.Float),
|
920
|
+
(r'#([0-9a-fA-F]{4})(_[0-9a-fA-F]{4})+', Number.Hex),
|
921
|
+
(r'#[0-9a-fA-F]+', Number.Hex),
|
922
|
+
(r'\$([01]{4})(_[01]{4})+', Number.Integer),
|
923
|
+
(r'\$[01]+', Number.Integer),
|
924
|
+
(r'\d{1,3}(_\d{3})+[kMGTP]?', Number.Integer),
|
925
|
+
(r'[0-9]+[kMGTP]?', Number.Integer),
|
926
|
+
(r'\n', Text)
|
927
|
+
],
|
928
|
+
'class': [
|
929
|
+
(r'[A-Za-z_][a-zA-Z0-9_]*', Name.Class, '#pop')
|
930
|
+
],
|
931
|
+
'import': [
|
932
|
+
(r'[a-z][a-zA-Z0-9_.]*',
|
933
|
+
Name.Namespace, '#pop')
|
934
|
+
],
|
935
|
+
}
|
936
|
+
|
937
|
+
|
938
|
+
class KotlinLexer(RegexLexer):
|
939
|
+
"""
|
940
|
+
For `Kotlin <http://confluence.jetbrains.net/display/Kotlin/>`_
|
941
|
+
source code.
|
942
|
+
|
943
|
+
Additional options accepted:
|
944
|
+
|
945
|
+
`unicodelevel`
|
946
|
+
Determines which Unicode characters this lexer allows for identifiers.
|
947
|
+
The possible values are:
|
948
|
+
|
949
|
+
* ``none`` -- only the ASCII letters and numbers are allowed. This
|
950
|
+
is the fastest selection.
|
951
|
+
* ``basic`` -- all Unicode characters from the specification except
|
952
|
+
category ``Lo`` are allowed.
|
953
|
+
* ``full`` -- all Unicode characters as specified in the C# specs
|
954
|
+
are allowed. Note that this means a considerable slowdown since the
|
955
|
+
``Lo`` category has more than 40,000 characters in it!
|
956
|
+
|
957
|
+
The default value is ``basic``.
|
958
|
+
|
959
|
+
*New in Pygments 1.5.*
|
960
|
+
"""
|
961
|
+
|
962
|
+
name = 'Kotlin'
|
963
|
+
aliases = ['kotlin']
|
964
|
+
filenames = ['*.kt']
|
965
|
+
mimetypes = ['text/x-kotlin'] # inferred
|
966
|
+
|
967
|
+
flags = re.MULTILINE | re.DOTALL | re.UNICODE
|
968
|
+
|
969
|
+
# for the range of allowed unicode characters in identifiers,
|
970
|
+
# see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
|
971
|
+
|
972
|
+
levels = {
|
973
|
+
'none': '@?[_a-zA-Z][a-zA-Z0-9_]*',
|
974
|
+
'basic': ('@?[_' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl + ']' +
|
975
|
+
'[' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl +
|
976
|
+
uni.Nd + uni.Pc + uni.Cf + uni.Mn + uni.Mc + ']*'),
|
977
|
+
'full': ('@?(?:_|[^' +
|
978
|
+
uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])'
|
979
|
+
+ '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
|
980
|
+
'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'),
|
981
|
+
}
|
982
|
+
|
983
|
+
tokens = {}
|
984
|
+
token_variants = True
|
985
|
+
|
986
|
+
for levelname, cs_ident in levels.items():
|
987
|
+
tokens[levelname] = {
|
988
|
+
'root': [
|
989
|
+
# method names
|
990
|
+
(r'^([ \t]*(?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type
|
991
|
+
r'(' + cs_ident + ')' # method name
|
992
|
+
r'(\s*)(\()', # signature start
|
993
|
+
bygroups(using(this), Name.Function, Text, Punctuation)),
|
994
|
+
(r'^\s*\[.*?\]', Name.Attribute),
|
995
|
+
(r'[^\S\n]+', Text),
|
996
|
+
(r'\\\n', Text), # line continuation
|
997
|
+
(r'//.*?\n', Comment.Single),
|
998
|
+
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
|
999
|
+
(r'\n', Text),
|
1000
|
+
(r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
|
1001
|
+
(r'[{}]', Punctuation),
|
1002
|
+
(r'@"(""|[^"])*"', String),
|
1003
|
+
(r'"(\\\\|\\"|[^"\n])*["\n]', String),
|
1004
|
+
(r"'\\.'|'[^\\]'", String.Char),
|
1005
|
+
(r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?"
|
1006
|
+
r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number),
|
1007
|
+
(r'#[ \t]*(if|endif|else|elif|define|undef|'
|
1008
|
+
r'line|error|warning|region|endregion|pragma)\b.*?\n',
|
1009
|
+
Comment.Preproc),
|
1010
|
+
(r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Text,
|
1011
|
+
Keyword)),
|
1012
|
+
(r'(abstract|as|break|catch|'
|
1013
|
+
r'fun|continue|default|delegate|'
|
1014
|
+
r'do|else|enum|extern|false|finally|'
|
1015
|
+
r'fixed|for|goto|if|implicit|in|interface|'
|
1016
|
+
r'internal|is|lock|null|'
|
1017
|
+
r'out|override|private|protected|public|readonly|'
|
1018
|
+
r'ref|return|sealed|sizeof|'
|
1019
|
+
r'when|this|throw|true|try|typeof|'
|
1020
|
+
r'unchecked|unsafe|virtual|void|while|'
|
1021
|
+
r'get|set|new|partial|yield|val|var)\b', Keyword),
|
1022
|
+
(r'(global)(::)', bygroups(Keyword, Punctuation)),
|
1023
|
+
(r'(bool|byte|char|decimal|double|dynamic|float|int|long|'
|
1024
|
+
r'short)\b\??', Keyword.Type),
|
1025
|
+
(r'(class|struct)(\s+)', bygroups(Keyword, Text), 'class'),
|
1026
|
+
(r'(package|using)(\s+)', bygroups(Keyword, Text), 'package'),
|
1027
|
+
(cs_ident, Name),
|
1028
|
+
],
|
1029
|
+
'class': [
|
1030
|
+
(cs_ident, Name.Class, '#pop')
|
1031
|
+
],
|
1032
|
+
'package': [
|
1033
|
+
(r'(?=\()', Text, '#pop'), # using (resource)
|
1034
|
+
('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop')
|
1035
|
+
]
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
def __init__(self, **options):
|
1039
|
+
level = get_choice_opt(options, 'unicodelevel', self.tokens.keys(),
|
1040
|
+
'basic')
|
1041
|
+
if level not in self._all_tokens:
|
1042
|
+
# compile the regexes now
|
1043
|
+
self._tokens = self.__class__.process_tokendef(level)
|
1044
|
+
else:
|
1045
|
+
self._tokens = self._all_tokens[level]
|
1046
|
+
|
1047
|
+
RegexLexer.__init__(self, **options)
|
1048
|
+
|
1049
|
+
|
1050
|
+
class XtendLexer(RegexLexer):
|
1051
|
+
"""
|
1052
|
+
For `Xtend <http://xtend-lang.org/>`_ source code.
|
1053
|
+
|
1054
|
+
*New in Pygments 1.6.*
|
1055
|
+
"""
|
1056
|
+
|
1057
|
+
name = 'Xtend'
|
1058
|
+
aliases = ['xtend']
|
1059
|
+
filenames = ['*.xtend']
|
1060
|
+
mimetypes = ['text/x-xtend']
|
1061
|
+
|
1062
|
+
flags = re.MULTILINE | re.DOTALL
|
1063
|
+
|
1064
|
+
tokens = {
|
1065
|
+
'root': [
|
1066
|
+
# method names
|
1067
|
+
(r'^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]]*\s+)+?)' # return arguments
|
1068
|
+
r'([a-zA-Z_$][a-zA-Z0-9_$]*)' # method name
|
1069
|
+
r'(\s*)(\()', # signature start
|
1070
|
+
bygroups(using(this), Name.Function, Text, Operator)),
|
1071
|
+
(r'[^\S\n]+', Text),
|
1072
|
+
(r'//.*?\n', Comment.Single),
|
1073
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
1074
|
+
(r'@[a-zA-Z_][a-zA-Z0-9_\.]*', Name.Decorator),
|
1075
|
+
(r'(assert|break|case|catch|continue|default|do|else|finally|for|'
|
1076
|
+
r'if|goto|instanceof|new|return|switch|this|throw|try|while|IF|'
|
1077
|
+
r'ELSE|ELSEIF|ENDIF|FOR|ENDFOR|SEPARATOR|BEFORE|AFTER)\b',
|
1078
|
+
Keyword),
|
1079
|
+
(r'(def|abstract|const|enum|extends|final|implements|native|private|'
|
1080
|
+
r'protected|public|static|strictfp|super|synchronized|throws|'
|
1081
|
+
r'transient|volatile)\b', Keyword.Declaration),
|
1082
|
+
(r'(boolean|byte|char|double|float|int|long|short|void)\b',
|
1083
|
+
Keyword.Type),
|
1084
|
+
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
|
1085
|
+
(r'(true|false|null)\b', Keyword.Constant),
|
1086
|
+
(r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
|
1087
|
+
'class'),
|
1088
|
+
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
|
1089
|
+
(r"(''')", String, 'template'),
|
1090
|
+
(ur"(\u00BB)", String, 'template'),
|
1091
|
+
(r'"(\\\\|\\"|[^"])*"', String),
|
1092
|
+
(r"'(\\\\|\\'|[^'])*'", String),
|
1093
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
|
1094
|
+
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
|
1095
|
+
(r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
|
1096
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
1097
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
1098
|
+
(r'[0-9]+L?', Number.Integer),
|
1099
|
+
(r'\n', Text)
|
1100
|
+
],
|
1101
|
+
'class': [
|
1102
|
+
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
|
1103
|
+
],
|
1104
|
+
'import': [
|
1105
|
+
(r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
|
1106
|
+
],
|
1107
|
+
'template': [
|
1108
|
+
(r"'''", String, '#pop'),
|
1109
|
+
(ur"\u00AB", String, '#pop'),
|
1110
|
+
(r'.', String)
|
1111
|
+
],
|
1112
|
+
}
|