pygments.rb 0.6.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +11 -0
- data/README.md +6 -6
- data/Rakefile +2 -1
- data/cache-lexers.rb +1 -1
- data/circle.yml +7 -0
- data/lib/pygments/lexer.rb +3 -3
- data/lib/pygments/popen.rb +67 -30
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -1
- data/test/test_pygments.rb +16 -16
- data/vendor/pygments-main/AUTHORS +54 -8
- data/vendor/pygments-main/CHANGES +247 -25
- data/vendor/pygments-main/LICENSE +1 -1
- data/vendor/pygments-main/Makefile +15 -6
- data/vendor/pygments-main/README.rst +39 -0
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/TODO +0 -3
- data/vendor/pygments-main/doc/_themes/pygments14/layout.html +1 -1
- data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +1 -1
- data/vendor/pygments-main/doc/conf.py +3 -11
- data/vendor/pygments-main/doc/docs/api.rst +15 -0
- data/vendor/pygments-main/doc/docs/cmdline.rst +6 -2
- data/vendor/pygments-main/doc/docs/filterdevelopment.rst +4 -3
- data/vendor/pygments-main/doc/docs/integrate.rst +11 -15
- data/vendor/pygments-main/doc/docs/java.rst +7 -7
- data/vendor/pygments-main/doc/docs/lexerdevelopment.rst +258 -171
- data/vendor/pygments-main/doc/docs/lexers.rst +2 -2
- data/vendor/pygments-main/doc/docs/styles.rst +58 -0
- data/vendor/pygments-main/doc/docs/tokens.rst +22 -2
- data/vendor/pygments-main/doc/docs/unicode.rst +15 -7
- data/vendor/pygments-main/doc/faq.rst +17 -21
- data/vendor/pygments-main/doc/index.rst +12 -11
- data/vendor/pygments-main/doc/languages.rst +10 -7
- data/vendor/pygments-main/external/autopygmentize +9 -6
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +70 -52
- data/vendor/pygments-main/external/markdown-processor.py +1 -1
- data/vendor/pygments-main/external/moin-parser.py +1 -1
- data/vendor/pygments-main/external/rst-directive.py +1 -1
- data/vendor/pygments-main/pygmentize +2 -1
- data/vendor/pygments-main/pygments/__init__.py +14 -15
- data/vendor/pygments-main/pygments/cmdline.py +188 -113
- data/vendor/pygments-main/pygments/console.py +13 -13
- data/vendor/pygments-main/pygments/filter.py +7 -7
- data/vendor/pygments-main/pygments/filters/__init__.py +24 -32
- data/vendor/pygments-main/pygments/formatter.py +5 -5
- data/vendor/pygments-main/pygments/formatters/__init__.py +92 -44
- data/vendor/pygments-main/pygments/formatters/_mapping.py +51 -69
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +63 -51
- data/vendor/pygments-main/pygments/formatters/img.py +25 -22
- data/vendor/pygments-main/pygments/formatters/irc.py +182 -0
- data/vendor/pygments-main/pygments/formatters/latex.py +34 -22
- data/vendor/pygments-main/pygments/formatters/other.py +5 -7
- data/vendor/pygments-main/pygments/formatters/rtf.py +28 -31
- data/vendor/pygments-main/pygments/formatters/svg.py +1 -2
- data/vendor/pygments-main/pygments/formatters/terminal.py +29 -45
- data/vendor/pygments-main/pygments/formatters/terminal256.py +118 -31
- data/vendor/pygments-main/pygments/lexer.py +120 -34
- data/vendor/pygments-main/pygments/lexers/__init__.py +85 -53
- data/vendor/pygments-main/pygments/lexers/{_asybuiltins.py → _asy_builtins.py} +7 -7
- data/vendor/pygments-main/pygments/lexers/{_clbuiltins.py → _cl_builtins.py} +17 -17
- data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +72 -0
- data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +1346 -0
- data/vendor/pygments-main/pygments/lexers/{_lassobuiltins.py → _lasso_builtins.py} +4699 -4561
- data/vendor/pygments-main/pygments/lexers/{_luabuiltins.py → _lua_builtins.py} +91 -51
- data/vendor/pygments-main/pygments/lexers/_mapping.py +342 -242
- data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1172 -0
- data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +2547 -0
- data/vendor/pygments-main/pygments/lexers/{_phpbuiltins.py → _php_builtins.py} +350 -353
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +600 -212
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3084 -30
- data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +1163 -0
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +91 -13
- data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +419 -0
- data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1004 -0
- data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1939 -0
- data/vendor/pygments-main/pygments/lexers/actionscript.py +240 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +14 -2542
- data/vendor/pygments-main/pygments/lexers/algebra.py +221 -0
- data/vendor/pygments-main/pygments/lexers/ambient.py +76 -0
- data/vendor/pygments-main/pygments/lexers/ampl.py +87 -0
- data/vendor/pygments-main/pygments/lexers/apl.py +101 -0
- data/vendor/pygments-main/pygments/lexers/archetype.py +318 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +276 -81
- data/vendor/pygments-main/pygments/lexers/automation.py +374 -0
- data/vendor/pygments-main/pygments/lexers/basic.py +500 -0
- data/vendor/pygments-main/pygments/lexers/bibtex.py +156 -0
- data/vendor/pygments-main/pygments/lexers/business.py +594 -0
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +252 -0
- data/vendor/pygments-main/pygments/lexers/c_like.py +541 -0
- data/vendor/pygments-main/pygments/lexers/capnproto.py +79 -0
- data/vendor/pygments-main/pygments/lexers/chapel.py +101 -0
- data/vendor/pygments-main/pygments/lexers/clean.py +288 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +24 -5182
- data/vendor/pygments-main/pygments/lexers/configs.py +833 -0
- data/vendor/pygments-main/pygments/lexers/console.py +114 -0
- data/vendor/pygments-main/pygments/lexers/crystal.py +384 -0
- data/vendor/pygments-main/pygments/lexers/csound.py +366 -0
- data/vendor/pygments-main/pygments/lexers/css.py +689 -0
- data/vendor/pygments-main/pygments/lexers/d.py +251 -0
- data/vendor/pygments-main/pygments/lexers/dalvik.py +6 -6
- data/vendor/pygments-main/pygments/lexers/data.py +555 -0
- data/vendor/pygments-main/pygments/lexers/diff.py +165 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +96 -88
- data/vendor/pygments-main/pygments/lexers/dsls.py +878 -0
- data/vendor/pygments-main/pygments/lexers/dylan.py +289 -0
- data/vendor/pygments-main/pygments/lexers/ecl.py +125 -0
- data/vendor/pygments-main/pygments/lexers/eiffel.py +65 -0
- data/vendor/pygments-main/pygments/lexers/elm.py +121 -0
- data/vendor/pygments-main/pygments/lexers/erlang.py +533 -0
- data/vendor/pygments-main/pygments/lexers/esoteric.py +275 -0
- data/vendor/pygments-main/pygments/lexers/ezhil.py +68 -0
- data/vendor/pygments-main/pygments/lexers/factor.py +344 -0
- data/vendor/pygments-main/pygments/lexers/fantom.py +250 -0
- data/vendor/pygments-main/pygments/lexers/felix.py +273 -0
- data/vendor/pygments-main/pygments/lexers/forth.py +177 -0
- data/vendor/pygments-main/pygments/lexers/fortran.py +205 -0
- data/vendor/pygments-main/pygments/lexers/foxpro.py +1 -1
- data/vendor/pygments-main/pygments/lexers/functional.py +11 -3661
- data/vendor/pygments-main/pygments/lexers/go.py +101 -0
- data/vendor/pygments-main/pygments/lexers/grammar_notation.py +213 -0
- data/vendor/pygments-main/pygments/lexers/graph.py +7 -8
- data/vendor/pygments-main/pygments/lexers/graphics.py +553 -0
- data/vendor/pygments-main/pygments/lexers/haskell.py +840 -0
- data/vendor/pygments-main/pygments/lexers/haxe.py +936 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +172 -145
- data/vendor/pygments-main/pygments/lexers/hexdump.py +97 -0
- data/vendor/pygments-main/pygments/lexers/html.py +602 -0
- data/vendor/pygments-main/pygments/lexers/idl.py +270 -0
- data/vendor/pygments-main/pygments/lexers/igor.py +288 -0
- data/vendor/pygments-main/pygments/lexers/inferno.py +3 -3
- data/vendor/pygments-main/pygments/lexers/installers.py +322 -0
- data/vendor/pygments-main/pygments/lexers/int_fiction.py +1343 -0
- data/vendor/pygments-main/pygments/lexers/iolang.py +63 -0
- data/vendor/pygments-main/pygments/lexers/j.py +146 -0
- data/vendor/pygments-main/pygments/lexers/javascript.py +1506 -0
- data/vendor/pygments-main/pygments/lexers/julia.py +333 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +232 -186
- data/vendor/pygments-main/pygments/lexers/lisp.py +2621 -0
- data/vendor/pygments-main/pygments/lexers/make.py +202 -0
- data/vendor/pygments-main/pygments/lexers/markup.py +595 -0
- data/vendor/pygments-main/pygments/lexers/math.py +11 -2276
- data/vendor/pygments-main/pygments/lexers/matlab.py +663 -0
- data/vendor/pygments-main/pygments/lexers/ml.py +769 -0
- data/vendor/pygments-main/pygments/lexers/modeling.py +358 -0
- data/vendor/pygments-main/pygments/lexers/modula2.py +1561 -0
- data/vendor/pygments-main/pygments/lexers/monte.py +203 -0
- data/vendor/pygments-main/pygments/lexers/ncl.py +1053 -0
- data/vendor/pygments-main/pygments/lexers/nimrod.py +159 -0
- data/vendor/pygments-main/pygments/lexers/nit.py +64 -0
- data/vendor/pygments-main/pygments/lexers/nix.py +136 -0
- data/vendor/pygments-main/pygments/lexers/oberon.py +105 -0
- data/vendor/pygments-main/pygments/lexers/objective.py +504 -0
- data/vendor/pygments-main/pygments/lexers/ooc.py +85 -0
- data/vendor/pygments-main/pygments/lexers/other.py +30 -4481
- data/vendor/pygments-main/pygments/lexers/parasail.py +79 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +171 -114
- data/vendor/pygments-main/pygments/lexers/pascal.py +644 -0
- data/vendor/pygments-main/pygments/lexers/pawn.py +199 -0
- data/vendor/pygments-main/pygments/lexers/perl.py +616 -0
- data/vendor/pygments-main/pygments/lexers/php.py +267 -0
- data/vendor/pygments-main/pygments/lexers/praat.py +294 -0
- data/vendor/pygments-main/pygments/lexers/prolog.py +306 -0
- data/vendor/pygments-main/pygments/lexers/python.py +938 -0
- data/vendor/pygments-main/pygments/lexers/qvt.py +152 -0
- data/vendor/pygments-main/pygments/lexers/r.py +453 -0
- data/vendor/pygments-main/pygments/lexers/rdf.py +195 -24
- data/vendor/pygments-main/pygments/lexers/rebol.py +431 -0
- data/vendor/pygments-main/pygments/lexers/resource.py +85 -0
- data/vendor/pygments-main/pygments/lexers/rnc.py +67 -0
- data/vendor/pygments-main/pygments/lexers/roboconf.py +82 -0
- data/vendor/pygments-main/pygments/lexers/{_robotframeworklexer.py → robotframework.py} +20 -18
- data/vendor/pygments-main/pygments/lexers/ruby.py +519 -0
- data/vendor/pygments-main/pygments/lexers/rust.py +209 -0
- data/vendor/pygments-main/pygments/lexers/sas.py +228 -0
- data/vendor/pygments-main/pygments/lexers/scripting.py +1222 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +478 -115
- data/vendor/pygments-main/pygments/lexers/smalltalk.py +195 -0
- data/vendor/pygments-main/pygments/lexers/smv.py +75 -0
- data/vendor/pygments-main/pygments/lexers/snobol.py +83 -0
- data/vendor/pygments-main/pygments/lexers/special.py +6 -2
- data/vendor/pygments-main/pygments/lexers/sql.py +209 -120
- data/vendor/pygments-main/pygments/lexers/stata.py +106 -0
- data/vendor/pygments-main/pygments/lexers/supercollider.py +90 -0
- data/vendor/pygments-main/pygments/lexers/tcl.py +145 -0
- data/vendor/pygments-main/pygments/lexers/templates.py +282 -90
- data/vendor/pygments-main/pygments/lexers/testing.py +207 -0
- data/vendor/pygments-main/pygments/lexers/text.py +15 -2045
- data/vendor/pygments-main/pygments/lexers/textedit.py +169 -0
- data/vendor/pygments-main/pygments/lexers/textfmts.py +297 -0
- data/vendor/pygments-main/pygments/lexers/theorem.py +458 -0
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +54 -0
- data/vendor/pygments-main/pygments/lexers/typoscript.py +225 -0
- data/vendor/pygments-main/pygments/lexers/urbi.py +133 -0
- data/vendor/pygments-main/pygments/lexers/varnish.py +190 -0
- data/vendor/pygments-main/pygments/lexers/verification.py +111 -0
- data/vendor/pygments-main/pygments/lexers/web.py +13 -4499
- data/vendor/pygments-main/pygments/lexers/webmisc.py +979 -0
- data/vendor/pygments-main/pygments/lexers/whiley.py +117 -0
- data/vendor/pygments-main/pygments/lexers/x10.py +69 -0
- data/vendor/pygments-main/pygments/modeline.py +5 -2
- data/vendor/pygments-main/pygments/plugin.py +1 -1
- data/vendor/pygments-main/pygments/regexopt.py +92 -0
- data/vendor/pygments-main/pygments/scanner.py +3 -2
- data/vendor/pygments-main/pygments/sphinxext.py +11 -6
- data/vendor/pygments-main/pygments/style.py +41 -4
- data/vendor/pygments-main/pygments/styles/__init__.py +5 -1
- data/vendor/pygments-main/pygments/styles/algol.py +63 -0
- data/vendor/pygments-main/pygments/styles/algol_nu.py +63 -0
- data/vendor/pygments-main/pygments/styles/arduino.py +98 -0
- data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
- data/vendor/pygments-main/pygments/styles/borland.py +1 -1
- data/vendor/pygments-main/pygments/styles/bw.py +1 -1
- data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
- data/vendor/pygments-main/pygments/styles/default.py +1 -1
- data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
- data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
- data/vendor/pygments-main/pygments/styles/igor.py +1 -1
- data/vendor/pygments-main/pygments/styles/lovelace.py +97 -0
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +1 -1
- data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
- data/vendor/pygments-main/pygments/styles/native.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -1
- data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
- data/vendor/pygments-main/pygments/styles/perldoc.py +2 -2
- data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
- data/vendor/pygments-main/pygments/styles/sas.py +41 -0
- data/vendor/pygments-main/pygments/styles/stata.py +37 -0
- data/vendor/pygments-main/pygments/styles/tango.py +1 -1
- data/vendor/pygments-main/pygments/styles/trac.py +1 -1
- data/vendor/pygments-main/pygments/styles/vim.py +1 -1
- data/vendor/pygments-main/pygments/styles/vs.py +1 -1
- data/vendor/pygments-main/pygments/styles/xcode.py +1 -1
- data/vendor/pygments-main/pygments/token.py +31 -16
- data/vendor/pygments-main/pygments/unistring.py +141 -65
- data/vendor/pygments-main/pygments/util.py +129 -33
- data/vendor/pygments-main/requirements.txt +5 -0
- data/vendor/pygments-main/scripts/check_sources.py +25 -40
- data/vendor/pygments-main/scripts/debug_lexer.py +246 -0
- data/vendor/pygments-main/scripts/find_error.py +1 -0
- data/vendor/pygments-main/scripts/get_vimkw.py +35 -4
- data/vendor/pygments-main/setup.cfg +3 -0
- data/vendor/pygments-main/setup.py +17 -30
- data/vendor/pygments-main/tox.ini +7 -0
- metadata +159 -387
- data/vendor/pygments-main/ez_setup.py +0 -382
- data/vendor/pygments-main/pygments/lexers/_cocoabuiltins.py +0 -73
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +0 -562
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +0 -1077
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +0 -13
- data/vendor/pygments-main/pygments/lexers/qbasic.py +0 -157
- data/vendor/pygments-main/scripts/find_codetags.py +0 -213
- data/vendor/pygments-main/scripts/find_error.py +0 -173
- data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +0 -37
- data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +0 -869
- data/vendor/pygments-main/tests/dtds/HTML4.dcl +0 -88
- data/vendor/pygments-main/tests/dtds/HTML4.dtd +0 -1092
- data/vendor/pygments-main/tests/dtds/HTML4.soc +0 -9
- data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +0 -195
- data/vendor/pygments-main/tests/dtds/HTMLspec.ent +0 -77
- data/vendor/pygments-main/tests/dtds/HTMLsym.ent +0 -241
- data/vendor/pygments-main/tests/examplefiles/99_bottles_of_beer.chpl +0 -118
- data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +0 -209
- data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +0 -102
- data/vendor/pygments-main/tests/examplefiles/BOM.js +0 -1
- data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +0 -611
- data/vendor/pygments-main/tests/examplefiles/Config.in.cache +0 -1973
- data/vendor/pygments-main/tests/examplefiles/Constants.mo +0 -158
- data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +0 -411
- data/vendor/pygments-main/tests/examplefiles/Deflate.fs +0 -578
- data/vendor/pygments-main/tests/examplefiles/Error.pmod +0 -38
- data/vendor/pygments-main/tests/examplefiles/Errors.scala +0 -18
- data/vendor/pygments-main/tests/examplefiles/FakeFile.pike +0 -360
- data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +0 -66
- data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +0 -104
- data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +0 -671
- data/vendor/pygments-main/tests/examplefiles/Intro.java +0 -1660
- data/vendor/pygments-main/tests/examplefiles/Makefile +0 -1131
- data/vendor/pygments-main/tests/examplefiles/Object.st +0 -4394
- data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +0 -584
- data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +0 -23
- data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +0 -378
- data/vendor/pygments-main/tests/examplefiles/Sorting.mod +0 -470
- data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +0 -382
- data/vendor/pygments-main/tests/examplefiles/addressbook.proto +0 -30
- data/vendor/pygments-main/tests/examplefiles/antlr_ANTLRv3.g +0 -608
- data/vendor/pygments-main/tests/examplefiles/antlr_throws +0 -1
- data/vendor/pygments-main/tests/examplefiles/apache2.conf +0 -393
- data/vendor/pygments-main/tests/examplefiles/as3_test.as +0 -143
- data/vendor/pygments-main/tests/examplefiles/as3_test2.as +0 -46
- data/vendor/pygments-main/tests/examplefiles/as3_test3.as +0 -3
- data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +0 -27
- data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +0 -25
- data/vendor/pygments-main/tests/examplefiles/badcase.java +0 -2
- data/vendor/pygments-main/tests/examplefiles/batchfile.bat +0 -49
- data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +0 -308
- data/vendor/pygments-main/tests/examplefiles/boot-9.scm +0 -1557
- data/vendor/pygments-main/tests/examplefiles/ca65_example +0 -284
- data/vendor/pygments-main/tests/examplefiles/cbmbas_example +0 -9
- data/vendor/pygments-main/tests/examplefiles/cells.ps +0 -515
- data/vendor/pygments-main/tests/examplefiles/ceval.c +0 -2604
- data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +0 -13
- data/vendor/pygments-main/tests/examplefiles/classes.dylan +0 -125
- data/vendor/pygments-main/tests/examplefiles/clojure-weird-keywords.clj +0 -5
- data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +0 -10
- data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +0 -447
- data/vendor/pygments-main/tests/examplefiles/core.cljs +0 -52
- data/vendor/pygments-main/tests/examplefiles/database.pytb +0 -20
- data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +0 -2461
- data/vendor/pygments-main/tests/examplefiles/demo.ahk +0 -181
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +0 -50
- data/vendor/pygments-main/tests/examplefiles/demo.hbs +0 -12
- data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +0 -68
- data/vendor/pygments-main/tests/examplefiles/dwarf.cw +0 -17
- data/vendor/pygments-main/tests/examplefiles/ember.handlebars +0 -33
- data/vendor/pygments-main/tests/examplefiles/erl_session +0 -10
- data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +0 -1
- data/vendor/pygments-main/tests/examplefiles/evil_regex.js +0 -48
- data/vendor/pygments-main/tests/examplefiles/example.Rd +0 -78
- data/vendor/pygments-main/tests/examplefiles/example.als +0 -217
- data/vendor/pygments-main/tests/examplefiles/example.bug +0 -54
- data/vendor/pygments-main/tests/examplefiles/example.c +0 -2080
- data/vendor/pygments-main/tests/examplefiles/example.ceylon +0 -52
- data/vendor/pygments-main/tests/examplefiles/example.chai +0 -6
- data/vendor/pygments-main/tests/examplefiles/example.clay +0 -33
- data/vendor/pygments-main/tests/examplefiles/example.cls +0 -15
- data/vendor/pygments-main/tests/examplefiles/example.cob +0 -3556
- data/vendor/pygments-main/tests/examplefiles/example.coffee +0 -27
- data/vendor/pygments-main/tests/examplefiles/example.cpp +0 -2363
- data/vendor/pygments-main/tests/examplefiles/example.e +0 -124
- data/vendor/pygments-main/tests/examplefiles/example.f90 +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.feature +0 -16
- data/vendor/pygments-main/tests/examplefiles/example.gd +0 -23
- data/vendor/pygments-main/tests/examplefiles/example.gi +0 -64
- data/vendor/pygments-main/tests/examplefiles/example.groovy +0 -2
- data/vendor/pygments-main/tests/examplefiles/example.gs +0 -106
- data/vendor/pygments-main/tests/examplefiles/example.gst +0 -7
- data/vendor/pygments-main/tests/examplefiles/example.hs +0 -27
- data/vendor/pygments-main/tests/examplefiles/example.hx +0 -185
- data/vendor/pygments-main/tests/examplefiles/example.i6t +0 -32
- data/vendor/pygments-main/tests/examplefiles/example.i7x +0 -45
- data/vendor/pygments-main/tests/examplefiles/example.inf +0 -374
- data/vendor/pygments-main/tests/examplefiles/example.j +0 -564
- data/vendor/pygments-main/tests/examplefiles/example.jag +0 -48
- data/vendor/pygments-main/tests/examplefiles/example.java +0 -16
- data/vendor/pygments-main/tests/examplefiles/example.kal +0 -75
- data/vendor/pygments-main/tests/examplefiles/example.kt +0 -47
- data/vendor/pygments-main/tests/examplefiles/example.lagda +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.liquid +0 -42
- data/vendor/pygments-main/tests/examplefiles/example.lua +0 -250
- data/vendor/pygments-main/tests/examplefiles/example.ma +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.monkey +0 -152
- data/vendor/pygments-main/tests/examplefiles/example.moo +0 -26
- data/vendor/pygments-main/tests/examplefiles/example.moon +0 -629
- data/vendor/pygments-main/tests/examplefiles/example.mq4 +0 -187
- data/vendor/pygments-main/tests/examplefiles/example.mqh +0 -123
- data/vendor/pygments-main/tests/examplefiles/example.msc +0 -43
- data/vendor/pygments-main/tests/examplefiles/example.ni +0 -57
- data/vendor/pygments-main/tests/examplefiles/example.nim +0 -1010
- data/vendor/pygments-main/tests/examplefiles/example.nix +0 -80
- data/vendor/pygments-main/tests/examplefiles/example.ns2 +0 -69
- data/vendor/pygments-main/tests/examplefiles/example.pas +0 -2708
- data/vendor/pygments-main/tests/examplefiles/example.pp +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.prg +0 -161
- data/vendor/pygments-main/tests/examplefiles/example.rb +0 -1852
- data/vendor/pygments-main/tests/examplefiles/example.red +0 -257
- data/vendor/pygments-main/tests/examplefiles/example.reds +0 -150
- data/vendor/pygments-main/tests/examplefiles/example.reg +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.rexx +0 -50
- data/vendor/pygments-main/tests/examplefiles/example.rhtml +0 -561
- data/vendor/pygments-main/tests/examplefiles/example.rkt +0 -743
- data/vendor/pygments-main/tests/examplefiles/example.rpf +0 -4
- data/vendor/pygments-main/tests/examplefiles/example.sh +0 -22
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.shell-session +0 -45
- data/vendor/pygments-main/tests/examplefiles/example.slim +0 -31
- data/vendor/pygments-main/tests/examplefiles/example.sls +0 -51
- data/vendor/pygments-main/tests/examplefiles/example.sml +0 -156
- data/vendor/pygments-main/tests/examplefiles/example.snobol +0 -15
- data/vendor/pygments-main/tests/examplefiles/example.stan +0 -110
- data/vendor/pygments-main/tests/examplefiles/example.tea +0 -34
- data/vendor/pygments-main/tests/examplefiles/example.todotxt +0 -9
- data/vendor/pygments-main/tests/examplefiles/example.ts +0 -28
- data/vendor/pygments-main/tests/examplefiles/example.u +0 -548
- data/vendor/pygments-main/tests/examplefiles/example.weechatlog +0 -9
- data/vendor/pygments-main/tests/examplefiles/example.xhtml +0 -376
- data/vendor/pygments-main/tests/examplefiles/example.xtend +0 -34
- data/vendor/pygments-main/tests/examplefiles/example.yaml +0 -302
- data/vendor/pygments-main/tests/examplefiles/example2.aspx +0 -29
- data/vendor/pygments-main/tests/examplefiles/example2.msc +0 -79
- data/vendor/pygments-main/tests/examplefiles/exampleScript.cfc +0 -241
- data/vendor/pygments-main/tests/examplefiles/exampleTag.cfc +0 -18
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +0 -205
- data/vendor/pygments-main/tests/examplefiles/example_file.fy +0 -128
- data/vendor/pygments-main/tests/examplefiles/firefox.mak +0 -586
- data/vendor/pygments-main/tests/examplefiles/flipflop.sv +0 -19
- data/vendor/pygments-main/tests/examplefiles/foo.sce +0 -6
- data/vendor/pygments-main/tests/examplefiles/format.ml +0 -1213
- data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +0 -77
- data/vendor/pygments-main/tests/examplefiles/function.mu +0 -1
- data/vendor/pygments-main/tests/examplefiles/functional.rst +0 -1472
- data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +0 -133
- data/vendor/pygments-main/tests/examplefiles/genclass.clj +0 -510
- data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +0 -193
- data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +0 -33
- data/vendor/pygments-main/tests/examplefiles/glsl.frag +0 -7
- data/vendor/pygments-main/tests/examplefiles/glsl.vert +0 -13
- data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +0 -22
- data/vendor/pygments-main/tests/examplefiles/hash_syntax.rb +0 -5
- data/vendor/pygments-main/tests/examplefiles/hello.at +0 -6
- data/vendor/pygments-main/tests/examplefiles/hello.golo +0 -5
- data/vendor/pygments-main/tests/examplefiles/hello.lsl +0 -12
- data/vendor/pygments-main/tests/examplefiles/hello.smali +0 -40
- data/vendor/pygments-main/tests/examplefiles/hello.sp +0 -9
- data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +0 -1
- data/vendor/pygments-main/tests/examplefiles/http_request_example +0 -15
- data/vendor/pygments-main/tests/examplefiles/http_response_example +0 -29
- data/vendor/pygments-main/tests/examplefiles/hybris_File.hy +0 -174
- data/vendor/pygments-main/tests/examplefiles/idl_sample.pro +0 -73
- data/vendor/pygments-main/tests/examplefiles/iex_example +0 -23
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +0 -71
- data/vendor/pygments-main/tests/examplefiles/intro.ik +0 -24
- data/vendor/pygments-main/tests/examplefiles/ints.php +0 -10
- data/vendor/pygments-main/tests/examplefiles/intsyn.fun +0 -675
- data/vendor/pygments-main/tests/examplefiles/intsyn.sig +0 -286
- data/vendor/pygments-main/tests/examplefiles/irb_heredoc +0 -8
- data/vendor/pygments-main/tests/examplefiles/irc.lsp +0 -214
- data/vendor/pygments-main/tests/examplefiles/java.properties +0 -16
- data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +0 -28
- data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +0 -45
- data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +0 -713
- data/vendor/pygments-main/tests/examplefiles/json.lasso +0 -301
- data/vendor/pygments-main/tests/examplefiles/json.lasso9 +0 -213
- data/vendor/pygments-main/tests/examplefiles/language.hy +0 -165
- data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +0 -13
- data/vendor/pygments-main/tests/examplefiles/limbo.b +0 -456
- data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +0 -47
- data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +0 -43
- data/vendor/pygments-main/tests/examplefiles/logos_example.xm +0 -28
- data/vendor/pygments-main/tests/examplefiles/ltmain.sh +0 -2849
- data/vendor/pygments-main/tests/examplefiles/main.cmake +0 -44
- data/vendor/pygments-main/tests/examplefiles/markdown.lsp +0 -679
- data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +0 -3
- data/vendor/pygments-main/tests/examplefiles/matlab_sample +0 -30
- data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +0 -37
- data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +0 -455
- data/vendor/pygments-main/tests/examplefiles/minehunt.qml +0 -112
- data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +0 -4
- data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +0 -340
- data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +0 -38
- data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +0 -95
- data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +0 -96
- data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +0 -30
- data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +0 -87
- data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +0 -118
- data/vendor/pygments-main/tests/examplefiles/numbers.c +0 -12
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +0 -179
- data/vendor/pygments-main/tests/examplefiles/openedge_example +0 -34
- data/vendor/pygments-main/tests/examplefiles/pawn_example +0 -25
- data/vendor/pygments-main/tests/examplefiles/perl_misc +0 -62
- data/vendor/pygments-main/tests/examplefiles/perl_perl5db +0 -998
- data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +0 -120
- data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +0 -856
- data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +0 -163
- data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +0 -567
- data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +0 -1223
- data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +0 -47
- data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +0 -10
- data/vendor/pygments-main/tests/examplefiles/psql_session.txt +0 -122
- data/vendor/pygments-main/tests/examplefiles/py3_test.txt +0 -2
- data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +0 -4
- data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +0 -14
- data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +0 -2
- data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +0 -4
- data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +0 -234
- data/vendor/pygments-main/tests/examplefiles/qbasic_example +0 -2
- data/vendor/pygments-main/tests/examplefiles/qsort.prolog +0 -13
- data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +0 -38
- data/vendor/pygments-main/tests/examplefiles/r6rs-comments.scm +0 -23
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +0 -280
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +0 -2
- data/vendor/pygments-main/tests/examplefiles/regex.js +0 -22
- data/vendor/pygments-main/tests/examplefiles/reversi.lsp +0 -427
- data/vendor/pygments-main/tests/examplefiles/robotframework_test.txt +0 -39
- data/vendor/pygments-main/tests/examplefiles/rql-queries.rql +0 -34
- data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +0 -11
- data/vendor/pygments-main/tests/examplefiles/rust_example.rs +0 -233
- data/vendor/pygments-main/tests/examplefiles/scilab.sci +0 -30
- data/vendor/pygments-main/tests/examplefiles/scope.cirru +0 -43
- data/vendor/pygments-main/tests/examplefiles/session.dylan-console +0 -9
- data/vendor/pygments-main/tests/examplefiles/sibling.prolog +0 -19
- data/vendor/pygments-main/tests/examplefiles/simple.md +0 -747
- data/vendor/pygments-main/tests/examplefiles/smarty_example.html +0 -209
- data/vendor/pygments-main/tests/examplefiles/source.lgt +0 -343
- data/vendor/pygments-main/tests/examplefiles/sources.list +0 -62
- data/vendor/pygments-main/tests/examplefiles/sparql.rq +0 -23
- data/vendor/pygments-main/tests/examplefiles/sphere.pov +0 -18
- data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +0 -27
- data/vendor/pygments-main/tests/examplefiles/squid.conf +0 -30
- data/vendor/pygments-main/tests/examplefiles/string.jl +0 -1031
- data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +0 -21
- data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +0 -3
- data/vendor/pygments-main/tests/examplefiles/swig_java.swg +0 -1329
- data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +0 -225
- data/vendor/pygments-main/tests/examplefiles/test.R +0 -185
- data/vendor/pygments-main/tests/examplefiles/test.adb +0 -211
- data/vendor/pygments-main/tests/examplefiles/test.agda +0 -102
- data/vendor/pygments-main/tests/examplefiles/test.apl +0 -26
- data/vendor/pygments-main/tests/examplefiles/test.asy +0 -131
- data/vendor/pygments-main/tests/examplefiles/test.awk +0 -121
- data/vendor/pygments-main/tests/examplefiles/test.bb +0 -95
- data/vendor/pygments-main/tests/examplefiles/test.bmx +0 -145
- data/vendor/pygments-main/tests/examplefiles/test.boo +0 -39
- data/vendor/pygments-main/tests/examplefiles/test.bro +0 -250
- data/vendor/pygments-main/tests/examplefiles/test.cs +0 -374
- data/vendor/pygments-main/tests/examplefiles/test.css +0 -54
- data/vendor/pygments-main/tests/examplefiles/test.cu +0 -36
- data/vendor/pygments-main/tests/examplefiles/test.cyp +0 -123
- data/vendor/pygments-main/tests/examplefiles/test.d +0 -135
- data/vendor/pygments-main/tests/examplefiles/test.dart +0 -23
- data/vendor/pygments-main/tests/examplefiles/test.dtd +0 -89
- data/vendor/pygments-main/tests/examplefiles/test.ebnf +0 -31
- data/vendor/pygments-main/tests/examplefiles/test.ec +0 -605
- data/vendor/pygments-main/tests/examplefiles/test.ecl +0 -58
- data/vendor/pygments-main/tests/examplefiles/test.eh +0 -315
- data/vendor/pygments-main/tests/examplefiles/test.erl +0 -169
- data/vendor/pygments-main/tests/examplefiles/test.evoque +0 -33
- data/vendor/pygments-main/tests/examplefiles/test.fan +0 -818
- data/vendor/pygments-main/tests/examplefiles/test.flx +0 -57
- data/vendor/pygments-main/tests/examplefiles/test.gdc +0 -13
- data/vendor/pygments-main/tests/examplefiles/test.groovy +0 -97
- data/vendor/pygments-main/tests/examplefiles/test.html +0 -339
- data/vendor/pygments-main/tests/examplefiles/test.idr +0 -93
- data/vendor/pygments-main/tests/examplefiles/test.ini +0 -10
- data/vendor/pygments-main/tests/examplefiles/test.java +0 -653
- data/vendor/pygments-main/tests/examplefiles/test.jsp +0 -24
- data/vendor/pygments-main/tests/examplefiles/test.maql +0 -45
- data/vendor/pygments-main/tests/examplefiles/test.mask +0 -41
- data/vendor/pygments-main/tests/examplefiles/test.mod +0 -374
- data/vendor/pygments-main/tests/examplefiles/test.moo +0 -51
- data/vendor/pygments-main/tests/examplefiles/test.myt +0 -166
- data/vendor/pygments-main/tests/examplefiles/test.nim +0 -93
- data/vendor/pygments-main/tests/examplefiles/test.opa +0 -10
- data/vendor/pygments-main/tests/examplefiles/test.p6 +0 -252
- data/vendor/pygments-main/tests/examplefiles/test.pan +0 -54
- data/vendor/pygments-main/tests/examplefiles/test.pas +0 -743
- data/vendor/pygments-main/tests/examplefiles/test.php +0 -507
- data/vendor/pygments-main/tests/examplefiles/test.pig +0 -148
- data/vendor/pygments-main/tests/examplefiles/test.plot +0 -333
- data/vendor/pygments-main/tests/examplefiles/test.ps1 +0 -108
- data/vendor/pygments-main/tests/examplefiles/test.pwn +0 -253
- data/vendor/pygments-main/tests/examplefiles/test.pypylog +0 -1839
- data/vendor/pygments-main/tests/examplefiles/test.r3 +0 -114
- data/vendor/pygments-main/tests/examplefiles/test.rb +0 -177
- data/vendor/pygments-main/tests/examplefiles/test.rhtml +0 -43
- data/vendor/pygments-main/tests/examplefiles/test.rsl +0 -111
- data/vendor/pygments-main/tests/examplefiles/test.scaml +0 -8
- data/vendor/pygments-main/tests/examplefiles/test.ssp +0 -12
- data/vendor/pygments-main/tests/examplefiles/test.swift +0 -65
- data/vendor/pygments-main/tests/examplefiles/test.tcsh +0 -830
- data/vendor/pygments-main/tests/examplefiles/test.vb +0 -407
- data/vendor/pygments-main/tests/examplefiles/test.vhdl +0 -161
- data/vendor/pygments-main/tests/examplefiles/test.xqy +0 -138
- data/vendor/pygments-main/tests/examplefiles/test.xsl +0 -23
- data/vendor/pygments-main/tests/examplefiles/test.zep +0 -33
- data/vendor/pygments-main/tests/examplefiles/test2.pypylog +0 -120
- data/vendor/pygments-main/tests/examplefiles/truncated.pytb +0 -15
- data/vendor/pygments-main/tests/examplefiles/type.lisp +0 -1218
- data/vendor/pygments-main/tests/examplefiles/underscore.coffee +0 -603
- data/vendor/pygments-main/tests/examplefiles/unicode.applescript +0 -5
- data/vendor/pygments-main/tests/examplefiles/unicode.go +0 -10
- data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +0 -11
- data/vendor/pygments-main/tests/examplefiles/unix-io.lid +0 -37
- data/vendor/pygments-main/tests/examplefiles/vbnet_test.bas +0 -29
- data/vendor/pygments-main/tests/examplefiles/vctreestatus_hg +0 -4
- data/vendor/pygments-main/tests/examplefiles/vimrc +0 -21
- data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +0 -3
- data/vendor/pygments-main/tests/examplefiles/while.pov +0 -13
- data/vendor/pygments-main/tests/examplefiles/wiki.factor +0 -384
- data/vendor/pygments-main/tests/examplefiles/xml_example +0 -1897
- data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +0 -798
- data/vendor/pygments-main/tests/run.py +0 -44
- data/vendor/pygments-main/tests/string_asserts.py +0 -22
- data/vendor/pygments-main/tests/support.py +0 -15
- data/vendor/pygments-main/tests/support/tags +0 -36
- data/vendor/pygments-main/tests/test_basic_api.py +0 -309
- data/vendor/pygments-main/tests/test_cfm.py +0 -46
- data/vendor/pygments-main/tests/test_clexer.py +0 -236
- data/vendor/pygments-main/tests/test_cmdline.py +0 -106
- data/vendor/pygments-main/tests/test_examplefiles.py +0 -110
- data/vendor/pygments-main/tests/test_html_formatter.py +0 -180
- data/vendor/pygments-main/tests/test_latex_formatter.py +0 -57
- data/vendor/pygments-main/tests/test_lexers_other.py +0 -68
- data/vendor/pygments-main/tests/test_objectiveclexer.py +0 -81
- data/vendor/pygments-main/tests/test_perllexer.py +0 -137
- data/vendor/pygments-main/tests/test_qbasiclexer.py +0 -43
- data/vendor/pygments-main/tests/test_regexlexer.py +0 -54
- data/vendor/pygments-main/tests/test_rtf_formatter.py +0 -109
- data/vendor/pygments-main/tests/test_string_asserts.py +0 -39
- data/vendor/pygments-main/tests/test_token.py +0 -46
- data/vendor/pygments-main/tests/test_using_api.py +0 -40
- data/vendor/pygments-main/tests/test_util.py +0 -135
@@ -0,0 +1,177 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.forth
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
|
7
|
+
:license: BSD, see LICENSE for details.
|
8
|
+
"""
|
9
|
+
|
10
|
+
import re
|
11
|
+
|
12
|
+
from pygments.lexer import RegexLexer, include, bygroups
|
13
|
+
from pygments.token import Error, Punctuation, Literal, Token, \
|
14
|
+
Text, Comment, Operator, Keyword, Name, String, Number, Generic
|
15
|
+
|
16
|
+
|
17
|
+
__all__ = ['ForthLexer']
|
18
|
+
|
19
|
+
|
20
|
+
class ForthLexer(RegexLexer):
|
21
|
+
"""
|
22
|
+
Lexer for Forth files.
|
23
|
+
|
24
|
+
.. versionadded:: 2.2
|
25
|
+
"""
|
26
|
+
name = 'Forth'
|
27
|
+
aliases = ['forth']
|
28
|
+
filenames = ['*.frt', '*.fs']
|
29
|
+
mimetypes = ['application/x-forth']
|
30
|
+
|
31
|
+
delimiter = r'\s'
|
32
|
+
delimiter_end = r'(?=[%s])' % delimiter
|
33
|
+
|
34
|
+
valid_name_chars = r'[^%s]' % delimiter
|
35
|
+
valid_name = r"%s+%s" % (valid_name_chars, delimiter_end)
|
36
|
+
|
37
|
+
flags = re.IGNORECASE | re.MULTILINE
|
38
|
+
|
39
|
+
tokens = {
|
40
|
+
'root': [
|
41
|
+
(r'\s+', Text),
|
42
|
+
# All comment types
|
43
|
+
(r'\\.*?\n', Comment.Single),
|
44
|
+
(r'\([\s].*?\)', Comment.Single),
|
45
|
+
# defining words. The next word is a new command name
|
46
|
+
(r'(:|variable|constant|value|buffer:)(\s+)',
|
47
|
+
bygroups(Keyword.Namespace, Text), 'worddef'),
|
48
|
+
# strings are rather simple
|
49
|
+
(r'([.sc]")(\s+?)', bygroups(String, Text), 'stringdef'),
|
50
|
+
# keywords from the various wordsets
|
51
|
+
# *** Wordset BLOCK
|
52
|
+
(r'(blk|block|buffer|evaluate|flush|load|save-buffers|update|'
|
53
|
+
# *** Wordset BLOCK-EXT
|
54
|
+
r'empty-buffers|list|refill|scr|thru|'
|
55
|
+
# *** Wordset CORE
|
56
|
+
r'\#s|\*\/mod|\+loop|\/mod|0<|0=|1\+|1-|2!|'
|
57
|
+
r'2\*|2\/|2@|2drop|2dup|2over|2swap|>body|'
|
58
|
+
r'>in|>number|>r|\?dup|abort|abort\"|abs|'
|
59
|
+
r'accept|align|aligned|allot|and|base|begin|'
|
60
|
+
r'bl|c!|c,|c@|cell\+|cells|char|char\+|'
|
61
|
+
r'chars|constant|count|cr|create|decimal|'
|
62
|
+
r'depth|do|does>|drop|dup|else|emit|environment\?|'
|
63
|
+
r'evaluate|execute|exit|fill|find|fm\/mod|'
|
64
|
+
r'here|hold|i|if|immediate|invert|j|key|'
|
65
|
+
r'leave|literal|loop|lshift|m\*|max|min|'
|
66
|
+
r'mod|move|negate|or|over|postpone|quit|'
|
67
|
+
r'r>|r@|recurse|repeat|rot|rshift|s\"|s>d|'
|
68
|
+
r'sign|sm\/rem|source|space|spaces|state|swap|'
|
69
|
+
r'then|type|u\.|u\<|um\*|um\/mod|unloop|until|'
|
70
|
+
r'variable|while|word|xor|\[char\]|\[\'\]|'
|
71
|
+
r'@|!|\#|<\#|\#>|:|;|\+|-|\*|\/|,|<|>|\|1\+|1-|\.|'
|
72
|
+
# *** Wordset CORE-EXT
|
73
|
+
r'\.r|0<>|'
|
74
|
+
r'0>|2>r|2r>|2r@|:noname|\?do|again|c\"|'
|
75
|
+
r'case|compile,|endcase|endof|erase|false|'
|
76
|
+
r'hex|marker|nip|of|pad|parse|pick|refill|'
|
77
|
+
r'restore-input|roll|save-input|source-id|to|'
|
78
|
+
r'true|tuck|u\.r|u>|unused|value|within|'
|
79
|
+
r'\[compile\]|'
|
80
|
+
# *** Wordset CORE-EXT-obsolescent
|
81
|
+
r'\#tib|convert|expect|query|span|'
|
82
|
+
r'tib|'
|
83
|
+
# *** Wordset DOUBLE
|
84
|
+
r'2constant|2literal|2variable|d\+|d-|'
|
85
|
+
r'd\.|d\.r|d0<|d0=|d2\*|d2\/|d<|d=|d>s|'
|
86
|
+
r'dabs|dmax|dmin|dnegate|m\*\/|m\+|'
|
87
|
+
# *** Wordset DOUBLE-EXT
|
88
|
+
r'2rot|du<|'
|
89
|
+
# *** Wordset EXCEPTION
|
90
|
+
r'catch|throw|'
|
91
|
+
# *** Wordset EXCEPTION-EXT
|
92
|
+
r'abort|abort\"|'
|
93
|
+
# *** Wordset FACILITY
|
94
|
+
r'at-xy|key\?|page|'
|
95
|
+
# *** Wordset FACILITY-EXT
|
96
|
+
r'ekey|ekey>char|ekey\?|emit\?|ms|time&date|'
|
97
|
+
# *** Wordset FILE
|
98
|
+
r'BIN|CLOSE-FILE|CREATE-FILE|DELETE-FILE|FILE-POSITION|'
|
99
|
+
r'FILE-SIZE|INCLUDE-FILE|INCLUDED|OPEN-FILE|R\/O|'
|
100
|
+
r'R\/W|READ-FILE|READ-LINE|REPOSITION-FILE|RESIZE-FILE|'
|
101
|
+
r'S\"|SOURCE-ID|W/O|WRITE-FILE|WRITE-LINE|'
|
102
|
+
# *** Wordset FILE-EXT
|
103
|
+
r'FILE-STATUS|FLUSH-FILE|REFILL|RENAME-FILE|'
|
104
|
+
# *** Wordset FLOAT
|
105
|
+
r'>float|d>f|'
|
106
|
+
r'f!|f\*|f\+|f-|f\/|f0<|f0=|f<|f>d|f@|'
|
107
|
+
r'falign|faligned|fconstant|fdepth|fdrop|fdup|'
|
108
|
+
r'fliteral|float\+|floats|floor|fmax|fmin|'
|
109
|
+
r'fnegate|fover|frot|fround|fswap|fvariable|'
|
110
|
+
r'represent|'
|
111
|
+
# *** Wordset FLOAT-EXT
|
112
|
+
r'df!|df@|dfalign|dfaligned|dfloat\+|'
|
113
|
+
r'dfloats|f\*\*|f\.|fabs|facos|facosh|falog|'
|
114
|
+
r'fasin|fasinh|fatan|fatan2|fatanh|fcos|fcosh|'
|
115
|
+
r'fe\.|fexp|fexpm1|fln|flnp1|flog|fs\.|fsin|'
|
116
|
+
r'fsincos|fsinh|fsqrt|ftan|ftanh|f~|precision|'
|
117
|
+
r'set-precision|sf!|sf@|sfalign|sfaligned|sfloat\+|'
|
118
|
+
r'sfloats|'
|
119
|
+
# *** Wordset LOCAL
|
120
|
+
r'\(local\)|to|'
|
121
|
+
# *** Wordset LOCAL-EXT
|
122
|
+
r'locals\||'
|
123
|
+
# *** Wordset MEMORY
|
124
|
+
r'allocate|free|resize|'
|
125
|
+
# *** Wordset SEARCH
|
126
|
+
r'definitions|find|forth-wordlist|get-current|'
|
127
|
+
r'get-order|search-wordlist|set-current|set-order|'
|
128
|
+
r'wordlist|'
|
129
|
+
# *** Wordset SEARCH-EXT
|
130
|
+
r'also|forth|only|order|previous|'
|
131
|
+
# *** Wordset STRING
|
132
|
+
r'-trailing|\/string|blank|cmove|cmove>|compare|'
|
133
|
+
r'search|sliteral|'
|
134
|
+
# *** Wordset TOOLS
|
135
|
+
r'.s|dump|see|words|'
|
136
|
+
# *** Wordset TOOLS-EXT
|
137
|
+
r';code|'
|
138
|
+
r'ahead|assembler|bye|code|cs-pick|cs-roll|'
|
139
|
+
r'editor|state|\[else\]|\[if\]|\[then\]|'
|
140
|
+
# *** Wordset TOOLS-EXT-obsolescent
|
141
|
+
r'forget|'
|
142
|
+
# Forth 2012
|
143
|
+
r'defer|defer@|defer!|action-of|begin-structure|field:|buffer:|'
|
144
|
+
r'parse-name|buffer:|traverse-wordlist|n>r|nr>|2value|fvalue|'
|
145
|
+
r'name>interpret|name>compile|name>string|'
|
146
|
+
r'cfield:|end-structure)'+delimiter, Keyword),
|
147
|
+
|
148
|
+
# Numbers
|
149
|
+
(r'(\$[0-9A-F]+)', Number.Hex),
|
150
|
+
(r'(\#|%|&|\-|\+)?[0-9]+', Number.Integer),
|
151
|
+
(r'(\#|%|&|\-|\+)?[0-9.]+', Keyword.Type),
|
152
|
+
# amforth specific
|
153
|
+
(r'(@i|!i|@e|!e|pause|noop|turnkey|sleep|'
|
154
|
+
r'itype|icompare|sp@|sp!|rp@|rp!|up@|up!|'
|
155
|
+
r'>a|a>|a@|a!|a@+|a@-|>b|b>|b@|b!|b@+|b@-|'
|
156
|
+
r'find-name|1ms|'
|
157
|
+
r'sp0|rp0|\(evaluate\)|int-trap|int!)' + delimiter,
|
158
|
+
Name.Constant),
|
159
|
+
# a proposal
|
160
|
+
(r'(do-recognizer|r:fail|recognizer:|get-recognizers|'
|
161
|
+
r'set-recognizers|r:float|r>comp|r>int|r>post|'
|
162
|
+
r'r:name|r:word|r:dnum|r:num|recognizer|forth-recognizer|'
|
163
|
+
r'rec:num|rec:float|rec:word)' + delimiter, Name.Decorator),
|
164
|
+
# defining words. The next word is a new command name
|
165
|
+
(r'(Evalue|Rvalue|Uvalue|Edefer|Rdefer|Udefer)(\s+)',
|
166
|
+
bygroups(Keyword.Namespace, Text), 'worddef'),
|
167
|
+
|
168
|
+
(valid_name, Name.Function), # Anything else is executed
|
169
|
+
|
170
|
+
],
|
171
|
+
'worddef': [
|
172
|
+
(r'\S+', Name.Class, '#pop'),
|
173
|
+
],
|
174
|
+
'stringdef': [
|
175
|
+
(r'[^"]+', String, '#pop'),
|
176
|
+
],
|
177
|
+
}
|
@@ -0,0 +1,205 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.fortran
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Lexers for Fortran languages.
|
7
|
+
|
8
|
+
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
|
9
|
+
:license: BSD, see LICENSE for details.
|
10
|
+
"""
|
11
|
+
|
12
|
+
import re
|
13
|
+
|
14
|
+
from pygments.lexer import RegexLexer, bygroups, include, words, using, default
|
15
|
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
16
|
+
Number, Punctuation, Generic
|
17
|
+
|
18
|
+
__all__ = ['FortranLexer', 'FortranFixedLexer']
|
19
|
+
|
20
|
+
|
21
|
+
class FortranLexer(RegexLexer):
|
22
|
+
"""
|
23
|
+
Lexer for FORTRAN 90 code.
|
24
|
+
|
25
|
+
.. versionadded:: 0.10
|
26
|
+
"""
|
27
|
+
name = 'Fortran'
|
28
|
+
aliases = ['fortran']
|
29
|
+
filenames = ['*.f03', '*.f90', '*.F03', '*.F90']
|
30
|
+
mimetypes = ['text/x-fortran']
|
31
|
+
flags = re.IGNORECASE | re.MULTILINE
|
32
|
+
|
33
|
+
# Data Types: INTEGER, REAL, COMPLEX, LOGICAL, CHARACTER and DOUBLE PRECISION
|
34
|
+
# Operators: **, *, +, -, /, <, >, <=, >=, ==, /=
|
35
|
+
# Logical (?): NOT, AND, OR, EQV, NEQV
|
36
|
+
|
37
|
+
# Builtins:
|
38
|
+
# http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Table-of-Intrinsic-Functions.html
|
39
|
+
|
40
|
+
tokens = {
|
41
|
+
'root': [
|
42
|
+
(r'^#.*\n', Comment.Preproc),
|
43
|
+
(r'!.*\n', Comment),
|
44
|
+
include('strings'),
|
45
|
+
include('core'),
|
46
|
+
(r'[a-z][\w$]*', Name),
|
47
|
+
include('nums'),
|
48
|
+
(r'[\s]+', Text),
|
49
|
+
],
|
50
|
+
'core': [
|
51
|
+
# Statements
|
52
|
+
(words((
|
53
|
+
'ABSTRACT', 'ACCEPT', 'ALL', 'ALLSTOP', 'ALLOCATABLE', 'ALLOCATE',
|
54
|
+
'ARRAY', 'ASSIGN', 'ASSOCIATE', 'ASYNCHRONOUS', 'BACKSPACE', 'BIND',
|
55
|
+
'BLOCK', 'BLOCKDATA', 'BYTE', 'CALL', 'CASE', 'CLASS', 'CLOSE',
|
56
|
+
'CODIMENSION', 'COMMON', 'CONCURRRENT', 'CONTIGUOUS', 'CONTAINS',
|
57
|
+
'CONTINUE', 'CRITICAL', 'CYCLE', 'DATA', 'DEALLOCATE', 'DECODE',
|
58
|
+
'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ENCODE', 'END',
|
59
|
+
'ENTRY', 'ENUM', 'ENUMERATOR', 'EQUIVALENCE', 'EXIT', 'EXTENDS',
|
60
|
+
'EXTERNAL', 'EXTRINSIC', 'FILE', 'FINAL', 'FORALL', 'FORMAT',
|
61
|
+
'FUNCTION', 'GENERIC', 'GOTO', 'IF', 'IMAGES', 'IMPLICIT',
|
62
|
+
'IMPORT', 'IMPURE', 'INCLUDE', 'INQUIRE', 'INTENT', 'INTERFACE',
|
63
|
+
'INTRINSIC', 'IS', 'LOCK', 'MEMORY', 'MODULE', 'NAMELIST', 'NULLIFY',
|
64
|
+
'NONE', 'NON_INTRINSIC', 'NON_OVERRIDABLE', 'NOPASS', 'OPEN', 'OPTIONAL',
|
65
|
+
'OPTIONS', 'PARAMETER', 'PASS', 'PAUSE', 'POINTER', 'PRINT', 'PRIVATE',
|
66
|
+
'PROGRAM', 'PROCEDURE', 'PROTECTED', 'PUBLIC', 'PURE', 'READ',
|
67
|
+
'RECURSIVE', 'RESULT', 'RETURN', 'REWIND', 'SAVE', 'SELECT', 'SEQUENCE',
|
68
|
+
'STOP', 'SUBMODULE', 'SUBROUTINE', 'SYNC', 'SYNCALL', 'SYNCIMAGES',
|
69
|
+
'SYNCMEMORY', 'TARGET', 'THEN', 'TYPE', 'UNLOCK', 'USE', 'VALUE',
|
70
|
+
'VOLATILE', 'WHERE', 'WRITE', 'WHILE'), prefix=r'\b', suffix=r'\s*\b'),
|
71
|
+
Keyword),
|
72
|
+
|
73
|
+
# Data Types
|
74
|
+
(words((
|
75
|
+
'CHARACTER', 'COMPLEX', 'DOUBLE PRECISION', 'DOUBLE COMPLEX', 'INTEGER',
|
76
|
+
'LOGICAL', 'REAL', 'C_INT', 'C_SHORT', 'C_LONG', 'C_LONG_LONG',
|
77
|
+
'C_SIGNED_CHAR', 'C_SIZE_T', 'C_INT8_T', 'C_INT16_T', 'C_INT32_T',
|
78
|
+
'C_INT64_T', 'C_INT_LEAST8_T', 'C_INT_LEAST16_T', 'C_INT_LEAST32_T',
|
79
|
+
'C_INT_LEAST64_T', 'C_INT_FAST8_T', 'C_INT_FAST16_T', 'C_INT_FAST32_T',
|
80
|
+
'C_INT_FAST64_T', 'C_INTMAX_T', 'C_INTPTR_T', 'C_FLOAT', 'C_DOUBLE',
|
81
|
+
'C_LONG_DOUBLE', 'C_FLOAT_COMPLEX', 'C_DOUBLE_COMPLEX',
|
82
|
+
'C_LONG_DOUBLE_COMPLEX', 'C_BOOL', 'C_CHAR', 'C_PTR', 'C_FUNPTR'),
|
83
|
+
prefix=r'\b', suffix=r'\s*\b'),
|
84
|
+
Keyword.Type),
|
85
|
+
|
86
|
+
# Operators
|
87
|
+
(r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)', Operator),
|
88
|
+
|
89
|
+
(r'(::)', Keyword.Declaration),
|
90
|
+
|
91
|
+
(r'[()\[\],:&%;.]', Punctuation),
|
92
|
+
# Intrinsics
|
93
|
+
(words((
|
94
|
+
'Abort', 'Abs', 'Access', 'AChar', 'ACos', 'ACosH', 'AdjustL',
|
95
|
+
'AdjustR', 'AImag', 'AInt', 'Alarm', 'All', 'Allocated', 'ALog',
|
96
|
+
'AMax', 'AMin', 'AMod', 'And', 'ANInt', 'Any', 'ASin', 'ASinH',
|
97
|
+
'Associated', 'ATan', 'ATanH', 'Atomic_Define', 'Atomic_Ref',
|
98
|
+
'BesJ', 'BesJN', 'Bessel_J0', 'Bessel_J1', 'Bessel_JN', 'Bessel_Y0',
|
99
|
+
'Bessel_Y1', 'Bessel_YN', 'BesY', 'BesYN', 'BGE', 'BGT', 'BLE',
|
100
|
+
'BLT', 'Bit_Size', 'BTest', 'CAbs', 'CCos', 'Ceiling', 'CExp',
|
101
|
+
'Char', 'ChDir', 'ChMod', 'CLog', 'Cmplx', 'Command_Argument_Count',
|
102
|
+
'Complex', 'Conjg', 'Cos', 'CosH', 'Count', 'CPU_Time', 'CShift',
|
103
|
+
'CSin', 'CSqRt', 'CTime', 'C_Loc', 'C_Associated',
|
104
|
+
'C_Null_Ptr', 'C_Null_Funptr', 'C_F_Pointer', 'C_F_ProcPointer',
|
105
|
+
'C_Null_Char', 'C_Alert', 'C_Backspace', 'C_Form_Feed', 'C_FunLoc',
|
106
|
+
'C_Sizeof', 'C_New_Line', 'C_Carriage_Return',
|
107
|
+
'C_Horizontal_Tab', 'C_Vertical_Tab', 'DAbs', 'DACos', 'DASin',
|
108
|
+
'DATan', 'Date_and_Time', 'DbesJ', 'DbesJN', 'DbesY',
|
109
|
+
'DbesYN', 'Dble', 'DCos', 'DCosH', 'DDiM', 'DErF',
|
110
|
+
'DErFC', 'DExp', 'Digits', 'DiM', 'DInt', 'DLog', 'DMax',
|
111
|
+
'DMin', 'DMod', 'DNInt', 'Dot_Product', 'DProd', 'DSign', 'DSinH',
|
112
|
+
'DShiftL', 'DShiftR', 'DSin', 'DSqRt', 'DTanH', 'DTan', 'DTime',
|
113
|
+
'EOShift', 'Epsilon', 'ErF', 'ErFC', 'ErFC_Scaled', 'ETime',
|
114
|
+
'Execute_Command_Line', 'Exit', 'Exp', 'Exponent', 'Extends_Type_Of',
|
115
|
+
'FDate', 'FGet', 'FGetC', 'FindLoc', 'Float', 'Floor', 'Flush',
|
116
|
+
'FNum', 'FPutC', 'FPut', 'Fraction', 'FSeek', 'FStat', 'FTell',
|
117
|
+
'Gamma', 'GError', 'GetArg', 'Get_Command', 'Get_Command_Argument',
|
118
|
+
'Get_Environment_Variable', 'GetCWD', 'GetEnv', 'GetGId', 'GetLog',
|
119
|
+
'GetPId', 'GetUId', 'GMTime', 'HostNm', 'Huge', 'Hypot', 'IAbs',
|
120
|
+
'IAChar', 'IAll', 'IAnd', 'IAny', 'IArgC', 'IBClr', 'IBits',
|
121
|
+
'IBSet', 'IChar', 'IDate', 'IDiM', 'IDInt', 'IDNInt', 'IEOr',
|
122
|
+
'IErrNo', 'IFix', 'Imag', 'ImagPart', 'Image_Index', 'Index',
|
123
|
+
'Int', 'IOr', 'IParity', 'IRand', 'IsaTty', 'IShft', 'IShftC',
|
124
|
+
'ISign', 'Iso_C_Binding', 'Is_Contiguous', 'Is_Iostat_End',
|
125
|
+
'Is_Iostat_Eor', 'ITime', 'Kill', 'Kind', 'LBound', 'LCoBound',
|
126
|
+
'Len', 'Len_Trim', 'LGe', 'LGt', 'Link', 'LLe', 'LLt', 'LnBlnk',
|
127
|
+
'Loc', 'Log', 'Log_Gamma', 'Logical', 'Long', 'LShift', 'LStat',
|
128
|
+
'LTime', 'MaskL', 'MaskR', 'MatMul', 'Max', 'MaxExponent',
|
129
|
+
'MaxLoc', 'MaxVal', 'MClock', 'Merge', 'Merge_Bits', 'Move_Alloc',
|
130
|
+
'Min', 'MinExponent', 'MinLoc', 'MinVal', 'Mod', 'Modulo', 'MvBits',
|
131
|
+
'Nearest', 'New_Line', 'NInt', 'Norm2', 'Not', 'Null', 'Num_Images',
|
132
|
+
'Or', 'Pack', 'Parity', 'PError', 'Precision', 'Present', 'Product',
|
133
|
+
'Radix', 'Rand', 'Random_Number', 'Random_Seed', 'Range', 'Real',
|
134
|
+
'RealPart', 'Rename', 'Repeat', 'Reshape', 'RRSpacing', 'RShift',
|
135
|
+
'Same_Type_As', 'Scale', 'Scan', 'Second', 'Selected_Char_Kind',
|
136
|
+
'Selected_Int_Kind', 'Selected_Real_Kind', 'Set_Exponent', 'Shape',
|
137
|
+
'ShiftA', 'ShiftL', 'ShiftR', 'Short', 'Sign', 'Signal', 'SinH',
|
138
|
+
'Sin', 'Sleep', 'Sngl', 'Spacing', 'Spread', 'SqRt', 'SRand',
|
139
|
+
'Stat', 'Storage_Size', 'Sum', 'SymLnk', 'System', 'System_Clock',
|
140
|
+
'Tan', 'TanH', 'Time', 'This_Image', 'Tiny', 'TrailZ', 'Transfer',
|
141
|
+
'Transpose', 'Trim', 'TtyNam', 'UBound', 'UCoBound', 'UMask',
|
142
|
+
'Unlink', 'Unpack', 'Verify', 'XOr', 'ZAbs', 'ZCos', 'ZExp',
|
143
|
+
'ZLog', 'ZSin', 'ZSqRt'), prefix=r'\b', suffix=r'\s*\b'),
|
144
|
+
Name.Builtin),
|
145
|
+
|
146
|
+
# Booleans
|
147
|
+
(r'\.(true|false)\.', Name.Builtin),
|
148
|
+
# Comparing Operators
|
149
|
+
(r'\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\.', Operator.Word),
|
150
|
+
],
|
151
|
+
|
152
|
+
'strings': [
|
153
|
+
(r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
|
154
|
+
(r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
|
155
|
+
],
|
156
|
+
|
157
|
+
'nums': [
|
158
|
+
(r'\d+(?![.e])(_[a-z]\w+)?', Number.Integer),
|
159
|
+
(r'[+-]?\d*\.\d+([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float),
|
160
|
+
(r'[+-]?\d+\.\d*([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float),
|
161
|
+
],
|
162
|
+
}
|
163
|
+
|
164
|
+
|
165
|
+
class FortranFixedLexer(RegexLexer):
|
166
|
+
"""
|
167
|
+
Lexer for fixed format Fortran.
|
168
|
+
|
169
|
+
.. versionadded:: 2.1
|
170
|
+
"""
|
171
|
+
name = 'FortranFixed'
|
172
|
+
aliases = ['fortranfixed']
|
173
|
+
filenames = ['*.f', '*.F']
|
174
|
+
|
175
|
+
flags = re.IGNORECASE
|
176
|
+
|
177
|
+
def _lex_fortran(self, match, ctx=None):
|
178
|
+
"""Lex a line just as free form fortran without line break."""
|
179
|
+
lexer = FortranLexer()
|
180
|
+
text = match.group(0) + "\n"
|
181
|
+
for index, token, value in lexer.get_tokens_unprocessed(text):
|
182
|
+
value = value.replace('\n', '')
|
183
|
+
if value != '':
|
184
|
+
yield index, token, value
|
185
|
+
|
186
|
+
tokens = {
|
187
|
+
'root': [
|
188
|
+
(r'[C*].*\n', Comment),
|
189
|
+
(r'#.*\n', Comment.Preproc),
|
190
|
+
(r' {0,4}!.*\n', Comment),
|
191
|
+
(r'(.{5})', Name.Label, 'cont-char'),
|
192
|
+
(r'.*\n', using(FortranLexer)),
|
193
|
+
],
|
194
|
+
'cont-char': [
|
195
|
+
(' ', Text, 'code'),
|
196
|
+
('0', Comment, 'code'),
|
197
|
+
('.', Generic.Strong, 'code'),
|
198
|
+
],
|
199
|
+
'code': [
|
200
|
+
(r'(.{66})(.*)(\n)',
|
201
|
+
bygroups(_lex_fortran, Comment, Text), 'root'),
|
202
|
+
(r'(.*)(\n)', bygroups(_lex_fortran, Text), 'root'),
|
203
|
+
default('root'),
|
204
|
+
]
|
205
|
+
}
|
@@ -3,3669 +3,19 @@
|
|
3
3
|
pygments.lexers.functional
|
4
4
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
5
5
|
|
6
|
-
|
6
|
+
Just export lexer classes previously contained in this module.
|
7
7
|
|
8
|
-
:copyright: Copyright 2006-
|
8
|
+
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
12
|
-
import
|
12
|
+
from pygments.lexers.lisp import SchemeLexer, CommonLispLexer, RacketLexer, \
|
13
|
+
NewLispLexer, ShenLexer
|
14
|
+
from pygments.lexers.haskell import HaskellLexer, LiterateHaskellLexer, \
|
15
|
+
KokaLexer
|
16
|
+
from pygments.lexers.theorem import CoqLexer
|
17
|
+
from pygments.lexers.erlang import ErlangLexer, ErlangShellLexer, \
|
18
|
+
ElixirConsoleLexer, ElixirLexer
|
19
|
+
from pygments.lexers.ml import SMLLexer, OcamlLexer, OpaLexer
|
13
20
|
|
14
|
-
|
15
|
-
from pygments.token import Text, Comment, Operator, Keyword, Name, \
|
16
|
-
String, Number, Punctuation, Literal, Generic, Error
|
17
|
-
from pygments import unistring as uni
|
18
|
-
|
19
|
-
__all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', 'CryptolLexer',
|
20
|
-
'HaskellLexer', 'AgdaLexer', 'LiterateCryptolLexer',
|
21
|
-
'LiterateHaskellLexer', 'LiterateAgdaLexer', 'SMLLexer',
|
22
|
-
'OcamlLexer', 'ErlangLexer', 'ErlangShellLexer', 'OpaLexer',
|
23
|
-
'CoqLexer', 'NewLispLexer', 'NixLexer', 'ElixirLexer',
|
24
|
-
'ElixirConsoleLexer', 'KokaLexer', 'IdrisLexer',
|
25
|
-
'LiterateIdrisLexer']
|
26
|
-
|
27
|
-
|
28
|
-
line_re = re.compile('.*?\n')
|
29
|
-
|
30
|
-
|
31
|
-
class RacketLexer(RegexLexer):
|
32
|
-
"""
|
33
|
-
Lexer for `Racket <http://racket-lang.org/>`_ source code (formerly
|
34
|
-
known as PLT Scheme).
|
35
|
-
|
36
|
-
.. versionadded:: 1.6
|
37
|
-
"""
|
38
|
-
|
39
|
-
name = 'Racket'
|
40
|
-
aliases = ['racket', 'rkt']
|
41
|
-
filenames = ['*.rkt', '*.rktd', '*.rktl']
|
42
|
-
mimetypes = ['text/x-racket', 'application/x-racket']
|
43
|
-
|
44
|
-
# Generated by example.rkt
|
45
|
-
_keywords = [
|
46
|
-
'#%app', '#%datum', '#%declare', '#%expression', '#%module-begin',
|
47
|
-
'#%plain-app', '#%plain-lambda', '#%plain-module-begin',
|
48
|
-
'#%printing-module-begin', '#%provide', '#%require',
|
49
|
-
'#%stratified-body', '#%top', '#%top-interaction',
|
50
|
-
'#%variable-reference', '->', '->*', '->*m', '->d', '->dm', '->i',
|
51
|
-
'->m', '...', ':do-in', '==', '=>', '_', 'absent', 'abstract',
|
52
|
-
'all-defined-out', 'all-from-out', 'and', 'any', 'augment', 'augment*',
|
53
|
-
'augment-final', 'augment-final*', 'augride', 'augride*', 'begin',
|
54
|
-
'begin-for-syntax', 'begin0', 'case', 'case->', 'case->m',
|
55
|
-
'case-lambda', 'class', 'class*', 'class-field-accessor',
|
56
|
-
'class-field-mutator', 'class/c', 'class/derived', 'combine-in',
|
57
|
-
'combine-out', 'command-line', 'compound-unit', 'compound-unit/infer',
|
58
|
-
'cond', 'contract', 'contract-out', 'contract-struct', 'contracted',
|
59
|
-
'define', 'define-compound-unit', 'define-compound-unit/infer',
|
60
|
-
'define-contract-struct', 'define-custom-hash-types',
|
61
|
-
'define-custom-set-types', 'define-for-syntax',
|
62
|
-
'define-local-member-name', 'define-logger', 'define-match-expander',
|
63
|
-
'define-member-name', 'define-module-boundary-contract',
|
64
|
-
'define-namespace-anchor', 'define-opt/c', 'define-sequence-syntax',
|
65
|
-
'define-serializable-class', 'define-serializable-class*',
|
66
|
-
'define-signature', 'define-signature-form', 'define-struct',
|
67
|
-
'define-struct/contract', 'define-struct/derived', 'define-syntax',
|
68
|
-
'define-syntax-rule', 'define-syntaxes', 'define-unit',
|
69
|
-
'define-unit-binding', 'define-unit-from-context',
|
70
|
-
'define-unit/contract', 'define-unit/new-import-export',
|
71
|
-
'define-unit/s', 'define-values', 'define-values-for-export',
|
72
|
-
'define-values-for-syntax', 'define-values/invoke-unit',
|
73
|
-
'define-values/invoke-unit/infer', 'define/augment',
|
74
|
-
'define/augment-final', 'define/augride', 'define/contract',
|
75
|
-
'define/final-prop', 'define/match', 'define/overment',
|
76
|
-
'define/override', 'define/override-final', 'define/private',
|
77
|
-
'define/public', 'define/public-final', 'define/pubment',
|
78
|
-
'define/subexpression-pos-prop', 'delay', 'delay/idle', 'delay/name',
|
79
|
-
'delay/strict', 'delay/sync', 'delay/thread', 'do', 'else', 'except',
|
80
|
-
'except-in', 'except-out', 'export', 'extends', 'failure-cont',
|
81
|
-
'false', 'false/c', 'field', 'field-bound?', 'file',
|
82
|
-
'flat-murec-contract', 'flat-rec-contract', 'for', 'for*', 'for*/and',
|
83
|
-
'for*/first', 'for*/fold', 'for*/fold/derived', 'for*/hash',
|
84
|
-
'for*/hasheq', 'for*/hasheqv', 'for*/last', 'for*/list', 'for*/lists',
|
85
|
-
'for*/mutable-set', 'for*/mutable-seteq', 'for*/mutable-seteqv',
|
86
|
-
'for*/or', 'for*/product', 'for*/set', 'for*/seteq', 'for*/seteqv',
|
87
|
-
'for*/sum', 'for*/vector', 'for*/weak-set', 'for*/weak-seteq',
|
88
|
-
'for*/weak-seteqv', 'for-label', 'for-meta', 'for-syntax',
|
89
|
-
'for-template', 'for/and', 'for/first', 'for/fold', 'for/fold/derived',
|
90
|
-
'for/hash', 'for/hasheq', 'for/hasheqv', 'for/last', 'for/list',
|
91
|
-
'for/lists', 'for/mutable-set', 'for/mutable-seteq',
|
92
|
-
'for/mutable-seteqv', 'for/or', 'for/product', 'for/set', 'for/seteq',
|
93
|
-
'for/seteqv', 'for/sum', 'for/vector', 'for/weak-set',
|
94
|
-
'for/weak-seteq', 'for/weak-seteqv', 'gen:custom-write', 'gen:dict',
|
95
|
-
'gen:equal+hash', 'gen:set', 'gen:stream', 'generic', 'get-field',
|
96
|
-
'if', 'implies', 'import', 'include', 'include-at/relative-to',
|
97
|
-
'include-at/relative-to/reader', 'include/reader', 'inherit',
|
98
|
-
'inherit-field', 'inherit/inner', 'inherit/super', 'init',
|
99
|
-
'init-depend', 'init-field', 'init-rest', 'inner', 'inspect',
|
100
|
-
'instantiate', 'interface', 'interface*', 'invoke-unit',
|
101
|
-
'invoke-unit/infer', 'lambda', 'lazy', 'let', 'let*', 'let*-values',
|
102
|
-
'let-syntax', 'let-syntaxes', 'let-values', 'let/cc', 'let/ec',
|
103
|
-
'letrec', 'letrec-syntax', 'letrec-syntaxes', 'letrec-syntaxes+values',
|
104
|
-
'letrec-values', 'lib', 'link', 'local', 'local-require', 'log-debug',
|
105
|
-
'log-error', 'log-fatal', 'log-info', 'log-warning', 'match', 'match*',
|
106
|
-
'match*/derived', 'match-define', 'match-define-values',
|
107
|
-
'match-lambda', 'match-lambda*', 'match-lambda**', 'match-let',
|
108
|
-
'match-let*', 'match-let*-values', 'match-let-values', 'match-letrec',
|
109
|
-
'match/derived', 'match/values', 'member-name-key', 'method-contract?',
|
110
|
-
'mixin', 'module', 'module*', 'module+', 'nand', 'new', 'nor',
|
111
|
-
'object-contract', 'object/c', 'only', 'only-in', 'only-meta-in',
|
112
|
-
'open', 'opt/c', 'or', 'overment', 'overment*', 'override',
|
113
|
-
'override*', 'override-final', 'override-final*', 'parameterize',
|
114
|
-
'parameterize*', 'parameterize-break', 'parametric->/c', 'place',
|
115
|
-
'place*', 'planet', 'prefix', 'prefix-in', 'prefix-out', 'private',
|
116
|
-
'private*', 'prompt-tag/c', 'protect-out', 'provide',
|
117
|
-
'provide-signature-elements', 'provide/contract', 'public', 'public*',
|
118
|
-
'public-final', 'public-final*', 'pubment', 'pubment*', 'quasiquote',
|
119
|
-
'quasisyntax', 'quasisyntax/loc', 'quote', 'quote-syntax',
|
120
|
-
'quote-syntax/prune', 'recontract-out', 'recursive-contract',
|
121
|
-
'relative-in', 'rename', 'rename-in', 'rename-inner', 'rename-out',
|
122
|
-
'rename-super', 'require', 'send', 'send*', 'send+', 'send-generic',
|
123
|
-
'send/apply', 'send/keyword-apply', 'set!', 'set!-values',
|
124
|
-
'set-field!', 'shared', 'stream', 'stream-cons', 'struct', 'struct*',
|
125
|
-
'struct-copy', 'struct-field-index', 'struct-out', 'struct/c',
|
126
|
-
'struct/ctc', 'struct/dc', 'submod', 'super', 'super-instantiate',
|
127
|
-
'super-make-object', 'super-new', 'syntax', 'syntax-case',
|
128
|
-
'syntax-case*', 'syntax-id-rules', 'syntax-rules', 'syntax/loc', 'tag',
|
129
|
-
'this', 'this%', 'thunk', 'thunk*', 'time', 'unconstrained-domain->',
|
130
|
-
'unit', 'unit-from-context', 'unit/c', 'unit/new-import-export',
|
131
|
-
'unit/s', 'unless', 'unquote', 'unquote-splicing', 'unsyntax',
|
132
|
-
'unsyntax-splicing', 'values/drop', 'when', 'with-continuation-mark',
|
133
|
-
'with-contract', 'with-handlers', 'with-handlers*', 'with-method',
|
134
|
-
'with-syntax', u'λ'
|
135
|
-
]
|
136
|
-
|
137
|
-
# Generated by example.rkt
|
138
|
-
_builtins = [
|
139
|
-
'*', '+', '-', '/', '<', '</c', '<=', '<=/c', '=', '=/c', '>', '>/c',
|
140
|
-
'>=', '>=/c', 'abort-current-continuation', 'abs', 'absolute-path?',
|
141
|
-
'acos', 'add-between', 'add1', 'alarm-evt', 'always-evt', 'and/c',
|
142
|
-
'andmap', 'angle', 'any/c', 'append', 'append*', 'append-map', 'apply',
|
143
|
-
'argmax', 'argmin', 'arithmetic-shift', 'arity-at-least',
|
144
|
-
'arity-at-least-value', 'arity-at-least?', 'arity-checking-wrapper',
|
145
|
-
'arity-includes?', 'arity=?', 'asin', 'assf', 'assoc', 'assq', 'assv',
|
146
|
-
'atan', 'bad-number-of-results', 'banner', 'base->-doms/c',
|
147
|
-
'base->-rngs/c', 'base->?', 'between/c', 'bitwise-and',
|
148
|
-
'bitwise-bit-field', 'bitwise-bit-set?', 'bitwise-ior', 'bitwise-not',
|
149
|
-
'bitwise-xor', 'blame-add-car-context', 'blame-add-cdr-context',
|
150
|
-
'blame-add-context', 'blame-add-missing-party',
|
151
|
-
'blame-add-nth-arg-context', 'blame-add-or-context',
|
152
|
-
'blame-add-range-context', 'blame-add-unknown-context',
|
153
|
-
'blame-context', 'blame-contract', 'blame-fmt->-string',
|
154
|
-
'blame-negative', 'blame-original?', 'blame-positive',
|
155
|
-
'blame-replace-negative', 'blame-source', 'blame-swap',
|
156
|
-
'blame-swapped?', 'blame-update', 'blame-value', 'blame?', 'boolean=?',
|
157
|
-
'boolean?', 'bound-identifier=?', 'box', 'box-cas!', 'box-immutable',
|
158
|
-
'box-immutable/c', 'box/c', 'box?', 'break-enabled', 'break-thread',
|
159
|
-
'build-chaperone-contract-property', 'build-compound-type-name',
|
160
|
-
'build-contract-property', 'build-flat-contract-property',
|
161
|
-
'build-list', 'build-path', 'build-path/convention-type',
|
162
|
-
'build-string', 'build-vector', 'byte-pregexp', 'byte-pregexp?',
|
163
|
-
'byte-ready?', 'byte-regexp', 'byte-regexp?', 'byte?', 'bytes',
|
164
|
-
'bytes->immutable-bytes', 'bytes->list', 'bytes->path',
|
165
|
-
'bytes->path-element', 'bytes->string/latin-1', 'bytes->string/locale',
|
166
|
-
'bytes->string/utf-8', 'bytes-append', 'bytes-append*',
|
167
|
-
'bytes-close-converter', 'bytes-convert', 'bytes-convert-end',
|
168
|
-
'bytes-converter?', 'bytes-copy', 'bytes-copy!',
|
169
|
-
'bytes-environment-variable-name?', 'bytes-fill!', 'bytes-join',
|
170
|
-
'bytes-length', 'bytes-no-nuls?', 'bytes-open-converter', 'bytes-ref',
|
171
|
-
'bytes-set!', 'bytes-utf-8-index', 'bytes-utf-8-length',
|
172
|
-
'bytes-utf-8-ref', 'bytes<?', 'bytes=?', 'bytes>?', 'bytes?', 'caaaar',
|
173
|
-
'caaadr', 'caaar', 'caadar', 'caaddr', 'caadr', 'caar', 'cadaar',
|
174
|
-
'cadadr', 'cadar', 'caddar', 'cadddr', 'caddr', 'cadr',
|
175
|
-
'call-in-nested-thread', 'call-with-atomic-output-file',
|
176
|
-
'call-with-break-parameterization',
|
177
|
-
'call-with-composable-continuation', 'call-with-continuation-barrier',
|
178
|
-
'call-with-continuation-prompt', 'call-with-current-continuation',
|
179
|
-
'call-with-default-reading-parameterization',
|
180
|
-
'call-with-escape-continuation', 'call-with-exception-handler',
|
181
|
-
'call-with-file-lock/timeout', 'call-with-immediate-continuation-mark',
|
182
|
-
'call-with-input-bytes', 'call-with-input-file',
|
183
|
-
'call-with-input-file*', 'call-with-input-string',
|
184
|
-
'call-with-output-bytes', 'call-with-output-file',
|
185
|
-
'call-with-output-file*', 'call-with-output-string',
|
186
|
-
'call-with-parameterization', 'call-with-semaphore',
|
187
|
-
'call-with-semaphore/enable-break', 'call-with-values', 'call/cc',
|
188
|
-
'call/ec', 'car', 'cdaaar', 'cdaadr', 'cdaar', 'cdadar', 'cdaddr',
|
189
|
-
'cdadr', 'cdar', 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr',
|
190
|
-
'cdddr', 'cddr', 'cdr', 'ceiling', 'channel-get', 'channel-put',
|
191
|
-
'channel-put-evt', 'channel-put-evt?', 'channel-try-get', 'channel/c',
|
192
|
-
'channel?', 'chaperone-box', 'chaperone-channel',
|
193
|
-
'chaperone-continuation-mark-key', 'chaperone-contract-property?',
|
194
|
-
'chaperone-contract?', 'chaperone-evt', 'chaperone-hash',
|
195
|
-
'chaperone-of?', 'chaperone-procedure', 'chaperone-prompt-tag',
|
196
|
-
'chaperone-struct', 'chaperone-struct-type', 'chaperone-vector',
|
197
|
-
'chaperone?', 'char->integer', 'char-alphabetic?', 'char-blank?',
|
198
|
-
'char-ci<=?', 'char-ci<?', 'char-ci=?', 'char-ci>=?', 'char-ci>?',
|
199
|
-
'char-downcase', 'char-foldcase', 'char-general-category',
|
200
|
-
'char-graphic?', 'char-iso-control?', 'char-lower-case?',
|
201
|
-
'char-numeric?', 'char-punctuation?', 'char-ready?', 'char-symbolic?',
|
202
|
-
'char-title-case?', 'char-titlecase', 'char-upcase',
|
203
|
-
'char-upper-case?', 'char-utf-8-length', 'char-whitespace?', 'char<=?',
|
204
|
-
'char<?', 'char=?', 'char>=?', 'char>?', 'char?',
|
205
|
-
'check-duplicate-identifier', 'checked-procedure-check-and-extract',
|
206
|
-
'choice-evt', 'class->interface', 'class-info', 'class?',
|
207
|
-
'cleanse-path', 'close-input-port', 'close-output-port',
|
208
|
-
'coerce-chaperone-contract', 'coerce-chaperone-contracts',
|
209
|
-
'coerce-contract', 'coerce-contract/f', 'coerce-contracts',
|
210
|
-
'coerce-flat-contract', 'coerce-flat-contracts', 'collect-garbage',
|
211
|
-
'collection-file-path', 'collection-path', 'compile',
|
212
|
-
'compile-allow-set!-undefined', 'compile-context-preservation-enabled',
|
213
|
-
'compile-enforce-module-constants', 'compile-syntax',
|
214
|
-
'compiled-expression?', 'compiled-module-expression?',
|
215
|
-
'complete-path?', 'complex?', 'compose', 'compose1', 'conjugate',
|
216
|
-
'cons', 'cons/c', 'cons?', 'const', 'continuation-mark-key/c',
|
217
|
-
'continuation-mark-key?', 'continuation-mark-set->context',
|
218
|
-
'continuation-mark-set->list', 'continuation-mark-set->list*',
|
219
|
-
'continuation-mark-set-first', 'continuation-mark-set?',
|
220
|
-
'continuation-marks', 'continuation-prompt-available?',
|
221
|
-
'continuation-prompt-tag?', 'continuation?',
|
222
|
-
'contract-continuation-mark-key', 'contract-first-order',
|
223
|
-
'contract-first-order-passes?', 'contract-name', 'contract-proc',
|
224
|
-
'contract-projection', 'contract-property?',
|
225
|
-
'contract-random-generate', 'contract-stronger?',
|
226
|
-
'contract-struct-exercise', 'contract-struct-generate',
|
227
|
-
'contract-val-first-projection', 'contract?', 'convert-stream',
|
228
|
-
'copy-directory/files', 'copy-file', 'copy-port', 'cos', 'cosh',
|
229
|
-
'count', 'current-blame-format', 'current-break-parameterization',
|
230
|
-
'current-code-inspector', 'current-command-line-arguments',
|
231
|
-
'current-compile', 'current-compiled-file-roots',
|
232
|
-
'current-continuation-marks', 'current-contract-region',
|
233
|
-
'current-custodian', 'current-directory', 'current-directory-for-user',
|
234
|
-
'current-drive', 'current-environment-variables', 'current-error-port',
|
235
|
-
'current-eval', 'current-evt-pseudo-random-generator',
|
236
|
-
'current-future', 'current-gc-milliseconds',
|
237
|
-
'current-get-interaction-input-port', 'current-inexact-milliseconds',
|
238
|
-
'current-input-port', 'current-inspector',
|
239
|
-
'current-library-collection-links', 'current-library-collection-paths',
|
240
|
-
'current-load', 'current-load-extension',
|
241
|
-
'current-load-relative-directory', 'current-load/use-compiled',
|
242
|
-
'current-locale', 'current-logger', 'current-memory-use',
|
243
|
-
'current-milliseconds', 'current-module-declare-name',
|
244
|
-
'current-module-declare-source', 'current-module-name-resolver',
|
245
|
-
'current-module-path-for-load', 'current-namespace',
|
246
|
-
'current-output-port', 'current-parameterization',
|
247
|
-
'current-preserved-thread-cell-values', 'current-print',
|
248
|
-
'current-process-milliseconds', 'current-prompt-read',
|
249
|
-
'current-pseudo-random-generator', 'current-read-interaction',
|
250
|
-
'current-reader-guard', 'current-readtable', 'current-seconds',
|
251
|
-
'current-security-guard', 'current-subprocess-custodian-mode',
|
252
|
-
'current-thread', 'current-thread-group',
|
253
|
-
'current-thread-initial-stack-size',
|
254
|
-
'current-write-relative-directory', 'curry', 'curryr',
|
255
|
-
'custodian-box-value', 'custodian-box?', 'custodian-limit-memory',
|
256
|
-
'custodian-managed-list', 'custodian-memory-accounting-available?',
|
257
|
-
'custodian-require-memory', 'custodian-shutdown-all', 'custodian?',
|
258
|
-
'custom-print-quotable-accessor', 'custom-print-quotable?',
|
259
|
-
'custom-write-accessor', 'custom-write-property-proc', 'custom-write?',
|
260
|
-
'date', 'date*', 'date*-nanosecond', 'date*-time-zone-name', 'date*?',
|
261
|
-
'date-day', 'date-dst?', 'date-hour', 'date-minute', 'date-month',
|
262
|
-
'date-second', 'date-time-zone-offset', 'date-week-day', 'date-year',
|
263
|
-
'date-year-day', 'date?', 'datum->syntax', 'datum-intern-literal',
|
264
|
-
'default-continuation-prompt-tag', 'degrees->radians',
|
265
|
-
'delete-directory', 'delete-directory/files', 'delete-file',
|
266
|
-
'denominator', 'dict->list', 'dict-can-functional-set?',
|
267
|
-
'dict-can-remove-keys?', 'dict-clear', 'dict-clear!', 'dict-copy',
|
268
|
-
'dict-count', 'dict-empty?', 'dict-for-each', 'dict-has-key?',
|
269
|
-
'dict-implements/c', 'dict-implements?', 'dict-iter-contract',
|
270
|
-
'dict-iterate-first', 'dict-iterate-key', 'dict-iterate-next',
|
271
|
-
'dict-iterate-value', 'dict-key-contract', 'dict-keys', 'dict-map',
|
272
|
-
'dict-mutable?', 'dict-ref', 'dict-ref!', 'dict-remove',
|
273
|
-
'dict-remove!', 'dict-set', 'dict-set!', 'dict-set*', 'dict-set*!',
|
274
|
-
'dict-update', 'dict-update!', 'dict-value-contract', 'dict-values',
|
275
|
-
'dict?', 'directory-exists?', 'directory-list', 'display',
|
276
|
-
'display-lines', 'display-lines-to-file', 'display-to-file',
|
277
|
-
'displayln', 'double-flonum?', 'drop', 'drop-right', 'dropf',
|
278
|
-
'dropf-right', 'dump-memory-stats', 'dup-input-port',
|
279
|
-
'dup-output-port', 'dynamic-get-field', 'dynamic-place',
|
280
|
-
'dynamic-place*', 'dynamic-require', 'dynamic-require-for-syntax',
|
281
|
-
'dynamic-send', 'dynamic-set-field!', 'dynamic-wind', 'eighth',
|
282
|
-
'empty', 'empty-sequence', 'empty-stream', 'empty?',
|
283
|
-
'environment-variables-copy', 'environment-variables-names',
|
284
|
-
'environment-variables-ref', 'environment-variables-set!',
|
285
|
-
'environment-variables?', 'eof', 'eof-evt', 'eof-object?',
|
286
|
-
'ephemeron-value', 'ephemeron?', 'eprintf', 'eq-contract-val',
|
287
|
-
'eq-contract?', 'eq-hash-code', 'eq?', 'equal-contract-val',
|
288
|
-
'equal-contract?', 'equal-hash-code', 'equal-secondary-hash-code',
|
289
|
-
'equal<%>', 'equal?', 'equal?/recur', 'eqv-hash-code', 'eqv?', 'error',
|
290
|
-
'error-display-handler', 'error-escape-handler',
|
291
|
-
'error-print-context-length', 'error-print-source-location',
|
292
|
-
'error-print-width', 'error-value->string-handler', 'eval',
|
293
|
-
'eval-jit-enabled', 'eval-syntax', 'even?', 'evt/c', 'evt?',
|
294
|
-
'exact->inexact', 'exact-ceiling', 'exact-floor', 'exact-integer?',
|
295
|
-
'exact-nonnegative-integer?', 'exact-positive-integer?', 'exact-round',
|
296
|
-
'exact-truncate', 'exact?', 'executable-yield-handler', 'exit',
|
297
|
-
'exit-handler', 'exn', 'exn-continuation-marks', 'exn-message',
|
298
|
-
'exn:break', 'exn:break-continuation', 'exn:break:hang-up',
|
299
|
-
'exn:break:hang-up?', 'exn:break:terminate', 'exn:break:terminate?',
|
300
|
-
'exn:break?', 'exn:fail', 'exn:fail:contract',
|
301
|
-
'exn:fail:contract:arity', 'exn:fail:contract:arity?',
|
302
|
-
'exn:fail:contract:blame', 'exn:fail:contract:blame-object',
|
303
|
-
'exn:fail:contract:blame?', 'exn:fail:contract:continuation',
|
304
|
-
'exn:fail:contract:continuation?', 'exn:fail:contract:divide-by-zero',
|
305
|
-
'exn:fail:contract:divide-by-zero?',
|
306
|
-
'exn:fail:contract:non-fixnum-result',
|
307
|
-
'exn:fail:contract:non-fixnum-result?', 'exn:fail:contract:variable',
|
308
|
-
'exn:fail:contract:variable-id', 'exn:fail:contract:variable?',
|
309
|
-
'exn:fail:contract?', 'exn:fail:filesystem',
|
310
|
-
'exn:fail:filesystem:errno', 'exn:fail:filesystem:errno-errno',
|
311
|
-
'exn:fail:filesystem:errno?', 'exn:fail:filesystem:exists',
|
312
|
-
'exn:fail:filesystem:exists?', 'exn:fail:filesystem:missing-module',
|
313
|
-
'exn:fail:filesystem:missing-module-path',
|
314
|
-
'exn:fail:filesystem:missing-module?', 'exn:fail:filesystem:version',
|
315
|
-
'exn:fail:filesystem:version?', 'exn:fail:filesystem?',
|
316
|
-
'exn:fail:network', 'exn:fail:network:errno',
|
317
|
-
'exn:fail:network:errno-errno', 'exn:fail:network:errno?',
|
318
|
-
'exn:fail:network?', 'exn:fail:object', 'exn:fail:object?',
|
319
|
-
'exn:fail:out-of-memory', 'exn:fail:out-of-memory?', 'exn:fail:read',
|
320
|
-
'exn:fail:read-srclocs', 'exn:fail:read:eof', 'exn:fail:read:eof?',
|
321
|
-
'exn:fail:read:non-char', 'exn:fail:read:non-char?', 'exn:fail:read?',
|
322
|
-
'exn:fail:syntax', 'exn:fail:syntax-exprs',
|
323
|
-
'exn:fail:syntax:missing-module',
|
324
|
-
'exn:fail:syntax:missing-module-path',
|
325
|
-
'exn:fail:syntax:missing-module?', 'exn:fail:syntax:unbound',
|
326
|
-
'exn:fail:syntax:unbound?', 'exn:fail:syntax?', 'exn:fail:unsupported',
|
327
|
-
'exn:fail:unsupported?', 'exn:fail:user', 'exn:fail:user?',
|
328
|
-
'exn:fail?', 'exn:misc:match?', 'exn:missing-module-accessor',
|
329
|
-
'exn:missing-module?', 'exn:srclocs-accessor', 'exn:srclocs?', 'exn?',
|
330
|
-
'exp', 'expand', 'expand-once', 'expand-syntax', 'expand-syntax-once',
|
331
|
-
'expand-syntax-to-top-form', 'expand-to-top-form', 'expand-user-path',
|
332
|
-
'explode-path', 'expt', 'externalizable<%>', 'false?', 'field-names',
|
333
|
-
'fifth', 'file->bytes', 'file->bytes-lines', 'file->lines',
|
334
|
-
'file->list', 'file->string', 'file->value', 'file-exists?',
|
335
|
-
'file-name-from-path', 'file-or-directory-identity',
|
336
|
-
'file-or-directory-modify-seconds', 'file-or-directory-permissions',
|
337
|
-
'file-position', 'file-position*', 'file-size',
|
338
|
-
'file-stream-buffer-mode', 'file-stream-port?', 'file-truncate',
|
339
|
-
'filename-extension', 'filesystem-change-evt',
|
340
|
-
'filesystem-change-evt-cancel', 'filesystem-change-evt?',
|
341
|
-
'filesystem-root-list', 'filter', 'filter-map', 'filter-not',
|
342
|
-
'filter-read-input-port', 'find-executable-path', 'find-files',
|
343
|
-
'find-library-collection-links', 'find-library-collection-paths',
|
344
|
-
'find-relative-path', 'find-system-path', 'findf', 'first', 'fixnum?',
|
345
|
-
'flat-contract', 'flat-contract-predicate', 'flat-contract-property?',
|
346
|
-
'flat-contract?', 'flat-named-contract', 'flatten',
|
347
|
-
'floating-point-bytes->real', 'flonum?', 'floor', 'flush-output',
|
348
|
-
'fold-files', 'foldl', 'foldr', 'for-each', 'force', 'format',
|
349
|
-
'fourth', 'fprintf', 'free-identifier=?', 'free-label-identifier=?',
|
350
|
-
'free-template-identifier=?', 'free-transformer-identifier=?',
|
351
|
-
'fsemaphore-count', 'fsemaphore-post', 'fsemaphore-try-wait?',
|
352
|
-
'fsemaphore-wait', 'fsemaphore?', 'future', 'future?',
|
353
|
-
'futures-enabled?', 'gcd', 'generate-member-key',
|
354
|
-
'generate-temporaries', 'generic-set?', 'generic?', 'gensym',
|
355
|
-
'get-output-bytes', 'get-output-string', 'get-preference',
|
356
|
-
'get/build-val-first-projection', 'getenv',
|
357
|
-
'global-port-print-handler', 'group-execute-bit', 'group-read-bit',
|
358
|
-
'group-write-bit', 'guard-evt', 'handle-evt', 'handle-evt?',
|
359
|
-
'has-contract?', 'hash', 'hash->list', 'hash-clear', 'hash-clear!',
|
360
|
-
'hash-copy', 'hash-copy-clear', 'hash-count', 'hash-empty?',
|
361
|
-
'hash-eq?', 'hash-equal?', 'hash-eqv?', 'hash-for-each',
|
362
|
-
'hash-has-key?', 'hash-iterate-first', 'hash-iterate-key',
|
363
|
-
'hash-iterate-next', 'hash-iterate-value', 'hash-keys', 'hash-map',
|
364
|
-
'hash-placeholder?', 'hash-ref', 'hash-ref!', 'hash-remove',
|
365
|
-
'hash-remove!', 'hash-set', 'hash-set!', 'hash-set*', 'hash-set*!',
|
366
|
-
'hash-update', 'hash-update!', 'hash-values', 'hash-weak?', 'hash/c',
|
367
|
-
'hash?', 'hasheq', 'hasheqv', 'identifier-binding',
|
368
|
-
'identifier-binding-symbol', 'identifier-label-binding',
|
369
|
-
'identifier-prune-lexical-context',
|
370
|
-
'identifier-prune-to-source-module',
|
371
|
-
'identifier-remove-from-definition-context',
|
372
|
-
'identifier-template-binding', 'identifier-transformer-binding',
|
373
|
-
'identifier?', 'identity', 'imag-part', 'immutable?',
|
374
|
-
'impersonate-box', 'impersonate-channel',
|
375
|
-
'impersonate-continuation-mark-key', 'impersonate-hash',
|
376
|
-
'impersonate-procedure', 'impersonate-prompt-tag',
|
377
|
-
'impersonate-struct', 'impersonate-vector', 'impersonator-contract?',
|
378
|
-
'impersonator-ephemeron', 'impersonator-of?',
|
379
|
-
'impersonator-prop:application-mark', 'impersonator-prop:contracted',
|
380
|
-
'impersonator-property-accessor-procedure?', 'impersonator-property?',
|
381
|
-
'impersonator?', 'implementation?', 'implementation?/c', 'in-bytes',
|
382
|
-
'in-bytes-lines', 'in-cycle', 'in-dict', 'in-dict-keys',
|
383
|
-
'in-dict-pairs', 'in-dict-values', 'in-directory', 'in-hash',
|
384
|
-
'in-hash-keys', 'in-hash-pairs', 'in-hash-values', 'in-indexed',
|
385
|
-
'in-input-port-bytes', 'in-input-port-chars', 'in-lines', 'in-list',
|
386
|
-
'in-mlist', 'in-naturals', 'in-parallel', 'in-permutations', 'in-port',
|
387
|
-
'in-producer', 'in-range', 'in-sequences', 'in-set', 'in-stream',
|
388
|
-
'in-string', 'in-value', 'in-values*-sequence', 'in-values-sequence',
|
389
|
-
'in-vector', 'inexact->exact', 'inexact-real?', 'inexact?',
|
390
|
-
'infinite?', 'input-port-append', 'input-port?', 'inspector?',
|
391
|
-
'instanceof/c', 'integer->char', 'integer->integer-bytes',
|
392
|
-
'integer-bytes->integer', 'integer-in', 'integer-length',
|
393
|
-
'integer-sqrt', 'integer-sqrt/remainder', 'integer?',
|
394
|
-
'interface->method-names', 'interface-extension?', 'interface?',
|
395
|
-
'internal-definition-context-seal', 'internal-definition-context?',
|
396
|
-
'is-a?', 'is-a?/c', 'keyword->string', 'keyword-apply', 'keyword<?',
|
397
|
-
'keyword?', 'keywords-match', 'kill-thread', 'last', 'last-pair',
|
398
|
-
'lcm', 'length', 'liberal-define-context?', 'link-exists?', 'list',
|
399
|
-
'list*', 'list->bytes', 'list->mutable-set', 'list->mutable-seteq',
|
400
|
-
'list->mutable-seteqv', 'list->set', 'list->seteq', 'list->seteqv',
|
401
|
-
'list->string', 'list->vector', 'list->weak-set', 'list->weak-seteq',
|
402
|
-
'list->weak-seteqv', 'list-ref', 'list-tail', 'list/c', 'list?',
|
403
|
-
'listof', 'load', 'load-extension', 'load-on-demand-enabled',
|
404
|
-
'load-relative', 'load-relative-extension', 'load/cd',
|
405
|
-
'load/use-compiled', 'local-expand', 'local-expand/capture-lifts',
|
406
|
-
'local-transformer-expand', 'local-transformer-expand/capture-lifts',
|
407
|
-
'locale-string-encoding', 'log', 'log-level?', 'log-max-level',
|
408
|
-
'log-message', 'log-receiver?', 'logger-name', 'logger?', 'magnitude',
|
409
|
-
'make-arity-at-least', 'make-base-empty-namespace',
|
410
|
-
'make-base-namespace', 'make-bytes', 'make-channel',
|
411
|
-
'make-chaperone-contract', 'make-continuation-mark-key',
|
412
|
-
'make-continuation-prompt-tag', 'make-contract', 'make-custodian',
|
413
|
-
'make-custodian-box', 'make-custom-hash', 'make-custom-hash-types',
|
414
|
-
'make-custom-set', 'make-custom-set-types', 'make-date', 'make-date*',
|
415
|
-
'make-derived-parameter', 'make-directory', 'make-directory*',
|
416
|
-
'make-do-sequence', 'make-empty-namespace',
|
417
|
-
'make-environment-variables', 'make-ephemeron', 'make-exn',
|
418
|
-
'make-exn:break', 'make-exn:break:hang-up', 'make-exn:break:terminate',
|
419
|
-
'make-exn:fail', 'make-exn:fail:contract',
|
420
|
-
'make-exn:fail:contract:arity', 'make-exn:fail:contract:blame',
|
421
|
-
'make-exn:fail:contract:continuation',
|
422
|
-
'make-exn:fail:contract:divide-by-zero',
|
423
|
-
'make-exn:fail:contract:non-fixnum-result',
|
424
|
-
'make-exn:fail:contract:variable', 'make-exn:fail:filesystem',
|
425
|
-
'make-exn:fail:filesystem:errno', 'make-exn:fail:filesystem:exists',
|
426
|
-
'make-exn:fail:filesystem:missing-module',
|
427
|
-
'make-exn:fail:filesystem:version', 'make-exn:fail:network',
|
428
|
-
'make-exn:fail:network:errno', 'make-exn:fail:object',
|
429
|
-
'make-exn:fail:out-of-memory', 'make-exn:fail:read',
|
430
|
-
'make-exn:fail:read:eof', 'make-exn:fail:read:non-char',
|
431
|
-
'make-exn:fail:syntax', 'make-exn:fail:syntax:missing-module',
|
432
|
-
'make-exn:fail:syntax:unbound', 'make-exn:fail:unsupported',
|
433
|
-
'make-exn:fail:user', 'make-file-or-directory-link',
|
434
|
-
'make-flat-contract', 'make-fsemaphore', 'make-generic',
|
435
|
-
'make-handle-get-preference-locked', 'make-hash',
|
436
|
-
'make-hash-placeholder', 'make-hasheq', 'make-hasheq-placeholder',
|
437
|
-
'make-hasheqv', 'make-hasheqv-placeholder',
|
438
|
-
'make-immutable-custom-hash', 'make-immutable-hash',
|
439
|
-
'make-immutable-hasheq', 'make-immutable-hasheqv',
|
440
|
-
'make-impersonator-property', 'make-input-port',
|
441
|
-
'make-input-port/read-to-peek', 'make-inspector',
|
442
|
-
'make-keyword-procedure', 'make-known-char-range-list',
|
443
|
-
'make-limited-input-port', 'make-list', 'make-lock-file-name',
|
444
|
-
'make-log-receiver', 'make-logger', 'make-mixin-contract',
|
445
|
-
'make-mutable-custom-set', 'make-none/c', 'make-object',
|
446
|
-
'make-output-port', 'make-parameter', 'make-phantom-bytes',
|
447
|
-
'make-pipe', 'make-pipe-with-specials', 'make-placeholder',
|
448
|
-
'make-polar', 'make-prefab-struct', 'make-primitive-class',
|
449
|
-
'make-proj-contract', 'make-pseudo-random-generator',
|
450
|
-
'make-reader-graph', 'make-readtable', 'make-rectangular',
|
451
|
-
'make-rename-transformer', 'make-resolved-module-path',
|
452
|
-
'make-security-guard', 'make-semaphore', 'make-set!-transformer',
|
453
|
-
'make-shared-bytes', 'make-sibling-inspector', 'make-special-comment',
|
454
|
-
'make-srcloc', 'make-string', 'make-struct-field-accessor',
|
455
|
-
'make-struct-field-mutator', 'make-struct-type',
|
456
|
-
'make-struct-type-property', 'make-syntax-delta-introducer',
|
457
|
-
'make-syntax-introducer', 'make-temporary-file',
|
458
|
-
'make-tentative-pretty-print-output-port', 'make-thread-cell',
|
459
|
-
'make-thread-group', 'make-vector', 'make-weak-box',
|
460
|
-
'make-weak-custom-hash', 'make-weak-custom-set', 'make-weak-hash',
|
461
|
-
'make-weak-hasheq', 'make-weak-hasheqv', 'make-will-executor', 'map',
|
462
|
-
'match-equality-test', 'matches-arity-exactly?', 'max', 'mcar', 'mcdr',
|
463
|
-
'mcons', 'member', 'member-name-key-hash-code', 'member-name-key=?',
|
464
|
-
'member-name-key?', 'memf', 'memq', 'memv', 'merge-input',
|
465
|
-
'method-in-interface?', 'min', 'mixin-contract', 'module->exports',
|
466
|
-
'module->imports', 'module->language-info', 'module->namespace',
|
467
|
-
'module-compiled-cross-phase-persistent?', 'module-compiled-exports',
|
468
|
-
'module-compiled-imports', 'module-compiled-language-info',
|
469
|
-
'module-compiled-name', 'module-compiled-submodules',
|
470
|
-
'module-declared?', 'module-path-index-join',
|
471
|
-
'module-path-index-resolve', 'module-path-index-split',
|
472
|
-
'module-path-index-submodule', 'module-path-index?', 'module-path?',
|
473
|
-
'module-predefined?', 'module-provide-protected?', 'modulo', 'mpair?',
|
474
|
-
'mutable-set', 'mutable-seteq', 'mutable-seteqv', 'n->th',
|
475
|
-
'nack-guard-evt', 'namespace-anchor->empty-namespace',
|
476
|
-
'namespace-anchor->namespace', 'namespace-anchor?',
|
477
|
-
'namespace-attach-module', 'namespace-attach-module-declaration',
|
478
|
-
'namespace-base-phase', 'namespace-mapped-symbols',
|
479
|
-
'namespace-module-identifier', 'namespace-module-registry',
|
480
|
-
'namespace-require', 'namespace-require/constant',
|
481
|
-
'namespace-require/copy', 'namespace-require/expansion-time',
|
482
|
-
'namespace-set-variable-value!', 'namespace-symbol->identifier',
|
483
|
-
'namespace-syntax-introduce', 'namespace-undefine-variable!',
|
484
|
-
'namespace-unprotect-module', 'namespace-variable-value', 'namespace?',
|
485
|
-
'nan?', 'natural-number/c', 'negate', 'negative?', 'never-evt',
|
486
|
-
u'new-∀/c', u'new-∃/c', 'newline', 'ninth', 'non-empty-listof',
|
487
|
-
'none/c', 'normal-case-path', 'normalize-arity', 'normalize-path',
|
488
|
-
'normalized-arity?', 'not', 'not/c', 'null', 'null?', 'number->string',
|
489
|
-
'number?', 'numerator', 'object%', 'object->vector', 'object-info',
|
490
|
-
'object-interface', 'object-method-arity-includes?', 'object-name',
|
491
|
-
'object=?', 'object?', 'odd?', 'one-of/c', 'open-input-bytes',
|
492
|
-
'open-input-file', 'open-input-output-file', 'open-input-string',
|
493
|
-
'open-output-bytes', 'open-output-file', 'open-output-nowhere',
|
494
|
-
'open-output-string', 'or/c', 'order-of-magnitude', 'ormap',
|
495
|
-
'other-execute-bit', 'other-read-bit', 'other-write-bit',
|
496
|
-
'output-port?', 'pair?', 'parameter-procedure=?', 'parameter/c',
|
497
|
-
'parameter?', 'parameterization?', 'parse-command-line', 'partition',
|
498
|
-
'path->bytes', 'path->complete-path', 'path->directory-path',
|
499
|
-
'path->string', 'path-add-suffix', 'path-convention-type',
|
500
|
-
'path-element->bytes', 'path-element->string', 'path-element?',
|
501
|
-
'path-for-some-system?', 'path-list-string->path-list', 'path-only',
|
502
|
-
'path-replace-suffix', 'path-string?', 'path<?', 'path?',
|
503
|
-
'pathlist-closure', 'peek-byte', 'peek-byte-or-special', 'peek-bytes',
|
504
|
-
'peek-bytes!', 'peek-bytes!-evt', 'peek-bytes-avail!',
|
505
|
-
'peek-bytes-avail!*', 'peek-bytes-avail!-evt',
|
506
|
-
'peek-bytes-avail!/enable-break', 'peek-bytes-evt', 'peek-char',
|
507
|
-
'peek-char-or-special', 'peek-string', 'peek-string!',
|
508
|
-
'peek-string!-evt', 'peek-string-evt', 'peeking-input-port',
|
509
|
-
'permutations', 'phantom-bytes?', 'pi', 'pi.f', 'pipe-content-length',
|
510
|
-
'place-break', 'place-channel', 'place-channel-get',
|
511
|
-
'place-channel-put', 'place-channel-put/get', 'place-channel?',
|
512
|
-
'place-dead-evt', 'place-enabled?', 'place-kill', 'place-location?',
|
513
|
-
'place-message-allowed?', 'place-sleep', 'place-wait', 'place?',
|
514
|
-
'placeholder-get', 'placeholder-set!', 'placeholder?',
|
515
|
-
'poll-guard-evt', 'port->bytes', 'port->bytes-lines', 'port->lines',
|
516
|
-
'port->list', 'port->string', 'port-closed-evt', 'port-closed?',
|
517
|
-
'port-commit-peeked', 'port-count-lines!', 'port-count-lines-enabled',
|
518
|
-
'port-counts-lines?', 'port-display-handler', 'port-file-identity',
|
519
|
-
'port-file-unlock', 'port-next-location', 'port-print-handler',
|
520
|
-
'port-progress-evt', 'port-provides-progress-evts?',
|
521
|
-
'port-read-handler', 'port-try-file-lock?', 'port-write-handler',
|
522
|
-
'port-writes-atomic?', 'port-writes-special?', 'port?', 'positive?',
|
523
|
-
'predicate/c', 'prefab-key->struct-type', 'prefab-key?',
|
524
|
-
'prefab-struct-key', 'preferences-lock-file-mode', 'pregexp',
|
525
|
-
'pregexp?', 'pretty-display', 'pretty-format', 'pretty-print',
|
526
|
-
'pretty-print-.-symbol-without-bars',
|
527
|
-
'pretty-print-abbreviate-read-macros', 'pretty-print-columns',
|
528
|
-
'pretty-print-current-style-table', 'pretty-print-depth',
|
529
|
-
'pretty-print-exact-as-decimal', 'pretty-print-extend-style-table',
|
530
|
-
'pretty-print-handler', 'pretty-print-newline',
|
531
|
-
'pretty-print-post-print-hook', 'pretty-print-pre-print-hook',
|
532
|
-
'pretty-print-print-hook', 'pretty-print-print-line',
|
533
|
-
'pretty-print-remap-stylable', 'pretty-print-show-inexactness',
|
534
|
-
'pretty-print-size-hook', 'pretty-print-style-table?',
|
535
|
-
'pretty-printing', 'pretty-write', 'primitive-closure?',
|
536
|
-
'primitive-result-arity', 'primitive?', 'print', 'print-as-expression',
|
537
|
-
'print-boolean-long-form', 'print-box', 'print-graph',
|
538
|
-
'print-hash-table', 'print-mpair-curly-braces',
|
539
|
-
'print-pair-curly-braces', 'print-reader-abbreviations',
|
540
|
-
'print-struct', 'print-syntax-width', 'print-unreadable',
|
541
|
-
'print-vector-length', 'printable/c', 'printable<%>', 'printf',
|
542
|
-
'procedure->method', 'procedure-arity', 'procedure-arity-includes/c',
|
543
|
-
'procedure-arity-includes?', 'procedure-arity?',
|
544
|
-
'procedure-closure-contents-eq?', 'procedure-extract-target',
|
545
|
-
'procedure-keywords', 'procedure-reduce-arity',
|
546
|
-
'procedure-reduce-keyword-arity', 'procedure-rename',
|
547
|
-
'procedure-struct-type?', 'procedure?', 'process', 'process*',
|
548
|
-
'process*/ports', 'process/ports', 'processor-count', 'progress-evt?',
|
549
|
-
'promise-forced?', 'promise-running?', 'promise/c', 'promise?',
|
550
|
-
'prop:arity-string', 'prop:chaperone-contract',
|
551
|
-
'prop:checked-procedure', 'prop:contract', 'prop:contracted',
|
552
|
-
'prop:custom-print-quotable', 'prop:custom-write', 'prop:dict',
|
553
|
-
'prop:dict/contract', 'prop:equal+hash', 'prop:evt',
|
554
|
-
'prop:exn:missing-module', 'prop:exn:srclocs', 'prop:flat-contract',
|
555
|
-
'prop:impersonator-of', 'prop:input-port',
|
556
|
-
'prop:liberal-define-context', 'prop:opt-chaperone-contract',
|
557
|
-
'prop:opt-chaperone-contract-get-test', 'prop:opt-chaperone-contract?',
|
558
|
-
'prop:output-port', 'prop:place-location', 'prop:procedure',
|
559
|
-
'prop:rename-transformer', 'prop:sequence', 'prop:set!-transformer',
|
560
|
-
'prop:stream', 'proper-subset?', 'pseudo-random-generator->vector',
|
561
|
-
'pseudo-random-generator-vector?', 'pseudo-random-generator?',
|
562
|
-
'put-preferences', 'putenv', 'quotient', 'quotient/remainder',
|
563
|
-
'radians->degrees', 'raise', 'raise-argument-error',
|
564
|
-
'raise-arguments-error', 'raise-arity-error', 'raise-blame-error',
|
565
|
-
'raise-contract-error', 'raise-mismatch-error',
|
566
|
-
'raise-not-cons-blame-error', 'raise-range-error',
|
567
|
-
'raise-result-error', 'raise-syntax-error', 'raise-type-error',
|
568
|
-
'raise-user-error', 'random', 'random-seed', 'range', 'rational?',
|
569
|
-
'rationalize', 'read', 'read-accept-bar-quote', 'read-accept-box',
|
570
|
-
'read-accept-compiled', 'read-accept-dot', 'read-accept-graph',
|
571
|
-
'read-accept-infix-dot', 'read-accept-lang', 'read-accept-quasiquote',
|
572
|
-
'read-accept-reader', 'read-byte', 'read-byte-or-special',
|
573
|
-
'read-bytes', 'read-bytes!', 'read-bytes!-evt', 'read-bytes-avail!',
|
574
|
-
'read-bytes-avail!*', 'read-bytes-avail!-evt',
|
575
|
-
'read-bytes-avail!/enable-break', 'read-bytes-evt', 'read-bytes-line',
|
576
|
-
'read-bytes-line-evt', 'read-case-sensitive', 'read-char',
|
577
|
-
'read-char-or-special', 'read-curly-brace-as-paren',
|
578
|
-
'read-decimal-as-inexact', 'read-eval-print-loop', 'read-language',
|
579
|
-
'read-line', 'read-line-evt', 'read-on-demand-source',
|
580
|
-
'read-square-bracket-as-paren', 'read-string', 'read-string!',
|
581
|
-
'read-string!-evt', 'read-string-evt', 'read-syntax',
|
582
|
-
'read-syntax/recursive', 'read/recursive', 'readtable-mapping',
|
583
|
-
'readtable?', 'real->decimal-string', 'real->double-flonum',
|
584
|
-
'real->floating-point-bytes', 'real->single-flonum', 'real-in',
|
585
|
-
'real-part', 'real?', 'reencode-input-port', 'reencode-output-port',
|
586
|
-
'regexp', 'regexp-match', 'regexp-match*', 'regexp-match-evt',
|
587
|
-
'regexp-match-exact?', 'regexp-match-peek',
|
588
|
-
'regexp-match-peek-immediate', 'regexp-match-peek-positions',
|
589
|
-
'regexp-match-peek-positions*',
|
590
|
-
'regexp-match-peek-positions-immediate',
|
591
|
-
'regexp-match-peek-positions-immediate/end',
|
592
|
-
'regexp-match-peek-positions/end', 'regexp-match-positions',
|
593
|
-
'regexp-match-positions*', 'regexp-match-positions/end',
|
594
|
-
'regexp-match/end', 'regexp-match?', 'regexp-max-lookbehind',
|
595
|
-
'regexp-quote', 'regexp-replace', 'regexp-replace*',
|
596
|
-
'regexp-replace-quote', 'regexp-replaces', 'regexp-split',
|
597
|
-
'regexp-try-match', 'regexp?', 'relative-path?', 'relocate-input-port',
|
598
|
-
'relocate-output-port', 'remainder', 'remove', 'remove*',
|
599
|
-
'remove-duplicates', 'remq', 'remq*', 'remv', 'remv*',
|
600
|
-
'rename-file-or-directory', 'rename-transformer-target',
|
601
|
-
'rename-transformer?', 'reroot-path', 'resolve-path',
|
602
|
-
'resolved-module-path-name', 'resolved-module-path?', 'rest',
|
603
|
-
'reverse', 'round', 'second', 'seconds->date', 'security-guard?',
|
604
|
-
'semaphore-peek-evt', 'semaphore-peek-evt?', 'semaphore-post',
|
605
|
-
'semaphore-try-wait?', 'semaphore-wait', 'semaphore-wait/enable-break',
|
606
|
-
'semaphore?', 'sequence->list', 'sequence->stream',
|
607
|
-
'sequence-add-between', 'sequence-andmap', 'sequence-append',
|
608
|
-
'sequence-count', 'sequence-filter', 'sequence-fold',
|
609
|
-
'sequence-for-each', 'sequence-generate', 'sequence-generate*',
|
610
|
-
'sequence-length', 'sequence-map', 'sequence-ormap', 'sequence-ref',
|
611
|
-
'sequence-tail', 'sequence?', 'set', 'set!-transformer-procedure',
|
612
|
-
'set!-transformer?', 'set->list', 'set->stream', 'set-add', 'set-add!',
|
613
|
-
'set-box!', 'set-clear', 'set-clear!', 'set-copy', 'set-copy-clear',
|
614
|
-
'set-count', 'set-empty?', 'set-eq?', 'set-equal?', 'set-eqv?',
|
615
|
-
'set-first', 'set-for-each', 'set-implements/c', 'set-implements?',
|
616
|
-
'set-intersect', 'set-intersect!', 'set-map', 'set-mcar!', 'set-mcdr!',
|
617
|
-
'set-member?', 'set-mutable?', 'set-phantom-bytes!',
|
618
|
-
'set-port-next-location!', 'set-remove', 'set-remove!', 'set-rest',
|
619
|
-
'set-subtract', 'set-subtract!', 'set-symmetric-difference',
|
620
|
-
'set-symmetric-difference!', 'set-union', 'set-union!', 'set-weak?',
|
621
|
-
'set/c', 'set=?', 'set?', 'seteq', 'seteqv', 'seventh', 'sgn',
|
622
|
-
'shared-bytes', 'shell-execute', 'shrink-path-wrt', 'shuffle',
|
623
|
-
'simple-form-path', 'simplify-path', 'sin', 'single-flonum?', 'sinh',
|
624
|
-
'sixth', 'skip-projection-wrapper?', 'sleep',
|
625
|
-
'some-system-path->string', 'sort', 'special-comment-value',
|
626
|
-
'special-comment?', 'special-filter-input-port', 'split-at',
|
627
|
-
'split-at-right', 'split-path', 'splitf-at', 'splitf-at-right', 'sqr',
|
628
|
-
'sqrt', 'srcloc', 'srcloc->string', 'srcloc-column', 'srcloc-line',
|
629
|
-
'srcloc-position', 'srcloc-source', 'srcloc-span', 'srcloc?',
|
630
|
-
'stop-after', 'stop-before', 'stream->list', 'stream-add-between',
|
631
|
-
'stream-andmap', 'stream-append', 'stream-count', 'stream-empty?',
|
632
|
-
'stream-filter', 'stream-first', 'stream-fold', 'stream-for-each',
|
633
|
-
'stream-length', 'stream-map', 'stream-ormap', 'stream-ref',
|
634
|
-
'stream-rest', 'stream-tail', 'stream?', 'string',
|
635
|
-
'string->bytes/latin-1', 'string->bytes/locale', 'string->bytes/utf-8',
|
636
|
-
'string->immutable-string', 'string->keyword', 'string->list',
|
637
|
-
'string->number', 'string->path', 'string->path-element',
|
638
|
-
'string->some-system-path', 'string->symbol',
|
639
|
-
'string->uninterned-symbol', 'string->unreadable-symbol',
|
640
|
-
'string-append', 'string-append*', 'string-ci<=?', 'string-ci<?',
|
641
|
-
'string-ci=?', 'string-ci>=?', 'string-ci>?', 'string-copy',
|
642
|
-
'string-copy!', 'string-downcase', 'string-environment-variable-name?',
|
643
|
-
'string-fill!', 'string-foldcase', 'string-join', 'string-len/c',
|
644
|
-
'string-length', 'string-locale-ci<?', 'string-locale-ci=?',
|
645
|
-
'string-locale-ci>?', 'string-locale-downcase', 'string-locale-upcase',
|
646
|
-
'string-locale<?', 'string-locale=?', 'string-locale>?',
|
647
|
-
'string-no-nuls?', 'string-normalize-nfc', 'string-normalize-nfd',
|
648
|
-
'string-normalize-nfkc', 'string-normalize-nfkd',
|
649
|
-
'string-normalize-spaces', 'string-ref', 'string-replace',
|
650
|
-
'string-set!', 'string-split', 'string-titlecase', 'string-trim',
|
651
|
-
'string-upcase', 'string-utf-8-length', 'string<=?', 'string<?',
|
652
|
-
'string=?', 'string>=?', 'string>?', 'string?', 'struct->vector',
|
653
|
-
'struct-accessor-procedure?', 'struct-constructor-procedure?',
|
654
|
-
'struct-info', 'struct-mutator-procedure?',
|
655
|
-
'struct-predicate-procedure?', 'struct-type-info',
|
656
|
-
'struct-type-make-constructor', 'struct-type-make-predicate',
|
657
|
-
'struct-type-property-accessor-procedure?', 'struct-type-property/c',
|
658
|
-
'struct-type-property?', 'struct-type?', 'struct:arity-at-least',
|
659
|
-
'struct:date', 'struct:date*', 'struct:exn', 'struct:exn:break',
|
660
|
-
'struct:exn:break:hang-up', 'struct:exn:break:terminate',
|
661
|
-
'struct:exn:fail', 'struct:exn:fail:contract',
|
662
|
-
'struct:exn:fail:contract:arity', 'struct:exn:fail:contract:blame',
|
663
|
-
'struct:exn:fail:contract:continuation',
|
664
|
-
'struct:exn:fail:contract:divide-by-zero',
|
665
|
-
'struct:exn:fail:contract:non-fixnum-result',
|
666
|
-
'struct:exn:fail:contract:variable', 'struct:exn:fail:filesystem',
|
667
|
-
'struct:exn:fail:filesystem:errno',
|
668
|
-
'struct:exn:fail:filesystem:exists',
|
669
|
-
'struct:exn:fail:filesystem:missing-module',
|
670
|
-
'struct:exn:fail:filesystem:version', 'struct:exn:fail:network',
|
671
|
-
'struct:exn:fail:network:errno', 'struct:exn:fail:object',
|
672
|
-
'struct:exn:fail:out-of-memory', 'struct:exn:fail:read',
|
673
|
-
'struct:exn:fail:read:eof', 'struct:exn:fail:read:non-char',
|
674
|
-
'struct:exn:fail:syntax', 'struct:exn:fail:syntax:missing-module',
|
675
|
-
'struct:exn:fail:syntax:unbound', 'struct:exn:fail:unsupported',
|
676
|
-
'struct:exn:fail:user', 'struct:srcloc',
|
677
|
-
'struct:wrapped-extra-arg-arrow', 'struct?', 'sub1', 'subbytes',
|
678
|
-
'subclass?', 'subclass?/c', 'subprocess', 'subprocess-group-enabled',
|
679
|
-
'subprocess-kill', 'subprocess-pid', 'subprocess-status',
|
680
|
-
'subprocess-wait', 'subprocess?', 'subset?', 'substring',
|
681
|
-
'symbol->string', 'symbol-interned?', 'symbol-unreadable?', 'symbol<?',
|
682
|
-
'symbol=?', 'symbol?', 'symbols', 'sync', 'sync/enable-break',
|
683
|
-
'sync/timeout', 'sync/timeout/enable-break', 'syntax->datum',
|
684
|
-
'syntax->list', 'syntax-arm', 'syntax-column', 'syntax-disarm',
|
685
|
-
'syntax-e', 'syntax-line', 'syntax-local-bind-syntaxes',
|
686
|
-
'syntax-local-certifier', 'syntax-local-context',
|
687
|
-
'syntax-local-expand-expression', 'syntax-local-get-shadower',
|
688
|
-
'syntax-local-introduce', 'syntax-local-lift-context',
|
689
|
-
'syntax-local-lift-expression',
|
690
|
-
'syntax-local-lift-module-end-declaration',
|
691
|
-
'syntax-local-lift-provide', 'syntax-local-lift-require',
|
692
|
-
'syntax-local-lift-values-expression',
|
693
|
-
'syntax-local-make-definition-context',
|
694
|
-
'syntax-local-make-delta-introducer',
|
695
|
-
'syntax-local-module-defined-identifiers',
|
696
|
-
'syntax-local-module-exports',
|
697
|
-
'syntax-local-module-required-identifiers', 'syntax-local-name',
|
698
|
-
'syntax-local-phase-level', 'syntax-local-submodules',
|
699
|
-
'syntax-local-transforming-module-provides?', 'syntax-local-value',
|
700
|
-
'syntax-local-value/immediate', 'syntax-original?', 'syntax-position',
|
701
|
-
'syntax-property', 'syntax-property-symbol-keys', 'syntax-protect',
|
702
|
-
'syntax-rearm', 'syntax-recertify', 'syntax-shift-phase-level',
|
703
|
-
'syntax-source', 'syntax-source-module', 'syntax-span', 'syntax-taint',
|
704
|
-
'syntax-tainted?', 'syntax-track-origin',
|
705
|
-
'syntax-transforming-module-expression?', 'syntax-transforming?',
|
706
|
-
'syntax/c', 'syntax?', 'system', 'system*', 'system*/exit-code',
|
707
|
-
'system-big-endian?', 'system-idle-evt', 'system-language+country',
|
708
|
-
'system-library-subpath', 'system-path-convention-type', 'system-type',
|
709
|
-
'system/exit-code', 'tail-marks-match?', 'take', 'take-right', 'takef',
|
710
|
-
'takef-right', 'tan', 'tanh', 'tcp-abandon-port', 'tcp-accept',
|
711
|
-
'tcp-accept-evt', 'tcp-accept-ready?', 'tcp-accept/enable-break',
|
712
|
-
'tcp-addresses', 'tcp-close', 'tcp-connect',
|
713
|
-
'tcp-connect/enable-break', 'tcp-listen', 'tcp-listener?', 'tcp-port?',
|
714
|
-
'tentative-pretty-print-port-cancel',
|
715
|
-
'tentative-pretty-print-port-transfer', 'tenth', 'terminal-port?',
|
716
|
-
'the-unsupplied-arg', 'third', 'thread', 'thread-cell-ref',
|
717
|
-
'thread-cell-set!', 'thread-cell-values?', 'thread-cell?',
|
718
|
-
'thread-dead-evt', 'thread-dead?', 'thread-group?', 'thread-receive',
|
719
|
-
'thread-receive-evt', 'thread-resume', 'thread-resume-evt',
|
720
|
-
'thread-rewind-receive', 'thread-running?', 'thread-send',
|
721
|
-
'thread-suspend', 'thread-suspend-evt', 'thread-try-receive',
|
722
|
-
'thread-wait', 'thread/suspend-to-kill', 'thread?', 'time-apply',
|
723
|
-
'touch', 'transplant-input-port', 'transplant-output-port', 'true',
|
724
|
-
'truncate', 'udp-addresses', 'udp-bind!', 'udp-bound?', 'udp-close',
|
725
|
-
'udp-connect!', 'udp-connected?', 'udp-multicast-interface',
|
726
|
-
'udp-multicast-join-group!', 'udp-multicast-leave-group!',
|
727
|
-
'udp-multicast-loopback?', 'udp-multicast-set-interface!',
|
728
|
-
'udp-multicast-set-loopback!', 'udp-multicast-set-ttl!',
|
729
|
-
'udp-multicast-ttl', 'udp-open-socket', 'udp-receive!',
|
730
|
-
'udp-receive!*', 'udp-receive!-evt', 'udp-receive!/enable-break',
|
731
|
-
'udp-receive-ready-evt', 'udp-send', 'udp-send*', 'udp-send-evt',
|
732
|
-
'udp-send-ready-evt', 'udp-send-to', 'udp-send-to*', 'udp-send-to-evt',
|
733
|
-
'udp-send-to/enable-break', 'udp-send/enable-break', 'udp?', 'unbox',
|
734
|
-
'uncaught-exception-handler', 'unit?', 'unspecified-dom',
|
735
|
-
'unsupplied-arg?', 'use-collection-link-paths',
|
736
|
-
'use-compiled-file-paths', 'use-user-specific-search-paths',
|
737
|
-
'user-execute-bit', 'user-read-bit', 'user-write-bit',
|
738
|
-
'value-contract', 'values', 'variable-reference->empty-namespace',
|
739
|
-
'variable-reference->module-base-phase',
|
740
|
-
'variable-reference->module-declaration-inspector',
|
741
|
-
'variable-reference->module-path-index',
|
742
|
-
'variable-reference->module-source', 'variable-reference->namespace',
|
743
|
-
'variable-reference->phase',
|
744
|
-
'variable-reference->resolved-module-path',
|
745
|
-
'variable-reference-constant?', 'variable-reference?', 'vector',
|
746
|
-
'vector->immutable-vector', 'vector->list',
|
747
|
-
'vector->pseudo-random-generator', 'vector->pseudo-random-generator!',
|
748
|
-
'vector->values', 'vector-append', 'vector-argmax', 'vector-argmin',
|
749
|
-
'vector-copy', 'vector-copy!', 'vector-count', 'vector-drop',
|
750
|
-
'vector-drop-right', 'vector-fill!', 'vector-filter',
|
751
|
-
'vector-filter-not', 'vector-immutable', 'vector-immutable/c',
|
752
|
-
'vector-immutableof', 'vector-length', 'vector-map', 'vector-map!',
|
753
|
-
'vector-member', 'vector-memq', 'vector-memv', 'vector-ref',
|
754
|
-
'vector-set!', 'vector-set*!', 'vector-set-performance-stats!',
|
755
|
-
'vector-split-at', 'vector-split-at-right', 'vector-take',
|
756
|
-
'vector-take-right', 'vector/c', 'vector?', 'vectorof', 'version',
|
757
|
-
'void', 'void?', 'weak-box-value', 'weak-box?', 'weak-set',
|
758
|
-
'weak-seteq', 'weak-seteqv', 'will-execute', 'will-executor?',
|
759
|
-
'will-register', 'will-try-execute', 'with-input-from-bytes',
|
760
|
-
'with-input-from-file', 'with-input-from-string',
|
761
|
-
'with-output-to-bytes', 'with-output-to-file', 'with-output-to-string',
|
762
|
-
'would-be-future', 'wrap-evt', 'wrapped-extra-arg-arrow',
|
763
|
-
'wrapped-extra-arg-arrow-extra-neg-party-argument',
|
764
|
-
'wrapped-extra-arg-arrow-real-func', 'wrapped-extra-arg-arrow?',
|
765
|
-
'writable<%>', 'write', 'write-byte', 'write-bytes',
|
766
|
-
'write-bytes-avail', 'write-bytes-avail*', 'write-bytes-avail-evt',
|
767
|
-
'write-bytes-avail/enable-break', 'write-char', 'write-special',
|
768
|
-
'write-special-avail*', 'write-special-evt', 'write-string',
|
769
|
-
'write-to-file', 'xor', 'zero?', '~.a', '~.s', '~.v', '~a', '~e', '~r',
|
770
|
-
'~s', '~v'
|
771
|
-
]
|
772
|
-
|
773
|
-
_opening_parenthesis = r'[([{]'
|
774
|
-
_closing_parenthesis = r'[)\]}]'
|
775
|
-
_delimiters = r'()[\]{}",\'`;\s'
|
776
|
-
_symbol = r'(?u)(?:\|[^|]*\||\\[\w\W]|[^|\\%s]+)+' % _delimiters
|
777
|
-
_exact_decimal_prefix = r'(?:#e)?(?:#d)?(?:#e)?'
|
778
|
-
_exponent = r'(?:[defls][-+]?\d+)'
|
779
|
-
_inexact_simple_no_hashes = r'(?:\d+(?:/\d+|\.\d*)?|\.\d+)'
|
780
|
-
_inexact_simple = (r'(?:%s|(?:\d+#+(?:\.#*|/\d+#*)?|\.\d+#+|'
|
781
|
-
r'\d+(?:\.\d*#+|/\d+#+)))' % _inexact_simple_no_hashes)
|
782
|
-
_inexact_normal_no_hashes = r'(?:%s%s?)' % (_inexact_simple_no_hashes,
|
783
|
-
_exponent)
|
784
|
-
_inexact_normal = r'(?:%s%s?)' % (_inexact_simple, _exponent)
|
785
|
-
_inexact_special = r'(?:(?:inf|nan)\.[0f])'
|
786
|
-
_inexact_real = r'(?:[-+]?%s|[-+]%s)' % (_inexact_normal,
|
787
|
-
_inexact_special)
|
788
|
-
_inexact_unsigned = r'(?:%s|%s)' % (_inexact_normal, _inexact_special)
|
789
|
-
|
790
|
-
tokens = {
|
791
|
-
'root': [
|
792
|
-
(_closing_parenthesis, Error),
|
793
|
-
(r'(?!\Z)', Text, 'unquoted-datum')
|
794
|
-
],
|
795
|
-
'datum': [
|
796
|
-
(r'(?s)#;|#![ /]([^\\\n]|\\.)*', Comment),
|
797
|
-
(u';[^\\n\\r\x85\u2028\u2029]*', Comment.Single),
|
798
|
-
(r'#\|', Comment.Multiline, 'block-comment'),
|
799
|
-
|
800
|
-
# Whitespaces
|
801
|
-
(r'(?u)\s+', Text),
|
802
|
-
|
803
|
-
# Numbers: Keep in mind Racket reader hash prefixes, which
|
804
|
-
# can denote the base or the type. These don't map neatly
|
805
|
-
# onto Pygments token types; some judgment calls here.
|
806
|
-
|
807
|
-
# #d or no prefix
|
808
|
-
(r'(?i)%s[-+]?\d+(?=[%s])' % (_exact_decimal_prefix, _delimiters),
|
809
|
-
Number.Integer, '#pop'),
|
810
|
-
(r'(?i)%s[-+]?(\d+(\.\d*)?|\.\d+)([deflst][-+]?\d+)?(?=[%s])' %
|
811
|
-
(_exact_decimal_prefix, _delimiters), Number.Float, '#pop'),
|
812
|
-
(r'(?i)%s[-+]?(%s([-+]%s?i)?|[-+]%s?i)(?=[%s])' %
|
813
|
-
(_exact_decimal_prefix, _inexact_normal_no_hashes,
|
814
|
-
_inexact_normal_no_hashes, _inexact_normal_no_hashes,
|
815
|
-
_delimiters), Number, '#pop'),
|
816
|
-
|
817
|
-
# Inexact without explicit #i
|
818
|
-
(r'(?i)(#d)?(%s([-+]%s?i)?|[-+]%s?i|%s@%s)(?=[%s])' %
|
819
|
-
(_inexact_real, _inexact_unsigned, _inexact_unsigned,
|
820
|
-
_inexact_real, _inexact_real, _delimiters), Number.Float,
|
821
|
-
'#pop'),
|
822
|
-
|
823
|
-
# The remaining extflonums
|
824
|
-
(r'(?i)(([-+]?%st[-+]?\d+)|[-+](inf|nan)\.t)(?=[%s])' %
|
825
|
-
(_inexact_simple, _delimiters), Number.Float, '#pop'),
|
826
|
-
|
827
|
-
# #b
|
828
|
-
(r'(?i)(#[ei])?#b%s' % _symbol, Number.Bin, '#pop'),
|
829
|
-
|
830
|
-
# #o
|
831
|
-
(r'(?i)(#[ei])?#o%s' % _symbol, Number.Oct, '#pop'),
|
832
|
-
|
833
|
-
# #x
|
834
|
-
(r'(?i)(#[ei])?#x%s' % _symbol, Number.Hex, '#pop'),
|
835
|
-
|
836
|
-
# #i is always inexact, i.e. float
|
837
|
-
(r'(?i)(#d)?#i%s' % _symbol, Number.Float, '#pop'),
|
838
|
-
|
839
|
-
# Strings and characters
|
840
|
-
(r'#?"', String.Double, ('#pop', 'string')),
|
841
|
-
(r'#<<(.+)\n(^(?!\1$).*$\n)*^\1$', String.Heredoc, '#pop'),
|
842
|
-
(r'#\\(u[\da-fA-F]{1,4}|U[\da-fA-F]{1,8})', String.Char, '#pop'),
|
843
|
-
(r'(?is)#\\([0-7]{3}|[a-z]+|.)', String.Char, '#pop'),
|
844
|
-
(r'(?s)#[pr]x#?"(\\?.)*?"', String.Regex, '#pop'),
|
845
|
-
|
846
|
-
# Constants
|
847
|
-
(r'#(true|false|[tTfF])', Name.Constant, '#pop'),
|
848
|
-
|
849
|
-
# Keyword argument names (e.g. #:keyword)
|
850
|
-
(r'#:%s' % _symbol, Keyword.Declaration, '#pop'),
|
851
|
-
|
852
|
-
# Reader extensions
|
853
|
-
(r'(#lang |#!)(\S+)',
|
854
|
-
bygroups(Keyword.Namespace, Name.Namespace)),
|
855
|
-
(r'#reader', Keyword.Namespace, 'quoted-datum'),
|
856
|
-
|
857
|
-
# Other syntax
|
858
|
-
(r"(?i)\.(?=[%s])|#c[is]|#['`]|#,@?" % _delimiters, Operator),
|
859
|
-
(r"'|#[s&]|#hash(eqv?)?|#\d*(?=%s)" % _opening_parenthesis,
|
860
|
-
Operator, ('#pop', 'quoted-datum'))
|
861
|
-
],
|
862
|
-
'datum*': [
|
863
|
-
(r'`|,@?', Operator),
|
864
|
-
(_symbol, String.Symbol, '#pop'),
|
865
|
-
(r'[|\\]', Error),
|
866
|
-
default('#pop')
|
867
|
-
],
|
868
|
-
'list': [
|
869
|
-
(_closing_parenthesis, Punctuation, '#pop')
|
870
|
-
],
|
871
|
-
'unquoted-datum': [
|
872
|
-
include('datum'),
|
873
|
-
(r'quote(?=[%s])' % _delimiters, Keyword,
|
874
|
-
('#pop', 'quoted-datum')),
|
875
|
-
(r'`', Operator, ('#pop', 'quasiquoted-datum')),
|
876
|
-
(r'quasiquote(?=[%s])' % _delimiters, Keyword,
|
877
|
-
('#pop', 'quasiquoted-datum')),
|
878
|
-
(_opening_parenthesis, Punctuation, ('#pop', 'unquoted-list')),
|
879
|
-
(r'(?u)(%s)(?=[%s])' % ('|'.join(
|
880
|
-
[re.escape(entry) for entry in _keywords]), _delimiters),
|
881
|
-
Keyword, '#pop'),
|
882
|
-
(r'(?u)(%s)(?=[%s])' % ('|'.join(
|
883
|
-
[re.escape(entry) for entry in _builtins]), _delimiters),
|
884
|
-
Name.Builtin, '#pop'),
|
885
|
-
(_symbol, Name, '#pop'),
|
886
|
-
include('datum*')
|
887
|
-
],
|
888
|
-
'unquoted-list': [
|
889
|
-
include('list'),
|
890
|
-
(r'(?!\Z)', Text, 'unquoted-datum')
|
891
|
-
],
|
892
|
-
'quasiquoted-datum': [
|
893
|
-
include('datum'),
|
894
|
-
(r',@?', Operator, ('#pop', 'unquoted-datum')),
|
895
|
-
(r'unquote(-splicing)?(?=[%s])' % _delimiters, Keyword,
|
896
|
-
('#pop', 'unquoted-datum')),
|
897
|
-
(_opening_parenthesis, Punctuation, ('#pop', 'quasiquoted-list')),
|
898
|
-
include('datum*')
|
899
|
-
],
|
900
|
-
'quasiquoted-list': [
|
901
|
-
include('list'),
|
902
|
-
(r'(?!\Z)', Text, 'quasiquoted-datum')
|
903
|
-
],
|
904
|
-
'quoted-datum': [
|
905
|
-
include('datum'),
|
906
|
-
(_opening_parenthesis, Punctuation, ('#pop', 'quoted-list')),
|
907
|
-
include('datum*')
|
908
|
-
],
|
909
|
-
'quoted-list': [
|
910
|
-
include('list'),
|
911
|
-
(r'(?!\Z)', Text, 'quoted-datum')
|
912
|
-
],
|
913
|
-
'block-comment': [
|
914
|
-
(r'#\|', Comment.Multiline, '#push'),
|
915
|
-
(r'\|#', Comment.Multiline, '#pop'),
|
916
|
-
(r'[^#|]+|.', Comment.Multiline)
|
917
|
-
],
|
918
|
-
'string': [
|
919
|
-
(r'"', String.Double, '#pop'),
|
920
|
-
(r'(?s)\\([0-7]{1,3}|x[\da-fA-F]{1,2}|u[\da-fA-F]{1,4}|'
|
921
|
-
r'U[\da-fA-F]{1,8}|.)', String.Escape),
|
922
|
-
(r'[^\\"]+', String.Double)
|
923
|
-
]
|
924
|
-
}
|
925
|
-
|
926
|
-
|
927
|
-
class SchemeLexer(RegexLexer):
|
928
|
-
"""
|
929
|
-
A Scheme lexer, parsing a stream and outputting the tokens
|
930
|
-
needed to highlight scheme code.
|
931
|
-
This lexer could be most probably easily subclassed to parse
|
932
|
-
other LISP-Dialects like Common Lisp, Emacs Lisp or AutoLisp.
|
933
|
-
|
934
|
-
This parser is checked with pastes from the LISP pastebin
|
935
|
-
at http://paste.lisp.org/ to cover as much syntax as possible.
|
936
|
-
|
937
|
-
It supports the full Scheme syntax as defined in R5RS.
|
938
|
-
|
939
|
-
.. versionadded:: 0.6
|
940
|
-
"""
|
941
|
-
name = 'Scheme'
|
942
|
-
aliases = ['scheme', 'scm']
|
943
|
-
filenames = ['*.scm', '*.ss']
|
944
|
-
mimetypes = ['text/x-scheme', 'application/x-scheme']
|
945
|
-
|
946
|
-
# list of known keywords and builtins taken form vim 6.4 scheme.vim
|
947
|
-
# syntax file.
|
948
|
-
keywords = [
|
949
|
-
'lambda', 'define', 'if', 'else', 'cond', 'and', 'or', 'case', 'let',
|
950
|
-
'let*', 'letrec', 'begin', 'do', 'delay', 'set!', '=>', 'quote',
|
951
|
-
'quasiquote', 'unquote', 'unquote-splicing', 'define-syntax',
|
952
|
-
'let-syntax', 'letrec-syntax', 'syntax-rules'
|
953
|
-
]
|
954
|
-
builtins = [
|
955
|
-
'*', '+', '-', '/', '<', '<=', '=', '>', '>=', 'abs', 'acos', 'angle',
|
956
|
-
'append', 'apply', 'asin', 'assoc', 'assq', 'assv', 'atan',
|
957
|
-
'boolean?', 'caaaar', 'caaadr', 'caaar', 'caadar', 'caaddr', 'caadr',
|
958
|
-
'caar', 'cadaar', 'cadadr', 'cadar', 'caddar', 'cadddr', 'caddr',
|
959
|
-
'cadr', 'call-with-current-continuation', 'call-with-input-file',
|
960
|
-
'call-with-output-file', 'call-with-values', 'call/cc', 'car',
|
961
|
-
'cdaaar', 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar',
|
962
|
-
'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr', 'cddr',
|
963
|
-
'cdr', 'ceiling', 'char->integer', 'char-alphabetic?', 'char-ci<=?',
|
964
|
-
'char-ci<?', 'char-ci=?', 'char-ci>=?', 'char-ci>?', 'char-downcase',
|
965
|
-
'char-lower-case?', 'char-numeric?', 'char-ready?', 'char-upcase',
|
966
|
-
'char-upper-case?', 'char-whitespace?', 'char<=?', 'char<?', 'char=?',
|
967
|
-
'char>=?', 'char>?', 'char?', 'close-input-port', 'close-output-port',
|
968
|
-
'complex?', 'cons', 'cos', 'current-input-port', 'current-output-port',
|
969
|
-
'denominator', 'display', 'dynamic-wind', 'eof-object?', 'eq?',
|
970
|
-
'equal?', 'eqv?', 'eval', 'even?', 'exact->inexact', 'exact?', 'exp',
|
971
|
-
'expt', 'floor', 'for-each', 'force', 'gcd', 'imag-part',
|
972
|
-
'inexact->exact', 'inexact?', 'input-port?', 'integer->char',
|
973
|
-
'integer?', 'interaction-environment', 'lcm', 'length', 'list',
|
974
|
-
'list->string', 'list->vector', 'list-ref', 'list-tail', 'list?',
|
975
|
-
'load', 'log', 'magnitude', 'make-polar', 'make-rectangular',
|
976
|
-
'make-string', 'make-vector', 'map', 'max', 'member', 'memq', 'memv',
|
977
|
-
'min', 'modulo', 'negative?', 'newline', 'not', 'null-environment',
|
978
|
-
'null?', 'number->string', 'number?', 'numerator', 'odd?',
|
979
|
-
'open-input-file', 'open-output-file', 'output-port?', 'pair?',
|
980
|
-
'peek-char', 'port?', 'positive?', 'procedure?', 'quotient',
|
981
|
-
'rational?', 'rationalize', 'read', 'read-char', 'real-part', 'real?',
|
982
|
-
'remainder', 'reverse', 'round', 'scheme-report-environment',
|
983
|
-
'set-car!', 'set-cdr!', 'sin', 'sqrt', 'string', 'string->list',
|
984
|
-
'string->number', 'string->symbol', 'string-append', 'string-ci<=?',
|
985
|
-
'string-ci<?', 'string-ci=?', 'string-ci>=?', 'string-ci>?',
|
986
|
-
'string-copy', 'string-fill!', 'string-length', 'string-ref',
|
987
|
-
'string-set!', 'string<=?', 'string<?', 'string=?', 'string>=?',
|
988
|
-
'string>?', 'string?', 'substring', 'symbol->string', 'symbol?',
|
989
|
-
'tan', 'transcript-off', 'transcript-on', 'truncate', 'values',
|
990
|
-
'vector', 'vector->list', 'vector-fill!', 'vector-length',
|
991
|
-
'vector-ref', 'vector-set!', 'vector?', 'with-input-from-file',
|
992
|
-
'with-output-to-file', 'write', 'write-char', 'zero?'
|
993
|
-
]
|
994
|
-
|
995
|
-
# valid names for identifiers
|
996
|
-
# well, names can only not consist fully of numbers
|
997
|
-
# but this should be good enough for now
|
998
|
-
valid_name = r'[a-zA-Z0-9!$%&*+,/:<=>?@^_~|-]+'
|
999
|
-
|
1000
|
-
tokens = {
|
1001
|
-
'root' : [
|
1002
|
-
# the comments
|
1003
|
-
# and going to the end of the line
|
1004
|
-
(r';.*$', Comment.Single),
|
1005
|
-
# multi-line comment
|
1006
|
-
(r'#\|', Comment.Multiline, 'multiline-comment'),
|
1007
|
-
# commented form (entire sexpr folliwng)
|
1008
|
-
(r'#;\s*\(', Comment, 'commented-form'),
|
1009
|
-
# signifies that the program text that follows is written with the
|
1010
|
-
# lexical and datum syntax described in r6rs
|
1011
|
-
(r'#!r6rs', Comment),
|
1012
|
-
|
1013
|
-
# whitespaces - usually not relevant
|
1014
|
-
(r'\s+', Text),
|
1015
|
-
|
1016
|
-
# numbers
|
1017
|
-
(r'-?\d+\.\d+', Number.Float),
|
1018
|
-
(r'-?\d+', Number.Integer),
|
1019
|
-
# support for uncommon kinds of numbers -
|
1020
|
-
# have to figure out what the characters mean
|
1021
|
-
#(r'(#e|#i|#b|#o|#d|#x)[\d.]+', Number),
|
1022
|
-
|
1023
|
-
# strings, symbols and characters
|
1024
|
-
(r'"(\\\\|\\"|[^"])*"', String),
|
1025
|
-
(r"'" + valid_name, String.Symbol),
|
1026
|
-
(r"#\\([()/'\"._!§$%& ?=+-]{1}|[a-zA-Z0-9]+)", String.Char),
|
1027
|
-
|
1028
|
-
# constants
|
1029
|
-
(r'(#t|#f)', Name.Constant),
|
1030
|
-
|
1031
|
-
# special operators
|
1032
|
-
(r"('|#|`|,@|,|\.)", Operator),
|
1033
|
-
|
1034
|
-
# highlight the keywords
|
1035
|
-
('(%s)' % '|'.join([
|
1036
|
-
re.escape(entry) + ' ' for entry in keywords]),
|
1037
|
-
Keyword
|
1038
|
-
),
|
1039
|
-
|
1040
|
-
# first variable in a quoted string like
|
1041
|
-
# '(this is syntactic sugar)
|
1042
|
-
(r"(?<='\()" + valid_name, Name.Variable),
|
1043
|
-
(r"(?<=#\()" + valid_name, Name.Variable),
|
1044
|
-
|
1045
|
-
# highlight the builtins
|
1046
|
-
("(?<=\()(%s)" % '|'.join([
|
1047
|
-
re.escape(entry) + ' ' for entry in builtins]),
|
1048
|
-
Name.Builtin
|
1049
|
-
),
|
1050
|
-
|
1051
|
-
# the remaining functions
|
1052
|
-
(r'(?<=\()' + valid_name, Name.Function),
|
1053
|
-
# find the remaining variables
|
1054
|
-
(valid_name, Name.Variable),
|
1055
|
-
|
1056
|
-
# the famous parentheses!
|
1057
|
-
(r'(\(|\))', Punctuation),
|
1058
|
-
(r'(\[|\])', Punctuation),
|
1059
|
-
],
|
1060
|
-
'multiline-comment' : [
|
1061
|
-
(r'#\|', Comment.Multiline, '#push'),
|
1062
|
-
(r'\|#', Comment.Multiline, '#pop'),
|
1063
|
-
(r'[^|#]+', Comment.Multiline),
|
1064
|
-
(r'[|#]', Comment.Multiline),
|
1065
|
-
],
|
1066
|
-
'commented-form' : [
|
1067
|
-
(r'\(', Comment, '#push'),
|
1068
|
-
(r'\)', Comment, '#pop'),
|
1069
|
-
(r'[^()]+', Comment),
|
1070
|
-
],
|
1071
|
-
}
|
1072
|
-
|
1073
|
-
|
1074
|
-
class CommonLispLexer(RegexLexer):
|
1075
|
-
"""
|
1076
|
-
A Common Lisp lexer.
|
1077
|
-
|
1078
|
-
.. versionadded:: 0.9
|
1079
|
-
"""
|
1080
|
-
name = 'Common Lisp'
|
1081
|
-
aliases = ['common-lisp', 'cl', 'lisp', 'elisp', 'emacs', 'emacs-lisp']
|
1082
|
-
filenames = ['*.cl', '*.lisp', '*.el'] # use for Elisp too
|
1083
|
-
mimetypes = ['text/x-common-lisp']
|
1084
|
-
|
1085
|
-
flags = re.IGNORECASE | re.MULTILINE
|
1086
|
-
|
1087
|
-
### couple of useful regexes
|
1088
|
-
|
1089
|
-
# characters that are not macro-characters and can be used to begin a symbol
|
1090
|
-
nonmacro = r'\\.|[\w!$%&*+-/<=>?@\[\]^{}~]'
|
1091
|
-
constituent = nonmacro + '|[#.:]'
|
1092
|
-
terminated = r'(?=[ "()\'\n,;`])' # whitespace or terminating macro characters
|
1093
|
-
|
1094
|
-
### symbol token, reverse-engineered from hyperspec
|
1095
|
-
# Take a deep breath...
|
1096
|
-
symbol = r'(\|[^|]+\||(?:%s)(?:%s)*)' % (nonmacro, constituent)
|
1097
|
-
|
1098
|
-
def __init__(self, **options):
|
1099
|
-
from pygments.lexers._clbuiltins import BUILTIN_FUNCTIONS, \
|
1100
|
-
SPECIAL_FORMS, MACROS, LAMBDA_LIST_KEYWORDS, DECLARATIONS, \
|
1101
|
-
BUILTIN_TYPES, BUILTIN_CLASSES
|
1102
|
-
self.builtin_function = BUILTIN_FUNCTIONS
|
1103
|
-
self.special_forms = SPECIAL_FORMS
|
1104
|
-
self.macros = MACROS
|
1105
|
-
self.lambda_list_keywords = LAMBDA_LIST_KEYWORDS
|
1106
|
-
self.declarations = DECLARATIONS
|
1107
|
-
self.builtin_types = BUILTIN_TYPES
|
1108
|
-
self.builtin_classes = BUILTIN_CLASSES
|
1109
|
-
RegexLexer.__init__(self, **options)
|
1110
|
-
|
1111
|
-
def get_tokens_unprocessed(self, text):
|
1112
|
-
stack = ['root']
|
1113
|
-
for index, token, value in RegexLexer.get_tokens_unprocessed(self, text, stack):
|
1114
|
-
if token is Name.Variable:
|
1115
|
-
if value in self.builtin_function:
|
1116
|
-
yield index, Name.Builtin, value
|
1117
|
-
continue
|
1118
|
-
if value in self.special_forms:
|
1119
|
-
yield index, Keyword, value
|
1120
|
-
continue
|
1121
|
-
if value in self.macros:
|
1122
|
-
yield index, Name.Builtin, value
|
1123
|
-
continue
|
1124
|
-
if value in self.lambda_list_keywords:
|
1125
|
-
yield index, Keyword, value
|
1126
|
-
continue
|
1127
|
-
if value in self.declarations:
|
1128
|
-
yield index, Keyword, value
|
1129
|
-
continue
|
1130
|
-
if value in self.builtin_types:
|
1131
|
-
yield index, Keyword.Type, value
|
1132
|
-
continue
|
1133
|
-
if value in self.builtin_classes:
|
1134
|
-
yield index, Name.Class, value
|
1135
|
-
continue
|
1136
|
-
yield index, token, value
|
1137
|
-
|
1138
|
-
tokens = {
|
1139
|
-
'root' : [
|
1140
|
-
('', Text, 'body'),
|
1141
|
-
],
|
1142
|
-
'multiline-comment' : [
|
1143
|
-
(r'#\|', Comment.Multiline, '#push'), # (cf. Hyperspec 2.4.8.19)
|
1144
|
-
(r'\|#', Comment.Multiline, '#pop'),
|
1145
|
-
(r'[^|#]+', Comment.Multiline),
|
1146
|
-
(r'[|#]', Comment.Multiline),
|
1147
|
-
],
|
1148
|
-
'commented-form' : [
|
1149
|
-
(r'\(', Comment.Preproc, '#push'),
|
1150
|
-
(r'\)', Comment.Preproc, '#pop'),
|
1151
|
-
(r'[^()]+', Comment.Preproc),
|
1152
|
-
],
|
1153
|
-
'body' : [
|
1154
|
-
# whitespace
|
1155
|
-
(r'\s+', Text),
|
1156
|
-
|
1157
|
-
# single-line comment
|
1158
|
-
(r';.*$', Comment.Single),
|
1159
|
-
|
1160
|
-
# multi-line comment
|
1161
|
-
(r'#\|', Comment.Multiline, 'multiline-comment'),
|
1162
|
-
|
1163
|
-
# encoding comment (?)
|
1164
|
-
(r'#\d*Y.*$', Comment.Special),
|
1165
|
-
|
1166
|
-
# strings and characters
|
1167
|
-
(r'"(\\.|\\\n|[^"\\])*"', String),
|
1168
|
-
# quoting
|
1169
|
-
(r":" + symbol, String.Symbol),
|
1170
|
-
(r"::" + symbol, String.Symbol),
|
1171
|
-
(r":#" + symbol, String.Symbol),
|
1172
|
-
(r"'" + symbol, String.Symbol),
|
1173
|
-
(r"'", Operator),
|
1174
|
-
(r"`", Operator),
|
1175
|
-
|
1176
|
-
# decimal numbers
|
1177
|
-
(r'[-+]?\d+\.?' + terminated, Number.Integer),
|
1178
|
-
(r'[-+]?\d+/\d+' + terminated, Number),
|
1179
|
-
(r'[-+]?(\d*\.\d+([defls][-+]?\d+)?|\d+(\.\d*)?[defls][-+]?\d+)' \
|
1180
|
-
+ terminated, Number.Float),
|
1181
|
-
|
1182
|
-
# sharpsign strings and characters
|
1183
|
-
(r"#\\." + terminated, String.Char),
|
1184
|
-
(r"#\\" + symbol, String.Char),
|
1185
|
-
|
1186
|
-
# vector
|
1187
|
-
(r'#\(', Operator, 'body'),
|
1188
|
-
|
1189
|
-
# bitstring
|
1190
|
-
(r'#\d*\*[01]*', Literal.Other),
|
1191
|
-
|
1192
|
-
# uninterned symbol
|
1193
|
-
(r'#:' + symbol, String.Symbol),
|
1194
|
-
|
1195
|
-
# read-time and load-time evaluation
|
1196
|
-
(r'#[.,]', Operator),
|
1197
|
-
|
1198
|
-
# function shorthand
|
1199
|
-
(r'#\'', Name.Function),
|
1200
|
-
|
1201
|
-
# binary rational
|
1202
|
-
(r'#[bB][+-]?[01]+(/[01]+)?', Number.Bin),
|
1203
|
-
|
1204
|
-
# octal rational
|
1205
|
-
(r'#[oO][+-]?[0-7]+(/[0-7]+)?', Number.Oct),
|
1206
|
-
|
1207
|
-
# hex rational
|
1208
|
-
(r'#[xX][+-]?[0-9a-f]+(/[0-9a-f]+)?', Number.Hex),
|
1209
|
-
|
1210
|
-
# radix rational
|
1211
|
-
(r'#\d+[rR][+-]?[0-9a-z]+(/[0-9a-z]+)?', Number),
|
1212
|
-
|
1213
|
-
# complex
|
1214
|
-
(r'(#[cC])(\()', bygroups(Number, Punctuation), 'body'),
|
1215
|
-
|
1216
|
-
# array
|
1217
|
-
(r'(#\d+[aA])(\()', bygroups(Literal.Other, Punctuation), 'body'),
|
1218
|
-
|
1219
|
-
# structure
|
1220
|
-
(r'(#[sS])(\()', bygroups(Literal.Other, Punctuation), 'body'),
|
1221
|
-
|
1222
|
-
# path
|
1223
|
-
(r'#[pP]?"(\\.|[^"])*"', Literal.Other),
|
1224
|
-
|
1225
|
-
# reference
|
1226
|
-
(r'#\d+=', Operator),
|
1227
|
-
(r'#\d+#', Operator),
|
1228
|
-
|
1229
|
-
# read-time comment
|
1230
|
-
(r'#+nil' + terminated + '\s*\(', Comment.Preproc, 'commented-form'),
|
1231
|
-
|
1232
|
-
# read-time conditional
|
1233
|
-
(r'#[+-]', Operator),
|
1234
|
-
|
1235
|
-
# special operators that should have been parsed already
|
1236
|
-
(r'(,@|,|\.)', Operator),
|
1237
|
-
|
1238
|
-
# special constants
|
1239
|
-
(r'(t|nil)' + terminated, Name.Constant),
|
1240
|
-
|
1241
|
-
# functions and variables
|
1242
|
-
(r'\*' + symbol + '\*', Name.Variable.Global),
|
1243
|
-
(symbol, Name.Variable),
|
1244
|
-
|
1245
|
-
# parentheses
|
1246
|
-
(r'\(', Punctuation, 'body'),
|
1247
|
-
(r'\)', Punctuation, '#pop'),
|
1248
|
-
],
|
1249
|
-
}
|
1250
|
-
|
1251
|
-
|
1252
|
-
class CryptolLexer(RegexLexer):
|
1253
|
-
"""
|
1254
|
-
FIXME: A Cryptol2 lexer based on the lexemes defined in the Haskell 98 Report.
|
1255
|
-
|
1256
|
-
.. versionadded:: 2.0
|
1257
|
-
"""
|
1258
|
-
name = 'Cryptol'
|
1259
|
-
aliases = ['cryptol', 'cry']
|
1260
|
-
filenames = ['*.cry']
|
1261
|
-
mimetypes = ['text/x-cryptol']
|
1262
|
-
|
1263
|
-
reserved = ['Arith','Bit','Cmp','False','Inf','True','else',
|
1264
|
-
'export','extern','fin','if','import','inf','lg2',
|
1265
|
-
'max','min','module','newtype','pragma','property',
|
1266
|
-
'then','type','where','width']
|
1267
|
-
ascii = ['NUL','SOH','[SE]TX','EOT','ENQ','ACK',
|
1268
|
-
'BEL','BS','HT','LF','VT','FF','CR','S[OI]','DLE',
|
1269
|
-
'DC[1-4]','NAK','SYN','ETB','CAN',
|
1270
|
-
'EM','SUB','ESC','[FGRU]S','SP','DEL']
|
1271
|
-
|
1272
|
-
tokens = {
|
1273
|
-
'root': [
|
1274
|
-
# Whitespace:
|
1275
|
-
(r'\s+', Text),
|
1276
|
-
#(r'--\s*|.*$', Comment.Doc),
|
1277
|
-
(r'//.*$', Comment.Single),
|
1278
|
-
(r'/\*', Comment.Multiline, 'comment'),
|
1279
|
-
# Lexemes:
|
1280
|
-
# Identifiers
|
1281
|
-
(r'\bimport\b', Keyword.Reserved, 'import'),
|
1282
|
-
(r'\bmodule\b', Keyword.Reserved, 'module'),
|
1283
|
-
(r'\berror\b', Name.Exception),
|
1284
|
-
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
1285
|
-
(r'^[_a-z][\w\']*', Name.Function),
|
1286
|
-
(r"'?[_a-z][\w']*", Name),
|
1287
|
-
(r"('')?[A-Z][\w\']*", Keyword.Type),
|
1288
|
-
# Operators
|
1289
|
-
(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator
|
1290
|
-
(r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
|
1291
|
-
(r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type), # Constructor operators
|
1292
|
-
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), # Other operators
|
1293
|
-
# Numbers
|
1294
|
-
(r'\d+[eE][+-]?\d+', Number.Float),
|
1295
|
-
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
1296
|
-
(r'0[oO][0-7]+', Number.Oct),
|
1297
|
-
(r'0[xX][\da-fA-F]+', Number.Hex),
|
1298
|
-
(r'\d+', Number.Integer),
|
1299
|
-
# Character/String Literals
|
1300
|
-
(r"'", String.Char, 'character'),
|
1301
|
-
(r'"', String, 'string'),
|
1302
|
-
# Special
|
1303
|
-
(r'\[\]', Keyword.Type),
|
1304
|
-
(r'\(\)', Name.Builtin),
|
1305
|
-
(r'[][(),;`{}]', Punctuation),
|
1306
|
-
],
|
1307
|
-
'import': [
|
1308
|
-
# Import statements
|
1309
|
-
(r'\s+', Text),
|
1310
|
-
(r'"', String, 'string'),
|
1311
|
-
# after "funclist" state
|
1312
|
-
(r'\)', Punctuation, '#pop'),
|
1313
|
-
(r'qualified\b', Keyword),
|
1314
|
-
# import X as Y
|
1315
|
-
(r'([A-Z][a-zA-Z0-9_.]*)(\s+)(as)(\s+)([A-Z][a-zA-Z0-9_.]*)',
|
1316
|
-
bygroups(Name.Namespace, Text, Keyword, Text, Name), '#pop'),
|
1317
|
-
# import X hiding (functions)
|
1318
|
-
(r'([A-Z][a-zA-Z0-9_.]*)(\s+)(hiding)(\s+)(\()',
|
1319
|
-
bygroups(Name.Namespace, Text, Keyword, Text, Punctuation), 'funclist'),
|
1320
|
-
# import X (functions)
|
1321
|
-
(r'([A-Z][a-zA-Z0-9_.]*)(\s+)(\()',
|
1322
|
-
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
1323
|
-
# import X
|
1324
|
-
(r'[a-zA-Z0-9_.]+', Name.Namespace, '#pop'),
|
1325
|
-
],
|
1326
|
-
'module': [
|
1327
|
-
(r'\s+', Text),
|
1328
|
-
(r'([A-Z][a-zA-Z0-9_.]*)(\s+)(\()',
|
1329
|
-
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
1330
|
-
(r'[A-Z][a-zA-Z0-9_.]*', Name.Namespace, '#pop'),
|
1331
|
-
],
|
1332
|
-
'funclist': [
|
1333
|
-
(r'\s+', Text),
|
1334
|
-
(r'[A-Z][a-zA-Z0-9_]*', Keyword.Type),
|
1335
|
-
(r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
|
1336
|
-
(r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
|
1337
|
-
(r'{-', Comment.Multiline, 'comment'),
|
1338
|
-
(r',', Punctuation),
|
1339
|
-
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
|
1340
|
-
# (HACK, but it makes sense to push two instances, believe me)
|
1341
|
-
(r'\(', Punctuation, ('funclist', 'funclist')),
|
1342
|
-
(r'\)', Punctuation, '#pop:2'),
|
1343
|
-
],
|
1344
|
-
'comment': [
|
1345
|
-
# Multiline Comments
|
1346
|
-
(r'[^/\*]+', Comment.Multiline),
|
1347
|
-
(r'/\*', Comment.Multiline, '#push'),
|
1348
|
-
(r'\*/', Comment.Multiline, '#pop'),
|
1349
|
-
(r'[\*/]', Comment.Multiline),
|
1350
|
-
],
|
1351
|
-
'character': [
|
1352
|
-
# Allows multi-chars, incorrectly.
|
1353
|
-
(r"[^\\']'", String.Char, '#pop'),
|
1354
|
-
(r"\\", String.Escape, 'escape'),
|
1355
|
-
("'", String.Char, '#pop'),
|
1356
|
-
],
|
1357
|
-
'string': [
|
1358
|
-
(r'[^\\"]+', String),
|
1359
|
-
(r"\\", String.Escape, 'escape'),
|
1360
|
-
('"', String, '#pop'),
|
1361
|
-
],
|
1362
|
-
'escape': [
|
1363
|
-
(r'[abfnrtv"\'&\\]', String.Escape, '#pop'),
|
1364
|
-
(r'\^[][A-Z@\^_]', String.Escape, '#pop'),
|
1365
|
-
('|'.join(ascii), String.Escape, '#pop'),
|
1366
|
-
(r'o[0-7]+', String.Escape, '#pop'),
|
1367
|
-
(r'x[\da-fA-F]+', String.Escape, '#pop'),
|
1368
|
-
(r'\d+', String.Escape, '#pop'),
|
1369
|
-
(r'\s+\\', String.Escape, '#pop'),
|
1370
|
-
],
|
1371
|
-
}
|
1372
|
-
|
1373
|
-
EXTRA_KEYWORDS = ['join', 'split', 'reverse', 'transpose', 'width',
|
1374
|
-
'length', 'tail', '<<', '>>', '<<<', '>>>', 'const',
|
1375
|
-
'reg', 'par', 'seq', 'ASSERT', 'undefined', 'error',
|
1376
|
-
'trace']
|
1377
|
-
|
1378
|
-
def get_tokens_unprocessed(self, text):
|
1379
|
-
stack = ['root']
|
1380
|
-
for index, token, value in \
|
1381
|
-
RegexLexer.get_tokens_unprocessed(self, text, stack):
|
1382
|
-
if token is Name and value in self.EXTRA_KEYWORDS:
|
1383
|
-
yield index, Name.Builtin, value
|
1384
|
-
else:
|
1385
|
-
yield index, token, value
|
1386
|
-
|
1387
|
-
|
1388
|
-
class HaskellLexer(RegexLexer):
|
1389
|
-
"""
|
1390
|
-
A Haskell lexer based on the lexemes defined in the Haskell 98 Report.
|
1391
|
-
|
1392
|
-
.. versionadded:: 0.8
|
1393
|
-
"""
|
1394
|
-
name = 'Haskell'
|
1395
|
-
aliases = ['haskell', 'hs']
|
1396
|
-
filenames = ['*.hs']
|
1397
|
-
mimetypes = ['text/x-haskell']
|
1398
|
-
|
1399
|
-
flags = re.MULTILINE | re.UNICODE
|
1400
|
-
|
1401
|
-
reserved = ['case','class','data','default','deriving','do','else',
|
1402
|
-
'if','in','infix[lr]?','instance',
|
1403
|
-
'let','newtype','of','then','type','where','_']
|
1404
|
-
ascii = ['NUL','SOH','[SE]TX','EOT','ENQ','ACK',
|
1405
|
-
'BEL','BS','HT','LF','VT','FF','CR','S[OI]','DLE',
|
1406
|
-
'DC[1-4]','NAK','SYN','ETB','CAN',
|
1407
|
-
'EM','SUB','ESC','[FGRU]S','SP','DEL']
|
1408
|
-
|
1409
|
-
tokens = {
|
1410
|
-
'root': [
|
1411
|
-
# Whitespace:
|
1412
|
-
(r'\s+', Text),
|
1413
|
-
#(r'--\s*|.*$', Comment.Doc),
|
1414
|
-
(r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
|
1415
|
-
(r'{-', Comment.Multiline, 'comment'),
|
1416
|
-
# Lexemes:
|
1417
|
-
# Identifiers
|
1418
|
-
(r'\bimport\b', Keyword.Reserved, 'import'),
|
1419
|
-
(r'\bmodule\b', Keyword.Reserved, 'module'),
|
1420
|
-
(r'\berror\b', Name.Exception),
|
1421
|
-
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
1422
|
-
(r'^[_' + uni.Ll + r'][\w\']*', Name.Function),
|
1423
|
-
(r"'?[_" + uni.Ll + r"'][\w']*", Name),
|
1424
|
-
(r"('')?[" + uni.Lu + r"][\w\']*", Keyword.Type),
|
1425
|
-
# Operators
|
1426
|
-
(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator
|
1427
|
-
(r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
|
1428
|
-
(r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type), # Constructor operators
|
1429
|
-
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), # Other operators
|
1430
|
-
# Numbers
|
1431
|
-
(r'\d+[eE][+-]?\d+', Number.Float),
|
1432
|
-
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
1433
|
-
(r'0[oO][0-7]+', Number.Oct),
|
1434
|
-
(r'0[xX][\da-fA-F]+', Number.Hex),
|
1435
|
-
(r'\d+', Number.Integer),
|
1436
|
-
# Character/String Literals
|
1437
|
-
(r"'", String.Char, 'character'),
|
1438
|
-
(r'"', String, 'string'),
|
1439
|
-
# Special
|
1440
|
-
(r'\[\]', Keyword.Type),
|
1441
|
-
(r'\(\)', Name.Builtin),
|
1442
|
-
(r'[][(),;`{}]', Punctuation),
|
1443
|
-
],
|
1444
|
-
'import': [
|
1445
|
-
# Import statements
|
1446
|
-
(r'\s+', Text),
|
1447
|
-
(r'"', String, 'string'),
|
1448
|
-
# after "funclist" state
|
1449
|
-
(r'\)', Punctuation, '#pop'),
|
1450
|
-
(r'qualified\b', Keyword),
|
1451
|
-
# import X as Y
|
1452
|
-
(r'([' + uni.Lu + r'][\w.]*)(\s+)(as)(\s+)([' + uni.Lu + r'][\w.]*)',
|
1453
|
-
bygroups(Name.Namespace, Text, Keyword, Text, Name), '#pop'),
|
1454
|
-
# import X hiding (functions)
|
1455
|
-
(r'([' + uni.Lu + r'][\w.]*)(\s+)(hiding)(\s+)(\()',
|
1456
|
-
bygroups(Name.Namespace, Text, Keyword, Text, Punctuation), 'funclist'),
|
1457
|
-
# import X (functions)
|
1458
|
-
(r'([' + uni.Lu + r'][\w.]*)(\s+)(\()',
|
1459
|
-
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
1460
|
-
# import X
|
1461
|
-
(r'[\w.]+', Name.Namespace, '#pop'),
|
1462
|
-
],
|
1463
|
-
'module': [
|
1464
|
-
(r'\s+', Text),
|
1465
|
-
(r'([' + uni.Lu + r'][\w.]*)(\s+)(\()',
|
1466
|
-
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
1467
|
-
(r'[' + uni.Lu + r'][\w.]*', Name.Namespace, '#pop'),
|
1468
|
-
],
|
1469
|
-
'funclist': [
|
1470
|
-
(r'\s+', Text),
|
1471
|
-
(r'[' + uni.Lu + r']\w*', Keyword.Type),
|
1472
|
-
(r'(_[\w\']+|[' + uni.Ll + r'][\w\']*)', Name.Function),
|
1473
|
-
(r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
|
1474
|
-
(r'{-', Comment.Multiline, 'comment'),
|
1475
|
-
(r',', Punctuation),
|
1476
|
-
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
|
1477
|
-
# (HACK, but it makes sense to push two instances, believe me)
|
1478
|
-
(r'\(', Punctuation, ('funclist', 'funclist')),
|
1479
|
-
(r'\)', Punctuation, '#pop:2'),
|
1480
|
-
],
|
1481
|
-
# NOTE: the next four states are shared in the AgdaLexer; make sure
|
1482
|
-
# any change is compatible with Agda as well or copy over and change
|
1483
|
-
'comment': [
|
1484
|
-
# Multiline Comments
|
1485
|
-
(r'[^-{}]+', Comment.Multiline),
|
1486
|
-
(r'{-', Comment.Multiline, '#push'),
|
1487
|
-
(r'-}', Comment.Multiline, '#pop'),
|
1488
|
-
(r'[-{}]', Comment.Multiline),
|
1489
|
-
],
|
1490
|
-
'character': [
|
1491
|
-
# Allows multi-chars, incorrectly.
|
1492
|
-
(r"[^\\']'", String.Char, '#pop'),
|
1493
|
-
(r"\\", String.Escape, 'escape'),
|
1494
|
-
("'", String.Char, '#pop'),
|
1495
|
-
],
|
1496
|
-
'string': [
|
1497
|
-
(r'[^\\"]+', String),
|
1498
|
-
(r"\\", String.Escape, 'escape'),
|
1499
|
-
('"', String, '#pop'),
|
1500
|
-
],
|
1501
|
-
'escape': [
|
1502
|
-
(r'[abfnrtv"\'&\\]', String.Escape, '#pop'),
|
1503
|
-
(r'\^[][' + uni.Lu + r'@\^_]', String.Escape, '#pop'),
|
1504
|
-
('|'.join(ascii), String.Escape, '#pop'),
|
1505
|
-
(r'o[0-7]+', String.Escape, '#pop'),
|
1506
|
-
(r'x[\da-fA-F]+', String.Escape, '#pop'),
|
1507
|
-
(r'\d+', String.Escape, '#pop'),
|
1508
|
-
(r'\s+\\', String.Escape, '#pop'),
|
1509
|
-
],
|
1510
|
-
}
|
1511
|
-
|
1512
|
-
|
1513
|
-
class IdrisLexer(RegexLexer):
|
1514
|
-
"""
|
1515
|
-
A lexer for the dependently typed programming language Idris.
|
1516
|
-
|
1517
|
-
Based on the Haskell and Agda Lexer.
|
1518
|
-
|
1519
|
-
.. versionadded:: 2.0
|
1520
|
-
"""
|
1521
|
-
name = 'Idris'
|
1522
|
-
aliases = ['idris', 'idr']
|
1523
|
-
filenames = ['*.idr']
|
1524
|
-
mimetypes = ['text/x-idris']
|
1525
|
-
|
1526
|
-
reserved = ['case','class','data','default','using','do','else',
|
1527
|
-
'if','in','infix[lr]?','instance','rewrite','auto',
|
1528
|
-
'namespace','codata','mutual','private','public','abstract',
|
1529
|
-
'total','partial',
|
1530
|
-
'let','proof','of','then','static','where','_','with',
|
1531
|
-
'pattern', 'term', 'syntax','prefix',
|
1532
|
-
'postulate','parameters','record','dsl','impossible','implicit',
|
1533
|
-
'tactics','intros','intro','compute','refine','exaxt','trivial']
|
1534
|
-
|
1535
|
-
ascii = ['NUL','SOH','[SE]TX','EOT','ENQ','ACK',
|
1536
|
-
'BEL','BS','HT','LF','VT','FF','CR','S[OI]','DLE',
|
1537
|
-
'DC[1-4]','NAK','SYN','ETB','CAN',
|
1538
|
-
'EM','SUB','ESC','[FGRU]S','SP','DEL']
|
1539
|
-
|
1540
|
-
annotations = ['assert_total','lib','link','include','provide','access',
|
1541
|
-
'default']
|
1542
|
-
|
1543
|
-
tokens = {
|
1544
|
-
'root': [
|
1545
|
-
# Declaration
|
1546
|
-
(r'^(\s*)([^\s\(\)\{\}]+)(\s*)(:)(\s*)',
|
1547
|
-
bygroups(Text, Name.Function, Text, Operator.Word, Text)),
|
1548
|
-
# Comments
|
1549
|
-
(r'^(\s*)(%%%s)' % '|'.join(annotations),
|
1550
|
-
bygroups(Text, Keyword.Reserved)),
|
1551
|
-
(r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
|
1552
|
-
(r'{-', Comment.Multiline, 'comment'),
|
1553
|
-
# Identifiers
|
1554
|
-
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
1555
|
-
(r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'),
|
1556
|
-
(r"('')?[A-Z][\w\']*", Keyword.Type),
|
1557
|
-
(r'[a-z][\w\']*', Text),
|
1558
|
-
# Special Symbols
|
1559
|
-
(r'(<-|::|->|=>|=)', Operator.Word), # specials
|
1560
|
-
(r'([\(\)\{\}\[\]:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
|
1561
|
-
# Numbers
|
1562
|
-
(r'\d+[eE][+-]?\d+', Number.Float),
|
1563
|
-
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
1564
|
-
(r'0[xX][\da-fA-F]+', Number.Hex),
|
1565
|
-
(r'\d+', Number.Integer),
|
1566
|
-
# Strings
|
1567
|
-
(r"'", String.Char, 'character'),
|
1568
|
-
(r'"', String, 'string'),
|
1569
|
-
(r'[^\s\(\)\{\}]+', Text),
|
1570
|
-
(r'\s+?', Text), # Whitespace
|
1571
|
-
],
|
1572
|
-
'module': [
|
1573
|
-
(r'\s+', Text),
|
1574
|
-
(r'([A-Z][\w.]*)(\s+)(\()',
|
1575
|
-
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
1576
|
-
(r'[A-Z][\w.]*', Name.Namespace, '#pop'),
|
1577
|
-
],
|
1578
|
-
'funclist': [
|
1579
|
-
(r'\s+', Text),
|
1580
|
-
(r'[A-Z]\w*', Keyword.Type),
|
1581
|
-
(r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
|
1582
|
-
(r'--.*$', Comment.Single),
|
1583
|
-
(r'{-', Comment.Multiline, 'comment'),
|
1584
|
-
(r',', Punctuation),
|
1585
|
-
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
|
1586
|
-
# (HACK, but it makes sense to push two instances, believe me)
|
1587
|
-
(r'\(', Punctuation, ('funclist', 'funclist')),
|
1588
|
-
(r'\)', Punctuation, '#pop:2'),
|
1589
|
-
],
|
1590
|
-
# NOTE: the next four states are shared in the AgdaLexer; make sure
|
1591
|
-
# any change is compatible with Agda as well or copy over and change
|
1592
|
-
'comment': [
|
1593
|
-
# Multiline Comments
|
1594
|
-
(r'[^-{}]+', Comment.Multiline),
|
1595
|
-
(r'{-', Comment.Multiline, '#push'),
|
1596
|
-
(r'-}', Comment.Multiline, '#pop'),
|
1597
|
-
(r'[-{}]', Comment.Multiline),
|
1598
|
-
],
|
1599
|
-
'character': [
|
1600
|
-
# Allows multi-chars, incorrectly.
|
1601
|
-
(r"[^\\']", String.Char),
|
1602
|
-
(r"\\", String.Escape, 'escape'),
|
1603
|
-
("'", String.Char, '#pop'),
|
1604
|
-
],
|
1605
|
-
'string': [
|
1606
|
-
(r'[^\\"]+', String),
|
1607
|
-
(r"\\", String.Escape, 'escape'),
|
1608
|
-
('"', String, '#pop'),
|
1609
|
-
],
|
1610
|
-
'escape': [
|
1611
|
-
(r'[abfnrtv"\'&\\]', String.Escape, '#pop'),
|
1612
|
-
(r'\^[][A-Z@\^_]', String.Escape, '#pop'),
|
1613
|
-
('|'.join(ascii), String.Escape, '#pop'),
|
1614
|
-
(r'o[0-7]+', String.Escape, '#pop'),
|
1615
|
-
(r'x[\da-fA-F]+', String.Escape, '#pop'),
|
1616
|
-
(r'\d+', String.Escape, '#pop'),
|
1617
|
-
(r'\s+\\', String.Escape, '#pop')
|
1618
|
-
],
|
1619
|
-
}
|
1620
|
-
|
1621
|
-
|
1622
|
-
class AgdaLexer(RegexLexer):
|
1623
|
-
"""
|
1624
|
-
For the `Agda <http://wiki.portal.chalmers.se/agda/pmwiki.php>`_
|
1625
|
-
dependently typed functional programming language and proof assistant.
|
1626
|
-
|
1627
|
-
.. versionadded:: 2.0
|
1628
|
-
"""
|
1629
|
-
|
1630
|
-
name = 'Agda'
|
1631
|
-
aliases = ['agda']
|
1632
|
-
filenames = ['*.agda']
|
1633
|
-
mimetypes = ['text/x-agda']
|
1634
|
-
|
1635
|
-
reserved = ['abstract', 'codata', 'coinductive', 'constructor', 'data',
|
1636
|
-
'field', 'forall', 'hiding', 'in', 'inductive', 'infix',
|
1637
|
-
'infixl', 'infixr', 'let', 'open', 'pattern', 'primitive',
|
1638
|
-
'private', 'mutual', 'quote', 'quoteGoal', 'quoteTerm',
|
1639
|
-
'record', 'syntax', 'rewrite', 'unquote', 'using', 'where',
|
1640
|
-
'with']
|
1641
|
-
|
1642
|
-
tokens = {
|
1643
|
-
'root': [
|
1644
|
-
# Declaration
|
1645
|
-
(r'^(\s*)([^\s\(\)\{\}]+)(\s*)(:)(\s*)',
|
1646
|
-
bygroups(Text, Name.Function, Text, Operator.Word, Text)),
|
1647
|
-
# Comments
|
1648
|
-
(r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
|
1649
|
-
(r'{-', Comment.Multiline, 'comment'),
|
1650
|
-
# Holes
|
1651
|
-
(r'{!', Comment.Directive, 'hole'),
|
1652
|
-
# Lexemes:
|
1653
|
-
# Identifiers
|
1654
|
-
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
1655
|
-
(r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'),
|
1656
|
-
(r'\b(Set|Prop)\b', Keyword.Type),
|
1657
|
-
# Special Symbols
|
1658
|
-
(r'(\(|\)|\{|\})', Operator),
|
1659
|
-
(u'(\\.{1,3}|\\||\u039B|\u2200|\u2192|:|=|->)', Operator.Word),
|
1660
|
-
# Numbers
|
1661
|
-
(r'\d+[eE][+-]?\d+', Number.Float),
|
1662
|
-
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
1663
|
-
(r'0[xX][\da-fA-F]+', Number.Hex),
|
1664
|
-
(r'\d+', Number.Integer),
|
1665
|
-
# Strings
|
1666
|
-
(r"'", String.Char, 'character'),
|
1667
|
-
(r'"', String, 'string'),
|
1668
|
-
(r'[^\s\(\)\{\}]+', Text),
|
1669
|
-
(r'\s+?', Text), # Whitespace
|
1670
|
-
],
|
1671
|
-
'hole': [
|
1672
|
-
# Holes
|
1673
|
-
(r'[^!{}]+', Comment.Directive),
|
1674
|
-
(r'{!', Comment.Directive, '#push'),
|
1675
|
-
(r'!}', Comment.Directive, '#pop'),
|
1676
|
-
(r'[!{}]', Comment.Directive),
|
1677
|
-
],
|
1678
|
-
'module': [
|
1679
|
-
(r'{-', Comment.Multiline, 'comment'),
|
1680
|
-
(r'[a-zA-Z][\w.]*', Name, '#pop'),
|
1681
|
-
(r'[^a-zA-Z]*', Text)
|
1682
|
-
],
|
1683
|
-
'comment': HaskellLexer.tokens['comment'],
|
1684
|
-
'character': HaskellLexer.tokens['character'],
|
1685
|
-
'string': HaskellLexer.tokens['string'],
|
1686
|
-
'escape': HaskellLexer.tokens['escape']
|
1687
|
-
}
|
1688
|
-
|
1689
|
-
|
1690
|
-
class LiterateLexer(Lexer):
|
1691
|
-
"""
|
1692
|
-
Base class for lexers of literate file formats based on LaTeX or Bird-style
|
1693
|
-
(prefixing each code line with ">").
|
1694
|
-
|
1695
|
-
Additional options accepted:
|
1696
|
-
|
1697
|
-
`litstyle`
|
1698
|
-
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
1699
|
-
is autodetected: if the first non-whitespace character in the source
|
1700
|
-
is a backslash or percent character, LaTeX is assumed, else Bird.
|
1701
|
-
"""
|
1702
|
-
|
1703
|
-
bird_re = re.compile(r'(>[ \t]*)(.*\n)')
|
1704
|
-
|
1705
|
-
def __init__(self, baselexer, **options):
|
1706
|
-
self.baselexer = baselexer
|
1707
|
-
Lexer.__init__(self, **options)
|
1708
|
-
|
1709
|
-
def get_tokens_unprocessed(self, text):
|
1710
|
-
style = self.options.get('litstyle')
|
1711
|
-
if style is None:
|
1712
|
-
style = (text.lstrip()[0:1] in '%\\') and 'latex' or 'bird'
|
1713
|
-
|
1714
|
-
code = ''
|
1715
|
-
insertions = []
|
1716
|
-
if style == 'bird':
|
1717
|
-
# bird-style
|
1718
|
-
for match in line_re.finditer(text):
|
1719
|
-
line = match.group()
|
1720
|
-
m = self.bird_re.match(line)
|
1721
|
-
if m:
|
1722
|
-
insertions.append((len(code),
|
1723
|
-
[(0, Comment.Special, m.group(1))]))
|
1724
|
-
code += m.group(2)
|
1725
|
-
else:
|
1726
|
-
insertions.append((len(code), [(0, Text, line)]))
|
1727
|
-
else:
|
1728
|
-
# latex-style
|
1729
|
-
from pygments.lexers.text import TexLexer
|
1730
|
-
lxlexer = TexLexer(**self.options)
|
1731
|
-
codelines = 0
|
1732
|
-
latex = ''
|
1733
|
-
for match in line_re.finditer(text):
|
1734
|
-
line = match.group()
|
1735
|
-
if codelines:
|
1736
|
-
if line.lstrip().startswith('\\end{code}'):
|
1737
|
-
codelines = 0
|
1738
|
-
latex += line
|
1739
|
-
else:
|
1740
|
-
code += line
|
1741
|
-
elif line.lstrip().startswith('\\begin{code}'):
|
1742
|
-
codelines = 1
|
1743
|
-
latex += line
|
1744
|
-
insertions.append((len(code),
|
1745
|
-
list(lxlexer.get_tokens_unprocessed(latex))))
|
1746
|
-
latex = ''
|
1747
|
-
else:
|
1748
|
-
latex += line
|
1749
|
-
insertions.append((len(code),
|
1750
|
-
list(lxlexer.get_tokens_unprocessed(latex))))
|
1751
|
-
for item in do_insertions(insertions, self.baselexer.get_tokens_unprocessed(code)):
|
1752
|
-
yield item
|
1753
|
-
|
1754
|
-
|
1755
|
-
class LiterateCryptolLexer(LiterateLexer):
|
1756
|
-
"""
|
1757
|
-
For Literate Cryptol (Bird-style or LaTeX) source.
|
1758
|
-
|
1759
|
-
Additional options accepted:
|
1760
|
-
|
1761
|
-
`litstyle`
|
1762
|
-
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
1763
|
-
is autodetected: if the first non-whitespace character in the source
|
1764
|
-
is a backslash or percent character, LaTeX is assumed, else Bird.
|
1765
|
-
|
1766
|
-
.. versionadded:: 0.9
|
1767
|
-
"""
|
1768
|
-
name = 'Literate Cryptol'
|
1769
|
-
aliases = ['lcry', 'literate-cryptol', 'lcryptol']
|
1770
|
-
filenames = ['*.lcry']
|
1771
|
-
mimetypes = ['text/x-literate-cryptol']
|
1772
|
-
|
1773
|
-
def __init__(self, **options):
|
1774
|
-
crylexer = CryptolLexer(**options)
|
1775
|
-
LiterateLexer.__init__(self, crylexer, **options)
|
1776
|
-
|
1777
|
-
|
1778
|
-
class LiterateHaskellLexer(LiterateLexer):
|
1779
|
-
"""
|
1780
|
-
For Literate Haskell (Bird-style or LaTeX) source.
|
1781
|
-
|
1782
|
-
Additional options accepted:
|
1783
|
-
|
1784
|
-
`litstyle`
|
1785
|
-
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
1786
|
-
is autodetected: if the first non-whitespace character in the source
|
1787
|
-
is a backslash or percent character, LaTeX is assumed, else Bird.
|
1788
|
-
|
1789
|
-
.. versionadded:: 0.9
|
1790
|
-
"""
|
1791
|
-
name = 'Literate Haskell'
|
1792
|
-
aliases = ['lhs', 'literate-haskell', 'lhaskell']
|
1793
|
-
filenames = ['*.lhs']
|
1794
|
-
mimetypes = ['text/x-literate-haskell']
|
1795
|
-
|
1796
|
-
def __init__(self, **options):
|
1797
|
-
hslexer = HaskellLexer(**options)
|
1798
|
-
LiterateLexer.__init__(self, hslexer, **options)
|
1799
|
-
|
1800
|
-
|
1801
|
-
class LiterateIdrisLexer(LiterateLexer):
|
1802
|
-
"""
|
1803
|
-
For Literate Idris (Bird-style or LaTeX) source.
|
1804
|
-
|
1805
|
-
Additional options accepted:
|
1806
|
-
|
1807
|
-
`litstyle`
|
1808
|
-
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
1809
|
-
is autodetected: if the first non-whitespace character in the source
|
1810
|
-
is a backslash or percent character, LaTeX is assumed, else Bird.
|
1811
|
-
|
1812
|
-
.. versionadded:: 2.0
|
1813
|
-
"""
|
1814
|
-
name = 'Literate Idris'
|
1815
|
-
aliases = ['lidr', 'literate-idris', 'lidris']
|
1816
|
-
filenames = ['*.lidr']
|
1817
|
-
mimetypes = ['text/x-literate-idris']
|
1818
|
-
|
1819
|
-
def __init__(self, **options):
|
1820
|
-
hslexer = IdrisLexer(**options)
|
1821
|
-
LiterateLexer.__init__(self, hslexer, **options)
|
1822
|
-
|
1823
|
-
|
1824
|
-
class LiterateAgdaLexer(LiterateLexer):
|
1825
|
-
"""
|
1826
|
-
For Literate Agda source.
|
1827
|
-
|
1828
|
-
Additional options accepted:
|
1829
|
-
|
1830
|
-
`litstyle`
|
1831
|
-
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
1832
|
-
is autodetected: if the first non-whitespace character in the source
|
1833
|
-
is a backslash or percent character, LaTeX is assumed, else Bird.
|
1834
|
-
|
1835
|
-
.. versionadded:: 2.0
|
1836
|
-
"""
|
1837
|
-
name = 'Literate Agda'
|
1838
|
-
aliases = ['lagda', 'literate-agda']
|
1839
|
-
filenames = ['*.lagda']
|
1840
|
-
mimetypes = ['text/x-literate-agda']
|
1841
|
-
|
1842
|
-
def __init__(self, **options):
|
1843
|
-
agdalexer = AgdaLexer(**options)
|
1844
|
-
LiterateLexer.__init__(self, agdalexer, litstyle='latex', **options)
|
1845
|
-
|
1846
|
-
|
1847
|
-
class SMLLexer(RegexLexer):
|
1848
|
-
"""
|
1849
|
-
For the Standard ML language.
|
1850
|
-
|
1851
|
-
.. versionadded:: 1.5
|
1852
|
-
"""
|
1853
|
-
|
1854
|
-
name = 'Standard ML'
|
1855
|
-
aliases = ['sml']
|
1856
|
-
filenames = ['*.sml', '*.sig', '*.fun',]
|
1857
|
-
mimetypes = ['text/x-standardml', 'application/x-standardml']
|
1858
|
-
|
1859
|
-
alphanumid_reserved = [
|
1860
|
-
# Core
|
1861
|
-
'abstype', 'and', 'andalso', 'as', 'case', 'datatype', 'do', 'else',
|
1862
|
-
'end', 'exception', 'fn', 'fun', 'handle', 'if', 'in', 'infix',
|
1863
|
-
'infixr', 'let', 'local', 'nonfix', 'of', 'op', 'open', 'orelse',
|
1864
|
-
'raise', 'rec', 'then', 'type', 'val', 'with', 'withtype', 'while',
|
1865
|
-
# Modules
|
1866
|
-
'eqtype', 'functor', 'include', 'sharing', 'sig', 'signature',
|
1867
|
-
'struct', 'structure', 'where',
|
1868
|
-
]
|
1869
|
-
|
1870
|
-
symbolicid_reserved = [
|
1871
|
-
# Core
|
1872
|
-
':', '\|', '=', '=>', '->', '#',
|
1873
|
-
# Modules
|
1874
|
-
':>',
|
1875
|
-
]
|
1876
|
-
|
1877
|
-
nonid_reserved = [ '(', ')', '[', ']', '{', '}', ',', ';', '...', '_' ]
|
1878
|
-
|
1879
|
-
alphanumid_re = r"[a-zA-Z][\w']*"
|
1880
|
-
symbolicid_re = r"[!%&$#+\-/:<=>?@\\~`^|*]+"
|
1881
|
-
|
1882
|
-
# A character constant is a sequence of the form #s, where s is a string
|
1883
|
-
# constant denoting a string of size one character. This setup just parses
|
1884
|
-
# the entire string as either a String.Double or a String.Char (depending
|
1885
|
-
# on the argument), even if the String.Char is an erronous
|
1886
|
-
# multiple-character string.
|
1887
|
-
def stringy (whatkind):
|
1888
|
-
return [
|
1889
|
-
(r'[^"\\]', whatkind),
|
1890
|
-
(r'\\[\\\"abtnvfr]', String.Escape),
|
1891
|
-
# Control-character notation is used for codes < 32,
|
1892
|
-
# where \^@ == \000
|
1893
|
-
(r'\\\^[\x40-\x5e]', String.Escape),
|
1894
|
-
# Docs say 'decimal digits'
|
1895
|
-
(r'\\[0-9]{3}', String.Escape),
|
1896
|
-
(r'\\u[0-9a-fA-F]{4}', String.Escape),
|
1897
|
-
(r'\\\s+\\', String.Interpol),
|
1898
|
-
(r'"', whatkind, '#pop'),
|
1899
|
-
]
|
1900
|
-
|
1901
|
-
# Callbacks for distinguishing tokens and reserved words
|
1902
|
-
def long_id_callback(self, match):
|
1903
|
-
if match.group(1) in self.alphanumid_reserved: token = Error
|
1904
|
-
else: token = Name.Namespace
|
1905
|
-
yield match.start(1), token, match.group(1)
|
1906
|
-
yield match.start(2), Punctuation, match.group(2)
|
1907
|
-
|
1908
|
-
def end_id_callback(self, match):
|
1909
|
-
if match.group(1) in self.alphanumid_reserved: token = Error
|
1910
|
-
elif match.group(1) in self.symbolicid_reserved: token = Error
|
1911
|
-
else: token = Name
|
1912
|
-
yield match.start(1), token, match.group(1)
|
1913
|
-
|
1914
|
-
def id_callback(self, match):
|
1915
|
-
str = match.group(1)
|
1916
|
-
if str in self.alphanumid_reserved: token = Keyword.Reserved
|
1917
|
-
elif str in self.symbolicid_reserved: token = Punctuation
|
1918
|
-
else: token = Name
|
1919
|
-
yield match.start(1), token, str
|
1920
|
-
|
1921
|
-
tokens = {
|
1922
|
-
# Whitespace and comments are (almost) everywhere
|
1923
|
-
'whitespace': [
|
1924
|
-
(r'\s+', Text),
|
1925
|
-
(r'\(\*', Comment.Multiline, 'comment'),
|
1926
|
-
],
|
1927
|
-
|
1928
|
-
'delimiters': [
|
1929
|
-
# This lexer treats these delimiters specially:
|
1930
|
-
# Delimiters define scopes, and the scope is how the meaning of
|
1931
|
-
# the `|' is resolved - is it a case/handle expression, or function
|
1932
|
-
# definition by cases? (This is not how the Definition works, but
|
1933
|
-
# it's how MLton behaves, see http://mlton.org/SMLNJDeviations)
|
1934
|
-
(r'\(|\[|{', Punctuation, 'main'),
|
1935
|
-
(r'\)|\]|}', Punctuation, '#pop'),
|
1936
|
-
(r'\b(let|if|local)\b(?!\')', Keyword.Reserved, ('main', 'main')),
|
1937
|
-
(r'\b(struct|sig|while)\b(?!\')', Keyword.Reserved, 'main'),
|
1938
|
-
(r'\b(do|else|end|in|then)\b(?!\')', Keyword.Reserved, '#pop'),
|
1939
|
-
],
|
1940
|
-
|
1941
|
-
'core': [
|
1942
|
-
# Punctuation that doesn't overlap symbolic identifiers
|
1943
|
-
(r'(%s)' % '|'.join([re.escape(z) for z in nonid_reserved]),
|
1944
|
-
Punctuation),
|
1945
|
-
|
1946
|
-
# Special constants: strings, floats, numbers in decimal and hex
|
1947
|
-
(r'#"', String.Char, 'char'),
|
1948
|
-
(r'"', String.Double, 'string'),
|
1949
|
-
(r'~?0x[0-9a-fA-F]+', Number.Hex),
|
1950
|
-
(r'0wx[0-9a-fA-F]+', Number.Hex),
|
1951
|
-
(r'0w\d+', Number.Integer),
|
1952
|
-
(r'~?\d+\.\d+[eE]~?\d+', Number.Float),
|
1953
|
-
(r'~?\d+\.\d+', Number.Float),
|
1954
|
-
(r'~?\d+[eE]~?\d+', Number.Float),
|
1955
|
-
(r'~?\d+', Number.Integer),
|
1956
|
-
|
1957
|
-
# Labels
|
1958
|
-
(r'#\s*[1-9][0-9]*', Name.Label),
|
1959
|
-
(r'#\s*(%s)' % alphanumid_re, Name.Label),
|
1960
|
-
(r'#\s+(%s)' % symbolicid_re, Name.Label),
|
1961
|
-
# Some reserved words trigger a special, local lexer state change
|
1962
|
-
(r'\b(datatype|abstype)\b(?!\')', Keyword.Reserved, 'dname'),
|
1963
|
-
(r'(?=\b(exception)\b(?!\'))', Text, ('ename')),
|
1964
|
-
(r'\b(functor|include|open|signature|structure)\b(?!\')',
|
1965
|
-
Keyword.Reserved, 'sname'),
|
1966
|
-
(r'\b(type|eqtype)\b(?!\')', Keyword.Reserved, 'tname'),
|
1967
|
-
|
1968
|
-
# Regular identifiers, long and otherwise
|
1969
|
-
(r'\'[\w\']*', Name.Decorator),
|
1970
|
-
(r'(%s)(\.)' % alphanumid_re, long_id_callback, "dotted"),
|
1971
|
-
(r'(%s)' % alphanumid_re, id_callback),
|
1972
|
-
(r'(%s)' % symbolicid_re, id_callback),
|
1973
|
-
],
|
1974
|
-
'dotted': [
|
1975
|
-
(r'(%s)(\.)' % alphanumid_re, long_id_callback),
|
1976
|
-
(r'(%s)' % alphanumid_re, end_id_callback, "#pop"),
|
1977
|
-
(r'(%s)' % symbolicid_re, end_id_callback, "#pop"),
|
1978
|
-
(r'\s+', Error),
|
1979
|
-
(r'\S+', Error),
|
1980
|
-
],
|
1981
|
-
|
1982
|
-
|
1983
|
-
# Main parser (prevents errors in files that have scoping errors)
|
1984
|
-
'root': [ default('main') ],
|
1985
|
-
|
1986
|
-
# In this scope, I expect '|' to not be followed by a function name,
|
1987
|
-
# and I expect 'and' to be followed by a binding site
|
1988
|
-
'main': [
|
1989
|
-
include('whitespace'),
|
1990
|
-
|
1991
|
-
# Special behavior of val/and/fun
|
1992
|
-
(r'\b(val|and)\b(?!\')', Keyword.Reserved, 'vname'),
|
1993
|
-
(r'\b(fun)\b(?!\')', Keyword.Reserved,
|
1994
|
-
('#pop', 'main-fun', 'fname')),
|
1995
|
-
|
1996
|
-
include('delimiters'),
|
1997
|
-
include('core'),
|
1998
|
-
(r'\S+', Error),
|
1999
|
-
],
|
2000
|
-
|
2001
|
-
# In this scope, I expect '|' and 'and' to be followed by a function
|
2002
|
-
'main-fun': [
|
2003
|
-
include('whitespace'),
|
2004
|
-
|
2005
|
-
(r'\s', Text),
|
2006
|
-
(r'\(\*', Comment.Multiline, 'comment'),
|
2007
|
-
|
2008
|
-
# Special behavior of val/and/fun
|
2009
|
-
(r'\b(fun|and)\b(?!\')', Keyword.Reserved, 'fname'),
|
2010
|
-
(r'\b(val)\b(?!\')', Keyword.Reserved,
|
2011
|
-
('#pop', 'main', 'vname')),
|
2012
|
-
|
2013
|
-
# Special behavior of '|' and '|'-manipulating keywords
|
2014
|
-
(r'\|', Punctuation, 'fname'),
|
2015
|
-
(r'\b(case|handle)\b(?!\')', Keyword.Reserved,
|
2016
|
-
('#pop', 'main')),
|
2017
|
-
|
2018
|
-
include('delimiters'),
|
2019
|
-
include('core'),
|
2020
|
-
(r'\S+', Error),
|
2021
|
-
],
|
2022
|
-
|
2023
|
-
# Character and string parsers
|
2024
|
-
'char': stringy(String.Char),
|
2025
|
-
'string': stringy(String.Double),
|
2026
|
-
|
2027
|
-
'breakout': [
|
2028
|
-
(r'(?=\b(%s)\b(?!\'))' % '|'.join(alphanumid_reserved), Text, '#pop'),
|
2029
|
-
],
|
2030
|
-
|
2031
|
-
# Dealing with what comes after module system keywords
|
2032
|
-
'sname': [
|
2033
|
-
include('whitespace'),
|
2034
|
-
include('breakout'),
|
2035
|
-
|
2036
|
-
(r'(%s)' % alphanumid_re, Name.Namespace),
|
2037
|
-
default('#pop'),
|
2038
|
-
],
|
2039
|
-
|
2040
|
-
# Dealing with what comes after the 'fun' (or 'and' or '|') keyword
|
2041
|
-
'fname': [
|
2042
|
-
include('whitespace'),
|
2043
|
-
(r'\'[0-9a-zA-Z_\']*', Name.Decorator),
|
2044
|
-
(r'\(', Punctuation, 'tyvarseq'),
|
2045
|
-
|
2046
|
-
(r'(%s)' % alphanumid_re, Name.Function, '#pop'),
|
2047
|
-
(r'(%s)' % symbolicid_re, Name.Function, '#pop'),
|
2048
|
-
|
2049
|
-
# Ignore interesting function declarations like "fun (x + y) = ..."
|
2050
|
-
default('#pop'),
|
2051
|
-
],
|
2052
|
-
|
2053
|
-
# Dealing with what comes after the 'val' (or 'and') keyword
|
2054
|
-
'vname': [
|
2055
|
-
include('whitespace'),
|
2056
|
-
(r'\'[0-9a-zA-Z_\']*', Name.Decorator),
|
2057
|
-
(r'\(', Punctuation, 'tyvarseq'),
|
2058
|
-
|
2059
|
-
(r'(%s)(\s*)(=(?!%s))' % (alphanumid_re, symbolicid_re),
|
2060
|
-
bygroups(Name.Variable, Text, Punctuation), '#pop'),
|
2061
|
-
(r'(%s)(\s*)(=(?!%s))' % (symbolicid_re, symbolicid_re),
|
2062
|
-
bygroups(Name.Variable, Text, Punctuation), '#pop'),
|
2063
|
-
(r'(%s)' % alphanumid_re, Name.Variable, '#pop'),
|
2064
|
-
(r'(%s)' % symbolicid_re, Name.Variable, '#pop'),
|
2065
|
-
|
2066
|
-
# Ignore interesting patterns like 'val (x, y)'
|
2067
|
-
default('#pop'),
|
2068
|
-
],
|
2069
|
-
|
2070
|
-
# Dealing with what comes after the 'type' (or 'and') keyword
|
2071
|
-
'tname': [
|
2072
|
-
include('whitespace'),
|
2073
|
-
include('breakout'),
|
2074
|
-
|
2075
|
-
(r'\'[0-9a-zA-Z_\']*', Name.Decorator),
|
2076
|
-
(r'\(', Punctuation, 'tyvarseq'),
|
2077
|
-
(r'=(?!%s)' % symbolicid_re, Punctuation, ('#pop', 'typbind')),
|
2078
|
-
|
2079
|
-
(r'(%s)' % alphanumid_re, Keyword.Type),
|
2080
|
-
(r'(%s)' % symbolicid_re, Keyword.Type),
|
2081
|
-
(r'\S+', Error, '#pop'),
|
2082
|
-
],
|
2083
|
-
|
2084
|
-
# A type binding includes most identifiers
|
2085
|
-
'typbind': [
|
2086
|
-
include('whitespace'),
|
2087
|
-
|
2088
|
-
(r'\b(and)\b(?!\')', Keyword.Reserved, ('#pop', 'tname')),
|
2089
|
-
|
2090
|
-
include('breakout'),
|
2091
|
-
include('core'),
|
2092
|
-
(r'\S+', Error, '#pop'),
|
2093
|
-
],
|
2094
|
-
|
2095
|
-
# Dealing with what comes after the 'datatype' (or 'and') keyword
|
2096
|
-
'dname': [
|
2097
|
-
include('whitespace'),
|
2098
|
-
include('breakout'),
|
2099
|
-
|
2100
|
-
(r'\'[0-9a-zA-Z_\']*', Name.Decorator),
|
2101
|
-
(r'\(', Punctuation, 'tyvarseq'),
|
2102
|
-
(r'(=)(\s*)(datatype)',
|
2103
|
-
bygroups(Punctuation, Text, Keyword.Reserved), '#pop'),
|
2104
|
-
(r'=(?!%s)' % symbolicid_re, Punctuation,
|
2105
|
-
('#pop', 'datbind', 'datcon')),
|
2106
|
-
|
2107
|
-
(r'(%s)' % alphanumid_re, Keyword.Type),
|
2108
|
-
(r'(%s)' % symbolicid_re, Keyword.Type),
|
2109
|
-
(r'\S+', Error, '#pop'),
|
2110
|
-
],
|
2111
|
-
|
2112
|
-
# common case - A | B | C of int
|
2113
|
-
'datbind': [
|
2114
|
-
include('whitespace'),
|
2115
|
-
|
2116
|
-
(r'\b(and)\b(?!\')', Keyword.Reserved, ('#pop', 'dname')),
|
2117
|
-
(r'\b(withtype)\b(?!\')', Keyword.Reserved, ('#pop', 'tname')),
|
2118
|
-
(r'\b(of)\b(?!\')', Keyword.Reserved),
|
2119
|
-
|
2120
|
-
(r'(\|)(\s*)(%s)' % alphanumid_re,
|
2121
|
-
bygroups(Punctuation, Text, Name.Class)),
|
2122
|
-
(r'(\|)(\s+)(%s)' % symbolicid_re,
|
2123
|
-
bygroups(Punctuation, Text, Name.Class)),
|
2124
|
-
|
2125
|
-
include('breakout'),
|
2126
|
-
include('core'),
|
2127
|
-
(r'\S+', Error),
|
2128
|
-
],
|
2129
|
-
|
2130
|
-
# Dealing with what comes after an exception
|
2131
|
-
'ename': [
|
2132
|
-
include('whitespace'),
|
2133
|
-
|
2134
|
-
(r'(exception|and)\b(\s+)(%s)' % alphanumid_re,
|
2135
|
-
bygroups(Keyword.Reserved, Text, Name.Class)),
|
2136
|
-
(r'(exception|and)\b(\s*)(%s)' % symbolicid_re,
|
2137
|
-
bygroups(Keyword.Reserved, Text, Name.Class)),
|
2138
|
-
(r'\b(of)\b(?!\')', Keyword.Reserved),
|
2139
|
-
|
2140
|
-
include('breakout'),
|
2141
|
-
include('core'),
|
2142
|
-
(r'\S+', Error),
|
2143
|
-
],
|
2144
|
-
|
2145
|
-
'datcon': [
|
2146
|
-
include('whitespace'),
|
2147
|
-
(r'(%s)' % alphanumid_re, Name.Class, '#pop'),
|
2148
|
-
(r'(%s)' % symbolicid_re, Name.Class, '#pop'),
|
2149
|
-
(r'\S+', Error, '#pop'),
|
2150
|
-
],
|
2151
|
-
|
2152
|
-
# Series of type variables
|
2153
|
-
'tyvarseq': [
|
2154
|
-
(r'\s', Text),
|
2155
|
-
(r'\(\*', Comment.Multiline, 'comment'),
|
2156
|
-
|
2157
|
-
(r'\'[0-9a-zA-Z_\']*', Name.Decorator),
|
2158
|
-
(alphanumid_re, Name),
|
2159
|
-
(r',', Punctuation),
|
2160
|
-
(r'\)', Punctuation, '#pop'),
|
2161
|
-
(symbolicid_re, Name),
|
2162
|
-
],
|
2163
|
-
|
2164
|
-
'comment': [
|
2165
|
-
(r'[^(*)]', Comment.Multiline),
|
2166
|
-
(r'\(\*', Comment.Multiline, '#push'),
|
2167
|
-
(r'\*\)', Comment.Multiline, '#pop'),
|
2168
|
-
(r'[(*)]', Comment.Multiline),
|
2169
|
-
],
|
2170
|
-
}
|
2171
|
-
|
2172
|
-
|
2173
|
-
class OcamlLexer(RegexLexer):
|
2174
|
-
"""
|
2175
|
-
For the OCaml language.
|
2176
|
-
|
2177
|
-
.. versionadded:: 0.7
|
2178
|
-
"""
|
2179
|
-
|
2180
|
-
name = 'OCaml'
|
2181
|
-
aliases = ['ocaml']
|
2182
|
-
filenames = ['*.ml', '*.mli', '*.mll', '*.mly']
|
2183
|
-
mimetypes = ['text/x-ocaml']
|
2184
|
-
|
2185
|
-
keywords = [
|
2186
|
-
'as', 'assert', 'begin', 'class', 'constraint', 'do', 'done',
|
2187
|
-
'downto', 'else', 'end', 'exception', 'external', 'false',
|
2188
|
-
'for', 'fun', 'function', 'functor', 'if', 'in', 'include',
|
2189
|
-
'inherit', 'initializer', 'lazy', 'let', 'match', 'method',
|
2190
|
-
'module', 'mutable', 'new', 'object', 'of', 'open', 'private',
|
2191
|
-
'raise', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try',
|
2192
|
-
'type', 'value', 'val', 'virtual', 'when', 'while', 'with',
|
2193
|
-
]
|
2194
|
-
keyopts = [
|
2195
|
-
'!=','#','&','&&','\(','\)','\*','\+',',','-',
|
2196
|
-
'-\.','->','\.','\.\.',':','::',':=',':>',';',';;','<',
|
2197
|
-
'<-','=','>','>]','>}','\?','\?\?','\[','\[<','\[>','\[\|',
|
2198
|
-
']','_','`','{','{<','\|','\|]','}','~'
|
2199
|
-
]
|
2200
|
-
|
2201
|
-
operators = r'[!$%&*+\./:<=>?@^|~-]'
|
2202
|
-
word_operators = ['and', 'asr', 'land', 'lor', 'lsl', 'lxor', 'mod', 'or']
|
2203
|
-
prefix_syms = r'[!?~]'
|
2204
|
-
infix_syms = r'[=<>@^|&+\*/$%-]'
|
2205
|
-
primitives = ['unit', 'int', 'float', 'bool', 'string', 'char', 'list', 'array']
|
2206
|
-
|
2207
|
-
tokens = {
|
2208
|
-
'escape-sequence': [
|
2209
|
-
(r'\\[\\\"\'ntbr]', String.Escape),
|
2210
|
-
(r'\\[0-9]{3}', String.Escape),
|
2211
|
-
(r'\\x[0-9a-fA-F]{2}', String.Escape),
|
2212
|
-
],
|
2213
|
-
'root': [
|
2214
|
-
(r'\s+', Text),
|
2215
|
-
(r'false|true|\(\)|\[\]', Name.Builtin.Pseudo),
|
2216
|
-
(r'\b([A-Z][\w\']*)(?=\s*\.)',
|
2217
|
-
Name.Namespace, 'dotted'),
|
2218
|
-
(r'\b([A-Z][\w\']*)', Name.Class),
|
2219
|
-
(r'\(\*(?![)])', Comment, 'comment'),
|
2220
|
-
(r'\b(%s)\b' % '|'.join(keywords), Keyword),
|
2221
|
-
(r'(%s)' % '|'.join(keyopts[::-1]), Operator),
|
2222
|
-
(r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator),
|
2223
|
-
(r'\b(%s)\b' % '|'.join(word_operators), Operator.Word),
|
2224
|
-
(r'\b(%s)\b' % '|'.join(primitives), Keyword.Type),
|
2225
|
-
|
2226
|
-
(r"[^\W\d][\w']*", Name),
|
2227
|
-
|
2228
|
-
(r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float),
|
2229
|
-
(r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
|
2230
|
-
(r'0[oO][0-7][0-7_]*', Number.Oct),
|
2231
|
-
(r'0[bB][01][01_]*', Number.Bin),
|
2232
|
-
(r'\d[\d_]*', Number.Integer),
|
2233
|
-
|
2234
|
-
(r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'",
|
2235
|
-
String.Char),
|
2236
|
-
(r"'.'", String.Char),
|
2237
|
-
(r"'", Keyword), # a stray quote is another syntax element
|
2238
|
-
|
2239
|
-
(r'"', String.Double, 'string'),
|
2240
|
-
|
2241
|
-
(r'[~?][a-z][\w\']*:', Name.Variable),
|
2242
|
-
],
|
2243
|
-
'comment': [
|
2244
|
-
(r'[^(*)]+', Comment),
|
2245
|
-
(r'\(\*', Comment, '#push'),
|
2246
|
-
(r'\*\)', Comment, '#pop'),
|
2247
|
-
(r'[(*)]', Comment),
|
2248
|
-
],
|
2249
|
-
'string': [
|
2250
|
-
(r'[^\\"]+', String.Double),
|
2251
|
-
include('escape-sequence'),
|
2252
|
-
(r'\\\n', String.Double),
|
2253
|
-
(r'"', String.Double, '#pop'),
|
2254
|
-
],
|
2255
|
-
'dotted': [
|
2256
|
-
(r'\s+', Text),
|
2257
|
-
(r'\.', Punctuation),
|
2258
|
-
(r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
|
2259
|
-
(r'[A-Z][\w\']*', Name.Class, '#pop'),
|
2260
|
-
(r'[a-z_][\w\']*', Name, '#pop'),
|
2261
|
-
],
|
2262
|
-
}
|
2263
|
-
|
2264
|
-
|
2265
|
-
class ErlangLexer(RegexLexer):
|
2266
|
-
"""
|
2267
|
-
For the Erlang functional programming language.
|
2268
|
-
|
2269
|
-
Blame Jeremy Thurgood (http://jerith.za.net/).
|
2270
|
-
|
2271
|
-
.. versionadded:: 0.9
|
2272
|
-
"""
|
2273
|
-
|
2274
|
-
name = 'Erlang'
|
2275
|
-
aliases = ['erlang']
|
2276
|
-
filenames = ['*.erl', '*.hrl', '*.es', '*.escript']
|
2277
|
-
mimetypes = ['text/x-erlang']
|
2278
|
-
|
2279
|
-
keywords = [
|
2280
|
-
'after', 'begin', 'case', 'catch', 'cond', 'end', 'fun', 'if',
|
2281
|
-
'let', 'of', 'query', 'receive', 'try', 'when',
|
2282
|
-
]
|
2283
|
-
|
2284
|
-
builtins = [ # See erlang(3) man page
|
2285
|
-
'abs', 'append_element', 'apply', 'atom_to_list', 'binary_to_list',
|
2286
|
-
'bitstring_to_list', 'binary_to_term', 'bit_size', 'bump_reductions',
|
2287
|
-
'byte_size', 'cancel_timer', 'check_process_code', 'delete_module',
|
2288
|
-
'demonitor', 'disconnect_node', 'display', 'element', 'erase', 'exit',
|
2289
|
-
'float', 'float_to_list', 'fun_info', 'fun_to_list',
|
2290
|
-
'function_exported', 'garbage_collect', 'get', 'get_keys',
|
2291
|
-
'group_leader', 'hash', 'hd', 'integer_to_list', 'iolist_to_binary',
|
2292
|
-
'iolist_size', 'is_atom', 'is_binary', 'is_bitstring', 'is_boolean',
|
2293
|
-
'is_builtin', 'is_float', 'is_function', 'is_integer', 'is_list',
|
2294
|
-
'is_number', 'is_pid', 'is_port', 'is_process_alive', 'is_record',
|
2295
|
-
'is_reference', 'is_tuple', 'length', 'link', 'list_to_atom',
|
2296
|
-
'list_to_binary', 'list_to_bitstring', 'list_to_existing_atom',
|
2297
|
-
'list_to_float', 'list_to_integer', 'list_to_pid', 'list_to_tuple',
|
2298
|
-
'load_module', 'localtime_to_universaltime', 'make_tuple', 'md5',
|
2299
|
-
'md5_final', 'md5_update', 'memory', 'module_loaded', 'monitor',
|
2300
|
-
'monitor_node', 'node', 'nodes', 'open_port', 'phash', 'phash2',
|
2301
|
-
'pid_to_list', 'port_close', 'port_command', 'port_connect',
|
2302
|
-
'port_control', 'port_call', 'port_info', 'port_to_list',
|
2303
|
-
'process_display', 'process_flag', 'process_info', 'purge_module',
|
2304
|
-
'put', 'read_timer', 'ref_to_list', 'register', 'resume_process',
|
2305
|
-
'round', 'send', 'send_after', 'send_nosuspend', 'set_cookie',
|
2306
|
-
'setelement', 'size', 'spawn', 'spawn_link', 'spawn_monitor',
|
2307
|
-
'spawn_opt', 'split_binary', 'start_timer', 'statistics',
|
2308
|
-
'suspend_process', 'system_flag', 'system_info', 'system_monitor',
|
2309
|
-
'system_profile', 'term_to_binary', 'tl', 'trace', 'trace_delivered',
|
2310
|
-
'trace_info', 'trace_pattern', 'trunc', 'tuple_size', 'tuple_to_list',
|
2311
|
-
'universaltime_to_localtime', 'unlink', 'unregister', 'whereis'
|
2312
|
-
]
|
2313
|
-
|
2314
|
-
operators = r'(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)'
|
2315
|
-
word_operators = [
|
2316
|
-
'and', 'andalso', 'band', 'bnot', 'bor', 'bsl', 'bsr', 'bxor',
|
2317
|
-
'div', 'not', 'or', 'orelse', 'rem', 'xor'
|
2318
|
-
]
|
2319
|
-
|
2320
|
-
atom_re = r"(?:[a-z]\w*|'[^\n']*[^\\]')"
|
2321
|
-
|
2322
|
-
variable_re = r'(?:[A-Z_]\w*)'
|
2323
|
-
|
2324
|
-
escape_re = r'(?:\\(?:[bdefnrstv\'"\\/]|[0-7][0-7]?[0-7]?|\^[a-zA-Z]))'
|
2325
|
-
|
2326
|
-
macro_re = r'(?:'+variable_re+r'|'+atom_re+r')'
|
2327
|
-
|
2328
|
-
base_re = r'(?:[2-9]|[12][0-9]|3[0-6])'
|
2329
|
-
|
2330
|
-
tokens = {
|
2331
|
-
'root': [
|
2332
|
-
(r'\s+', Text),
|
2333
|
-
(r'%.*\n', Comment),
|
2334
|
-
('(' + '|'.join(keywords) + r')\b', Keyword),
|
2335
|
-
('(' + '|'.join(builtins) + r')\b', Name.Builtin),
|
2336
|
-
('(' + '|'.join(word_operators) + r')\b', Operator.Word),
|
2337
|
-
(r'^-', Punctuation, 'directive'),
|
2338
|
-
(operators, Operator),
|
2339
|
-
(r'"', String, 'string'),
|
2340
|
-
(r'<<', Name.Label),
|
2341
|
-
(r'>>', Name.Label),
|
2342
|
-
('(' + atom_re + ')(:)', bygroups(Name.Namespace, Punctuation)),
|
2343
|
-
('(?:^|(?<=:))(' + atom_re + r')(\s*)(\()',
|
2344
|
-
bygroups(Name.Function, Text, Punctuation)),
|
2345
|
-
(r'[+-]?'+base_re+r'#[0-9a-zA-Z]+', Number.Integer),
|
2346
|
-
(r'[+-]?\d+', Number.Integer),
|
2347
|
-
(r'[+-]?\d+.\d+', Number.Float),
|
2348
|
-
(r'[]\[:_@\".{}()|;,]', Punctuation),
|
2349
|
-
(variable_re, Name.Variable),
|
2350
|
-
(atom_re, Name),
|
2351
|
-
(r'\?'+macro_re, Name.Constant),
|
2352
|
-
(r'\$(?:'+escape_re+r'|\\[ %]|[^\\])', String.Char),
|
2353
|
-
(r'#'+atom_re+r'(:?\.'+atom_re+r')?', Name.Label),
|
2354
|
-
],
|
2355
|
-
'string': [
|
2356
|
-
(escape_re, String.Escape),
|
2357
|
-
(r'"', String, '#pop'),
|
2358
|
-
(r'~[0-9.*]*[~#+bBcdefginpPswWxX]', String.Interpol),
|
2359
|
-
(r'[^"\\~]+', String),
|
2360
|
-
(r'~', String),
|
2361
|
-
],
|
2362
|
-
'directive': [
|
2363
|
-
(r'(define)(\s*)(\()('+macro_re+r')',
|
2364
|
-
bygroups(Name.Entity, Text, Punctuation, Name.Constant), '#pop'),
|
2365
|
-
(r'(record)(\s*)(\()('+macro_re+r')',
|
2366
|
-
bygroups(Name.Entity, Text, Punctuation, Name.Label), '#pop'),
|
2367
|
-
(atom_re, Name.Entity, '#pop'),
|
2368
|
-
],
|
2369
|
-
}
|
2370
|
-
|
2371
|
-
|
2372
|
-
class ErlangShellLexer(Lexer):
|
2373
|
-
"""
|
2374
|
-
Shell sessions in erl (for Erlang code).
|
2375
|
-
|
2376
|
-
.. versionadded:: 1.1
|
2377
|
-
"""
|
2378
|
-
name = 'Erlang erl session'
|
2379
|
-
aliases = ['erl']
|
2380
|
-
filenames = ['*.erl-sh']
|
2381
|
-
mimetypes = ['text/x-erl-shellsession']
|
2382
|
-
|
2383
|
-
_prompt_re = re.compile(r'\d+>(?=\s|\Z)')
|
2384
|
-
|
2385
|
-
def get_tokens_unprocessed(self, text):
|
2386
|
-
erlexer = ErlangLexer(**self.options)
|
2387
|
-
|
2388
|
-
curcode = ''
|
2389
|
-
insertions = []
|
2390
|
-
for match in line_re.finditer(text):
|
2391
|
-
line = match.group()
|
2392
|
-
m = self._prompt_re.match(line)
|
2393
|
-
if m is not None:
|
2394
|
-
end = m.end()
|
2395
|
-
insertions.append((len(curcode),
|
2396
|
-
[(0, Generic.Prompt, line[:end])]))
|
2397
|
-
curcode += line[end:]
|
2398
|
-
else:
|
2399
|
-
if curcode:
|
2400
|
-
for item in do_insertions(insertions,
|
2401
|
-
erlexer.get_tokens_unprocessed(curcode)):
|
2402
|
-
yield item
|
2403
|
-
curcode = ''
|
2404
|
-
insertions = []
|
2405
|
-
if line.startswith('*'):
|
2406
|
-
yield match.start(), Generic.Traceback, line
|
2407
|
-
else:
|
2408
|
-
yield match.start(), Generic.Output, line
|
2409
|
-
if curcode:
|
2410
|
-
for item in do_insertions(insertions,
|
2411
|
-
erlexer.get_tokens_unprocessed(curcode)):
|
2412
|
-
yield item
|
2413
|
-
|
2414
|
-
|
2415
|
-
class OpaLexer(RegexLexer):
|
2416
|
-
"""
|
2417
|
-
Lexer for the Opa language (http://opalang.org).
|
2418
|
-
|
2419
|
-
.. versionadded:: 1.5
|
2420
|
-
"""
|
2421
|
-
|
2422
|
-
name = 'Opa'
|
2423
|
-
aliases = ['opa']
|
2424
|
-
filenames = ['*.opa']
|
2425
|
-
mimetypes = ['text/x-opa']
|
2426
|
-
|
2427
|
-
# most of these aren't strictly keywords
|
2428
|
-
# but if you color only real keywords, you might just
|
2429
|
-
# as well not color anything
|
2430
|
-
keywords = [
|
2431
|
-
'and', 'as', 'begin', 'case', 'client', 'css', 'database', 'db', 'do',
|
2432
|
-
'else', 'end', 'external', 'forall', 'function', 'if', 'import',
|
2433
|
-
'match', 'module', 'or', 'package', 'parser', 'rec', 'server', 'then',
|
2434
|
-
'type', 'val', 'with', 'xml_parser',
|
2435
|
-
]
|
2436
|
-
|
2437
|
-
# matches both stuff and `stuff`
|
2438
|
-
ident_re = r'(([a-zA-Z_]\w*)|(`[^`]*`))'
|
2439
|
-
|
2440
|
-
op_re = r'[.=\-<>,@~%/+?*&^!]'
|
2441
|
-
punc_re = r'[()\[\],;|]' # '{' and '}' are treated elsewhere
|
2442
|
-
# because they are also used for inserts
|
2443
|
-
|
2444
|
-
tokens = {
|
2445
|
-
# copied from the caml lexer, should be adapted
|
2446
|
-
'escape-sequence': [
|
2447
|
-
(r'\\[\\\"\'ntr}]', String.Escape),
|
2448
|
-
(r'\\[0-9]{3}', String.Escape),
|
2449
|
-
(r'\\x[0-9a-fA-F]{2}', String.Escape),
|
2450
|
-
],
|
2451
|
-
|
2452
|
-
# factorizing these rules, because they are inserted many times
|
2453
|
-
'comments': [
|
2454
|
-
(r'/\*', Comment, 'nested-comment'),
|
2455
|
-
(r'//.*?$', Comment),
|
2456
|
-
],
|
2457
|
-
'comments-and-spaces': [
|
2458
|
-
include('comments'),
|
2459
|
-
(r'\s+', Text),
|
2460
|
-
],
|
2461
|
-
|
2462
|
-
'root': [
|
2463
|
-
include('comments-and-spaces'),
|
2464
|
-
# keywords
|
2465
|
-
(r'\b(%s)\b' % '|'.join(keywords), Keyword),
|
2466
|
-
# directives
|
2467
|
-
# we could parse the actual set of directives instead of anything
|
2468
|
-
# starting with @, but this is troublesome
|
2469
|
-
# because it needs to be adjusted all the time
|
2470
|
-
# and assuming we parse only sources that compile, it is useless
|
2471
|
-
(r'@'+ident_re+r'\b', Name.Builtin.Pseudo),
|
2472
|
-
|
2473
|
-
# number literals
|
2474
|
-
(r'-?.[\d]+([eE][+\-]?\d+)', Number.Float),
|
2475
|
-
(r'-?\d+.\d*([eE][+\-]?\d+)', Number.Float),
|
2476
|
-
(r'-?\d+[eE][+\-]?\d+', Number.Float),
|
2477
|
-
(r'0[xX][\da-fA-F]+', Number.Hex),
|
2478
|
-
(r'0[oO][0-7]+', Number.Oct),
|
2479
|
-
(r'0[bB][01]+', Number.Bin),
|
2480
|
-
(r'\d+', Number.Integer),
|
2481
|
-
# color literals
|
2482
|
-
(r'#[\da-fA-F]{3,6}', Number.Integer),
|
2483
|
-
|
2484
|
-
# string literals
|
2485
|
-
(r'"', String.Double, 'string'),
|
2486
|
-
# char literal, should be checked because this is the regexp from
|
2487
|
-
# the caml lexer
|
2488
|
-
(r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2})|.)'",
|
2489
|
-
String.Char),
|
2490
|
-
|
2491
|
-
# this is meant to deal with embedded exprs in strings
|
2492
|
-
# every time we find a '}' we pop a state so that if we were
|
2493
|
-
# inside a string, we are back in the string state
|
2494
|
-
# as a consequence, we must also push a state every time we find a
|
2495
|
-
# '{' or else we will have errors when parsing {} for instance
|
2496
|
-
(r'{', Operator, '#push'),
|
2497
|
-
(r'}', Operator, '#pop'),
|
2498
|
-
|
2499
|
-
# html literals
|
2500
|
-
# this is a much more strict that the actual parser,
|
2501
|
-
# since a<b would not be parsed as html
|
2502
|
-
# but then again, the parser is way too lax, and we can't hope
|
2503
|
-
# to have something as tolerant
|
2504
|
-
(r'<(?=[a-zA-Z>])', String.Single, 'html-open-tag'),
|
2505
|
-
|
2506
|
-
# db path
|
2507
|
-
# matching the '[_]' in '/a[_]' because it is a part
|
2508
|
-
# of the syntax of the db path definition
|
2509
|
-
# unfortunately, i don't know how to match the ']' in
|
2510
|
-
# /a[1], so this is somewhat inconsistent
|
2511
|
-
(r'[@?!]?(/\w+)+(\[_\])?', Name.Variable),
|
2512
|
-
# putting the same color on <- as on db path, since
|
2513
|
-
# it can be used only to mean Db.write
|
2514
|
-
(r'<-(?!'+op_re+r')', Name.Variable),
|
2515
|
-
|
2516
|
-
# 'modules'
|
2517
|
-
# although modules are not distinguished by their names as in caml
|
2518
|
-
# the standard library seems to follow the convention that modules
|
2519
|
-
# only area capitalized
|
2520
|
-
(r'\b([A-Z]\w*)(?=\.)', Name.Namespace),
|
2521
|
-
|
2522
|
-
# operators
|
2523
|
-
# = has a special role because this is the only
|
2524
|
-
# way to syntactic distinguish binding constructions
|
2525
|
-
# unfortunately, this colors the equal in {x=2} too
|
2526
|
-
(r'=(?!'+op_re+r')', Keyword),
|
2527
|
-
(r'(%s)+' % op_re, Operator),
|
2528
|
-
(r'(%s)+' % punc_re, Operator),
|
2529
|
-
|
2530
|
-
# coercions
|
2531
|
-
(r':', Operator, 'type'),
|
2532
|
-
# type variables
|
2533
|
-
# we need this rule because we don't parse specially type
|
2534
|
-
# definitions so in "type t('a) = ...", "'a" is parsed by 'root'
|
2535
|
-
("'"+ident_re, Keyword.Type),
|
2536
|
-
|
2537
|
-
# id literal, #something, or #{expr}
|
2538
|
-
(r'#'+ident_re, String.Single),
|
2539
|
-
(r'#(?={)', String.Single),
|
2540
|
-
|
2541
|
-
# identifiers
|
2542
|
-
# this avoids to color '2' in 'a2' as an integer
|
2543
|
-
(ident_re, Text),
|
2544
|
-
|
2545
|
-
# default, not sure if that is needed or not
|
2546
|
-
# (r'.', Text),
|
2547
|
-
],
|
2548
|
-
|
2549
|
-
# it is quite painful to have to parse types to know where they end
|
2550
|
-
# this is the general rule for a type
|
2551
|
-
# a type is either:
|
2552
|
-
# * -> ty
|
2553
|
-
# * type-with-slash
|
2554
|
-
# * type-with-slash -> ty
|
2555
|
-
# * type-with-slash (, type-with-slash)+ -> ty
|
2556
|
-
#
|
2557
|
-
# the code is pretty funky in here, but this code would roughly
|
2558
|
-
# translate in caml to:
|
2559
|
-
# let rec type stream =
|
2560
|
-
# match stream with
|
2561
|
-
# | [< "->"; stream >] -> type stream
|
2562
|
-
# | [< ""; stream >] ->
|
2563
|
-
# type_with_slash stream
|
2564
|
-
# type_lhs_1 stream;
|
2565
|
-
# and type_1 stream = ...
|
2566
|
-
'type': [
|
2567
|
-
include('comments-and-spaces'),
|
2568
|
-
(r'->', Keyword.Type),
|
2569
|
-
default(('#pop', 'type-lhs-1', 'type-with-slash')),
|
2570
|
-
],
|
2571
|
-
|
2572
|
-
# parses all the atomic or closed constructions in the syntax of type
|
2573
|
-
# expressions: record types, tuple types, type constructors, basic type
|
2574
|
-
# and type variables
|
2575
|
-
'type-1': [
|
2576
|
-
include('comments-and-spaces'),
|
2577
|
-
(r'\(', Keyword.Type, ('#pop', 'type-tuple')),
|
2578
|
-
(r'~?{', Keyword.Type, ('#pop', 'type-record')),
|
2579
|
-
(ident_re+r'\(', Keyword.Type, ('#pop', 'type-tuple')),
|
2580
|
-
(ident_re, Keyword.Type, '#pop'),
|
2581
|
-
("'"+ident_re, Keyword.Type),
|
2582
|
-
# this case is not in the syntax but sometimes
|
2583
|
-
# we think we are parsing types when in fact we are parsing
|
2584
|
-
# some css, so we just pop the states until we get back into
|
2585
|
-
# the root state
|
2586
|
-
default('#pop'),
|
2587
|
-
],
|
2588
|
-
|
2589
|
-
# type-with-slash is either:
|
2590
|
-
# * type-1
|
2591
|
-
# * type-1 (/ type-1)+
|
2592
|
-
'type-with-slash': [
|
2593
|
-
include('comments-and-spaces'),
|
2594
|
-
default(('#pop', 'slash-type-1', 'type-1')),
|
2595
|
-
],
|
2596
|
-
'slash-type-1': [
|
2597
|
-
include('comments-and-spaces'),
|
2598
|
-
('/', Keyword.Type, ('#pop', 'type-1')),
|
2599
|
-
# same remark as above
|
2600
|
-
default('#pop'),
|
2601
|
-
],
|
2602
|
-
|
2603
|
-
# we go in this state after having parsed a type-with-slash
|
2604
|
-
# while trying to parse a type
|
2605
|
-
# and at this point we must determine if we are parsing an arrow
|
2606
|
-
# type (in which case we must continue parsing) or not (in which
|
2607
|
-
# case we stop)
|
2608
|
-
'type-lhs-1': [
|
2609
|
-
include('comments-and-spaces'),
|
2610
|
-
(r'->', Keyword.Type, ('#pop', 'type')),
|
2611
|
-
(r'(?=,)', Keyword.Type, ('#pop', 'type-arrow')),
|
2612
|
-
default('#pop'),
|
2613
|
-
],
|
2614
|
-
'type-arrow': [
|
2615
|
-
include('comments-and-spaces'),
|
2616
|
-
# the look ahead here allows to parse f(x : int, y : float -> truc)
|
2617
|
-
# correctly
|
2618
|
-
(r',(?=[^:]*?->)', Keyword.Type, 'type-with-slash'),
|
2619
|
-
(r'->', Keyword.Type, ('#pop', 'type')),
|
2620
|
-
# same remark as above
|
2621
|
-
default('#pop'),
|
2622
|
-
],
|
2623
|
-
|
2624
|
-
# no need to do precise parsing for tuples and records
|
2625
|
-
# because they are closed constructions, so we can simply
|
2626
|
-
# find the closing delimiter
|
2627
|
-
# note that this function would be not work if the source
|
2628
|
-
# contained identifiers like `{)` (although it could be patched
|
2629
|
-
# to support it)
|
2630
|
-
'type-tuple': [
|
2631
|
-
include('comments-and-spaces'),
|
2632
|
-
(r'[^\(\)/*]+', Keyword.Type),
|
2633
|
-
(r'[/*]', Keyword.Type),
|
2634
|
-
(r'\(', Keyword.Type, '#push'),
|
2635
|
-
(r'\)', Keyword.Type, '#pop'),
|
2636
|
-
],
|
2637
|
-
'type-record': [
|
2638
|
-
include('comments-and-spaces'),
|
2639
|
-
(r'[^{}/*]+', Keyword.Type),
|
2640
|
-
(r'[/*]', Keyword.Type),
|
2641
|
-
(r'{', Keyword.Type, '#push'),
|
2642
|
-
(r'}', Keyword.Type, '#pop'),
|
2643
|
-
],
|
2644
|
-
|
2645
|
-
# 'type-tuple': [
|
2646
|
-
# include('comments-and-spaces'),
|
2647
|
-
# (r'\)', Keyword.Type, '#pop'),
|
2648
|
-
# default(('#pop', 'type-tuple-1', 'type-1')),
|
2649
|
-
# ],
|
2650
|
-
# 'type-tuple-1': [
|
2651
|
-
# include('comments-and-spaces'),
|
2652
|
-
# (r',?\s*\)', Keyword.Type, '#pop'), # ,) is a valid end of tuple, in (1,)
|
2653
|
-
# (r',', Keyword.Type, 'type-1'),
|
2654
|
-
# ],
|
2655
|
-
# 'type-record':[
|
2656
|
-
# include('comments-and-spaces'),
|
2657
|
-
# (r'}', Keyword.Type, '#pop'),
|
2658
|
-
# (r'~?(?:\w+|`[^`]*`)', Keyword.Type, 'type-record-field-expr'),
|
2659
|
-
# ],
|
2660
|
-
# 'type-record-field-expr': [
|
2661
|
-
#
|
2662
|
-
# ],
|
2663
|
-
|
2664
|
-
'nested-comment': [
|
2665
|
-
(r'[^/*]+', Comment),
|
2666
|
-
(r'/\*', Comment, '#push'),
|
2667
|
-
(r'\*/', Comment, '#pop'),
|
2668
|
-
(r'[/*]', Comment),
|
2669
|
-
],
|
2670
|
-
|
2671
|
-
# the copy pasting between string and single-string
|
2672
|
-
# is kinda sad. Is there a way to avoid that??
|
2673
|
-
'string': [
|
2674
|
-
(r'[^\\"{]+', String.Double),
|
2675
|
-
(r'"', String.Double, '#pop'),
|
2676
|
-
(r'{', Operator, 'root'),
|
2677
|
-
include('escape-sequence'),
|
2678
|
-
],
|
2679
|
-
'single-string': [
|
2680
|
-
(r'[^\\\'{]+', String.Double),
|
2681
|
-
(r'\'', String.Double, '#pop'),
|
2682
|
-
(r'{', Operator, 'root'),
|
2683
|
-
include('escape-sequence'),
|
2684
|
-
],
|
2685
|
-
|
2686
|
-
# all the html stuff
|
2687
|
-
# can't really reuse some existing html parser
|
2688
|
-
# because we must be able to parse embedded expressions
|
2689
|
-
|
2690
|
-
# we are in this state after someone parsed the '<' that
|
2691
|
-
# started the html literal
|
2692
|
-
'html-open-tag': [
|
2693
|
-
(r'[\w\-:]+', String.Single, ('#pop', 'html-attr')),
|
2694
|
-
(r'>', String.Single, ('#pop', 'html-content')),
|
2695
|
-
],
|
2696
|
-
|
2697
|
-
# we are in this state after someone parsed the '</' that
|
2698
|
-
# started the end of the closing tag
|
2699
|
-
'html-end-tag': [
|
2700
|
-
# this is a star, because </> is allowed
|
2701
|
-
(r'[\w\-:]*>', String.Single, '#pop'),
|
2702
|
-
],
|
2703
|
-
|
2704
|
-
# we are in this state after having parsed '<ident(:ident)?'
|
2705
|
-
# we thus parse a possibly empty list of attributes
|
2706
|
-
'html-attr': [
|
2707
|
-
(r'\s+', Text),
|
2708
|
-
(r'[\w\-:]+=', String.Single, 'html-attr-value'),
|
2709
|
-
(r'/>', String.Single, '#pop'),
|
2710
|
-
(r'>', String.Single, ('#pop', 'html-content')),
|
2711
|
-
],
|
2712
|
-
|
2713
|
-
'html-attr-value': [
|
2714
|
-
(r"'", String.Single, ('#pop', 'single-string')),
|
2715
|
-
(r'"', String.Single, ('#pop', 'string')),
|
2716
|
-
(r'#'+ident_re, String.Single, '#pop'),
|
2717
|
-
(r'#(?={)', String.Single, ('#pop', 'root')),
|
2718
|
-
(r'[^"\'{`=<>]+', String.Single, '#pop'),
|
2719
|
-
(r'{', Operator, ('#pop', 'root')), # this is a tail call!
|
2720
|
-
],
|
2721
|
-
|
2722
|
-
# we should probably deal with '\' escapes here
|
2723
|
-
'html-content': [
|
2724
|
-
(r'<!--', Comment, 'html-comment'),
|
2725
|
-
(r'</', String.Single, ('#pop', 'html-end-tag')),
|
2726
|
-
(r'<', String.Single, 'html-open-tag'),
|
2727
|
-
(r'{', Operator, 'root'),
|
2728
|
-
(r'[^<{]+', String.Single),
|
2729
|
-
],
|
2730
|
-
|
2731
|
-
'html-comment': [
|
2732
|
-
(r'-->', Comment, '#pop'),
|
2733
|
-
(r'[^\-]+|-', Comment),
|
2734
|
-
],
|
2735
|
-
}
|
2736
|
-
|
2737
|
-
|
2738
|
-
class CoqLexer(RegexLexer):
|
2739
|
-
"""
|
2740
|
-
For the `Coq <http://coq.inria.fr/>`_ theorem prover.
|
2741
|
-
|
2742
|
-
.. versionadded:: 1.5
|
2743
|
-
"""
|
2744
|
-
|
2745
|
-
name = 'Coq'
|
2746
|
-
aliases = ['coq']
|
2747
|
-
filenames = ['*.v']
|
2748
|
-
mimetypes = ['text/x-coq']
|
2749
|
-
|
2750
|
-
keywords1 = [
|
2751
|
-
# Vernacular commands
|
2752
|
-
'Section', 'Module', 'End', 'Require', 'Import', 'Export', 'Variable',
|
2753
|
-
'Variables', 'Parameter', 'Parameters', 'Axiom', 'Hypothesis',
|
2754
|
-
'Hypotheses', 'Notation', 'Local', 'Tactic', 'Reserved', 'Scope',
|
2755
|
-
'Open', 'Close', 'Bind', 'Delimit', 'Definition', 'Let', 'Ltac',
|
2756
|
-
'Fixpoint', 'CoFixpoint', 'Morphism', 'Relation', 'Implicit',
|
2757
|
-
'Arguments', 'Set', 'Unset', 'Contextual', 'Strict', 'Prenex',
|
2758
|
-
'Implicits', 'Inductive', 'CoInductive', 'Record', 'Structure',
|
2759
|
-
'Canonical', 'Coercion', 'Theorem', 'Lemma', 'Corollary',
|
2760
|
-
'Proposition', 'Fact', 'Remark', 'Example', 'Proof', 'Goal', 'Save',
|
2761
|
-
'Qed', 'Defined', 'Hint', 'Resolve', 'Rewrite', 'View', 'Search',
|
2762
|
-
'Show', 'Print', 'Printing', 'All', 'Graph', 'Projections', 'inside',
|
2763
|
-
'outside',
|
2764
|
-
]
|
2765
|
-
keywords2 = [
|
2766
|
-
# Gallina
|
2767
|
-
'forall', 'exists', 'exists2', 'fun', 'fix', 'cofix', 'struct',
|
2768
|
-
'match', 'end', 'in', 'return', 'let', 'if', 'is', 'then', 'else',
|
2769
|
-
'for', 'of', 'nosimpl', 'with', 'as',
|
2770
|
-
]
|
2771
|
-
keywords3 = [
|
2772
|
-
# Sorts
|
2773
|
-
'Type', 'Prop',
|
2774
|
-
]
|
2775
|
-
keywords4 = [
|
2776
|
-
# Tactics
|
2777
|
-
'pose', 'set', 'move', 'case', 'elim', 'apply', 'clear', 'hnf', 'intro',
|
2778
|
-
'intros', 'generalize', 'rename', 'pattern', 'after', 'destruct',
|
2779
|
-
'induction', 'using', 'refine', 'inversion', 'injection', 'rewrite',
|
2780
|
-
'congr', 'unlock', 'compute', 'ring', 'field', 'replace', 'fold',
|
2781
|
-
'unfold', 'change', 'cutrewrite', 'simpl', 'have', 'suff', 'wlog',
|
2782
|
-
'suffices', 'without', 'loss', 'nat_norm', 'assert', 'cut', 'trivial',
|
2783
|
-
'revert', 'bool_congr', 'nat_congr', 'symmetry', 'transitivity', 'auto',
|
2784
|
-
'split', 'left', 'right', 'autorewrite',
|
2785
|
-
]
|
2786
|
-
keywords5 = [
|
2787
|
-
# Terminators
|
2788
|
-
'by', 'done', 'exact', 'reflexivity', 'tauto', 'romega', 'omega',
|
2789
|
-
'assumption', 'solve', 'contradiction', 'discriminate',
|
2790
|
-
]
|
2791
|
-
keywords6 = [
|
2792
|
-
# Control
|
2793
|
-
'do', 'last', 'first', 'try', 'idtac', 'repeat',
|
2794
|
-
]
|
2795
|
-
# 'as', 'assert', 'begin', 'class', 'constraint', 'do', 'done',
|
2796
|
-
# 'downto', 'else', 'end', 'exception', 'external', 'false',
|
2797
|
-
# 'for', 'fun', 'function', 'functor', 'if', 'in', 'include',
|
2798
|
-
# 'inherit', 'initializer', 'lazy', 'let', 'match', 'method',
|
2799
|
-
# 'module', 'mutable', 'new', 'object', 'of', 'open', 'private',
|
2800
|
-
# 'raise', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try',
|
2801
|
-
# 'type', 'val', 'virtual', 'when', 'while', 'with'
|
2802
|
-
keyopts = [
|
2803
|
-
'!=', '#', '&', '&&', r'\(', r'\)', r'\*', r'\+', ',', '-',
|
2804
|
-
r'-\.', '->', r'\.', r'\.\.', ':', '::', ':=', ':>', ';', ';;', '<',
|
2805
|
-
'<-', '=', '>', '>]', '>}', r'\?', r'\?\?', r'\[', r'\[<', r'\[>',
|
2806
|
-
r'\[\|', ']', '_', '`', '{', '{<', r'\|', r'\|]', '}', '~', '=>',
|
2807
|
-
r'/\\', r'\\/',
|
2808
|
-
u'Π', u'λ',
|
2809
|
-
]
|
2810
|
-
operators = r'[!$%&*+\./:<=>?@^|~-]'
|
2811
|
-
word_operators = ['and', 'asr', 'land', 'lor', 'lsl', 'lxor', 'mod', 'or']
|
2812
|
-
prefix_syms = r'[!?~]'
|
2813
|
-
infix_syms = r'[=<>@^|&+\*/$%-]'
|
2814
|
-
primitives = ['unit', 'int', 'float', 'bool', 'string', 'char', 'list',
|
2815
|
-
'array']
|
2816
|
-
|
2817
|
-
tokens = {
|
2818
|
-
'root': [
|
2819
|
-
(r'\s+', Text),
|
2820
|
-
(r'false|true|\(\)|\[\]', Name.Builtin.Pseudo),
|
2821
|
-
(r'\(\*', Comment, 'comment'),
|
2822
|
-
(r'\b(%s)\b' % '|'.join(keywords1), Keyword.Namespace),
|
2823
|
-
(r'\b(%s)\b' % '|'.join(keywords2), Keyword),
|
2824
|
-
(r'\b(%s)\b' % '|'.join(keywords3), Keyword.Type),
|
2825
|
-
(r'\b(%s)\b' % '|'.join(keywords4), Keyword),
|
2826
|
-
(r'\b(%s)\b' % '|'.join(keywords5), Keyword.Pseudo),
|
2827
|
-
(r'\b(%s)\b' % '|'.join(keywords6), Keyword.Reserved),
|
2828
|
-
(r'\b([A-Z][\w\']*)(?=\s*\.)',
|
2829
|
-
Name.Namespace, 'dotted'),
|
2830
|
-
(r'\b([A-Z][\w\']*)', Name.Class),
|
2831
|
-
(r'(%s)' % '|'.join(keyopts[::-1]), Operator),
|
2832
|
-
(r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator),
|
2833
|
-
(r'\b(%s)\b' % '|'.join(word_operators), Operator.Word),
|
2834
|
-
(r'\b(%s)\b' % '|'.join(primitives), Keyword.Type),
|
2835
|
-
|
2836
|
-
(r"[^\W\d][\w']*", Name),
|
2837
|
-
|
2838
|
-
(r'\d[\d_]*', Number.Integer),
|
2839
|
-
(r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
|
2840
|
-
(r'0[oO][0-7][0-7_]*', Number.Oct),
|
2841
|
-
(r'0[bB][01][01_]*', Number.Bin),
|
2842
|
-
(r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float),
|
2843
|
-
|
2844
|
-
(r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'",
|
2845
|
-
String.Char),
|
2846
|
-
(r"'.'", String.Char),
|
2847
|
-
(r"'", Keyword), # a stray quote is another syntax element
|
2848
|
-
|
2849
|
-
(r'"', String.Double, 'string'),
|
2850
|
-
|
2851
|
-
(r'[~?][a-z][\w\']*:', Name.Variable),
|
2852
|
-
],
|
2853
|
-
'comment': [
|
2854
|
-
(r'[^(*)]+', Comment),
|
2855
|
-
(r'\(\*', Comment, '#push'),
|
2856
|
-
(r'\*\)', Comment, '#pop'),
|
2857
|
-
(r'[(*)]', Comment),
|
2858
|
-
],
|
2859
|
-
'string': [
|
2860
|
-
(r'[^"]+', String.Double),
|
2861
|
-
(r'""', String.Double),
|
2862
|
-
(r'"', String.Double, '#pop'),
|
2863
|
-
],
|
2864
|
-
'dotted': [
|
2865
|
-
(r'\s+', Text),
|
2866
|
-
(r'\.', Punctuation),
|
2867
|
-
(r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
|
2868
|
-
(r'[A-Z][\w\']*', Name.Class, '#pop'),
|
2869
|
-
(r'[a-z][a-z0-9_\']*', Name, '#pop'),
|
2870
|
-
default('#pop')
|
2871
|
-
],
|
2872
|
-
}
|
2873
|
-
|
2874
|
-
def analyse_text(text):
|
2875
|
-
if text.startswith('(*'):
|
2876
|
-
return True
|
2877
|
-
|
2878
|
-
|
2879
|
-
class NewLispLexer(RegexLexer):
|
2880
|
-
"""
|
2881
|
-
For `newLISP. <www.newlisp.org>`_ source code (version 10.3.0).
|
2882
|
-
|
2883
|
-
.. versionadded:: 1.5
|
2884
|
-
"""
|
2885
|
-
|
2886
|
-
name = 'NewLisp'
|
2887
|
-
aliases = ['newlisp']
|
2888
|
-
filenames = ['*.lsp', '*.nl']
|
2889
|
-
mimetypes = ['text/x-newlisp', 'application/x-newlisp']
|
2890
|
-
|
2891
|
-
flags = re.IGNORECASE | re.MULTILINE | re.UNICODE
|
2892
|
-
|
2893
|
-
# list of built-in functions for newLISP version 10.3
|
2894
|
-
builtins = [
|
2895
|
-
'^', '--', '-', ':', '!', '!=', '?', '@', '*', '/', '&', '%', '+', '++',
|
2896
|
-
'<', '<<', '<=', '=', '>', '>=', '>>', '|', '~', '$', '$0', '$1', '$10',
|
2897
|
-
'$11', '$12', '$13', '$14', '$15', '$2', '$3', '$4', '$5', '$6', '$7',
|
2898
|
-
'$8', '$9', '$args', '$idx', '$it', '$main-args', 'abort', 'abs',
|
2899
|
-
'acos', 'acosh', 'add', 'address', 'amb', 'and', 'and', 'append-file',
|
2900
|
-
'append', 'apply', 'args', 'array-list', 'array?', 'array', 'asin',
|
2901
|
-
'asinh', 'assoc', 'atan', 'atan2', 'atanh', 'atom?', 'base64-dec',
|
2902
|
-
'base64-enc', 'bayes-query', 'bayes-train', 'begin', 'begin', 'begin',
|
2903
|
-
'beta', 'betai', 'bind', 'binomial', 'bits', 'callback', 'case', 'case',
|
2904
|
-
'case', 'catch', 'ceil', 'change-dir', 'char', 'chop', 'Class', 'clean',
|
2905
|
-
'close', 'command-event', 'cond', 'cond', 'cond', 'cons', 'constant',
|
2906
|
-
'context?', 'context', 'copy-file', 'copy', 'cos', 'cosh', 'count',
|
2907
|
-
'cpymem', 'crc32', 'crit-chi2', 'crit-z', 'current-line', 'curry',
|
2908
|
-
'date-list', 'date-parse', 'date-value', 'date', 'debug', 'dec',
|
2909
|
-
'def-new', 'default', 'define-macro', 'define-macro', 'define',
|
2910
|
-
'delete-file', 'delete-url', 'delete', 'destroy', 'det', 'device',
|
2911
|
-
'difference', 'directory?', 'directory', 'div', 'do-until', 'do-while',
|
2912
|
-
'doargs', 'dolist', 'dostring', 'dotimes', 'dotree', 'dump', 'dup',
|
2913
|
-
'empty?', 'encrypt', 'ends-with', 'env', 'erf', 'error-event',
|
2914
|
-
'eval-string', 'eval', 'exec', 'exists', 'exit', 'exp', 'expand',
|
2915
|
-
'explode', 'extend', 'factor', 'fft', 'file-info', 'file?', 'filter',
|
2916
|
-
'find-all', 'find', 'first', 'flat', 'float?', 'float', 'floor', 'flt',
|
2917
|
-
'fn', 'for-all', 'for', 'fork', 'format', 'fv', 'gammai', 'gammaln',
|
2918
|
-
'gcd', 'get-char', 'get-float', 'get-int', 'get-long', 'get-string',
|
2919
|
-
'get-url', 'global?', 'global', 'if-not', 'if', 'ifft', 'import', 'inc',
|
2920
|
-
'index', 'inf?', 'int', 'integer?', 'integer', 'intersect', 'invert',
|
2921
|
-
'irr', 'join', 'lambda-macro', 'lambda?', 'lambda', 'last-error',
|
2922
|
-
'last', 'legal?', 'length', 'let', 'let', 'let', 'letex', 'letn',
|
2923
|
-
'letn', 'letn', 'list?', 'list', 'load', 'local', 'log', 'lookup',
|
2924
|
-
'lower-case', 'macro?', 'main-args', 'MAIN', 'make-dir', 'map', 'mat',
|
2925
|
-
'match', 'max', 'member', 'min', 'mod', 'module', 'mul', 'multiply',
|
2926
|
-
'NaN?', 'net-accept', 'net-close', 'net-connect', 'net-error',
|
2927
|
-
'net-eval', 'net-interface', 'net-ipv', 'net-listen', 'net-local',
|
2928
|
-
'net-lookup', 'net-packet', 'net-peek', 'net-peer', 'net-ping',
|
2929
|
-
'net-receive-from', 'net-receive-udp', 'net-receive', 'net-select',
|
2930
|
-
'net-send-to', 'net-send-udp', 'net-send', 'net-service',
|
2931
|
-
'net-sessions', 'new', 'nil?', 'nil', 'normal', 'not', 'now', 'nper',
|
2932
|
-
'npv', 'nth', 'null?', 'number?', 'open', 'or', 'ostype', 'pack',
|
2933
|
-
'parse-date', 'parse', 'peek', 'pipe', 'pmt', 'pop-assoc', 'pop',
|
2934
|
-
'post-url', 'pow', 'prefix', 'pretty-print', 'primitive?', 'print',
|
2935
|
-
'println', 'prob-chi2', 'prob-z', 'process', 'prompt-event',
|
2936
|
-
'protected?', 'push', 'put-url', 'pv', 'quote?', 'quote', 'rand',
|
2937
|
-
'random', 'randomize', 'read', 'read-char', 'read-expr', 'read-file',
|
2938
|
-
'read-key', 'read-line', 'read-utf8', 'read', 'reader-event',
|
2939
|
-
'real-path', 'receive', 'ref-all', 'ref', 'regex-comp', 'regex',
|
2940
|
-
'remove-dir', 'rename-file', 'replace', 'reset', 'rest', 'reverse',
|
2941
|
-
'rotate', 'round', 'save', 'search', 'seed', 'seek', 'select', 'self',
|
2942
|
-
'semaphore', 'send', 'sequence', 'series', 'set-locale', 'set-ref-all',
|
2943
|
-
'set-ref', 'set', 'setf', 'setq', 'sgn', 'share', 'signal', 'silent',
|
2944
|
-
'sin', 'sinh', 'sleep', 'slice', 'sort', 'source', 'spawn', 'sqrt',
|
2945
|
-
'starts-with', 'string?', 'string', 'sub', 'swap', 'sym', 'symbol?',
|
2946
|
-
'symbols', 'sync', 'sys-error', 'sys-info', 'tan', 'tanh', 'term',
|
2947
|
-
'throw-error', 'throw', 'time-of-day', 'time', 'timer', 'title-case',
|
2948
|
-
'trace-highlight', 'trace', 'transpose', 'Tree', 'trim', 'true?',
|
2949
|
-
'true', 'unicode', 'unify', 'unique', 'unless', 'unpack', 'until',
|
2950
|
-
'upper-case', 'utf8', 'utf8len', 'uuid', 'wait-pid', 'when', 'while',
|
2951
|
-
'write', 'write-char', 'write-file', 'write-line', 'write',
|
2952
|
-
'xfer-event', 'xml-error', 'xml-parse', 'xml-type-tags', 'zero?',
|
2953
|
-
]
|
2954
|
-
|
2955
|
-
# valid names
|
2956
|
-
valid_name = r'([\w!$%&*+.,/<=>?@^~|-])+|(\[.*?\])+'
|
2957
|
-
|
2958
|
-
tokens = {
|
2959
|
-
'root': [
|
2960
|
-
# shebang
|
2961
|
-
(r'#!(.*?)$', Comment.Preproc),
|
2962
|
-
# comments starting with semicolon
|
2963
|
-
(r';.*$', Comment.Single),
|
2964
|
-
# comments starting with #
|
2965
|
-
(r'#.*$', Comment.Single),
|
2966
|
-
|
2967
|
-
# whitespace
|
2968
|
-
(r'\s+', Text),
|
2969
|
-
|
2970
|
-
# strings, symbols and characters
|
2971
|
-
(r'"(\\\\|\\"|[^"])*"', String),
|
2972
|
-
|
2973
|
-
# braces
|
2974
|
-
(r"{", String, "bracestring"),
|
2975
|
-
|
2976
|
-
# [text] ... [/text] delimited strings
|
2977
|
-
(r'\[text\]*', String, "tagstring"),
|
2978
|
-
|
2979
|
-
# 'special' operators...
|
2980
|
-
(r"('|:)", Operator),
|
2981
|
-
|
2982
|
-
# highlight the builtins
|
2983
|
-
('(%s)' % '|'.join(re.escape(entry) + '\\b' for entry in builtins),
|
2984
|
-
Keyword),
|
2985
|
-
|
2986
|
-
# the remaining functions
|
2987
|
-
(r'(?<=\()' + valid_name, Name.Variable),
|
2988
|
-
|
2989
|
-
# the remaining variables
|
2990
|
-
(valid_name, String.Symbol),
|
2991
|
-
|
2992
|
-
# parentheses
|
2993
|
-
(r'(\(|\))', Punctuation),
|
2994
|
-
],
|
2995
|
-
|
2996
|
-
# braced strings...
|
2997
|
-
'bracestring': [
|
2998
|
-
("{", String, "#push"),
|
2999
|
-
("}", String, "#pop"),
|
3000
|
-
("[^{}]+", String),
|
3001
|
-
],
|
3002
|
-
|
3003
|
-
# tagged [text]...[/text] delimited strings...
|
3004
|
-
'tagstring': [
|
3005
|
-
(r'(?s)(.*?)(\[/text\])', String, '#pop'),
|
3006
|
-
],
|
3007
|
-
}
|
3008
|
-
|
3009
|
-
|
3010
|
-
class NixLexer(RegexLexer):
|
3011
|
-
"""
|
3012
|
-
For the `Nix language <http://nixos.org/nix/>`_.
|
3013
|
-
|
3014
|
-
.. versionadded:: 2.0
|
3015
|
-
"""
|
3016
|
-
|
3017
|
-
name = 'Nix'
|
3018
|
-
aliases = ['nixos', 'nix']
|
3019
|
-
filenames = ['*.nix']
|
3020
|
-
mimetypes = ['text/x-nix']
|
3021
|
-
|
3022
|
-
flags = re.MULTILINE | re.UNICODE
|
3023
|
-
|
3024
|
-
keywords = ['rec', 'with', 'let', 'in', 'inherit', 'assert', 'if',
|
3025
|
-
'else', 'then', '...']
|
3026
|
-
builtins = ['import', 'abort', 'baseNameOf', 'dirOf', 'isNull', 'builtins',
|
3027
|
-
'map', 'removeAttrs', 'throw', 'toString', 'derivation']
|
3028
|
-
operators = ['++', '+', '?', '.', '!', '//', '==',
|
3029
|
-
'!=', '&&', '||', '->', '=']
|
3030
|
-
|
3031
|
-
punctuations = ["(", ")", "[", "]", ";", "{", "}", ":", ",", "@"]
|
3032
|
-
|
3033
|
-
tokens = {
|
3034
|
-
'root': [
|
3035
|
-
# comments starting with #
|
3036
|
-
(r'#.*$', Comment.Single),
|
3037
|
-
|
3038
|
-
# multiline comments
|
3039
|
-
(r'/\*', Comment.Multiline, 'comment'),
|
3040
|
-
|
3041
|
-
# whitespace
|
3042
|
-
(r'\s+', Text),
|
3043
|
-
|
3044
|
-
# keywords
|
3045
|
-
('(%s)' % '|'.join(re.escape(entry) + '\\b' for entry in keywords), Keyword),
|
3046
|
-
|
3047
|
-
# highlight the builtins
|
3048
|
-
('(%s)' % '|'.join(re.escape(entry) + '\\b' for entry in builtins),
|
3049
|
-
Name.Builtin),
|
3050
|
-
|
3051
|
-
(r'\b(true|false|null)\b', Name.Constant),
|
3052
|
-
|
3053
|
-
# operators
|
3054
|
-
('(%s)' % '|'.join(re.escape(entry) for entry in operators),
|
3055
|
-
Operator),
|
3056
|
-
|
3057
|
-
# word operators
|
3058
|
-
(r'\b(or|and)\b', Operator.Word),
|
3059
|
-
|
3060
|
-
# punctuations
|
3061
|
-
('(%s)' % '|'.join(re.escape(entry) for entry in punctuations), Punctuation),
|
3062
|
-
|
3063
|
-
# integers
|
3064
|
-
(r'[0-9]+', Number.Integer),
|
3065
|
-
|
3066
|
-
# strings
|
3067
|
-
(r'"', String.Double, 'doublequote'),
|
3068
|
-
(r"''", String.Single, 'singlequote'),
|
3069
|
-
|
3070
|
-
# paths
|
3071
|
-
(r'[\w.+-]*(\/[\w.+-]+)+', Literal),
|
3072
|
-
(r'\<[\w.+-]+(\/[\w.+-]+)*\>', Literal),
|
3073
|
-
|
3074
|
-
# urls
|
3075
|
-
(r'[a-zA-Z][a-zA-Z0-9\+\-\.]*\:[\w%/?:@&=+$,\\.!~*\'-]+', Literal),
|
3076
|
-
|
3077
|
-
# names of variables
|
3078
|
-
(r'[\w-]+\s*=', String.Symbol),
|
3079
|
-
(r'[a-zA-Z_][\w\'-]*', Text),
|
3080
|
-
|
3081
|
-
],
|
3082
|
-
'comment': [
|
3083
|
-
(r'[^/\*]+', Comment.Multiline),
|
3084
|
-
(r'/\*', Comment.Multiline, '#push'),
|
3085
|
-
(r'\*/', Comment.Multiline, '#pop'),
|
3086
|
-
(r'[\*/]', Comment.Multiline),
|
3087
|
-
],
|
3088
|
-
'singlequote': [
|
3089
|
-
(r"'''", String.Escape),
|
3090
|
-
(r"''\$\{", String.Escape),
|
3091
|
-
(r"''\n", String.Escape),
|
3092
|
-
(r"''\r", String.Escape),
|
3093
|
-
(r"''\t", String.Escape),
|
3094
|
-
(r"''", String.Single, '#pop'),
|
3095
|
-
(r'\$\{', String.Interpol, 'antiquote'),
|
3096
|
-
(r"[^']", String.Single),
|
3097
|
-
],
|
3098
|
-
'doublequote': [
|
3099
|
-
(r'\\', String.Escape),
|
3100
|
-
(r'\\"', String.Escape),
|
3101
|
-
(r'\\${', String.Escape),
|
3102
|
-
(r'"', String.Double, '#pop'),
|
3103
|
-
(r'\$\{', String.Interpol, 'antiquote'),
|
3104
|
-
(r'[^"]', String.Double),
|
3105
|
-
],
|
3106
|
-
'antiquote': [
|
3107
|
-
(r"}", String.Interpol, '#pop'),
|
3108
|
-
# TODO: we should probably escape also here ''${ \${
|
3109
|
-
(r"\$\{", String.Interpol, '#push'),
|
3110
|
-
include('root'),
|
3111
|
-
],
|
3112
|
-
}
|
3113
|
-
|
3114
|
-
def analyse_text(text):
|
3115
|
-
rv = 0.0
|
3116
|
-
# TODO: let/in
|
3117
|
-
if re.search(r'import.+?<[^>]+>', text):
|
3118
|
-
rv += 0.4
|
3119
|
-
if re.search(r'mkDerivation\s+(\(|\{|rec)', text):
|
3120
|
-
rv += 0.4
|
3121
|
-
if re.search(r'with\s+[a-zA-Z\.]+;', text):
|
3122
|
-
rv += 0.2
|
3123
|
-
if re.search(r'inherit\s+[a-zA-Z()\.];', text):
|
3124
|
-
rv += 0.2
|
3125
|
-
if re.search(r'=\s+mkIf\s+', text):
|
3126
|
-
rv += 0.4
|
3127
|
-
if re.search(r'\{[a-zA-Z,\s]+\}:', text):
|
3128
|
-
rv += 0.1
|
3129
|
-
return rv
|
3130
|
-
|
3131
|
-
|
3132
|
-
def gen_elixir_string_rules(name, symbol, token):
|
3133
|
-
states = {}
|
3134
|
-
states['string_' + name] = [
|
3135
|
-
(r'[^#%s\\]+' % (symbol,), token),
|
3136
|
-
include('escapes'),
|
3137
|
-
(r'\\.', token),
|
3138
|
-
(r'(%s)(:?)' % (symbol,), bygroups(token, Punctuation), "#pop"),
|
3139
|
-
include('interpol')
|
3140
|
-
]
|
3141
|
-
return states
|
3142
|
-
|
3143
|
-
def gen_elixir_sigstr_rules(term, token, interpol=True):
|
3144
|
-
if interpol:
|
3145
|
-
return [
|
3146
|
-
(r'[^#%s\\]+' % (term,), token),
|
3147
|
-
include('escapes'),
|
3148
|
-
(r'\\.', token),
|
3149
|
-
(r'%s[a-zA-Z]*' % (term,), token, '#pop'),
|
3150
|
-
include('interpol')
|
3151
|
-
]
|
3152
|
-
else:
|
3153
|
-
return [
|
3154
|
-
(r'[^%s\\]+' % (term,), token),
|
3155
|
-
(r'\\.', token),
|
3156
|
-
(r'%s[a-zA-Z]*' % (term,), token, '#pop'),
|
3157
|
-
]
|
3158
|
-
|
3159
|
-
class ElixirLexer(RegexLexer):
|
3160
|
-
"""
|
3161
|
-
For the `Elixir language <http://elixir-lang.org>`_.
|
3162
|
-
|
3163
|
-
.. versionadded:: 1.5
|
3164
|
-
"""
|
3165
|
-
|
3166
|
-
name = 'Elixir'
|
3167
|
-
aliases = ['elixir', 'ex', 'exs']
|
3168
|
-
filenames = ['*.ex', '*.exs']
|
3169
|
-
mimetypes = ['text/x-elixir']
|
3170
|
-
|
3171
|
-
KEYWORD = ['fn', 'do', 'end', 'after', 'else', 'rescue', 'catch']
|
3172
|
-
KEYWORD_OPERATOR = ['not', 'and', 'or', 'xor', 'when', 'in']
|
3173
|
-
BUILTIN = [
|
3174
|
-
'case', 'cond', 'for', 'if', 'unless', 'try', 'receive', 'raise',
|
3175
|
-
'quote', 'unquote', 'unquote_splicing', 'throw', 'super'
|
3176
|
-
]
|
3177
|
-
BUILTIN_DECLARATION = [
|
3178
|
-
'def', 'defp', 'defmodule', 'defprotocol', 'defmacro', 'defmacrop',
|
3179
|
-
'defdelegate', 'defexception', 'defstruct', 'defimpl', 'defcallback'
|
3180
|
-
]
|
3181
|
-
|
3182
|
-
BUILTIN_NAMESPACE = ['import', 'require', 'use', 'alias']
|
3183
|
-
CONSTANT = ['nil', 'true', 'false']
|
3184
|
-
|
3185
|
-
PSEUDO_VAR = ['_', '__MODULE__', '__DIR__', '__ENV__', '__CALLER__']
|
3186
|
-
|
3187
|
-
OPERATORS3 = ['<<<', '>>>', '|||', '&&&', '^^^', '~~~', '===', '!==']
|
3188
|
-
OPERATORS2 = [
|
3189
|
-
'==', '!=', '<=', '>=', '&&', '||', '<>', '++', '--', '|>', '=~'
|
3190
|
-
]
|
3191
|
-
OPERATORS1 = ['<', '>', '+', '-', '*', '/', '!', '^', '&']
|
3192
|
-
|
3193
|
-
PUNCTUATION = [
|
3194
|
-
'\\\\', '<<', '>>', '::', '->', '<-', '=>', '|', '(', ')',
|
3195
|
-
'{', '}', ';', ',', '.', '[', ']', '%', '='
|
3196
|
-
]
|
3197
|
-
|
3198
|
-
def get_tokens_unprocessed(self, text):
|
3199
|
-
for index, token, value in RegexLexer.get_tokens_unprocessed(self, text):
|
3200
|
-
if token is Name:
|
3201
|
-
if value in self.KEYWORD:
|
3202
|
-
yield index, Keyword, value
|
3203
|
-
elif value in self.KEYWORD_OPERATOR:
|
3204
|
-
yield index, Operator.Word, value
|
3205
|
-
elif value in self.BUILTIN:
|
3206
|
-
yield index, Keyword, value
|
3207
|
-
elif value in self.BUILTIN_DECLARATION:
|
3208
|
-
yield index, Keyword.Declaration, value
|
3209
|
-
elif value in self.BUILTIN_NAMESPACE:
|
3210
|
-
yield index, Keyword.Namespace, value
|
3211
|
-
elif value in self.CONSTANT:
|
3212
|
-
yield index, Name.Constant, value
|
3213
|
-
elif value in self.PSEUDO_VAR:
|
3214
|
-
yield index, Name.Builtin.Pseudo, value
|
3215
|
-
else:
|
3216
|
-
yield index, token, value
|
3217
|
-
else:
|
3218
|
-
yield index, token, value
|
3219
|
-
|
3220
|
-
def gen_elixir_sigil_rules():
|
3221
|
-
# these braces are balanced inside the sigil string
|
3222
|
-
braces = [
|
3223
|
-
(r'\{', r'\}', 'cb'),
|
3224
|
-
(r'\[', r'\]', 'sb'),
|
3225
|
-
(r'\(', r'\)', 'pa'),
|
3226
|
-
(r'\<', r'\>', 'ab'),
|
3227
|
-
]
|
3228
|
-
|
3229
|
-
# these are also valid sigil terminators, they are not balanced
|
3230
|
-
terms = [
|
3231
|
-
(r'/', 'slas'), (r'\|', 'pipe'), ('"', 'quot'), ("'", 'apos'),
|
3232
|
-
]
|
3233
|
-
|
3234
|
-
# heredocs have slightly different rules, they are not balanced
|
3235
|
-
triquotes = [(r'"""', 'triquot'), (r"'''", 'triapos')]
|
3236
|
-
|
3237
|
-
token = String.Other
|
3238
|
-
states = {'sigils': []}
|
3239
|
-
|
3240
|
-
for term, name in triquotes:
|
3241
|
-
states['sigils'] += [
|
3242
|
-
(r'(~[a-z])(%s)' % (term,), bygroups(token, String.Heredoc),
|
3243
|
-
(name + '-end', name + '-intp')),
|
3244
|
-
(r'(~[A-Z])(%s)' % (term,), bygroups(token, String.Heredoc),
|
3245
|
-
(name + '-end', name + '-no-intp')),
|
3246
|
-
]
|
3247
|
-
|
3248
|
-
states[name +'-end'] = [(r'[a-zA-Z]*', token, '#pop')]
|
3249
|
-
states[name +'-intp'] = [
|
3250
|
-
(r'^\s*' + term, String.Heredoc, '#pop'),
|
3251
|
-
include('heredoc_interpol'),
|
3252
|
-
]
|
3253
|
-
states[name +'-no-intp'] = [
|
3254
|
-
(r'^\s*' + term, String.Heredoc, '#pop'),
|
3255
|
-
include('heredoc_no_interpol'),
|
3256
|
-
]
|
3257
|
-
|
3258
|
-
for term, name in terms:
|
3259
|
-
states['sigils'] += [
|
3260
|
-
(r'~[a-z]' + term, token, name + '-intp'),
|
3261
|
-
(r'~[A-Z]' + term, token, name + '-no-intp'),
|
3262
|
-
]
|
3263
|
-
|
3264
|
-
# Similar states to the braced sigils, but no balancing of
|
3265
|
-
# terminators
|
3266
|
-
states[name +'-intp'] = gen_elixir_sigstr_rules(term, token)
|
3267
|
-
states[name +'-no-intp'] = \
|
3268
|
-
gen_elixir_sigstr_rules(term, token, interpol=False)
|
3269
|
-
|
3270
|
-
for lbrace, rbrace, name in braces:
|
3271
|
-
states['sigils'] += [
|
3272
|
-
(r'~[a-z]' + lbrace, token, name + '-intp'),
|
3273
|
-
(r'~[A-Z]' + lbrace, token, name + '-no-intp')
|
3274
|
-
]
|
3275
|
-
|
3276
|
-
states[name +'-intp'] = [
|
3277
|
-
(r'\\.', token),
|
3278
|
-
(lbrace, token, '#push'),
|
3279
|
-
] + gen_elixir_sigstr_rules(rbrace, token)
|
3280
|
-
|
3281
|
-
states[name +'-no-intp'] = [
|
3282
|
-
(r'\\.', token),
|
3283
|
-
(lbrace, token, '#push'),
|
3284
|
-
] + gen_elixir_sigstr_rules(rbrace, token, interpol=False)
|
3285
|
-
|
3286
|
-
return states
|
3287
|
-
|
3288
|
-
op3_re = "|".join(re.escape(s) for s in OPERATORS3)
|
3289
|
-
op2_re = "|".join(re.escape(s) for s in OPERATORS2)
|
3290
|
-
op1_re = "|".join(re.escape(s) for s in OPERATORS1)
|
3291
|
-
ops_re = r'(?:%s|%s|%s)' % (op3_re, op2_re, op1_re)
|
3292
|
-
punctuation_re = "|".join(re.escape(s) for s in PUNCTUATION)
|
3293
|
-
name_re = r'[a-z_][a-zA-Z_0-9]*[!\?]?'
|
3294
|
-
modname_re = r'[A-Z][A-Za-z_]*(?:\.[A-Z][A-Za-z_]*)*'
|
3295
|
-
complex_name_re = r'(?:%s|%s|%s)' % (name_re, modname_re, ops_re)
|
3296
|
-
special_atom_re = r'(?:\.\.\.|<<>>|%{}|%|{})'
|
3297
|
-
|
3298
|
-
tokens = {
|
3299
|
-
'root': [
|
3300
|
-
(r'\s+', Text),
|
3301
|
-
(r'#.*$', Comment.Single),
|
3302
|
-
|
3303
|
-
# Various kinds of characters
|
3304
|
-
(r'(?i)(\?)(\\x{)([\da-f]+)(})',
|
3305
|
-
bygroups(String.Char,
|
3306
|
-
String.Escape, Number.Hex, String.Escape)),
|
3307
|
-
(r'(?i)(\?)(\\x[\da-f]{1,2})',
|
3308
|
-
bygroups(String.Char, String.Escape)),
|
3309
|
-
(r'(\?)(\\[0-7]{1,3})',
|
3310
|
-
bygroups(String.Char, String.Escape)),
|
3311
|
-
(r'(\?)(\\[abdefnrstv])',
|
3312
|
-
bygroups(String.Char, String.Escape)),
|
3313
|
-
(r'\?\\?.', String.Char),
|
3314
|
-
|
3315
|
-
# atoms
|
3316
|
-
(r':' + special_atom_re, String.Symbol),
|
3317
|
-
(r':' + complex_name_re, String.Symbol),
|
3318
|
-
(r':"', String.Symbol, 'string_double_atom'),
|
3319
|
-
(r":'", String.Symbol, 'string_single_atom'),
|
3320
|
-
|
3321
|
-
# [keywords: ...]
|
3322
|
-
(r'(%s|%s)(:)(?=\s|\n)' % (special_atom_re, complex_name_re),
|
3323
|
-
bygroups(String.Symbol, Punctuation)),
|
3324
|
-
|
3325
|
-
# @attributes
|
3326
|
-
(r'@' + name_re, Name.Attribute),
|
3327
|
-
|
3328
|
-
# operators and punctuation
|
3329
|
-
(op3_re, Operator),
|
3330
|
-
(op2_re, Operator),
|
3331
|
-
(punctuation_re, Punctuation),
|
3332
|
-
(r'&\d', Name.Entity), # anon func arguments
|
3333
|
-
(op1_re, Operator),
|
3334
|
-
|
3335
|
-
# identifiers
|
3336
|
-
(name_re, Name),
|
3337
|
-
(modname_re, Name.Class),
|
3338
|
-
|
3339
|
-
# numbers
|
3340
|
-
(r'0[bB][01]+', Number.Bin),
|
3341
|
-
(r'0[0-7]+', Number.Oct),
|
3342
|
-
(r'(?i)0x[\da-f]+', Number.Hex),
|
3343
|
-
(r'\d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?', Number.Float),
|
3344
|
-
(r'\d(_?\d)*', Number.Integer),
|
3345
|
-
|
3346
|
-
# strings and heredocs
|
3347
|
-
(r'"""\s*', String.Heredoc, 'heredoc_double'),
|
3348
|
-
(r"'''\s*$", String.Heredoc, 'heredoc_single'),
|
3349
|
-
(r'"', String.Double, 'string_double'),
|
3350
|
-
(r"'", String.Single, 'string_single'),
|
3351
|
-
|
3352
|
-
include('sigils'),
|
3353
|
-
],
|
3354
|
-
'heredoc_double': [
|
3355
|
-
(r'^\s*"""', String.Heredoc, '#pop'),
|
3356
|
-
include('heredoc_interpol'),
|
3357
|
-
],
|
3358
|
-
'heredoc_single': [
|
3359
|
-
(r"^\s*'''", String.Heredoc, '#pop'),
|
3360
|
-
include('heredoc_interpol'),
|
3361
|
-
],
|
3362
|
-
'heredoc_interpol': [
|
3363
|
-
(r'[^#\\\n]+', String.Heredoc),
|
3364
|
-
include('escapes'),
|
3365
|
-
(r'\\.', String.Heredoc),
|
3366
|
-
(r'\n+', String.Heredoc),
|
3367
|
-
include('interpol'),
|
3368
|
-
],
|
3369
|
-
'heredoc_no_interpol': [
|
3370
|
-
(r'[^\\\n]+', String.Heredoc),
|
3371
|
-
(r'\\.', String.Heredoc),
|
3372
|
-
(r'\n+', String.Heredoc),
|
3373
|
-
],
|
3374
|
-
'escapes': [
|
3375
|
-
(r'(?i)(\\x{)([\da-f]+)(})',
|
3376
|
-
bygroups(String.Escape, Number.Hex, String.Escape)),
|
3377
|
-
(r'(?i)\\x[\da-f]{1,2}', String.Escape),
|
3378
|
-
(r'\\[0-7]{1,3}', String.Escape),
|
3379
|
-
(r'\\[abdefnrstv]', String.Escape),
|
3380
|
-
],
|
3381
|
-
'interpol': [
|
3382
|
-
(r'#{', String.Interpol, 'interpol_string'),
|
3383
|
-
],
|
3384
|
-
'interpol_string' : [
|
3385
|
-
(r'}', String.Interpol, "#pop"),
|
3386
|
-
include('root')
|
3387
|
-
],
|
3388
|
-
}
|
3389
|
-
tokens.update(gen_elixir_string_rules('double', '"', String.Double))
|
3390
|
-
tokens.update(gen_elixir_string_rules('single', "'", String.Single))
|
3391
|
-
tokens.update(gen_elixir_string_rules('double_atom', '"', String.Symbol))
|
3392
|
-
tokens.update(gen_elixir_string_rules('single_atom', "'", String.Symbol))
|
3393
|
-
tokens.update(gen_elixir_sigil_rules())
|
3394
|
-
|
3395
|
-
|
3396
|
-
class ElixirConsoleLexer(Lexer):
|
3397
|
-
"""
|
3398
|
-
For Elixir interactive console (iex) output like:
|
3399
|
-
|
3400
|
-
.. sourcecode:: iex
|
3401
|
-
|
3402
|
-
iex> [head | tail] = [1,2,3]
|
3403
|
-
[1,2,3]
|
3404
|
-
iex> head
|
3405
|
-
1
|
3406
|
-
iex> tail
|
3407
|
-
[2,3]
|
3408
|
-
iex> [head | tail]
|
3409
|
-
[1,2,3]
|
3410
|
-
iex> length [head | tail]
|
3411
|
-
3
|
3412
|
-
|
3413
|
-
.. versionadded:: 1.5
|
3414
|
-
"""
|
3415
|
-
|
3416
|
-
name = 'Elixir iex session'
|
3417
|
-
aliases = ['iex']
|
3418
|
-
mimetypes = ['text/x-elixir-shellsession']
|
3419
|
-
|
3420
|
-
_prompt_re = re.compile('(iex|\.{3})(\(\d+\))?> ')
|
3421
|
-
|
3422
|
-
def get_tokens_unprocessed(self, text):
|
3423
|
-
exlexer = ElixirLexer(**self.options)
|
3424
|
-
|
3425
|
-
curcode = ''
|
3426
|
-
in_error = False
|
3427
|
-
insertions = []
|
3428
|
-
for match in line_re.finditer(text):
|
3429
|
-
line = match.group()
|
3430
|
-
if line.startswith(u'** '):
|
3431
|
-
in_error = True
|
3432
|
-
insertions.append((len(curcode),
|
3433
|
-
[(0, Generic.Error, line[:-1])]))
|
3434
|
-
curcode += line[-1:]
|
3435
|
-
else:
|
3436
|
-
m = self._prompt_re.match(line)
|
3437
|
-
if m is not None:
|
3438
|
-
in_error = False
|
3439
|
-
end = m.end()
|
3440
|
-
insertions.append((len(curcode),
|
3441
|
-
[(0, Generic.Prompt, line[:end])]))
|
3442
|
-
curcode += line[end:]
|
3443
|
-
else:
|
3444
|
-
if curcode:
|
3445
|
-
for item in do_insertions(insertions,
|
3446
|
-
exlexer.get_tokens_unprocessed(curcode)):
|
3447
|
-
yield item
|
3448
|
-
curcode = ''
|
3449
|
-
insertions = []
|
3450
|
-
token = Generic.Error if in_error else Generic.Output
|
3451
|
-
yield match.start(), token, line
|
3452
|
-
if curcode:
|
3453
|
-
for item in do_insertions(insertions,
|
3454
|
-
exlexer.get_tokens_unprocessed(curcode)):
|
3455
|
-
yield item
|
3456
|
-
|
3457
|
-
|
3458
|
-
class KokaLexer(RegexLexer):
|
3459
|
-
"""
|
3460
|
-
Lexer for the `Koka <http://koka.codeplex.com>`_
|
3461
|
-
language.
|
3462
|
-
|
3463
|
-
.. versionadded:: 1.6
|
3464
|
-
"""
|
3465
|
-
|
3466
|
-
name = 'Koka'
|
3467
|
-
aliases = ['koka']
|
3468
|
-
filenames = ['*.kk', '*.kki']
|
3469
|
-
mimetypes = ['text/x-koka']
|
3470
|
-
|
3471
|
-
keywords = [
|
3472
|
-
'infix', 'infixr', 'infixl',
|
3473
|
-
'type', 'cotype', 'rectype', 'alias',
|
3474
|
-
'struct', 'con',
|
3475
|
-
'fun', 'function', 'val', 'var',
|
3476
|
-
'external',
|
3477
|
-
'if', 'then', 'else', 'elif', 'return', 'match',
|
3478
|
-
'private', 'public', 'private',
|
3479
|
-
'module', 'import', 'as',
|
3480
|
-
'include', 'inline',
|
3481
|
-
'rec',
|
3482
|
-
'try', 'yield', 'enum',
|
3483
|
-
'interface', 'instance',
|
3484
|
-
]
|
3485
|
-
|
3486
|
-
# keywords that are followed by a type
|
3487
|
-
typeStartKeywords = [
|
3488
|
-
'type', 'cotype', 'rectype', 'alias', 'struct', 'enum',
|
3489
|
-
]
|
3490
|
-
|
3491
|
-
# keywords valid in a type
|
3492
|
-
typekeywords = [
|
3493
|
-
'forall', 'exists', 'some', 'with',
|
3494
|
-
]
|
3495
|
-
|
3496
|
-
# builtin names and special names
|
3497
|
-
builtin = [
|
3498
|
-
'for', 'while', 'repeat',
|
3499
|
-
'foreach', 'foreach-indexed',
|
3500
|
-
'error', 'catch', 'finally',
|
3501
|
-
'cs', 'js', 'file', 'ref', 'assigned',
|
3502
|
-
]
|
3503
|
-
|
3504
|
-
# symbols that can be in an operator
|
3505
|
-
symbols = '[\$%&\*\+@!/\\\^~=\.:\-\?\|<>]+'
|
3506
|
-
|
3507
|
-
# symbol boundary: an operator keyword should not be followed by any of these
|
3508
|
-
sboundary = '(?!'+symbols+')'
|
3509
|
-
|
3510
|
-
# name boundary: a keyword should not be followed by any of these
|
3511
|
-
boundary = '(?![\w/])'
|
3512
|
-
|
3513
|
-
# koka token abstractions
|
3514
|
-
tokenType = Name.Attribute
|
3515
|
-
tokenTypeDef = Name.Class
|
3516
|
-
tokenConstructor = Generic.Emph
|
3517
|
-
|
3518
|
-
# main lexer
|
3519
|
-
tokens = {
|
3520
|
-
'root': [
|
3521
|
-
include('whitespace'),
|
3522
|
-
|
3523
|
-
# go into type mode
|
3524
|
-
(r'::?' + sboundary, tokenType, 'type'),
|
3525
|
-
(r'(alias)(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef),
|
3526
|
-
'alias-type'),
|
3527
|
-
(r'(struct)(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef),
|
3528
|
-
'struct-type'),
|
3529
|
-
((r'(%s)' % '|'.join(typeStartKeywords)) +
|
3530
|
-
r'(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef),
|
3531
|
-
'type'),
|
3532
|
-
|
3533
|
-
# special sequences of tokens (we use ?: for non-capturing group as
|
3534
|
-
# required by 'bygroups')
|
3535
|
-
(r'(module)(\s+)(interface\s+)?((?:[a-z]\w*/)*[a-z]\w*)',
|
3536
|
-
bygroups(Keyword, Text, Keyword, Name.Namespace)),
|
3537
|
-
(r'(import)(\s+)((?:[a-z]\w*/)*[a-z]\w*)'
|
3538
|
-
r'(?:(\s*)(=)(\s*)((?:qualified\s*)?)'
|
3539
|
-
r'((?:[a-z]\w*/)*[a-z]\w*))?',
|
3540
|
-
bygroups(Keyword, Text, Name.Namespace, Text, Keyword, Text,
|
3541
|
-
Keyword, Name.Namespace)),
|
3542
|
-
|
3543
|
-
(r'(^(?:(?:public|private)\s*)?(?:function|fun|val))'
|
3544
|
-
r'(\s+)([a-z]\w*|\((?:' + symbols + r'|/)\))',
|
3545
|
-
bygroups(Keyword, Text, Name.Function)),
|
3546
|
-
(r'(^(?:(?:public|private)\s*)?external)(\s+)(inline\s+)?'
|
3547
|
-
r'([a-z]\w*|\((?:' + symbols + r'|/)\))',
|
3548
|
-
bygroups(Keyword, Text, Keyword, Name.Function)),
|
3549
|
-
|
3550
|
-
# keywords
|
3551
|
-
(r'(%s)' % '|'.join(typekeywords) + boundary, Keyword.Type),
|
3552
|
-
(r'(%s)' % '|'.join(keywords) + boundary, Keyword),
|
3553
|
-
(r'(%s)' % '|'.join(builtin) + boundary, Keyword.Pseudo),
|
3554
|
-
(r'::?|:=|\->|[=\.]' + sboundary, Keyword),
|
3555
|
-
|
3556
|
-
# names
|
3557
|
-
(r'((?:[a-z]\w*/)*)([A-Z]\w*)',
|
3558
|
-
bygroups(Name.Namespace, tokenConstructor)),
|
3559
|
-
(r'((?:[a-z]\w*/)*)([a-z]\w*)', bygroups(Name.Namespace, Name)),
|
3560
|
-
(r'((?:[a-z]\w*/)*)(\((?:' + symbols + r'|/)\))',
|
3561
|
-
bygroups(Name.Namespace, Name)),
|
3562
|
-
(r'_\w*', Name.Variable),
|
3563
|
-
|
3564
|
-
# literal string
|
3565
|
-
(r'@"', String.Double, 'litstring'),
|
3566
|
-
|
3567
|
-
# operators
|
3568
|
-
(symbols + "|/(?![\*/])", Operator),
|
3569
|
-
(r'`', Operator),
|
3570
|
-
(r'[\{\}\(\)\[\];,]', Punctuation),
|
3571
|
-
|
3572
|
-
# literals. No check for literal characters with len > 1
|
3573
|
-
(r'[0-9]+\.[0-9]+([eE][\-\+]?[0-9]+)?', Number.Float),
|
3574
|
-
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
3575
|
-
(r'[0-9]+', Number.Integer),
|
3576
|
-
|
3577
|
-
(r"'", String.Char, 'char'),
|
3578
|
-
(r'"', String.Double, 'string'),
|
3579
|
-
],
|
3580
|
-
|
3581
|
-
# type started by alias
|
3582
|
-
'alias-type': [
|
3583
|
-
(r'=',Keyword),
|
3584
|
-
include('type')
|
3585
|
-
],
|
3586
|
-
|
3587
|
-
# type started by struct
|
3588
|
-
'struct-type': [
|
3589
|
-
(r'(?=\((?!,*\)))',Punctuation, '#pop'),
|
3590
|
-
include('type')
|
3591
|
-
],
|
3592
|
-
|
3593
|
-
# type started by colon
|
3594
|
-
'type': [
|
3595
|
-
(r'[\(\[<]', tokenType, 'type-nested'),
|
3596
|
-
include('type-content')
|
3597
|
-
],
|
3598
|
-
|
3599
|
-
# type nested in brackets: can contain parameters, comma etc.
|
3600
|
-
'type-nested': [
|
3601
|
-
(r'[\)\]>]', tokenType, '#pop'),
|
3602
|
-
(r'[\(\[<]', tokenType, 'type-nested'),
|
3603
|
-
(r',', tokenType),
|
3604
|
-
(r'([a-z]\w*)(\s*)(:)(?!:)',
|
3605
|
-
bygroups(Name, Text, tokenType)), # parameter name
|
3606
|
-
include('type-content')
|
3607
|
-
],
|
3608
|
-
|
3609
|
-
# shared contents of a type
|
3610
|
-
'type-content': [
|
3611
|
-
include('whitespace'),
|
3612
|
-
|
3613
|
-
# keywords
|
3614
|
-
(r'(%s)' % '|'.join(typekeywords) + boundary, Keyword),
|
3615
|
-
(r'(?=((%s)' % '|'.join(keywords) + boundary + '))',
|
3616
|
-
Keyword, '#pop'), # need to match because names overlap...
|
3617
|
-
|
3618
|
-
# kinds
|
3619
|
-
(r'[EPHVX]' + boundary, tokenType),
|
3620
|
-
|
3621
|
-
# type names
|
3622
|
-
(r'[a-z][0-9]*(?![\w/])', tokenType ),
|
3623
|
-
(r'_\w*', tokenType.Variable), # Generic.Emph
|
3624
|
-
(r'((?:[a-z]\w*/)*)([A-Z]\w*)',
|
3625
|
-
bygroups(Name.Namespace, tokenType)),
|
3626
|
-
(r'((?:[a-z]\w*/)*)([a-z]\w+)',
|
3627
|
-
bygroups(Name.Namespace, tokenType)),
|
3628
|
-
|
3629
|
-
# type keyword operators
|
3630
|
-
(r'::|\->|[\.:|]', tokenType),
|
3631
|
-
|
3632
|
-
#catchall
|
3633
|
-
default('#pop')
|
3634
|
-
],
|
3635
|
-
|
3636
|
-
# comments and literals
|
3637
|
-
'whitespace': [
|
3638
|
-
(r'\n\s*#.*$', Comment.Preproc),
|
3639
|
-
(r'\s+', Text),
|
3640
|
-
(r'/\*', Comment.Multiline, 'comment'),
|
3641
|
-
(r'//.*$', Comment.Single)
|
3642
|
-
],
|
3643
|
-
'comment': [
|
3644
|
-
(r'[^/\*]+', Comment.Multiline),
|
3645
|
-
(r'/\*', Comment.Multiline, '#push'),
|
3646
|
-
(r'\*/', Comment.Multiline, '#pop'),
|
3647
|
-
(r'[\*/]', Comment.Multiline),
|
3648
|
-
],
|
3649
|
-
'litstring': [
|
3650
|
-
(r'[^"]+', String.Double),
|
3651
|
-
(r'""', String.Escape),
|
3652
|
-
(r'"', String.Double, '#pop'),
|
3653
|
-
],
|
3654
|
-
'string': [
|
3655
|
-
(r'[^\\"\n]+', String.Double),
|
3656
|
-
include('escape-sequence'),
|
3657
|
-
(r'["\n]', String.Double, '#pop'),
|
3658
|
-
],
|
3659
|
-
'char': [
|
3660
|
-
(r'[^\\\'\n]+', String.Char),
|
3661
|
-
include('escape-sequence'),
|
3662
|
-
(r'[\'\n]', String.Char, '#pop'),
|
3663
|
-
],
|
3664
|
-
'escape-sequence': [
|
3665
|
-
(r'\\[nrt\\\"\']', String.Escape),
|
3666
|
-
(r'\\x[0-9a-fA-F]{2}', String.Escape),
|
3667
|
-
(r'\\u[0-9a-fA-F]{4}', String.Escape),
|
3668
|
-
# Yes, \U literals are 6 hex digits.
|
3669
|
-
(r'\\U[0-9a-fA-F]{6}', String.Escape)
|
3670
|
-
]
|
3671
|
-
}
|
21
|
+
__all__ = []
|