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,358 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.modeling
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Lexers for modeling 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, include, bygroups, using, default
|
15
|
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
16
|
+
Number, Punctuation
|
17
|
+
|
18
|
+
from pygments.lexers.html import HtmlLexer
|
19
|
+
from pygments.lexers import _stan_builtins
|
20
|
+
|
21
|
+
__all__ = ['ModelicaLexer', 'BugsLexer', 'JagsLexer', 'StanLexer']
|
22
|
+
|
23
|
+
|
24
|
+
class ModelicaLexer(RegexLexer):
|
25
|
+
"""
|
26
|
+
For `Modelica <http://www.modelica.org/>`_ source code.
|
27
|
+
|
28
|
+
.. versionadded:: 1.1
|
29
|
+
"""
|
30
|
+
name = 'Modelica'
|
31
|
+
aliases = ['modelica']
|
32
|
+
filenames = ['*.mo']
|
33
|
+
mimetypes = ['text/x-modelica']
|
34
|
+
|
35
|
+
flags = re.DOTALL | re.MULTILINE
|
36
|
+
|
37
|
+
_name = r"(?:'(?:[^\\']|\\.)+'|[a-zA-Z_]\w*)"
|
38
|
+
|
39
|
+
tokens = {
|
40
|
+
'whitespace': [
|
41
|
+
(u'[\\s\ufeff]+', Text),
|
42
|
+
(r'//[^\n]*\n?', Comment.Single),
|
43
|
+
(r'/\*.*?\*/', Comment.Multiline)
|
44
|
+
],
|
45
|
+
'root': [
|
46
|
+
include('whitespace'),
|
47
|
+
(r'"', String.Double, 'string'),
|
48
|
+
(r'[()\[\]{},;]+', Punctuation),
|
49
|
+
(r'\.?[*^/+-]|\.|<>|[<>:=]=?', Operator),
|
50
|
+
(r'\d+(\.?\d*[eE][-+]?\d+|\.\d*)', Number.Float),
|
51
|
+
(r'\d+', Number.Integer),
|
52
|
+
(r'(abs|acos|actualStream|array|asin|assert|AssertionLevel|atan|'
|
53
|
+
r'atan2|backSample|Boolean|cardinality|cat|ceil|change|Clock|'
|
54
|
+
r'Connections|cos|cosh|cross|delay|diagonal|div|edge|exp|'
|
55
|
+
r'ExternalObject|fill|floor|getInstanceName|hold|homotopy|'
|
56
|
+
r'identity|inStream|integer|Integer|interval|inverse|isPresent|'
|
57
|
+
r'linspace|log|log10|matrix|max|min|mod|ndims|noClock|noEvent|'
|
58
|
+
r'ones|outerProduct|pre|previous|product|Real|reinit|rem|rooted|'
|
59
|
+
r'sample|scalar|semiLinear|shiftSample|sign|sin|sinh|size|skew|'
|
60
|
+
r'smooth|spatialDistribution|sqrt|StateSelect|String|subSample|'
|
61
|
+
r'sum|superSample|symmetric|tan|tanh|terminal|terminate|time|'
|
62
|
+
r'transpose|vector|zeros)\b', Name.Builtin),
|
63
|
+
(r'(algorithm|annotation|break|connect|constant|constrainedby|der|'
|
64
|
+
r'discrete|each|else|elseif|elsewhen|encapsulated|enumeration|'
|
65
|
+
r'equation|exit|expandable|extends|external|final|flow|for|if|'
|
66
|
+
r'import|impure|in|initial|inner|input|loop|nondiscrete|outer|'
|
67
|
+
r'output|parameter|partial|protected|public|pure|redeclare|'
|
68
|
+
r'replaceable|return|stream|then|when|while)\b',
|
69
|
+
Keyword.Reserved),
|
70
|
+
(r'(and|not|or)\b', Operator.Word),
|
71
|
+
(r'(block|class|connector|end|function|model|operator|package|'
|
72
|
+
r'record|type)\b', Keyword.Reserved, 'class'),
|
73
|
+
(r'(false|true)\b', Keyword.Constant),
|
74
|
+
(r'within\b', Keyword.Reserved, 'package-prefix'),
|
75
|
+
(_name, Name)
|
76
|
+
],
|
77
|
+
'class': [
|
78
|
+
include('whitespace'),
|
79
|
+
(r'(function|record)\b', Keyword.Reserved),
|
80
|
+
(r'(if|for|when|while)\b', Keyword.Reserved, '#pop'),
|
81
|
+
(_name, Name.Class, '#pop'),
|
82
|
+
default('#pop')
|
83
|
+
],
|
84
|
+
'package-prefix': [
|
85
|
+
include('whitespace'),
|
86
|
+
(_name, Name.Namespace, '#pop'),
|
87
|
+
default('#pop')
|
88
|
+
],
|
89
|
+
'string': [
|
90
|
+
(r'"', String.Double, '#pop'),
|
91
|
+
(r'\\[\'"?\\abfnrtv]', String.Escape),
|
92
|
+
(r'(?i)<\s*html\s*>([^\\"]|\\.)+?(<\s*/\s*html\s*>|(?="))',
|
93
|
+
using(HtmlLexer)),
|
94
|
+
(r'<|\\?[^"\\<]+', String.Double)
|
95
|
+
]
|
96
|
+
}
|
97
|
+
|
98
|
+
|
99
|
+
class BugsLexer(RegexLexer):
|
100
|
+
"""
|
101
|
+
Pygments Lexer for `OpenBugs <http://www.openbugs.net/>`_ and WinBugs
|
102
|
+
models.
|
103
|
+
|
104
|
+
.. versionadded:: 1.6
|
105
|
+
"""
|
106
|
+
|
107
|
+
name = 'BUGS'
|
108
|
+
aliases = ['bugs', 'winbugs', 'openbugs']
|
109
|
+
filenames = ['*.bug']
|
110
|
+
|
111
|
+
_FUNCTIONS = (
|
112
|
+
# Scalar functions
|
113
|
+
'abs', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh',
|
114
|
+
'cloglog', 'cos', 'cosh', 'cumulative', 'cut', 'density', 'deviance',
|
115
|
+
'equals', 'expr', 'gammap', 'ilogit', 'icloglog', 'integral', 'log',
|
116
|
+
'logfact', 'loggam', 'logit', 'max', 'min', 'phi', 'post.p.value',
|
117
|
+
'pow', 'prior.p.value', 'probit', 'replicate.post', 'replicate.prior',
|
118
|
+
'round', 'sin', 'sinh', 'solution', 'sqrt', 'step', 'tan', 'tanh',
|
119
|
+
'trunc',
|
120
|
+
# Vector functions
|
121
|
+
'inprod', 'interp.lin', 'inverse', 'logdet', 'mean', 'eigen.vals',
|
122
|
+
'ode', 'prod', 'p.valueM', 'rank', 'ranked', 'replicate.postM',
|
123
|
+
'sd', 'sort', 'sum',
|
124
|
+
# Special
|
125
|
+
'D', 'I', 'F', 'T', 'C')
|
126
|
+
""" OpenBUGS built-in functions
|
127
|
+
|
128
|
+
From http://www.openbugs.info/Manuals/ModelSpecification.html#ContentsAII
|
129
|
+
|
130
|
+
This also includes
|
131
|
+
|
132
|
+
- T, C, I : Truncation and censoring.
|
133
|
+
``T`` and ``C`` are in OpenBUGS. ``I`` in WinBUGS.
|
134
|
+
- D : ODE
|
135
|
+
- F : Functional http://www.openbugs.info/Examples/Functionals.html
|
136
|
+
|
137
|
+
"""
|
138
|
+
|
139
|
+
_DISTRIBUTIONS = ('dbern', 'dbin', 'dcat', 'dnegbin', 'dpois',
|
140
|
+
'dhyper', 'dbeta', 'dchisqr', 'ddexp', 'dexp',
|
141
|
+
'dflat', 'dgamma', 'dgev', 'df', 'dggamma', 'dgpar',
|
142
|
+
'dloglik', 'dlnorm', 'dlogis', 'dnorm', 'dpar',
|
143
|
+
'dt', 'dunif', 'dweib', 'dmulti', 'ddirch', 'dmnorm',
|
144
|
+
'dmt', 'dwish')
|
145
|
+
""" OpenBUGS built-in distributions
|
146
|
+
|
147
|
+
Functions from
|
148
|
+
http://www.openbugs.info/Manuals/ModelSpecification.html#ContentsAI
|
149
|
+
"""
|
150
|
+
|
151
|
+
tokens = {
|
152
|
+
'whitespace': [
|
153
|
+
(r"\s+", Text),
|
154
|
+
],
|
155
|
+
'comments': [
|
156
|
+
# Comments
|
157
|
+
(r'#.*$', Comment.Single),
|
158
|
+
],
|
159
|
+
'root': [
|
160
|
+
# Comments
|
161
|
+
include('comments'),
|
162
|
+
include('whitespace'),
|
163
|
+
# Block start
|
164
|
+
(r'(model)(\s+)(\{)',
|
165
|
+
bygroups(Keyword.Namespace, Text, Punctuation)),
|
166
|
+
# Reserved Words
|
167
|
+
(r'(for|in)(?![\w.])', Keyword.Reserved),
|
168
|
+
# Built-in Functions
|
169
|
+
(r'(%s)(?=\s*\()'
|
170
|
+
% r'|'.join(_FUNCTIONS + _DISTRIBUTIONS),
|
171
|
+
Name.Builtin),
|
172
|
+
# Regular variable names
|
173
|
+
(r'[A-Za-z][\w.]*', Name),
|
174
|
+
# Number Literals
|
175
|
+
(r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number),
|
176
|
+
# Punctuation
|
177
|
+
(r'\[|\]|\(|\)|:|,|;', Punctuation),
|
178
|
+
# Assignment operators
|
179
|
+
# SLexer makes these tokens Operators.
|
180
|
+
(r'<-|~', Operator),
|
181
|
+
# Infix and prefix operators
|
182
|
+
(r'\+|-|\*|/', Operator),
|
183
|
+
# Block
|
184
|
+
(r'[{}]', Punctuation),
|
185
|
+
]
|
186
|
+
}
|
187
|
+
|
188
|
+
def analyse_text(text):
|
189
|
+
if re.search(r"^\s*model\s*{", text, re.M):
|
190
|
+
return 0.7
|
191
|
+
else:
|
192
|
+
return 0.0
|
193
|
+
|
194
|
+
|
195
|
+
class JagsLexer(RegexLexer):
|
196
|
+
"""
|
197
|
+
Pygments Lexer for JAGS.
|
198
|
+
|
199
|
+
.. versionadded:: 1.6
|
200
|
+
"""
|
201
|
+
|
202
|
+
name = 'JAGS'
|
203
|
+
aliases = ['jags']
|
204
|
+
filenames = ['*.jag', '*.bug']
|
205
|
+
|
206
|
+
# JAGS
|
207
|
+
_FUNCTIONS = (
|
208
|
+
'abs', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh',
|
209
|
+
'cos', 'cosh', 'cloglog',
|
210
|
+
'equals', 'exp', 'icloglog', 'ifelse', 'ilogit', 'log', 'logfact',
|
211
|
+
'loggam', 'logit', 'phi', 'pow', 'probit', 'round', 'sin', 'sinh',
|
212
|
+
'sqrt', 'step', 'tan', 'tanh', 'trunc', 'inprod', 'interp.lin',
|
213
|
+
'logdet', 'max', 'mean', 'min', 'prod', 'sum', 'sd', 'inverse',
|
214
|
+
'rank', 'sort', 't', 'acos', 'acosh', 'asin', 'asinh', 'atan',
|
215
|
+
# Truncation/Censoring (should I include)
|
216
|
+
'T', 'I')
|
217
|
+
# Distributions with density, probability and quartile functions
|
218
|
+
_DISTRIBUTIONS = tuple('[dpq]%s' % x for x in
|
219
|
+
('bern', 'beta', 'dchiqsqr', 'ddexp', 'dexp',
|
220
|
+
'df', 'gamma', 'gen.gamma', 'logis', 'lnorm',
|
221
|
+
'negbin', 'nchisqr', 'norm', 'par', 'pois', 'weib'))
|
222
|
+
# Other distributions without density and probability
|
223
|
+
_OTHER_DISTRIBUTIONS = (
|
224
|
+
'dt', 'dunif', 'dbetabin', 'dbern', 'dbin', 'dcat', 'dhyper',
|
225
|
+
'ddirch', 'dmnorm', 'dwish', 'dmt', 'dmulti', 'dbinom', 'dchisq',
|
226
|
+
'dnbinom', 'dweibull', 'ddirich')
|
227
|
+
|
228
|
+
tokens = {
|
229
|
+
'whitespace': [
|
230
|
+
(r"\s+", Text),
|
231
|
+
],
|
232
|
+
'names': [
|
233
|
+
# Regular variable names
|
234
|
+
(r'[a-zA-Z][\w.]*\b', Name),
|
235
|
+
],
|
236
|
+
'comments': [
|
237
|
+
# do not use stateful comments
|
238
|
+
(r'(?s)/\*.*?\*/', Comment.Multiline),
|
239
|
+
# Comments
|
240
|
+
(r'#.*$', Comment.Single),
|
241
|
+
],
|
242
|
+
'root': [
|
243
|
+
# Comments
|
244
|
+
include('comments'),
|
245
|
+
include('whitespace'),
|
246
|
+
# Block start
|
247
|
+
(r'(model|data)(\s+)(\{)',
|
248
|
+
bygroups(Keyword.Namespace, Text, Punctuation)),
|
249
|
+
(r'var(?![\w.])', Keyword.Declaration),
|
250
|
+
# Reserved Words
|
251
|
+
(r'(for|in)(?![\w.])', Keyword.Reserved),
|
252
|
+
# Builtins
|
253
|
+
# Need to use lookahead because . is a valid char
|
254
|
+
(r'(%s)(?=\s*\()' % r'|'.join(_FUNCTIONS
|
255
|
+
+ _DISTRIBUTIONS
|
256
|
+
+ _OTHER_DISTRIBUTIONS),
|
257
|
+
Name.Builtin),
|
258
|
+
# Names
|
259
|
+
include('names'),
|
260
|
+
# Number Literals
|
261
|
+
(r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number),
|
262
|
+
(r'\[|\]|\(|\)|:|,|;', Punctuation),
|
263
|
+
# Assignment operators
|
264
|
+
(r'<-|~', Operator),
|
265
|
+
# # JAGS includes many more than OpenBUGS
|
266
|
+
(r'\+|-|\*|\/|\|\|[&]{2}|[<>=]=?|\^|%.*?%', Operator),
|
267
|
+
(r'[{}]', Punctuation),
|
268
|
+
]
|
269
|
+
}
|
270
|
+
|
271
|
+
def analyse_text(text):
|
272
|
+
if re.search(r'^\s*model\s*\{', text, re.M):
|
273
|
+
if re.search(r'^\s*data\s*\{', text, re.M):
|
274
|
+
return 0.9
|
275
|
+
elif re.search(r'^\s*var', text, re.M):
|
276
|
+
return 0.9
|
277
|
+
else:
|
278
|
+
return 0.3
|
279
|
+
else:
|
280
|
+
return 0
|
281
|
+
|
282
|
+
|
283
|
+
class StanLexer(RegexLexer):
|
284
|
+
"""Pygments Lexer for Stan models.
|
285
|
+
|
286
|
+
The Stan modeling language is specified in the *Stan Modeling Language
|
287
|
+
User's Guide and Reference Manual, v2.8.0*,
|
288
|
+
`pdf <https://github.com/stan-dev/stan/releases/download/v2.8.8/stan-reference-2.8.0.pdf>`__.
|
289
|
+
|
290
|
+
.. versionadded:: 1.6
|
291
|
+
"""
|
292
|
+
|
293
|
+
name = 'Stan'
|
294
|
+
aliases = ['stan']
|
295
|
+
filenames = ['*.stan']
|
296
|
+
|
297
|
+
tokens = {
|
298
|
+
'whitespace': [
|
299
|
+
(r"\s+", Text),
|
300
|
+
],
|
301
|
+
'comments': [
|
302
|
+
(r'(?s)/\*.*?\*/', Comment.Multiline),
|
303
|
+
# Comments
|
304
|
+
(r'(//|#).*$', Comment.Single),
|
305
|
+
],
|
306
|
+
'root': [
|
307
|
+
# Stan is more restrictive on strings than this regex
|
308
|
+
(r'"[^"]*"', String),
|
309
|
+
# Comments
|
310
|
+
include('comments'),
|
311
|
+
# block start
|
312
|
+
include('whitespace'),
|
313
|
+
# Block start
|
314
|
+
(r'(%s)(\s*)(\{)' %
|
315
|
+
r'|'.join(('functions', 'data', r'transformed\s+?data',
|
316
|
+
'parameters', r'transformed\s+parameters',
|
317
|
+
'model', r'generated\s+quantities')),
|
318
|
+
bygroups(Keyword.Namespace, Text, Punctuation)),
|
319
|
+
# Reserved Words
|
320
|
+
(r'(%s)\b' % r'|'.join(_stan_builtins.KEYWORDS), Keyword),
|
321
|
+
# Truncation
|
322
|
+
(r'T(?=\s*\[)', Keyword),
|
323
|
+
# Data types
|
324
|
+
(r'(%s)\b' % r'|'.join(_stan_builtins.TYPES), Keyword.Type),
|
325
|
+
# Punctuation
|
326
|
+
(r"[;:,\[\]()]", Punctuation),
|
327
|
+
# Builtin
|
328
|
+
(r'(%s)(?=\s*\()'
|
329
|
+
% r'|'.join(_stan_builtins.FUNCTIONS
|
330
|
+
+ _stan_builtins.DISTRIBUTIONS),
|
331
|
+
Name.Builtin),
|
332
|
+
# Special names ending in __, like lp__
|
333
|
+
(r'[A-Za-z]\w*__\b', Name.Builtin.Pseudo),
|
334
|
+
(r'(%s)\b' % r'|'.join(_stan_builtins.RESERVED), Keyword.Reserved),
|
335
|
+
# user-defined functions
|
336
|
+
(r'[A-Za-z]\w*(?=\s*\()]', Name.Function),
|
337
|
+
# Regular variable names
|
338
|
+
(r'[A-Za-z]\w*\b', Name),
|
339
|
+
# Real Literals
|
340
|
+
(r'-?[0-9]+(\.[0-9]+)?[eE]-?[0-9]+', Number.Float),
|
341
|
+
(r'-?[0-9]*\.[0-9]*', Number.Float),
|
342
|
+
# Integer Literals
|
343
|
+
(r'-?[0-9]+', Number.Integer),
|
344
|
+
# Assignment operators
|
345
|
+
# SLexer makes these tokens Operators.
|
346
|
+
(r'<-|~', Operator),
|
347
|
+
# Infix, prefix and postfix operators (and = )
|
348
|
+
(r"\+|-|\.?\*|\.?/|\\|'|\^|==?|!=?|<=?|>=?|\|\||&&", Operator),
|
349
|
+
# Block delimiters
|
350
|
+
(r'[{}]', Punctuation),
|
351
|
+
]
|
352
|
+
}
|
353
|
+
|
354
|
+
def analyse_text(text):
|
355
|
+
if re.search(r'^\s*parameters\s*\{', text, re.M):
|
356
|
+
return 1.0
|
357
|
+
else:
|
358
|
+
return 0.0
|
@@ -0,0 +1,1561 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers.modula2
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
Multi-Dialect Lexer for Modula-2.
|
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, include
|
15
|
+
from pygments.util import get_bool_opt, get_list_opt
|
16
|
+
from pygments.token import Text, Comment, Operator, Keyword, Name, \
|
17
|
+
String, Number, Punctuation, Error
|
18
|
+
|
19
|
+
__all__ = ['Modula2Lexer']
|
20
|
+
|
21
|
+
|
22
|
+
# Multi-Dialect Modula-2 Lexer
|
23
|
+
class Modula2Lexer(RegexLexer):
|
24
|
+
"""
|
25
|
+
For `Modula-2 <http://www.modula2.org/>`_ source code.
|
26
|
+
|
27
|
+
The Modula-2 lexer supports several dialects. By default, it operates in
|
28
|
+
fallback mode, recognising the *combined* literals, punctuation symbols
|
29
|
+
and operators of all supported dialects, and the *combined* reserved words
|
30
|
+
and builtins of PIM Modula-2, ISO Modula-2 and Modula-2 R10, while not
|
31
|
+
differentiating between library defined identifiers.
|
32
|
+
|
33
|
+
To select a specific dialect, a dialect option may be passed
|
34
|
+
or a dialect tag may be embedded into a source file.
|
35
|
+
|
36
|
+
Dialect Options:
|
37
|
+
|
38
|
+
`m2pim`
|
39
|
+
Select PIM Modula-2 dialect.
|
40
|
+
`m2iso`
|
41
|
+
Select ISO Modula-2 dialect.
|
42
|
+
`m2r10`
|
43
|
+
Select Modula-2 R10 dialect.
|
44
|
+
`objm2`
|
45
|
+
Select Objective Modula-2 dialect.
|
46
|
+
|
47
|
+
The PIM and ISO dialect options may be qualified with a language extension.
|
48
|
+
|
49
|
+
Language Extensions:
|
50
|
+
|
51
|
+
`+aglet`
|
52
|
+
Select Aglet Modula-2 extensions, available with m2iso.
|
53
|
+
`+gm2`
|
54
|
+
Select GNU Modula-2 extensions, available with m2pim.
|
55
|
+
`+p1`
|
56
|
+
Select p1 Modula-2 extensions, available with m2iso.
|
57
|
+
`+xds`
|
58
|
+
Select XDS Modula-2 extensions, available with m2iso.
|
59
|
+
|
60
|
+
|
61
|
+
Passing a Dialect Option via Unix Commandline Interface
|
62
|
+
|
63
|
+
Dialect options may be passed to the lexer using the `dialect` key.
|
64
|
+
Only one such option should be passed. If multiple dialect options are
|
65
|
+
passed, the first valid option is used, any subsequent options are ignored.
|
66
|
+
|
67
|
+
Examples:
|
68
|
+
|
69
|
+
`$ pygmentize -O full,dialect=m2iso -f html -o /path/to/output /path/to/input`
|
70
|
+
Use ISO dialect to render input to HTML output
|
71
|
+
`$ pygmentize -O full,dialect=m2iso+p1 -f rtf -o /path/to/output /path/to/input`
|
72
|
+
Use ISO dialect with p1 extensions to render input to RTF output
|
73
|
+
|
74
|
+
|
75
|
+
Embedding a Dialect Option within a source file
|
76
|
+
|
77
|
+
A dialect option may be embedded in a source file in form of a dialect
|
78
|
+
tag, a specially formatted comment that specifies a dialect option.
|
79
|
+
|
80
|
+
Dialect Tag EBNF::
|
81
|
+
|
82
|
+
dialectTag :
|
83
|
+
OpeningCommentDelim Prefix dialectOption ClosingCommentDelim ;
|
84
|
+
|
85
|
+
dialectOption :
|
86
|
+
'm2pim' | 'm2iso' | 'm2r10' | 'objm2' |
|
87
|
+
'm2iso+aglet' | 'm2pim+gm2' | 'm2iso+p1' | 'm2iso+xds' ;
|
88
|
+
|
89
|
+
Prefix : '!' ;
|
90
|
+
|
91
|
+
OpeningCommentDelim : '(*' ;
|
92
|
+
|
93
|
+
ClosingCommentDelim : '*)' ;
|
94
|
+
|
95
|
+
No whitespace is permitted between the tokens of a dialect tag.
|
96
|
+
|
97
|
+
In the event that a source file contains multiple dialect tags, the first
|
98
|
+
tag that contains a valid dialect option will be used and any subsequent
|
99
|
+
dialect tags will be ignored. Ideally, a dialect tag should be placed
|
100
|
+
at the beginning of a source file.
|
101
|
+
|
102
|
+
An embedded dialect tag overrides a dialect option set via command line.
|
103
|
+
|
104
|
+
Examples:
|
105
|
+
|
106
|
+
``(*!m2r10*) DEFINITION MODULE Foobar; ...``
|
107
|
+
Use Modula2 R10 dialect to render this source file.
|
108
|
+
``(*!m2pim+gm2*) DEFINITION MODULE Bazbam; ...``
|
109
|
+
Use PIM dialect with GNU extensions to render this source file.
|
110
|
+
|
111
|
+
|
112
|
+
Algol Publication Mode:
|
113
|
+
|
114
|
+
In Algol publication mode, source text is rendered for publication of
|
115
|
+
algorithms in scientific papers and academic texts, following the format
|
116
|
+
of the Revised Algol-60 Language Report. It is activated by passing
|
117
|
+
one of two corresponding styles as an option:
|
118
|
+
|
119
|
+
`algol`
|
120
|
+
render reserved words lowercase underline boldface
|
121
|
+
and builtins lowercase boldface italic
|
122
|
+
`algol_nu`
|
123
|
+
render reserved words lowercase boldface (no underlining)
|
124
|
+
and builtins lowercase boldface italic
|
125
|
+
|
126
|
+
The lexer automatically performs the required lowercase conversion when
|
127
|
+
this mode is activated.
|
128
|
+
|
129
|
+
Example:
|
130
|
+
|
131
|
+
``$ pygmentize -O full,style=algol -f latex -o /path/to/output /path/to/input``
|
132
|
+
Render input file in Algol publication mode to LaTeX output.
|
133
|
+
|
134
|
+
|
135
|
+
Rendering Mode of First Class ADT Identifiers:
|
136
|
+
|
137
|
+
The rendering of standard library first class ADT identifiers is controlled
|
138
|
+
by option flag "treat_stdlib_adts_as_builtins".
|
139
|
+
|
140
|
+
When this option is turned on, standard library ADT identifiers are rendered
|
141
|
+
as builtins. When it is turned off, they are rendered as ordinary library
|
142
|
+
identifiers.
|
143
|
+
|
144
|
+
`treat_stdlib_adts_as_builtins` (default: On)
|
145
|
+
|
146
|
+
The option is useful for dialects that support ADTs as first class objects
|
147
|
+
and provide ADTs in the standard library that would otherwise be built-in.
|
148
|
+
|
149
|
+
At present, only Modula-2 R10 supports library ADTs as first class objects
|
150
|
+
and therefore, no ADT identifiers are defined for any other dialects.
|
151
|
+
|
152
|
+
Example:
|
153
|
+
|
154
|
+
``$ pygmentize -O full,dialect=m2r10,treat_stdlib_adts_as_builtins=Off ...``
|
155
|
+
Render standard library ADTs as ordinary library types.
|
156
|
+
|
157
|
+
.. versionadded:: 1.3
|
158
|
+
|
159
|
+
.. versionchanged:: 2.1
|
160
|
+
Added multi-dialect support.
|
161
|
+
"""
|
162
|
+
name = 'Modula-2'
|
163
|
+
aliases = ['modula2', 'm2']
|
164
|
+
filenames = ['*.def', '*.mod']
|
165
|
+
mimetypes = ['text/x-modula2']
|
166
|
+
|
167
|
+
flags = re.MULTILINE | re.DOTALL
|
168
|
+
|
169
|
+
tokens = {
|
170
|
+
'whitespace': [
|
171
|
+
(r'\n+', Text), # blank lines
|
172
|
+
(r'\s+', Text), # whitespace
|
173
|
+
],
|
174
|
+
'dialecttags': [
|
175
|
+
# PIM Dialect Tag
|
176
|
+
(r'\(\*!m2pim\*\)', Comment.Special),
|
177
|
+
# ISO Dialect Tag
|
178
|
+
(r'\(\*!m2iso\*\)', Comment.Special),
|
179
|
+
# M2R10 Dialect Tag
|
180
|
+
(r'\(\*!m2r10\*\)', Comment.Special),
|
181
|
+
# ObjM2 Dialect Tag
|
182
|
+
(r'\(\*!objm2\*\)', Comment.Special),
|
183
|
+
# Aglet Extensions Dialect Tag
|
184
|
+
(r'\(\*!m2iso\+aglet\*\)', Comment.Special),
|
185
|
+
# GNU Extensions Dialect Tag
|
186
|
+
(r'\(\*!m2pim\+gm2\*\)', Comment.Special),
|
187
|
+
# p1 Extensions Dialect Tag
|
188
|
+
(r'\(\*!m2iso\+p1\*\)', Comment.Special),
|
189
|
+
# XDS Extensions Dialect Tag
|
190
|
+
(r'\(\*!m2iso\+xds\*\)', Comment.Special),
|
191
|
+
],
|
192
|
+
'identifiers': [
|
193
|
+
(r'([a-zA-Z_$][\w$]*)', Name),
|
194
|
+
],
|
195
|
+
'prefixed_number_literals': [
|
196
|
+
#
|
197
|
+
# Base-2, whole number
|
198
|
+
(r'0b[01]+(\'[01]+)*', Number.Bin),
|
199
|
+
#
|
200
|
+
# Base-16, whole number
|
201
|
+
(r'0[ux][0-9A-F]+(\'[0-9A-F]+)*', Number.Hex),
|
202
|
+
],
|
203
|
+
'plain_number_literals': [
|
204
|
+
#
|
205
|
+
# Base-10, real number with exponent
|
206
|
+
(r'[0-9]+(\'[0-9]+)*' # integral part
|
207
|
+
r'\.[0-9]+(\'[0-9]+)*' # fractional part
|
208
|
+
r'[eE][+-]?[0-9]+(\'[0-9]+)*', # exponent
|
209
|
+
Number.Float),
|
210
|
+
#
|
211
|
+
# Base-10, real number without exponent
|
212
|
+
(r'[0-9]+(\'[0-9]+)*' # integral part
|
213
|
+
r'\.[0-9]+(\'[0-9]+)*', # fractional part
|
214
|
+
Number.Float),
|
215
|
+
#
|
216
|
+
# Base-10, whole number
|
217
|
+
(r'[0-9]+(\'[0-9]+)*', Number.Integer),
|
218
|
+
],
|
219
|
+
'suffixed_number_literals': [
|
220
|
+
#
|
221
|
+
# Base-8, whole number
|
222
|
+
(r'[0-7]+B', Number.Oct),
|
223
|
+
#
|
224
|
+
# Base-8, character code
|
225
|
+
(r'[0-7]+C', Number.Oct),
|
226
|
+
#
|
227
|
+
# Base-16, number
|
228
|
+
(r'[0-9A-F]+H', Number.Hex),
|
229
|
+
],
|
230
|
+
'string_literals': [
|
231
|
+
(r"'(\\\\|\\'|[^'])*'", String), # single quoted string
|
232
|
+
(r'"(\\\\|\\"|[^"])*"', String), # double quoted string
|
233
|
+
],
|
234
|
+
'digraph_operators': [
|
235
|
+
# Dot Product Operator
|
236
|
+
(r'\*\.', Operator),
|
237
|
+
# Array Concatenation Operator
|
238
|
+
(r'\+>', Operator), # M2R10 + ObjM2
|
239
|
+
# Inequality Operator
|
240
|
+
(r'<>', Operator), # ISO + PIM
|
241
|
+
# Less-Or-Equal, Subset
|
242
|
+
(r'<=', Operator),
|
243
|
+
# Greater-Or-Equal, Superset
|
244
|
+
(r'>=', Operator),
|
245
|
+
# Identity Operator
|
246
|
+
(r'==', Operator), # M2R10 + ObjM2
|
247
|
+
# Type Conversion Operator
|
248
|
+
(r'::', Operator), # M2R10 + ObjM2
|
249
|
+
# Assignment Symbol
|
250
|
+
(r':=', Operator),
|
251
|
+
# Postfix Increment Mutator
|
252
|
+
(r'\+\+', Operator), # M2R10 + ObjM2
|
253
|
+
# Postfix Decrement Mutator
|
254
|
+
(r'--', Operator), # M2R10 + ObjM2
|
255
|
+
],
|
256
|
+
'unigraph_operators': [
|
257
|
+
# Arithmetic Operators
|
258
|
+
(r'[+-]', Operator),
|
259
|
+
(r'[*/]', Operator),
|
260
|
+
# ISO 80000-2 compliant Set Difference Operator
|
261
|
+
(r'\\', Operator), # M2R10 + ObjM2
|
262
|
+
# Relational Operators
|
263
|
+
(r'[=#<>]', Operator),
|
264
|
+
# Dereferencing Operator
|
265
|
+
(r'\^', Operator),
|
266
|
+
# Dereferencing Operator Synonym
|
267
|
+
(r'@', Operator), # ISO
|
268
|
+
# Logical AND Operator Synonym
|
269
|
+
(r'&', Operator), # PIM + ISO
|
270
|
+
# Logical NOT Operator Synonym
|
271
|
+
(r'~', Operator), # PIM + ISO
|
272
|
+
# Smalltalk Message Prefix
|
273
|
+
(r'`', Operator), # ObjM2
|
274
|
+
],
|
275
|
+
'digraph_punctuation': [
|
276
|
+
# Range Constructor
|
277
|
+
(r'\.\.', Punctuation),
|
278
|
+
# Opening Chevron Bracket
|
279
|
+
(r'<<', Punctuation), # M2R10 + ISO
|
280
|
+
# Closing Chevron Bracket
|
281
|
+
(r'>>', Punctuation), # M2R10 + ISO
|
282
|
+
# Blueprint Punctuation
|
283
|
+
(r'->', Punctuation), # M2R10 + ISO
|
284
|
+
# Distinguish |# and # in M2 R10
|
285
|
+
(r'\|#', Punctuation),
|
286
|
+
# Distinguish ## and # in M2 R10
|
287
|
+
(r'##', Punctuation),
|
288
|
+
# Distinguish |* and * in M2 R10
|
289
|
+
(r'\|\*', Punctuation),
|
290
|
+
],
|
291
|
+
'unigraph_punctuation': [
|
292
|
+
# Common Punctuation
|
293
|
+
(r'[()\[\]{},.:;|]', Punctuation),
|
294
|
+
# Case Label Separator Synonym
|
295
|
+
(r'!', Punctuation), # ISO
|
296
|
+
# Blueprint Punctuation
|
297
|
+
(r'\?', Punctuation), # M2R10 + ObjM2
|
298
|
+
],
|
299
|
+
'comments': [
|
300
|
+
# Single Line Comment
|
301
|
+
(r'^//.*?\n', Comment.Single), # M2R10 + ObjM2
|
302
|
+
# Block Comment
|
303
|
+
(r'\(\*([^$].*?)\*\)', Comment.Multiline),
|
304
|
+
# Template Block Comment
|
305
|
+
(r'/\*(.*?)\*/', Comment.Multiline), # M2R10 + ObjM2
|
306
|
+
],
|
307
|
+
'pragmas': [
|
308
|
+
# ISO Style Pragmas
|
309
|
+
(r'<\*.*?\*>', Comment.Preproc), # ISO, M2R10 + ObjM2
|
310
|
+
# Pascal Style Pragmas
|
311
|
+
(r'\(\*\$.*?\*\)', Comment.Preproc), # PIM
|
312
|
+
],
|
313
|
+
'root': [
|
314
|
+
include('whitespace'),
|
315
|
+
include('dialecttags'),
|
316
|
+
include('pragmas'),
|
317
|
+
include('comments'),
|
318
|
+
include('identifiers'),
|
319
|
+
include('suffixed_number_literals'), # PIM + ISO
|
320
|
+
include('prefixed_number_literals'), # M2R10 + ObjM2
|
321
|
+
include('plain_number_literals'),
|
322
|
+
include('string_literals'),
|
323
|
+
include('digraph_punctuation'),
|
324
|
+
include('digraph_operators'),
|
325
|
+
include('unigraph_punctuation'),
|
326
|
+
include('unigraph_operators'),
|
327
|
+
]
|
328
|
+
}
|
329
|
+
|
330
|
+
# C o m m o n D a t a s e t s
|
331
|
+
|
332
|
+
# Common Reserved Words Dataset
|
333
|
+
common_reserved_words = (
|
334
|
+
# 37 common reserved words
|
335
|
+
'AND', 'ARRAY', 'BEGIN', 'BY', 'CASE', 'CONST', 'DEFINITION', 'DIV',
|
336
|
+
'DO', 'ELSE', 'ELSIF', 'END', 'EXIT', 'FOR', 'FROM', 'IF',
|
337
|
+
'IMPLEMENTATION', 'IMPORT', 'IN', 'LOOP', 'MOD', 'MODULE', 'NOT',
|
338
|
+
'OF', 'OR', 'POINTER', 'PROCEDURE', 'RECORD', 'REPEAT', 'RETURN',
|
339
|
+
'SET', 'THEN', 'TO', 'TYPE', 'UNTIL', 'VAR', 'WHILE',
|
340
|
+
)
|
341
|
+
|
342
|
+
# Common Builtins Dataset
|
343
|
+
common_builtins = (
|
344
|
+
# 16 common builtins
|
345
|
+
'ABS', 'BOOLEAN', 'CARDINAL', 'CHAR', 'CHR', 'FALSE', 'INTEGER',
|
346
|
+
'LONGINT', 'LONGREAL', 'MAX', 'MIN', 'NIL', 'ODD', 'ORD', 'REAL',
|
347
|
+
'TRUE',
|
348
|
+
)
|
349
|
+
|
350
|
+
# Common Pseudo-Module Builtins Dataset
|
351
|
+
common_pseudo_builtins = (
|
352
|
+
# 4 common pseudo builtins
|
353
|
+
'ADDRESS', 'BYTE', 'WORD', 'ADR'
|
354
|
+
)
|
355
|
+
|
356
|
+
# P I M M o d u l a - 2 D a t a s e t s
|
357
|
+
|
358
|
+
# Lexemes to Mark as Error Tokens for PIM Modula-2
|
359
|
+
pim_lexemes_to_reject = (
|
360
|
+
'!', '`', '@', '$', '%', '?', '\\', '==', '++', '--', '::', '*.',
|
361
|
+
'+>', '->', '<<', '>>', '|#', '##',
|
362
|
+
)
|
363
|
+
|
364
|
+
# PIM Modula-2 Additional Reserved Words Dataset
|
365
|
+
pim_additional_reserved_words = (
|
366
|
+
# 3 additional reserved words
|
367
|
+
'EXPORT', 'QUALIFIED', 'WITH',
|
368
|
+
)
|
369
|
+
|
370
|
+
# PIM Modula-2 Additional Builtins Dataset
|
371
|
+
pim_additional_builtins = (
|
372
|
+
# 16 additional builtins
|
373
|
+
'BITSET', 'CAP', 'DEC', 'DISPOSE', 'EXCL', 'FLOAT', 'HALT', 'HIGH',
|
374
|
+
'INC', 'INCL', 'NEW', 'NIL', 'PROC', 'SIZE', 'TRUNC', 'VAL',
|
375
|
+
)
|
376
|
+
|
377
|
+
# PIM Modula-2 Additional Pseudo-Module Builtins Dataset
|
378
|
+
pim_additional_pseudo_builtins = (
|
379
|
+
# 5 additional pseudo builtins
|
380
|
+
'SYSTEM', 'PROCESS', 'TSIZE', 'NEWPROCESS', 'TRANSFER',
|
381
|
+
)
|
382
|
+
|
383
|
+
# I S O M o d u l a - 2 D a t a s e t s
|
384
|
+
|
385
|
+
# Lexemes to Mark as Error Tokens for ISO Modula-2
|
386
|
+
iso_lexemes_to_reject = (
|
387
|
+
'`', '$', '%', '?', '\\', '==', '++', '--', '::', '*.', '+>', '->',
|
388
|
+
'<<', '>>', '|#', '##',
|
389
|
+
)
|
390
|
+
|
391
|
+
# ISO Modula-2 Additional Reserved Words Dataset
|
392
|
+
iso_additional_reserved_words = (
|
393
|
+
# 9 additional reserved words (ISO 10514-1)
|
394
|
+
'EXCEPT', 'EXPORT', 'FINALLY', 'FORWARD', 'PACKEDSET', 'QUALIFIED',
|
395
|
+
'REM', 'RETRY', 'WITH',
|
396
|
+
# 10 additional reserved words (ISO 10514-2 & ISO 10514-3)
|
397
|
+
'ABSTRACT', 'AS', 'CLASS', 'GUARD', 'INHERIT', 'OVERRIDE', 'READONLY',
|
398
|
+
'REVEAL', 'TRACED', 'UNSAFEGUARDED',
|
399
|
+
)
|
400
|
+
|
401
|
+
# ISO Modula-2 Additional Builtins Dataset
|
402
|
+
iso_additional_builtins = (
|
403
|
+
# 26 additional builtins (ISO 10514-1)
|
404
|
+
'BITSET', 'CAP', 'CMPLX', 'COMPLEX', 'DEC', 'DISPOSE', 'EXCL', 'FLOAT',
|
405
|
+
'HALT', 'HIGH', 'IM', 'INC', 'INCL', 'INT', 'INTERRUPTIBLE', 'LENGTH',
|
406
|
+
'LFLOAT', 'LONGCOMPLEX', 'NEW', 'PROC', 'PROTECTION', 'RE', 'SIZE',
|
407
|
+
'TRUNC', 'UNINTERRUBTIBLE', 'VAL',
|
408
|
+
# 5 additional builtins (ISO 10514-2 & ISO 10514-3)
|
409
|
+
'CREATE', 'DESTROY', 'EMPTY', 'ISMEMBER', 'SELF',
|
410
|
+
)
|
411
|
+
|
412
|
+
# ISO Modula-2 Additional Pseudo-Module Builtins Dataset
|
413
|
+
iso_additional_pseudo_builtins = (
|
414
|
+
# 14 additional builtins (SYSTEM)
|
415
|
+
'SYSTEM', 'BITSPERLOC', 'LOCSPERBYTE', 'LOCSPERWORD', 'LOC',
|
416
|
+
'ADDADR', 'SUBADR', 'DIFADR', 'MAKEADR', 'ADR',
|
417
|
+
'ROTATE', 'SHIFT', 'CAST', 'TSIZE',
|
418
|
+
# 13 additional builtins (COROUTINES)
|
419
|
+
'COROUTINES', 'ATTACH', 'COROUTINE', 'CURRENT', 'DETACH', 'HANDLER',
|
420
|
+
'INTERRUPTSOURCE', 'IOTRANSFER', 'IsATTACHED', 'LISTEN',
|
421
|
+
'NEWCOROUTINE', 'PROT', 'TRANSFER',
|
422
|
+
# 9 additional builtins (EXCEPTIONS)
|
423
|
+
'EXCEPTIONS', 'AllocateSource', 'CurrentNumber', 'ExceptionNumber',
|
424
|
+
'ExceptionSource', 'GetMessage', 'IsCurrentSource',
|
425
|
+
'IsExceptionalExecution', 'RAISE',
|
426
|
+
# 3 additional builtins (TERMINATION)
|
427
|
+
'TERMINATION', 'IsTerminating', 'HasHalted',
|
428
|
+
# 4 additional builtins (M2EXCEPTION)
|
429
|
+
'M2EXCEPTION', 'M2Exceptions', 'M2Exception', 'IsM2Exception',
|
430
|
+
'indexException', 'rangeException', 'caseSelectException',
|
431
|
+
'invalidLocation', 'functionException', 'wholeValueException',
|
432
|
+
'wholeDivException', 'realValueException', 'realDivException',
|
433
|
+
'complexValueException', 'complexDivException', 'protException',
|
434
|
+
'sysException', 'coException', 'exException',
|
435
|
+
)
|
436
|
+
|
437
|
+
# M o d u l a - 2 R 1 0 D a t a s e t s
|
438
|
+
|
439
|
+
# Lexemes to Mark as Error Tokens for Modula-2 R10
|
440
|
+
m2r10_lexemes_to_reject = (
|
441
|
+
'!', '`', '@', '$', '%', '&', '<>',
|
442
|
+
)
|
443
|
+
|
444
|
+
# Modula-2 R10 reserved words in addition to the common set
|
445
|
+
m2r10_additional_reserved_words = (
|
446
|
+
# 12 additional reserved words
|
447
|
+
'ALIAS', 'ARGLIST', 'BLUEPRINT', 'COPY', 'GENLIB', 'INDETERMINATE',
|
448
|
+
'NEW', 'NONE', 'OPAQUE', 'REFERENTIAL', 'RELEASE', 'RETAIN',
|
449
|
+
# 2 additional reserved words with symbolic assembly option
|
450
|
+
'ASM', 'REG',
|
451
|
+
)
|
452
|
+
|
453
|
+
# Modula-2 R10 builtins in addition to the common set
|
454
|
+
m2r10_additional_builtins = (
|
455
|
+
# 26 additional builtins
|
456
|
+
'CARDINAL', 'COUNT', 'EMPTY', 'EXISTS', 'INSERT', 'LENGTH', 'LONGCARD',
|
457
|
+
'OCTET', 'PTR', 'PRED', 'READ', 'READNEW', 'REMOVE', 'RETRIEVE', 'SORT',
|
458
|
+
'STORE', 'SUBSET', 'SUCC', 'TLIMIT', 'TMAX', 'TMIN', 'TRUE', 'TSIZE',
|
459
|
+
'UNICHAR', 'WRITE', 'WRITEF',
|
460
|
+
)
|
461
|
+
|
462
|
+
# Modula-2 R10 Additional Pseudo-Module Builtins Dataset
|
463
|
+
m2r10_additional_pseudo_builtins = (
|
464
|
+
# 13 additional builtins (TPROPERTIES)
|
465
|
+
'TPROPERTIES', 'PROPERTY', 'LITERAL', 'TPROPERTY', 'TLITERAL',
|
466
|
+
'TBUILTIN', 'TDYN', 'TREFC', 'TNIL', 'TBASE', 'TPRECISION',
|
467
|
+
'TMAXEXP', 'TMINEXP',
|
468
|
+
# 4 additional builtins (CONVERSION)
|
469
|
+
'CONVERSION', 'TSXFSIZE', 'SXF', 'VAL',
|
470
|
+
# 35 additional builtins (UNSAFE)
|
471
|
+
'UNSAFE', 'CAST', 'INTRINSIC', 'AVAIL', 'ADD', 'SUB', 'ADDC', 'SUBC',
|
472
|
+
'FETCHADD', 'FETCHSUB', 'SHL', 'SHR', 'ASHR', 'ROTL', 'ROTR', 'ROTLC',
|
473
|
+
'ROTRC', 'BWNOT', 'BWAND', 'BWOR', 'BWXOR', 'BWNAND', 'BWNOR',
|
474
|
+
'SETBIT', 'TESTBIT', 'LSBIT', 'MSBIT', 'CSBITS', 'BAIL', 'HALT',
|
475
|
+
'TODO', 'FFI', 'ADDR', 'VARGLIST', 'VARGC',
|
476
|
+
# 11 additional builtins (ATOMIC)
|
477
|
+
'ATOMIC', 'INTRINSIC', 'AVAIL', 'SWAP', 'CAS', 'INC', 'DEC', 'BWAND',
|
478
|
+
'BWNAND', 'BWOR', 'BWXOR',
|
479
|
+
# 7 additional builtins (COMPILER)
|
480
|
+
'COMPILER', 'DEBUG', 'MODNAME', 'PROCNAME', 'LINENUM', 'DEFAULT',
|
481
|
+
'HASH',
|
482
|
+
# 5 additional builtins (ASSEMBLER)
|
483
|
+
'ASSEMBLER', 'REGISTER', 'SETREG', 'GETREG', 'CODE',
|
484
|
+
)
|
485
|
+
|
486
|
+
# O b j e c t i v e M o d u l a - 2 D a t a s e t s
|
487
|
+
|
488
|
+
# Lexemes to Mark as Error Tokens for Objective Modula-2
|
489
|
+
objm2_lexemes_to_reject = (
|
490
|
+
'!', '$', '%', '&', '<>',
|
491
|
+
)
|
492
|
+
|
493
|
+
# Objective Modula-2 Extensions
|
494
|
+
# reserved words in addition to Modula-2 R10
|
495
|
+
objm2_additional_reserved_words = (
|
496
|
+
# 16 additional reserved words
|
497
|
+
'BYCOPY', 'BYREF', 'CLASS', 'CONTINUE', 'CRITICAL', 'INOUT', 'METHOD',
|
498
|
+
'ON', 'OPTIONAL', 'OUT', 'PRIVATE', 'PROTECTED', 'PROTOCOL', 'PUBLIC',
|
499
|
+
'SUPER', 'TRY',
|
500
|
+
)
|
501
|
+
|
502
|
+
# Objective Modula-2 Extensions
|
503
|
+
# builtins in addition to Modula-2 R10
|
504
|
+
objm2_additional_builtins = (
|
505
|
+
# 3 additional builtins
|
506
|
+
'OBJECT', 'NO', 'YES',
|
507
|
+
)
|
508
|
+
|
509
|
+
# Objective Modula-2 Extensions
|
510
|
+
# pseudo-module builtins in addition to Modula-2 R10
|
511
|
+
objm2_additional_pseudo_builtins = (
|
512
|
+
# None
|
513
|
+
)
|
514
|
+
|
515
|
+
# A g l e t M o d u l a - 2 D a t a s e t s
|
516
|
+
|
517
|
+
# Aglet Extensions
|
518
|
+
# reserved words in addition to ISO Modula-2
|
519
|
+
aglet_additional_reserved_words = (
|
520
|
+
# None
|
521
|
+
)
|
522
|
+
|
523
|
+
# Aglet Extensions
|
524
|
+
# builtins in addition to ISO Modula-2
|
525
|
+
aglet_additional_builtins = (
|
526
|
+
# 9 additional builtins
|
527
|
+
'BITSET8', 'BITSET16', 'BITSET32', 'CARDINAL8', 'CARDINAL16',
|
528
|
+
'CARDINAL32', 'INTEGER8', 'INTEGER16', 'INTEGER32',
|
529
|
+
)
|
530
|
+
|
531
|
+
# Aglet Modula-2 Extensions
|
532
|
+
# pseudo-module builtins in addition to ISO Modula-2
|
533
|
+
aglet_additional_pseudo_builtins = (
|
534
|
+
# None
|
535
|
+
)
|
536
|
+
|
537
|
+
# G N U M o d u l a - 2 D a t a s e t s
|
538
|
+
|
539
|
+
# GNU Extensions
|
540
|
+
# reserved words in addition to PIM Modula-2
|
541
|
+
gm2_additional_reserved_words = (
|
542
|
+
# 10 additional reserved words
|
543
|
+
'ASM', '__ATTRIBUTE__', '__BUILTIN__', '__COLUMN__', '__DATE__',
|
544
|
+
'__FILE__', '__FUNCTION__', '__LINE__', '__MODULE__', 'VOLATILE',
|
545
|
+
)
|
546
|
+
|
547
|
+
# GNU Extensions
|
548
|
+
# builtins in addition to PIM Modula-2
|
549
|
+
gm2_additional_builtins = (
|
550
|
+
# 21 additional builtins
|
551
|
+
'BITSET8', 'BITSET16', 'BITSET32', 'CARDINAL8', 'CARDINAL16',
|
552
|
+
'CARDINAL32', 'CARDINAL64', 'COMPLEX32', 'COMPLEX64', 'COMPLEX96',
|
553
|
+
'COMPLEX128', 'INTEGER8', 'INTEGER16', 'INTEGER32', 'INTEGER64',
|
554
|
+
'REAL8', 'REAL16', 'REAL32', 'REAL96', 'REAL128', 'THROW',
|
555
|
+
)
|
556
|
+
|
557
|
+
# GNU Extensions
|
558
|
+
# pseudo-module builtins in addition to PIM Modula-2
|
559
|
+
gm2_additional_pseudo_builtins = (
|
560
|
+
# None
|
561
|
+
)
|
562
|
+
|
563
|
+
# p 1 M o d u l a - 2 D a t a s e t s
|
564
|
+
|
565
|
+
# p1 Extensions
|
566
|
+
# reserved words in addition to ISO Modula-2
|
567
|
+
p1_additional_reserved_words = (
|
568
|
+
# None
|
569
|
+
)
|
570
|
+
|
571
|
+
# p1 Extensions
|
572
|
+
# builtins in addition to ISO Modula-2
|
573
|
+
p1_additional_builtins = (
|
574
|
+
# None
|
575
|
+
)
|
576
|
+
|
577
|
+
# p1 Modula-2 Extensions
|
578
|
+
# pseudo-module builtins in addition to ISO Modula-2
|
579
|
+
p1_additional_pseudo_builtins = (
|
580
|
+
# 1 additional builtin
|
581
|
+
'BCD',
|
582
|
+
)
|
583
|
+
|
584
|
+
# X D S M o d u l a - 2 D a t a s e t s
|
585
|
+
|
586
|
+
# XDS Extensions
|
587
|
+
# reserved words in addition to ISO Modula-2
|
588
|
+
xds_additional_reserved_words = (
|
589
|
+
# 1 additional reserved word
|
590
|
+
'SEQ',
|
591
|
+
)
|
592
|
+
|
593
|
+
# XDS Extensions
|
594
|
+
# builtins in addition to ISO Modula-2
|
595
|
+
xds_additional_builtins = (
|
596
|
+
# 9 additional builtins
|
597
|
+
'ASH', 'ASSERT', 'DIFFADR_TYPE', 'ENTIER', 'INDEX', 'LEN',
|
598
|
+
'LONGCARD', 'SHORTCARD', 'SHORTINT',
|
599
|
+
)
|
600
|
+
|
601
|
+
# XDS Modula-2 Extensions
|
602
|
+
# pseudo-module builtins in addition to ISO Modula-2
|
603
|
+
xds_additional_pseudo_builtins = (
|
604
|
+
# 22 additional builtins (SYSTEM)
|
605
|
+
'PROCESS', 'NEWPROCESS', 'BOOL8', 'BOOL16', 'BOOL32', 'CARD8',
|
606
|
+
'CARD16', 'CARD32', 'INT8', 'INT16', 'INT32', 'REF', 'MOVE',
|
607
|
+
'FILL', 'GET', 'PUT', 'CC', 'int', 'unsigned', 'size_t', 'void'
|
608
|
+
# 3 additional builtins (COMPILER)
|
609
|
+
'COMPILER', 'OPTION', 'EQUATION'
|
610
|
+
)
|
611
|
+
|
612
|
+
# P I M S t a n d a r d L i b r a r y D a t a s e t s
|
613
|
+
|
614
|
+
# PIM Modula-2 Standard Library Modules Dataset
|
615
|
+
pim_stdlib_module_identifiers = (
|
616
|
+
'Terminal', 'FileSystem', 'InOut', 'RealInOut', 'MathLib0', 'Storage',
|
617
|
+
)
|
618
|
+
|
619
|
+
# PIM Modula-2 Standard Library Types Dataset
|
620
|
+
pim_stdlib_type_identifiers = (
|
621
|
+
'Flag', 'FlagSet', 'Response', 'Command', 'Lock', 'Permission',
|
622
|
+
'MediumType', 'File', 'FileProc', 'DirectoryProc', 'FileCommand',
|
623
|
+
'DirectoryCommand',
|
624
|
+
)
|
625
|
+
|
626
|
+
# PIM Modula-2 Standard Library Procedures Dataset
|
627
|
+
pim_stdlib_proc_identifiers = (
|
628
|
+
'Read', 'BusyRead', 'ReadAgain', 'Write', 'WriteString', 'WriteLn',
|
629
|
+
'Create', 'Lookup', 'Close', 'Delete', 'Rename', 'SetRead', 'SetWrite',
|
630
|
+
'SetModify', 'SetOpen', 'Doio', 'SetPos', 'GetPos', 'Length', 'Reset',
|
631
|
+
'Again', 'ReadWord', 'WriteWord', 'ReadChar', 'WriteChar',
|
632
|
+
'CreateMedium', 'DeleteMedium', 'AssignName', 'DeassignName',
|
633
|
+
'ReadMedium', 'LookupMedium', 'OpenInput', 'OpenOutput', 'CloseInput',
|
634
|
+
'CloseOutput', 'ReadString', 'ReadInt', 'ReadCard', 'ReadWrd',
|
635
|
+
'WriteInt', 'WriteCard', 'WriteOct', 'WriteHex', 'WriteWrd',
|
636
|
+
'ReadReal', 'WriteReal', 'WriteFixPt', 'WriteRealOct', 'sqrt', 'exp',
|
637
|
+
'ln', 'sin', 'cos', 'arctan', 'entier', 'ALLOCATE', 'DEALLOCATE',
|
638
|
+
)
|
639
|
+
|
640
|
+
# PIM Modula-2 Standard Library Variables Dataset
|
641
|
+
pim_stdlib_var_identifiers = (
|
642
|
+
'Done', 'termCH', 'in', 'out'
|
643
|
+
)
|
644
|
+
|
645
|
+
# PIM Modula-2 Standard Library Constants Dataset
|
646
|
+
pim_stdlib_const_identifiers = (
|
647
|
+
'EOL',
|
648
|
+
)
|
649
|
+
|
650
|
+
# I S O S t a n d a r d L i b r a r y D a t a s e t s
|
651
|
+
|
652
|
+
# ISO Modula-2 Standard Library Modules Dataset
|
653
|
+
iso_stdlib_module_identifiers = (
|
654
|
+
# TO DO
|
655
|
+
)
|
656
|
+
|
657
|
+
# ISO Modula-2 Standard Library Types Dataset
|
658
|
+
iso_stdlib_type_identifiers = (
|
659
|
+
# TO DO
|
660
|
+
)
|
661
|
+
|
662
|
+
# ISO Modula-2 Standard Library Procedures Dataset
|
663
|
+
iso_stdlib_proc_identifiers = (
|
664
|
+
# TO DO
|
665
|
+
)
|
666
|
+
|
667
|
+
# ISO Modula-2 Standard Library Variables Dataset
|
668
|
+
iso_stdlib_var_identifiers = (
|
669
|
+
# TO DO
|
670
|
+
)
|
671
|
+
|
672
|
+
# ISO Modula-2 Standard Library Constants Dataset
|
673
|
+
iso_stdlib_const_identifiers = (
|
674
|
+
# TO DO
|
675
|
+
)
|
676
|
+
|
677
|
+
# M 2 R 1 0 S t a n d a r d L i b r a r y D a t a s e t s
|
678
|
+
|
679
|
+
# Modula-2 R10 Standard Library ADTs Dataset
|
680
|
+
m2r10_stdlib_adt_identifiers = (
|
681
|
+
'BCD', 'LONGBCD', 'BITSET', 'SHORTBITSET', 'LONGBITSET',
|
682
|
+
'LONGLONGBITSET', 'COMPLEX', 'LONGCOMPLEX', 'SHORTCARD', 'LONGLONGCARD',
|
683
|
+
'SHORTINT', 'LONGLONGINT', 'POSINT', 'SHORTPOSINT', 'LONGPOSINT',
|
684
|
+
'LONGLONGPOSINT', 'BITSET8', 'BITSET16', 'BITSET32', 'BITSET64',
|
685
|
+
'BITSET128', 'BS8', 'BS16', 'BS32', 'BS64', 'BS128', 'CARDINAL8',
|
686
|
+
'CARDINAL16', 'CARDINAL32', 'CARDINAL64', 'CARDINAL128', 'CARD8',
|
687
|
+
'CARD16', 'CARD32', 'CARD64', 'CARD128', 'INTEGER8', 'INTEGER16',
|
688
|
+
'INTEGER32', 'INTEGER64', 'INTEGER128', 'INT8', 'INT16', 'INT32',
|
689
|
+
'INT64', 'INT128', 'STRING', 'UNISTRING',
|
690
|
+
)
|
691
|
+
|
692
|
+
# Modula-2 R10 Standard Library Blueprints Dataset
|
693
|
+
m2r10_stdlib_blueprint_identifiers = (
|
694
|
+
'ProtoRoot', 'ProtoComputational', 'ProtoNumeric', 'ProtoScalar',
|
695
|
+
'ProtoNonScalar', 'ProtoCardinal', 'ProtoInteger', 'ProtoReal',
|
696
|
+
'ProtoComplex', 'ProtoVector', 'ProtoTuple', 'ProtoCompArray',
|
697
|
+
'ProtoCollection', 'ProtoStaticArray', 'ProtoStaticSet',
|
698
|
+
'ProtoStaticString', 'ProtoArray', 'ProtoString', 'ProtoSet',
|
699
|
+
'ProtoMultiSet', 'ProtoDictionary', 'ProtoMultiDict', 'ProtoExtension',
|
700
|
+
'ProtoIO', 'ProtoCardMath', 'ProtoIntMath', 'ProtoRealMath',
|
701
|
+
)
|
702
|
+
|
703
|
+
# Modula-2 R10 Standard Library Modules Dataset
|
704
|
+
m2r10_stdlib_module_identifiers = (
|
705
|
+
'ASCII', 'BooleanIO', 'CharIO', 'UnicharIO', 'OctetIO',
|
706
|
+
'CardinalIO', 'LongCardIO', 'IntegerIO', 'LongIntIO', 'RealIO',
|
707
|
+
'LongRealIO', 'BCDIO', 'LongBCDIO', 'CardMath', 'LongCardMath',
|
708
|
+
'IntMath', 'LongIntMath', 'RealMath', 'LongRealMath', 'BCDMath',
|
709
|
+
'LongBCDMath', 'FileIO', 'FileSystem', 'Storage', 'IOSupport',
|
710
|
+
)
|
711
|
+
|
712
|
+
# Modula-2 R10 Standard Library Types Dataset
|
713
|
+
m2r10_stdlib_type_identifiers = (
|
714
|
+
'File', 'Status',
|
715
|
+
# TO BE COMPLETED
|
716
|
+
)
|
717
|
+
|
718
|
+
# Modula-2 R10 Standard Library Procedures Dataset
|
719
|
+
m2r10_stdlib_proc_identifiers = (
|
720
|
+
'ALLOCATE', 'DEALLOCATE', 'SIZE',
|
721
|
+
# TO BE COMPLETED
|
722
|
+
)
|
723
|
+
|
724
|
+
# Modula-2 R10 Standard Library Variables Dataset
|
725
|
+
m2r10_stdlib_var_identifiers = (
|
726
|
+
'stdIn', 'stdOut', 'stdErr',
|
727
|
+
)
|
728
|
+
|
729
|
+
# Modula-2 R10 Standard Library Constants Dataset
|
730
|
+
m2r10_stdlib_const_identifiers = (
|
731
|
+
'pi', 'tau',
|
732
|
+
)
|
733
|
+
|
734
|
+
# D i a l e c t s
|
735
|
+
|
736
|
+
# Dialect modes
|
737
|
+
dialects = (
|
738
|
+
'unknown',
|
739
|
+
'm2pim', 'm2iso', 'm2r10', 'objm2',
|
740
|
+
'm2iso+aglet', 'm2pim+gm2', 'm2iso+p1', 'm2iso+xds',
|
741
|
+
)
|
742
|
+
|
743
|
+
# D a t a b a s e s
|
744
|
+
|
745
|
+
# Lexemes to Mark as Errors Database
|
746
|
+
lexemes_to_reject_db = {
|
747
|
+
# Lexemes to reject for unknown dialect
|
748
|
+
'unknown': (
|
749
|
+
# LEAVE THIS EMPTY
|
750
|
+
),
|
751
|
+
# Lexemes to reject for PIM Modula-2
|
752
|
+
'm2pim': (
|
753
|
+
pim_lexemes_to_reject,
|
754
|
+
),
|
755
|
+
# Lexemes to reject for ISO Modula-2
|
756
|
+
'm2iso': (
|
757
|
+
iso_lexemes_to_reject,
|
758
|
+
),
|
759
|
+
# Lexemes to reject for Modula-2 R10
|
760
|
+
'm2r10': (
|
761
|
+
m2r10_lexemes_to_reject,
|
762
|
+
),
|
763
|
+
# Lexemes to reject for Objective Modula-2
|
764
|
+
'objm2': (
|
765
|
+
objm2_lexemes_to_reject,
|
766
|
+
),
|
767
|
+
# Lexemes to reject for Aglet Modula-2
|
768
|
+
'm2iso+aglet': (
|
769
|
+
iso_lexemes_to_reject,
|
770
|
+
),
|
771
|
+
# Lexemes to reject for GNU Modula-2
|
772
|
+
'm2pim+gm2': (
|
773
|
+
pim_lexemes_to_reject,
|
774
|
+
),
|
775
|
+
# Lexemes to reject for p1 Modula-2
|
776
|
+
'm2iso+p1': (
|
777
|
+
iso_lexemes_to_reject,
|
778
|
+
),
|
779
|
+
# Lexemes to reject for XDS Modula-2
|
780
|
+
'm2iso+xds': (
|
781
|
+
iso_lexemes_to_reject,
|
782
|
+
),
|
783
|
+
}
|
784
|
+
|
785
|
+
# Reserved Words Database
|
786
|
+
reserved_words_db = {
|
787
|
+
# Reserved words for unknown dialect
|
788
|
+
'unknown': (
|
789
|
+
common_reserved_words,
|
790
|
+
pim_additional_reserved_words,
|
791
|
+
iso_additional_reserved_words,
|
792
|
+
m2r10_additional_reserved_words,
|
793
|
+
),
|
794
|
+
|
795
|
+
# Reserved words for PIM Modula-2
|
796
|
+
'm2pim': (
|
797
|
+
common_reserved_words,
|
798
|
+
pim_additional_reserved_words,
|
799
|
+
),
|
800
|
+
|
801
|
+
# Reserved words for Modula-2 R10
|
802
|
+
'm2iso': (
|
803
|
+
common_reserved_words,
|
804
|
+
iso_additional_reserved_words,
|
805
|
+
),
|
806
|
+
|
807
|
+
# Reserved words for ISO Modula-2
|
808
|
+
'm2r10': (
|
809
|
+
common_reserved_words,
|
810
|
+
m2r10_additional_reserved_words,
|
811
|
+
),
|
812
|
+
|
813
|
+
# Reserved words for Objective Modula-2
|
814
|
+
'objm2': (
|
815
|
+
common_reserved_words,
|
816
|
+
m2r10_additional_reserved_words,
|
817
|
+
objm2_additional_reserved_words,
|
818
|
+
),
|
819
|
+
|
820
|
+
# Reserved words for Aglet Modula-2 Extensions
|
821
|
+
'm2iso+aglet': (
|
822
|
+
common_reserved_words,
|
823
|
+
iso_additional_reserved_words,
|
824
|
+
aglet_additional_reserved_words,
|
825
|
+
),
|
826
|
+
|
827
|
+
# Reserved words for GNU Modula-2 Extensions
|
828
|
+
'm2pim+gm2': (
|
829
|
+
common_reserved_words,
|
830
|
+
pim_additional_reserved_words,
|
831
|
+
gm2_additional_reserved_words,
|
832
|
+
),
|
833
|
+
|
834
|
+
# Reserved words for p1 Modula-2 Extensions
|
835
|
+
'm2iso+p1': (
|
836
|
+
common_reserved_words,
|
837
|
+
iso_additional_reserved_words,
|
838
|
+
p1_additional_reserved_words,
|
839
|
+
),
|
840
|
+
|
841
|
+
# Reserved words for XDS Modula-2 Extensions
|
842
|
+
'm2iso+xds': (
|
843
|
+
common_reserved_words,
|
844
|
+
iso_additional_reserved_words,
|
845
|
+
xds_additional_reserved_words,
|
846
|
+
),
|
847
|
+
}
|
848
|
+
|
849
|
+
# Builtins Database
|
850
|
+
builtins_db = {
|
851
|
+
# Builtins for unknown dialect
|
852
|
+
'unknown': (
|
853
|
+
common_builtins,
|
854
|
+
pim_additional_builtins,
|
855
|
+
iso_additional_builtins,
|
856
|
+
m2r10_additional_builtins,
|
857
|
+
),
|
858
|
+
|
859
|
+
# Builtins for PIM Modula-2
|
860
|
+
'm2pim': (
|
861
|
+
common_builtins,
|
862
|
+
pim_additional_builtins,
|
863
|
+
),
|
864
|
+
|
865
|
+
# Builtins for ISO Modula-2
|
866
|
+
'm2iso': (
|
867
|
+
common_builtins,
|
868
|
+
iso_additional_builtins,
|
869
|
+
),
|
870
|
+
|
871
|
+
# Builtins for ISO Modula-2
|
872
|
+
'm2r10': (
|
873
|
+
common_builtins,
|
874
|
+
m2r10_additional_builtins,
|
875
|
+
),
|
876
|
+
|
877
|
+
# Builtins for Objective Modula-2
|
878
|
+
'objm2': (
|
879
|
+
common_builtins,
|
880
|
+
m2r10_additional_builtins,
|
881
|
+
objm2_additional_builtins,
|
882
|
+
),
|
883
|
+
|
884
|
+
# Builtins for Aglet Modula-2 Extensions
|
885
|
+
'm2iso+aglet': (
|
886
|
+
common_builtins,
|
887
|
+
iso_additional_builtins,
|
888
|
+
aglet_additional_builtins,
|
889
|
+
),
|
890
|
+
|
891
|
+
# Builtins for GNU Modula-2 Extensions
|
892
|
+
'm2pim+gm2': (
|
893
|
+
common_builtins,
|
894
|
+
pim_additional_builtins,
|
895
|
+
gm2_additional_builtins,
|
896
|
+
),
|
897
|
+
|
898
|
+
# Builtins for p1 Modula-2 Extensions
|
899
|
+
'm2iso+p1': (
|
900
|
+
common_builtins,
|
901
|
+
iso_additional_builtins,
|
902
|
+
p1_additional_builtins,
|
903
|
+
),
|
904
|
+
|
905
|
+
# Builtins for XDS Modula-2 Extensions
|
906
|
+
'm2iso+xds': (
|
907
|
+
common_builtins,
|
908
|
+
iso_additional_builtins,
|
909
|
+
xds_additional_builtins,
|
910
|
+
),
|
911
|
+
}
|
912
|
+
|
913
|
+
# Pseudo-Module Builtins Database
|
914
|
+
pseudo_builtins_db = {
|
915
|
+
# Builtins for unknown dialect
|
916
|
+
'unknown': (
|
917
|
+
common_pseudo_builtins,
|
918
|
+
pim_additional_pseudo_builtins,
|
919
|
+
iso_additional_pseudo_builtins,
|
920
|
+
m2r10_additional_pseudo_builtins,
|
921
|
+
),
|
922
|
+
|
923
|
+
# Builtins for PIM Modula-2
|
924
|
+
'm2pim': (
|
925
|
+
common_pseudo_builtins,
|
926
|
+
pim_additional_pseudo_builtins,
|
927
|
+
),
|
928
|
+
|
929
|
+
# Builtins for ISO Modula-2
|
930
|
+
'm2iso': (
|
931
|
+
common_pseudo_builtins,
|
932
|
+
iso_additional_pseudo_builtins,
|
933
|
+
),
|
934
|
+
|
935
|
+
# Builtins for ISO Modula-2
|
936
|
+
'm2r10': (
|
937
|
+
common_pseudo_builtins,
|
938
|
+
m2r10_additional_pseudo_builtins,
|
939
|
+
),
|
940
|
+
|
941
|
+
# Builtins for Objective Modula-2
|
942
|
+
'objm2': (
|
943
|
+
common_pseudo_builtins,
|
944
|
+
m2r10_additional_pseudo_builtins,
|
945
|
+
objm2_additional_pseudo_builtins,
|
946
|
+
),
|
947
|
+
|
948
|
+
# Builtins for Aglet Modula-2 Extensions
|
949
|
+
'm2iso+aglet': (
|
950
|
+
common_pseudo_builtins,
|
951
|
+
iso_additional_pseudo_builtins,
|
952
|
+
aglet_additional_pseudo_builtins,
|
953
|
+
),
|
954
|
+
|
955
|
+
# Builtins for GNU Modula-2 Extensions
|
956
|
+
'm2pim+gm2': (
|
957
|
+
common_pseudo_builtins,
|
958
|
+
pim_additional_pseudo_builtins,
|
959
|
+
gm2_additional_pseudo_builtins,
|
960
|
+
),
|
961
|
+
|
962
|
+
# Builtins for p1 Modula-2 Extensions
|
963
|
+
'm2iso+p1': (
|
964
|
+
common_pseudo_builtins,
|
965
|
+
iso_additional_pseudo_builtins,
|
966
|
+
p1_additional_pseudo_builtins,
|
967
|
+
),
|
968
|
+
|
969
|
+
# Builtins for XDS Modula-2 Extensions
|
970
|
+
'm2iso+xds': (
|
971
|
+
common_pseudo_builtins,
|
972
|
+
iso_additional_pseudo_builtins,
|
973
|
+
xds_additional_pseudo_builtins,
|
974
|
+
),
|
975
|
+
}
|
976
|
+
|
977
|
+
# Standard Library ADTs Database
|
978
|
+
stdlib_adts_db = {
|
979
|
+
# Empty entry for unknown dialect
|
980
|
+
'unknown': (
|
981
|
+
# LEAVE THIS EMPTY
|
982
|
+
),
|
983
|
+
# Standard Library ADTs for PIM Modula-2
|
984
|
+
'm2pim': (
|
985
|
+
# No first class library types
|
986
|
+
),
|
987
|
+
|
988
|
+
# Standard Library ADTs for ISO Modula-2
|
989
|
+
'm2iso': (
|
990
|
+
# No first class library types
|
991
|
+
),
|
992
|
+
|
993
|
+
# Standard Library ADTs for Modula-2 R10
|
994
|
+
'm2r10': (
|
995
|
+
m2r10_stdlib_adt_identifiers,
|
996
|
+
),
|
997
|
+
|
998
|
+
# Standard Library ADTs for Objective Modula-2
|
999
|
+
'objm2': (
|
1000
|
+
m2r10_stdlib_adt_identifiers,
|
1001
|
+
),
|
1002
|
+
|
1003
|
+
# Standard Library ADTs for Aglet Modula-2
|
1004
|
+
'm2iso+aglet': (
|
1005
|
+
# No first class library types
|
1006
|
+
),
|
1007
|
+
|
1008
|
+
# Standard Library ADTs for GNU Modula-2
|
1009
|
+
'm2pim+gm2': (
|
1010
|
+
# No first class library types
|
1011
|
+
),
|
1012
|
+
|
1013
|
+
# Standard Library ADTs for p1 Modula-2
|
1014
|
+
'm2iso+p1': (
|
1015
|
+
# No first class library types
|
1016
|
+
),
|
1017
|
+
|
1018
|
+
# Standard Library ADTs for XDS Modula-2
|
1019
|
+
'm2iso+xds': (
|
1020
|
+
# No first class library types
|
1021
|
+
),
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
# Standard Library Modules Database
|
1025
|
+
stdlib_modules_db = {
|
1026
|
+
# Empty entry for unknown dialect
|
1027
|
+
'unknown': (
|
1028
|
+
# LEAVE THIS EMPTY
|
1029
|
+
),
|
1030
|
+
# Standard Library Modules for PIM Modula-2
|
1031
|
+
'm2pim': (
|
1032
|
+
pim_stdlib_module_identifiers,
|
1033
|
+
),
|
1034
|
+
|
1035
|
+
# Standard Library Modules for ISO Modula-2
|
1036
|
+
'm2iso': (
|
1037
|
+
iso_stdlib_module_identifiers,
|
1038
|
+
),
|
1039
|
+
|
1040
|
+
# Standard Library Modules for Modula-2 R10
|
1041
|
+
'm2r10': (
|
1042
|
+
m2r10_stdlib_blueprint_identifiers,
|
1043
|
+
m2r10_stdlib_module_identifiers,
|
1044
|
+
m2r10_stdlib_adt_identifiers,
|
1045
|
+
),
|
1046
|
+
|
1047
|
+
# Standard Library Modules for Objective Modula-2
|
1048
|
+
'objm2': (
|
1049
|
+
m2r10_stdlib_blueprint_identifiers,
|
1050
|
+
m2r10_stdlib_module_identifiers,
|
1051
|
+
),
|
1052
|
+
|
1053
|
+
# Standard Library Modules for Aglet Modula-2
|
1054
|
+
'm2iso+aglet': (
|
1055
|
+
iso_stdlib_module_identifiers,
|
1056
|
+
),
|
1057
|
+
|
1058
|
+
# Standard Library Modules for GNU Modula-2
|
1059
|
+
'm2pim+gm2': (
|
1060
|
+
pim_stdlib_module_identifiers,
|
1061
|
+
),
|
1062
|
+
|
1063
|
+
# Standard Library Modules for p1 Modula-2
|
1064
|
+
'm2iso+p1': (
|
1065
|
+
iso_stdlib_module_identifiers,
|
1066
|
+
),
|
1067
|
+
|
1068
|
+
# Standard Library Modules for XDS Modula-2
|
1069
|
+
'm2iso+xds': (
|
1070
|
+
iso_stdlib_module_identifiers,
|
1071
|
+
),
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
# Standard Library Types Database
|
1075
|
+
stdlib_types_db = {
|
1076
|
+
# Empty entry for unknown dialect
|
1077
|
+
'unknown': (
|
1078
|
+
# LEAVE THIS EMPTY
|
1079
|
+
),
|
1080
|
+
# Standard Library Types for PIM Modula-2
|
1081
|
+
'm2pim': (
|
1082
|
+
pim_stdlib_type_identifiers,
|
1083
|
+
),
|
1084
|
+
|
1085
|
+
# Standard Library Types for ISO Modula-2
|
1086
|
+
'm2iso': (
|
1087
|
+
iso_stdlib_type_identifiers,
|
1088
|
+
),
|
1089
|
+
|
1090
|
+
# Standard Library Types for Modula-2 R10
|
1091
|
+
'm2r10': (
|
1092
|
+
m2r10_stdlib_type_identifiers,
|
1093
|
+
),
|
1094
|
+
|
1095
|
+
# Standard Library Types for Objective Modula-2
|
1096
|
+
'objm2': (
|
1097
|
+
m2r10_stdlib_type_identifiers,
|
1098
|
+
),
|
1099
|
+
|
1100
|
+
# Standard Library Types for Aglet Modula-2
|
1101
|
+
'm2iso+aglet': (
|
1102
|
+
iso_stdlib_type_identifiers,
|
1103
|
+
),
|
1104
|
+
|
1105
|
+
# Standard Library Types for GNU Modula-2
|
1106
|
+
'm2pim+gm2': (
|
1107
|
+
pim_stdlib_type_identifiers,
|
1108
|
+
),
|
1109
|
+
|
1110
|
+
# Standard Library Types for p1 Modula-2
|
1111
|
+
'm2iso+p1': (
|
1112
|
+
iso_stdlib_type_identifiers,
|
1113
|
+
),
|
1114
|
+
|
1115
|
+
# Standard Library Types for XDS Modula-2
|
1116
|
+
'm2iso+xds': (
|
1117
|
+
iso_stdlib_type_identifiers,
|
1118
|
+
),
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
# Standard Library Procedures Database
|
1122
|
+
stdlib_procedures_db = {
|
1123
|
+
# Empty entry for unknown dialect
|
1124
|
+
'unknown': (
|
1125
|
+
# LEAVE THIS EMPTY
|
1126
|
+
),
|
1127
|
+
# Standard Library Procedures for PIM Modula-2
|
1128
|
+
'm2pim': (
|
1129
|
+
pim_stdlib_proc_identifiers,
|
1130
|
+
),
|
1131
|
+
|
1132
|
+
# Standard Library Procedures for ISO Modula-2
|
1133
|
+
'm2iso': (
|
1134
|
+
iso_stdlib_proc_identifiers,
|
1135
|
+
),
|
1136
|
+
|
1137
|
+
# Standard Library Procedures for Modula-2 R10
|
1138
|
+
'm2r10': (
|
1139
|
+
m2r10_stdlib_proc_identifiers,
|
1140
|
+
),
|
1141
|
+
|
1142
|
+
# Standard Library Procedures for Objective Modula-2
|
1143
|
+
'objm2': (
|
1144
|
+
m2r10_stdlib_proc_identifiers,
|
1145
|
+
),
|
1146
|
+
|
1147
|
+
# Standard Library Procedures for Aglet Modula-2
|
1148
|
+
'm2iso+aglet': (
|
1149
|
+
iso_stdlib_proc_identifiers,
|
1150
|
+
),
|
1151
|
+
|
1152
|
+
# Standard Library Procedures for GNU Modula-2
|
1153
|
+
'm2pim+gm2': (
|
1154
|
+
pim_stdlib_proc_identifiers,
|
1155
|
+
),
|
1156
|
+
|
1157
|
+
# Standard Library Procedures for p1 Modula-2
|
1158
|
+
'm2iso+p1': (
|
1159
|
+
iso_stdlib_proc_identifiers,
|
1160
|
+
),
|
1161
|
+
|
1162
|
+
# Standard Library Procedures for XDS Modula-2
|
1163
|
+
'm2iso+xds': (
|
1164
|
+
iso_stdlib_proc_identifiers,
|
1165
|
+
),
|
1166
|
+
}
|
1167
|
+
|
1168
|
+
# Standard Library Variables Database
|
1169
|
+
stdlib_variables_db = {
|
1170
|
+
# Empty entry for unknown dialect
|
1171
|
+
'unknown': (
|
1172
|
+
# LEAVE THIS EMPTY
|
1173
|
+
),
|
1174
|
+
# Standard Library Variables for PIM Modula-2
|
1175
|
+
'm2pim': (
|
1176
|
+
pim_stdlib_var_identifiers,
|
1177
|
+
),
|
1178
|
+
|
1179
|
+
# Standard Library Variables for ISO Modula-2
|
1180
|
+
'm2iso': (
|
1181
|
+
iso_stdlib_var_identifiers,
|
1182
|
+
),
|
1183
|
+
|
1184
|
+
# Standard Library Variables for Modula-2 R10
|
1185
|
+
'm2r10': (
|
1186
|
+
m2r10_stdlib_var_identifiers,
|
1187
|
+
),
|
1188
|
+
|
1189
|
+
# Standard Library Variables for Objective Modula-2
|
1190
|
+
'objm2': (
|
1191
|
+
m2r10_stdlib_var_identifiers,
|
1192
|
+
),
|
1193
|
+
|
1194
|
+
# Standard Library Variables for Aglet Modula-2
|
1195
|
+
'm2iso+aglet': (
|
1196
|
+
iso_stdlib_var_identifiers,
|
1197
|
+
),
|
1198
|
+
|
1199
|
+
# Standard Library Variables for GNU Modula-2
|
1200
|
+
'm2pim+gm2': (
|
1201
|
+
pim_stdlib_var_identifiers,
|
1202
|
+
),
|
1203
|
+
|
1204
|
+
# Standard Library Variables for p1 Modula-2
|
1205
|
+
'm2iso+p1': (
|
1206
|
+
iso_stdlib_var_identifiers,
|
1207
|
+
),
|
1208
|
+
|
1209
|
+
# Standard Library Variables for XDS Modula-2
|
1210
|
+
'm2iso+xds': (
|
1211
|
+
iso_stdlib_var_identifiers,
|
1212
|
+
),
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
# Standard Library Constants Database
|
1216
|
+
stdlib_constants_db = {
|
1217
|
+
# Empty entry for unknown dialect
|
1218
|
+
'unknown': (
|
1219
|
+
# LEAVE THIS EMPTY
|
1220
|
+
),
|
1221
|
+
# Standard Library Constants for PIM Modula-2
|
1222
|
+
'm2pim': (
|
1223
|
+
pim_stdlib_const_identifiers,
|
1224
|
+
),
|
1225
|
+
|
1226
|
+
# Standard Library Constants for ISO Modula-2
|
1227
|
+
'm2iso': (
|
1228
|
+
iso_stdlib_const_identifiers,
|
1229
|
+
),
|
1230
|
+
|
1231
|
+
# Standard Library Constants for Modula-2 R10
|
1232
|
+
'm2r10': (
|
1233
|
+
m2r10_stdlib_const_identifiers,
|
1234
|
+
),
|
1235
|
+
|
1236
|
+
# Standard Library Constants for Objective Modula-2
|
1237
|
+
'objm2': (
|
1238
|
+
m2r10_stdlib_const_identifiers,
|
1239
|
+
),
|
1240
|
+
|
1241
|
+
# Standard Library Constants for Aglet Modula-2
|
1242
|
+
'm2iso+aglet': (
|
1243
|
+
iso_stdlib_const_identifiers,
|
1244
|
+
),
|
1245
|
+
|
1246
|
+
# Standard Library Constants for GNU Modula-2
|
1247
|
+
'm2pim+gm2': (
|
1248
|
+
pim_stdlib_const_identifiers,
|
1249
|
+
),
|
1250
|
+
|
1251
|
+
# Standard Library Constants for p1 Modula-2
|
1252
|
+
'm2iso+p1': (
|
1253
|
+
iso_stdlib_const_identifiers,
|
1254
|
+
),
|
1255
|
+
|
1256
|
+
# Standard Library Constants for XDS Modula-2
|
1257
|
+
'm2iso+xds': (
|
1258
|
+
iso_stdlib_const_identifiers,
|
1259
|
+
),
|
1260
|
+
}
|
1261
|
+
|
1262
|
+
# M e t h o d s
|
1263
|
+
|
1264
|
+
# initialise a lexer instance
|
1265
|
+
def __init__(self, **options):
|
1266
|
+
#
|
1267
|
+
# check dialect options
|
1268
|
+
#
|
1269
|
+
dialects = get_list_opt(options, 'dialect', [])
|
1270
|
+
#
|
1271
|
+
for dialect_option in dialects:
|
1272
|
+
if dialect_option in self.dialects[1:-1]:
|
1273
|
+
# valid dialect option found
|
1274
|
+
self.set_dialect(dialect_option)
|
1275
|
+
break
|
1276
|
+
#
|
1277
|
+
# Fallback Mode (DEFAULT)
|
1278
|
+
else:
|
1279
|
+
# no valid dialect option
|
1280
|
+
self.set_dialect('unknown')
|
1281
|
+
#
|
1282
|
+
self.dialect_set_by_tag = False
|
1283
|
+
#
|
1284
|
+
# check style options
|
1285
|
+
#
|
1286
|
+
styles = get_list_opt(options, 'style', [])
|
1287
|
+
#
|
1288
|
+
# use lowercase mode for Algol style
|
1289
|
+
if 'algol' in styles or 'algol_nu' in styles:
|
1290
|
+
self.algol_publication_mode = True
|
1291
|
+
else:
|
1292
|
+
self.algol_publication_mode = False
|
1293
|
+
#
|
1294
|
+
# Check option flags
|
1295
|
+
#
|
1296
|
+
self.treat_stdlib_adts_as_builtins = get_bool_opt(
|
1297
|
+
options, 'treat_stdlib_adts_as_builtins', True)
|
1298
|
+
#
|
1299
|
+
# call superclass initialiser
|
1300
|
+
RegexLexer.__init__(self, **options)
|
1301
|
+
|
1302
|
+
# Set lexer to a specified dialect
|
1303
|
+
def set_dialect(self, dialect_id):
|
1304
|
+
#
|
1305
|
+
# if __debug__:
|
1306
|
+
# print 'entered set_dialect with arg: ', dialect_id
|
1307
|
+
#
|
1308
|
+
# check dialect name against known dialects
|
1309
|
+
if dialect_id not in self.dialects:
|
1310
|
+
dialect = 'unknown' # default
|
1311
|
+
else:
|
1312
|
+
dialect = dialect_id
|
1313
|
+
#
|
1314
|
+
# compose lexemes to reject set
|
1315
|
+
lexemes_to_reject_set = set()
|
1316
|
+
# add each list of reject lexemes for this dialect
|
1317
|
+
for list in self.lexemes_to_reject_db[dialect]:
|
1318
|
+
lexemes_to_reject_set.update(set(list))
|
1319
|
+
#
|
1320
|
+
# compose reserved words set
|
1321
|
+
reswords_set = set()
|
1322
|
+
# add each list of reserved words for this dialect
|
1323
|
+
for list in self.reserved_words_db[dialect]:
|
1324
|
+
reswords_set.update(set(list))
|
1325
|
+
#
|
1326
|
+
# compose builtins set
|
1327
|
+
builtins_set = set()
|
1328
|
+
# add each list of builtins for this dialect excluding reserved words
|
1329
|
+
for list in self.builtins_db[dialect]:
|
1330
|
+
builtins_set.update(set(list).difference(reswords_set))
|
1331
|
+
#
|
1332
|
+
# compose pseudo-builtins set
|
1333
|
+
pseudo_builtins_set = set()
|
1334
|
+
# add each list of builtins for this dialect excluding reserved words
|
1335
|
+
for list in self.pseudo_builtins_db[dialect]:
|
1336
|
+
pseudo_builtins_set.update(set(list).difference(reswords_set))
|
1337
|
+
#
|
1338
|
+
# compose ADTs set
|
1339
|
+
adts_set = set()
|
1340
|
+
# add each list of ADTs for this dialect excluding reserved words
|
1341
|
+
for list in self.stdlib_adts_db[dialect]:
|
1342
|
+
adts_set.update(set(list).difference(reswords_set))
|
1343
|
+
#
|
1344
|
+
# compose modules set
|
1345
|
+
modules_set = set()
|
1346
|
+
# add each list of builtins for this dialect excluding builtins
|
1347
|
+
for list in self.stdlib_modules_db[dialect]:
|
1348
|
+
modules_set.update(set(list).difference(builtins_set))
|
1349
|
+
#
|
1350
|
+
# compose types set
|
1351
|
+
types_set = set()
|
1352
|
+
# add each list of types for this dialect excluding builtins
|
1353
|
+
for list in self.stdlib_types_db[dialect]:
|
1354
|
+
types_set.update(set(list).difference(builtins_set))
|
1355
|
+
#
|
1356
|
+
# compose procedures set
|
1357
|
+
procedures_set = set()
|
1358
|
+
# add each list of procedures for this dialect excluding builtins
|
1359
|
+
for list in self.stdlib_procedures_db[dialect]:
|
1360
|
+
procedures_set.update(set(list).difference(builtins_set))
|
1361
|
+
#
|
1362
|
+
# compose variables set
|
1363
|
+
variables_set = set()
|
1364
|
+
# add each list of variables for this dialect excluding builtins
|
1365
|
+
for list in self.stdlib_variables_db[dialect]:
|
1366
|
+
variables_set.update(set(list).difference(builtins_set))
|
1367
|
+
#
|
1368
|
+
# compose constants set
|
1369
|
+
constants_set = set()
|
1370
|
+
# add each list of constants for this dialect excluding builtins
|
1371
|
+
for list in self.stdlib_constants_db[dialect]:
|
1372
|
+
constants_set.update(set(list).difference(builtins_set))
|
1373
|
+
#
|
1374
|
+
# update lexer state
|
1375
|
+
self.dialect = dialect
|
1376
|
+
self.lexemes_to_reject = lexemes_to_reject_set
|
1377
|
+
self.reserved_words = reswords_set
|
1378
|
+
self.builtins = builtins_set
|
1379
|
+
self.pseudo_builtins = pseudo_builtins_set
|
1380
|
+
self.adts = adts_set
|
1381
|
+
self.modules = modules_set
|
1382
|
+
self.types = types_set
|
1383
|
+
self.procedures = procedures_set
|
1384
|
+
self.variables = variables_set
|
1385
|
+
self.constants = constants_set
|
1386
|
+
#
|
1387
|
+
# if __debug__:
|
1388
|
+
# print 'exiting set_dialect'
|
1389
|
+
# print ' self.dialect: ', self.dialect
|
1390
|
+
# print ' self.lexemes_to_reject: ', self.lexemes_to_reject
|
1391
|
+
# print ' self.reserved_words: ', self.reserved_words
|
1392
|
+
# print ' self.builtins: ', self.builtins
|
1393
|
+
# print ' self.pseudo_builtins: ', self.pseudo_builtins
|
1394
|
+
# print ' self.adts: ', self.adts
|
1395
|
+
# print ' self.modules: ', self.modules
|
1396
|
+
# print ' self.types: ', self.types
|
1397
|
+
# print ' self.procedures: ', self.procedures
|
1398
|
+
# print ' self.variables: ', self.variables
|
1399
|
+
# print ' self.types: ', self.types
|
1400
|
+
# print ' self.constants: ', self.constants
|
1401
|
+
|
1402
|
+
# Extracts a dialect name from a dialect tag comment string and checks
|
1403
|
+
# the extracted name against known dialects. If a match is found, the
|
1404
|
+
# matching name is returned, otherwise dialect id 'unknown' is returned
|
1405
|
+
def get_dialect_from_dialect_tag(self, dialect_tag):
|
1406
|
+
#
|
1407
|
+
# if __debug__:
|
1408
|
+
# print 'entered get_dialect_from_dialect_tag with arg: ', dialect_tag
|
1409
|
+
#
|
1410
|
+
# constants
|
1411
|
+
left_tag_delim = '(*!'
|
1412
|
+
right_tag_delim = '*)'
|
1413
|
+
left_tag_delim_len = len(left_tag_delim)
|
1414
|
+
right_tag_delim_len = len(right_tag_delim)
|
1415
|
+
indicator_start = left_tag_delim_len
|
1416
|
+
indicator_end = -(right_tag_delim_len)
|
1417
|
+
#
|
1418
|
+
# check comment string for dialect indicator
|
1419
|
+
if len(dialect_tag) > (left_tag_delim_len + right_tag_delim_len) \
|
1420
|
+
and dialect_tag.startswith(left_tag_delim) \
|
1421
|
+
and dialect_tag.endswith(right_tag_delim):
|
1422
|
+
#
|
1423
|
+
# if __debug__:
|
1424
|
+
# print 'dialect tag found'
|
1425
|
+
#
|
1426
|
+
# extract dialect indicator
|
1427
|
+
indicator = dialect_tag[indicator_start:indicator_end]
|
1428
|
+
#
|
1429
|
+
# if __debug__:
|
1430
|
+
# print 'extracted: ', indicator
|
1431
|
+
#
|
1432
|
+
# check against known dialects
|
1433
|
+
for index in range(1, len(self.dialects)):
|
1434
|
+
#
|
1435
|
+
# if __debug__:
|
1436
|
+
# print 'dialects[', index, ']: ', self.dialects[index]
|
1437
|
+
#
|
1438
|
+
if indicator == self.dialects[index]:
|
1439
|
+
#
|
1440
|
+
# if __debug__:
|
1441
|
+
# print 'matching dialect found'
|
1442
|
+
#
|
1443
|
+
# indicator matches known dialect
|
1444
|
+
return indicator
|
1445
|
+
else:
|
1446
|
+
# indicator does not match any dialect
|
1447
|
+
return 'unknown' # default
|
1448
|
+
else:
|
1449
|
+
# invalid indicator string
|
1450
|
+
return 'unknown' # default
|
1451
|
+
|
1452
|
+
# intercept the token stream, modify token attributes and return them
|
1453
|
+
def get_tokens_unprocessed(self, text):
|
1454
|
+
for index, token, value in RegexLexer.get_tokens_unprocessed(self, text):
|
1455
|
+
#
|
1456
|
+
# check for dialect tag if dialect has not been set by tag
|
1457
|
+
if not self.dialect_set_by_tag and token == Comment.Special:
|
1458
|
+
indicated_dialect = self.get_dialect_from_dialect_tag(value)
|
1459
|
+
if indicated_dialect != 'unknown':
|
1460
|
+
# token is a dialect indicator
|
1461
|
+
# reset reserved words and builtins
|
1462
|
+
self.set_dialect(indicated_dialect)
|
1463
|
+
self.dialect_set_by_tag = True
|
1464
|
+
#
|
1465
|
+
# check for reserved words, predefined and stdlib identifiers
|
1466
|
+
if token is Name:
|
1467
|
+
if value in self.reserved_words:
|
1468
|
+
token = Keyword.Reserved
|
1469
|
+
if self.algol_publication_mode:
|
1470
|
+
value = value.lower()
|
1471
|
+
#
|
1472
|
+
elif value in self.builtins:
|
1473
|
+
token = Name.Builtin
|
1474
|
+
if self.algol_publication_mode:
|
1475
|
+
value = value.lower()
|
1476
|
+
#
|
1477
|
+
elif value in self.pseudo_builtins:
|
1478
|
+
token = Name.Builtin.Pseudo
|
1479
|
+
if self.algol_publication_mode:
|
1480
|
+
value = value.lower()
|
1481
|
+
#
|
1482
|
+
elif value in self.adts:
|
1483
|
+
if not self.treat_stdlib_adts_as_builtins:
|
1484
|
+
token = Name.Namespace
|
1485
|
+
else:
|
1486
|
+
token = Name.Builtin.Pseudo
|
1487
|
+
if self.algol_publication_mode:
|
1488
|
+
value = value.lower()
|
1489
|
+
#
|
1490
|
+
elif value in self.modules:
|
1491
|
+
token = Name.Namespace
|
1492
|
+
#
|
1493
|
+
elif value in self.types:
|
1494
|
+
token = Name.Class
|
1495
|
+
#
|
1496
|
+
elif value in self.procedures:
|
1497
|
+
token = Name.Function
|
1498
|
+
#
|
1499
|
+
elif value in self.variables:
|
1500
|
+
token = Name.Variable
|
1501
|
+
#
|
1502
|
+
elif value in self.constants:
|
1503
|
+
token = Name.Constant
|
1504
|
+
#
|
1505
|
+
elif token in Number:
|
1506
|
+
#
|
1507
|
+
# mark prefix number literals as error for PIM and ISO dialects
|
1508
|
+
if self.dialect not in ('unknown', 'm2r10', 'objm2'):
|
1509
|
+
if "'" in value or value[0:2] in ('0b', '0x', '0u'):
|
1510
|
+
token = Error
|
1511
|
+
#
|
1512
|
+
elif self.dialect in ('m2r10', 'objm2'):
|
1513
|
+
# mark base-8 number literals as errors for M2 R10 and ObjM2
|
1514
|
+
if token is Number.Oct:
|
1515
|
+
token = Error
|
1516
|
+
# mark suffix base-16 literals as errors for M2 R10 and ObjM2
|
1517
|
+
elif token is Number.Hex and 'H' in value:
|
1518
|
+
token = Error
|
1519
|
+
# mark real numbers with E as errors for M2 R10 and ObjM2
|
1520
|
+
elif token is Number.Float and 'E' in value:
|
1521
|
+
token = Error
|
1522
|
+
#
|
1523
|
+
elif token in Comment:
|
1524
|
+
#
|
1525
|
+
# mark single line comment as error for PIM and ISO dialects
|
1526
|
+
if token is Comment.Single:
|
1527
|
+
if self.dialect not in ('unknown', 'm2r10', 'objm2'):
|
1528
|
+
token = Error
|
1529
|
+
#
|
1530
|
+
if token is Comment.Preproc:
|
1531
|
+
# mark ISO pragma as error for PIM dialects
|
1532
|
+
if value.startswith('<*') and \
|
1533
|
+
self.dialect.startswith('m2pim'):
|
1534
|
+
token = Error
|
1535
|
+
# mark PIM pragma as comment for other dialects
|
1536
|
+
elif value.startswith('(*$') and \
|
1537
|
+
self.dialect != 'unknown' and \
|
1538
|
+
not self.dialect.startswith('m2pim'):
|
1539
|
+
token = Comment.Multiline
|
1540
|
+
#
|
1541
|
+
else: # token is neither Name nor Comment
|
1542
|
+
#
|
1543
|
+
# mark lexemes matching the dialect's error token set as errors
|
1544
|
+
if value in self.lexemes_to_reject:
|
1545
|
+
token = Error
|
1546
|
+
#
|
1547
|
+
# substitute lexemes when in Algol mode
|
1548
|
+
if self.algol_publication_mode:
|
1549
|
+
if value == '#':
|
1550
|
+
value = u'≠'
|
1551
|
+
elif value == '<=':
|
1552
|
+
value = u'≤'
|
1553
|
+
elif value == '>=':
|
1554
|
+
value = u'≥'
|
1555
|
+
elif value == '==':
|
1556
|
+
value = u'≡'
|
1557
|
+
elif value == '*.':
|
1558
|
+
value = u'•'
|
1559
|
+
|
1560
|
+
# return result
|
1561
|
+
yield index, token, value
|