summaryrefslogtreecommitdiff
path: root/pygments/lexers
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/lexers')
-rw-r--r--pygments/lexers/_mapping.py13
-rw-r--r--pygments/lexers/asm.py114
-rw-r--r--pygments/lexers/basic.py103
-rw-r--r--pygments/lexers/boa.py92
-rw-r--r--pygments/lexers/configs.py98
-rw-r--r--pygments/lexers/dotnet.py9
-rw-r--r--pygments/lexers/freefem.py967
-rw-r--r--pygments/lexers/javascript.py2
-rw-r--r--pygments/lexers/make.py4
-rw-r--r--pygments/lexers/pony.py94
-rw-r--r--pygments/lexers/prolog.py1
-rw-r--r--pygments/lexers/rdf.py7
-rw-r--r--pygments/lexers/rust.py2
-rw-r--r--pygments/lexers/shell.py2
-rw-r--r--pygments/lexers/slash.py187
-rw-r--r--pygments/lexers/teraterm.py158
-rw-r--r--pygments/lexers/theorem.py2
17 files changed, 1830 insertions, 25 deletions
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index 6e0f728c..ce1b6dfc 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -44,9 +44,11 @@ LEXERS = {
'ArduinoLexer': ('pygments.lexers.c_like', 'Arduino', ('arduino',), ('*.ino',), ('text/x-arduino',)),
'AspectJLexer': ('pygments.lexers.jvm', 'AspectJ', ('aspectj',), ('*.aj',), ('text/x-aspectj',)),
'AsymptoteLexer': ('pygments.lexers.graphics', 'Asymptote', ('asy', 'asymptote'), ('*.asy',), ('text/x-asymptote',)),
+ 'AugeasLexer': ('pygments.lexers.configs', 'Augeas', ('augeas',), ('*.aug',), ()),
'AutoItLexer': ('pygments.lexers.automation', 'AutoIt', ('autoit',), ('*.au3',), ('text/x-autoit',)),
'AutohotkeyLexer': ('pygments.lexers.automation', 'autohotkey', ('ahk', 'autohotkey'), ('*.ahk', '*.ahkl'), ('text/x-autohotkey',)),
'AwkLexer': ('pygments.lexers.textedit', 'Awk', ('awk', 'gawk', 'mawk', 'nawk'), ('*.awk',), ('application/x-awk',)),
+ 'BBCBasicLexer': ('pygments.lexers.basic', 'BBC Basic', ('bbcbasic',), ('*.bbc',), ()),
'BBCodeLexer': ('pygments.lexers.markup', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)),
'BCLexer': ('pygments.lexers.algebra', 'BC', ('bc',), ('*.bc',), ()),
'BSTLexer': ('pygments.lexers.bibtex', 'BST', ('bst', 'bst-pybtex'), ('*.bst',), ()),
@@ -59,6 +61,7 @@ LEXERS = {
'BlitzBasicLexer': ('pygments.lexers.basic', 'BlitzBasic', ('blitzbasic', 'b3d', 'bplus'), ('*.bb', '*.decls'), ('text/x-bb',)),
'BlitzMaxLexer': ('pygments.lexers.basic', 'BlitzMax', ('blitzmax', 'bmax'), ('*.bmx',), ('text/x-bmx',)),
'BnfLexer': ('pygments.lexers.grammar_notation', 'BNF', ('bnf',), ('*.bnf',), ('text/x-bnf',)),
+ 'BoaLexer': ('pygments.lexers.boa', 'Boa', ('boa',), ('*.boa',), ()),
'BooLexer': ('pygments.lexers.dotnet', 'Boo', ('boo',), ('*.boo',), ('text/x-boo',)),
'BoogieLexer': ('pygments.lexers.verification', 'Boogie', ('boogie',), ('*.bpl',), ()),
'BrainfuckLexer': ('pygments.lexers.esoteric', 'Brainfuck', ('brainfuck', 'bf'), ('*.bf', '*.b'), ('application/x-brainfuck',)),
@@ -121,6 +124,7 @@ LEXERS = {
'DObjdumpLexer': ('pygments.lexers.asm', 'd-objdump', ('d-objdump',), ('*.d-objdump',), ('text/x-d-objdump',)),
'DarcsPatchLexer': ('pygments.lexers.diff', 'Darcs Patch', ('dpatch',), ('*.dpatch', '*.darcspatch'), ()),
'DartLexer': ('pygments.lexers.javascript', 'Dart', ('dart',), ('*.dart',), ('text/x-dart',)),
+ 'Dasm16Lexer': ('pygments.lexers.asm', 'DASM16', ('dasm16',), ('*.dasm16', '*.dasm'), ('text/x-dasm16',)),
'DebianControlLexer': ('pygments.lexers.installers', 'Debian Control file', ('control', 'debcontrol'), ('control',), ()),
'DelphiLexer': ('pygments.lexers.pascal', 'Delphi', ('delphi', 'pas', 'pascal', 'objectpascal'), ('*.pas', '*.dpr'), ('text/x-pascal',)),
'DgLexer': ('pygments.lexers.python', 'dg', ('dg',), ('*.dg',), ('text/x-dg',)),
@@ -149,7 +153,7 @@ LEXERS = {
'EvoqueLexer': ('pygments.lexers.templates', 'Evoque', ('evoque',), ('*.evoque',), ('application/x-evoque',)),
'EvoqueXmlLexer': ('pygments.lexers.templates', 'XML+Evoque', ('xml+evoque',), ('*.xml',), ('application/xml+evoque',)),
'EzhilLexer': ('pygments.lexers.ezhil', 'Ezhil', ('ezhil',), ('*.n',), ('text/x-ezhil',)),
- 'FSharpLexer': ('pygments.lexers.dotnet', 'FSharp', ('fsharp',), ('*.fs', '*.fsi'), ('text/x-fsharp',)),
+ 'FSharpLexer': ('pygments.lexers.dotnet', 'F#', ('fsharp', 'f#'), ('*.fs', '*.fsi'), ('text/x-fsharp',)),
'FactorLexer': ('pygments.lexers.factor', 'Factor', ('factor',), ('*.factor',), ('text/x-factor',)),
'FancyLexer': ('pygments.lexers.ruby', 'Fancy', ('fancy', 'fy'), ('*.fy', '*.fancypack'), ('text/x-fancysrc',)),
'FantomLexer': ('pygments.lexers.fantom', 'Fantom', ('fan',), ('*.fan',), ('application/x-fantom',)),
@@ -162,6 +166,7 @@ LEXERS = {
'FortranFixedLexer': ('pygments.lexers.fortran', 'FortranFixed', ('fortranfixed',), ('*.f', '*.F'), ()),
'FortranLexer': ('pygments.lexers.fortran', 'Fortran', ('fortran',), ('*.f03', '*.f90', '*.F03', '*.F90'), ('text/x-fortran',)),
'FoxProLexer': ('pygments.lexers.foxpro', 'FoxPro', ('foxpro', 'vfp', 'clipper', 'xbase'), ('*.PRG', '*.prg'), ()),
+ 'FreeFemLexer': ('pygments.lexers.freefem', 'Freefem', ('freefem',), ('*.edp',), ('text/x-freefem',)),
'GAPLexer': ('pygments.lexers.algebra', 'GAP', ('gap',), ('*.g', '*.gd', '*.gi', '*.gap'), ()),
'GLShaderLexer': ('pygments.lexers.graphics', 'GLSL', ('glsl',), ('*.vert', '*.frag', '*.geo'), ('text/x-glslsrc',)),
'GasLexer': ('pygments.lexers.asm', 'GAS', ('gas', 'asm'), ('*.s', '*.S'), ('text/x-gas',)),
@@ -322,6 +327,7 @@ LEXERS = {
'PikeLexer': ('pygments.lexers.c_like', 'Pike', ('pike',), ('*.pike', '*.pmod'), ('text/x-pike',)),
'PkgConfigLexer': ('pygments.lexers.configs', 'PkgConfig', ('pkgconfig',), ('*.pc',), ()),
'PlPgsqlLexer': ('pygments.lexers.sql', 'PL/pgSQL', ('plpgsql',), (), ('text/x-plpgsql',)),
+ 'PonyLexer': ('pygments.lexers.pony', 'Pony', ('pony',), ('*.pony',), ()),
'PostScriptLexer': ('pygments.lexers.graphics', 'PostScript', ('postscript', 'postscr'), ('*.ps', '*.eps'), ('application/postscript',)),
'PostgresConsoleLexer': ('pygments.lexers.sql', 'PostgreSQL console (psql)', ('psql', 'postgresql-console', 'postgres-console'), (), ('text/x-postgresql-psql',)),
'PostgresLexer': ('pygments.lexers.sql', 'PostgreSQL SQL dialect', ('postgresql', 'postgres'), (), ('text/x-postgresql',)),
@@ -386,6 +392,7 @@ LEXERS = {
'ScssLexer': ('pygments.lexers.css', 'SCSS', ('scss',), ('*.scss',), ('text/x-scss',)),
'ShenLexer': ('pygments.lexers.lisp', 'Shen', ('shen',), ('*.shen',), ('text/x-shen', 'application/x-shen')),
'SilverLexer': ('pygments.lexers.verification', 'Silver', ('silver',), ('*.sil', '*.vpr'), ()),
+ 'SlashLexer': ('pygments.lexers.slash', 'Slash', ('slash',), ('*.sl',), ()),
'SlimLexer': ('pygments.lexers.webmisc', 'Slim', ('slim',), ('*.slim',), ('text/x-slim',)),
'SlurmBashLexer': ('pygments.lexers.shell', 'Slurm', ('slurm', 'sbatch'), ('*.sl',), ()),
'SmaliLexer': ('pygments.lexers.dalvik', 'Smali', ('smali',), ('*.smali',), ('text/smali',)),
@@ -408,12 +415,14 @@ LEXERS = {
'SwigLexer': ('pygments.lexers.c_like', 'SWIG', ('swig',), ('*.swg', '*.i'), ('text/swig',)),
'SystemVerilogLexer': ('pygments.lexers.hdl', 'systemverilog', ('systemverilog', 'sv'), ('*.sv', '*.svh'), ('text/x-systemverilog',)),
'TAPLexer': ('pygments.lexers.testing', 'TAP', ('tap',), ('*.tap',), ()),
+ 'TOMLLexer': ('pygments.lexers.configs', 'TOML', ('toml',), ('*.toml',), ()),
'Tads3Lexer': ('pygments.lexers.int_fiction', 'TADS 3', ('tads3',), ('*.t',), ()),
'TasmLexer': ('pygments.lexers.asm', 'TASM', ('tasm',), ('*.asm', '*.ASM', '*.tasm'), ('text/x-tasm',)),
'TclLexer': ('pygments.lexers.tcl', 'Tcl', ('tcl',), ('*.tcl', '*.rvt'), ('text/x-tcl', 'text/x-script.tcl', 'application/x-tcl')),
'TcshLexer': ('pygments.lexers.shell', 'Tcsh', ('tcsh', 'csh'), ('*.tcsh', '*.csh'), ('application/x-csh',)),
'TcshSessionLexer': ('pygments.lexers.shell', 'Tcsh Session', ('tcshcon',), (), ()),
'TeaTemplateLexer': ('pygments.lexers.templates', 'Tea', ('tea',), ('*.tea',), ('text/x-tea',)),
+ 'TeraTermLexer': ('pygments.lexers.teraterm', 'Tera Term macro', ('ttl', 'teraterm', 'teratermmacro'), ('*.ttl',), ('text/x-teratermmacro',)),
'TermcapLexer': ('pygments.lexers.configs', 'Termcap', ('termcap',), ('termcap', 'termcap.src'), ()),
'TerminfoLexer': ('pygments.lexers.configs', 'Terminfo', ('terminfo',), ('terminfo', 'terminfo.src'), ()),
'TerraformLexer': ('pygments.lexers.configs', 'Terraform', ('terraform', 'tf'), ('*.tf',), ('application/x-tf', 'application/x-terraform')),
@@ -433,7 +442,7 @@ LEXERS = {
'UcodeLexer': ('pygments.lexers.unicon', 'ucode', ('ucode',), ('*.u', '*.u1', '*.u2'), ()),
'UniconLexer': ('pygments.lexers.unicon', 'Unicon', ('unicon',), ('*.icn',), ('text/unicon',)),
'UrbiscriptLexer': ('pygments.lexers.urbi', 'UrbiScript', ('urbiscript',), ('*.u',), ('application/x-urbiscript',)),
- 'VBScriptLexer': ('pygments.lexers.basic', 'VBScript', (), ('*.vbs', '*.VBS'), ()),
+ 'VBScriptLexer': ('pygments.lexers.basic', 'VBScript', ('vbscript',), ('*.vbs', '*.VBS'), ()),
'VCLLexer': ('pygments.lexers.varnish', 'VCL', ('vcl',), ('*.vcl',), ('text/x-vclsrc',)),
'VCLSnippetLexer': ('pygments.lexers.varnish', 'VCLSnippets', ('vclsnippets', 'vclsnippet'), (), ('text/x-vclsnippet',)),
'VCTreeStatusLexer': ('pygments.lexers.console', 'VCTreeStatus', ('vctreestatus',), (), ()),
diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py
index 2f08d510..3d2933d6 100644
--- a/pygments/lexers/asm.py
+++ b/pygments/lexers/asm.py
@@ -20,7 +20,7 @@ from pygments.token import Text, Name, Number, String, Comment, Punctuation, \
__all__ = ['GasLexer', 'ObjdumpLexer', 'DObjdumpLexer', 'CppObjdumpLexer',
'CObjdumpLexer', 'HsailLexer', 'LlvmLexer', 'NasmLexer',
- 'NasmObjdumpLexer', 'TasmLexer', 'Ca65Lexer']
+ 'NasmObjdumpLexer', 'TasmLexer', 'Ca65Lexer', 'Dasm16Lexer']
class GasLexer(RegexLexer):
@@ -468,9 +468,11 @@ class NasmLexer(RegexLexer):
r'mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]')
wordop = r'seg|wrt|strict'
type = r'byte|[dq]?word'
- directives = (r'BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|'
+ # Directives must be followed by whitespace, otherwise CPU will match
+ # cpuid for instance.
+ directives = (r'(?:BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|'
r'ORG|ALIGN|STRUC|ENDSTRUC|COMMON|CPU|GROUP|UPPERCASE|IMPORT|'
- r'EXPORT|LIBRARY|MODULE')
+ r'EXPORT|LIBRARY|MODULE)\s+')
flags = re.IGNORECASE | re.MULTILINE
tokens = {
@@ -650,3 +652,109 @@ class Ca65Lexer(RegexLexer):
# comments in GAS start with "#"
if re.match(r'^\s*;', text, re.MULTILINE):
return 0.9
+
+
+class Dasm16Lexer(RegexLexer):
+ """
+ Simple lexer for DCPU-16 Assembly
+
+ Check http://0x10c.com/doc/dcpu-16.txt
+
+ .. versionadded:: 2.4
+ """
+ name = 'DASM16'
+ aliases = ['dasm16']
+ filenames = ['*.dasm16', '*.dasm']
+ mimetypes = ['text/x-dasm16']
+
+ INSTRUCTIONS = [
+ 'SET',
+ 'ADD', 'SUB',
+ 'MUL', 'MLI',
+ 'DIV', 'DVI',
+ 'MOD', 'MDI',
+ 'AND', 'BOR', 'XOR',
+ 'SHR', 'ASR', 'SHL',
+ 'IFB', 'IFC', 'IFE', 'IFN', 'IFG', 'IFA', 'IFL', 'IFU',
+ 'ADX', 'SBX',
+ 'STI', 'STD',
+ 'JSR',
+ 'INT', 'IAG', 'IAS', 'RFI', 'IAQ', 'HWN', 'HWQ', 'HWI',
+ ]
+
+ REGISTERS = [
+ 'A', 'B', 'C',
+ 'X', 'Y', 'Z',
+ 'I', 'J',
+ 'SP', 'PC', 'EX',
+ 'POP', 'PEEK', 'PUSH'
+ ]
+
+ # Regexes yo
+ char = r'[a-zA-Z$._0-9@]'
+ identifier = r'(?:[a-zA-Z$_]' + char + r'*|\.' + char + '+)'
+ number = r'[+-]?(?:0[xX][a-zA-Z0-9]+|\d+)'
+ binary_number = r'0b[01_]+'
+ instruction = r'(?i)(' + '|'.join(INSTRUCTIONS) + ')'
+ single_char = r"'\\?" + char + "'"
+ string = r'"(\\"|[^"])*"'
+
+ def guess_identifier(lexer, match):
+ ident = match.group(0)
+ klass = Name.Variable if ident.upper() in lexer.REGISTERS else Name.Label
+ yield match.start(), klass, ident
+
+ tokens = {
+ 'root': [
+ include('whitespace'),
+ (':' + identifier, Name.Label),
+ (identifier + ':', Name.Label),
+ (instruction, Name.Function, 'instruction-args'),
+ (r'\.' + identifier, Name.Function, 'data-args'),
+ (r'[\r\n]+', Text)
+ ],
+
+ 'numeric' : [
+ (binary_number, Number.Integer),
+ (number, Number.Integer),
+ (single_char, String),
+ ],
+
+ 'arg' : [
+ (identifier, guess_identifier),
+ include('numeric')
+ ],
+
+ 'deref' : [
+ (r'\+', Punctuation),
+ (r'\]', Punctuation, '#pop'),
+ include('arg'),
+ include('whitespace')
+ ],
+
+ 'instruction-line' : [
+ (r'[\r\n]+', Text, '#pop'),
+ (r';.*?$', Comment, '#pop'),
+ include('whitespace')
+ ],
+
+ 'instruction-args': [
+ (r',', Punctuation),
+ (r'\[', Punctuation, 'deref'),
+ include('arg'),
+ include('instruction-line')
+ ],
+
+ 'data-args' : [
+ (r',', Punctuation),
+ include('numeric'),
+ (string, String),
+ include('instruction-line')
+ ],
+
+ 'whitespace': [
+ (r'\n', Text),
+ (r'\s+', Text),
+ (r';.*?\n', Comment)
+ ],
+ }
diff --git a/pygments/lexers/basic.py b/pygments/lexers/basic.py
index b0409386..f93d6d52 100644
--- a/pygments/lexers/basic.py
+++ b/pygments/lexers/basic.py
@@ -18,7 +18,8 @@ from pygments.lexers import _vbscript_builtins
__all__ = ['BlitzBasicLexer', 'BlitzMaxLexer', 'MonkeyLexer', 'CbmBasicV2Lexer',
- 'QBasicLexer', 'VBScriptLexer']
+ 'QBasicLexer', 'VBScriptLexer', 'BBCBasicLexer']
+
class BlitzMaxLexer(RegexLexer):
@@ -509,7 +510,7 @@ class VBScriptLexer(RegexLexer):
.. versionadded:: 2.4
"""
name = 'VBScript'
- aliases = []
+ aliases = ['vbscript']
filenames = ['*.vbs', '*.VBS']
flags = re.IGNORECASE
@@ -549,7 +550,7 @@ class VBScriptLexer(RegexLexer):
(r'[a-z_][a-z0-9_]*', Name),
(r'\b_\n', Operator),
(words(r'(),.:'), Punctuation),
- ('.+(\n)?', Error)
+ (r'.+(\n)?', Error)
],
'dim_more': [
(r'(\s*)(,)(\s*)([a-z_][a-z0-9]*)', bygroups(Whitespace, Punctuation, Whitespace, Name.Variable)),
@@ -561,4 +562,98 @@ class VBScriptLexer(RegexLexer):
(r'"', String.Double, '#pop'),
(r'\n', Error, '#pop'), # Unterminated string
],
- } \ No newline at end of file
+ }
+
+
+class BBCBasicLexer(RegexLexer):
+ """
+ BBC Basic was supplied on the BBC Micro, and later Acorn RISC OS.
+ It is also used by BBC Basic For Windows.
+
+ .. versionadded:: 2.4
+ """
+ base_keywords = ['OTHERWISE', 'AND', 'DIV', 'EOR', 'MOD', 'OR', 'ERROR',
+ 'LINE', 'OFF', 'STEP', 'SPC', 'TAB', 'ELSE', 'THEN',
+ 'OPENIN', 'PTR', 'PAGE', 'TIME', 'LOMEM', 'HIMEM', 'ABS',
+ 'ACS', 'ADVAL', 'ASC', 'ASN', 'ATN', 'BGET', 'COS', 'COUNT',
+ 'DEG', 'ERL', 'ERR', 'EVAL', 'EXP', 'EXT', 'FALSE', 'FN',
+ 'GET', 'INKEY', 'INSTR', 'INT', 'LEN', 'LN', 'LOG', 'NOT',
+ 'OPENUP', 'OPENOUT', 'PI', 'POINT', 'POS', 'RAD', 'RND',
+ 'SGN', 'SIN', 'SQR', 'TAN', 'TO', 'TRUE', 'USR', 'VAL',
+ 'VPOS', 'CHR$', 'GET$', 'INKEY$', 'LEFT$', 'MID$',
+ 'RIGHT$', 'STR$', 'STRING$', 'EOF', 'PTR', 'PAGE', 'TIME',
+ 'LOMEM', 'HIMEM', 'SOUND', 'BPUT', 'CALL', 'CHAIN', 'CLEAR',
+ 'CLOSE', 'CLG', 'CLS', 'DATA', 'DEF', 'DIM', 'DRAW', 'END',
+ 'ENDPROC', 'ENVELOPE', 'FOR', 'GOSUB', 'GOTO', 'GCOL', 'IF',
+ 'INPUT', 'LET', 'LOCAL', 'MODE', 'MOVE', 'NEXT', 'ON',
+ 'VDU', 'PLOT', 'PRINT', 'PROC', 'READ', 'REM', 'REPEAT',
+ 'REPORT', 'RESTORE', 'RETURN', 'RUN', 'STOP', 'COLOUR',
+ 'TRACE', 'UNTIL', 'WIDTH', 'OSCLI']
+
+ basic5_keywords = ['WHEN', 'OF', 'ENDCASE', 'ENDIF', 'ENDWHILE', 'CASE',
+ 'CIRCLE', 'FILL', 'ORIGIN', 'POINT', 'RECTANGLE', 'SWAP',
+ 'WHILE', 'WAIT', 'MOUSE', 'QUIT', 'SYS', 'INSTALL',
+ 'LIBRARY', 'TINT', 'ELLIPSE', 'BEATS', 'TEMPO', 'VOICES',
+ 'VOICE', 'STEREO', 'OVERLAY', 'APPEND', 'AUTO', 'CRUNCH',
+ 'DELETE', 'EDIT', 'HELP', 'LIST', 'LOAD', 'LVAR', 'NEW',
+ 'OLD', 'RENUMBER', 'SAVE', 'TEXTLOAD', 'TEXTSAVE',
+ 'TWIN', 'TWINO', 'INSTALL', 'SUM', 'BEAT']
+
+
+ name = 'BBC Basic'
+ aliases = ['bbcbasic']
+ filenames = ['*.bbc']
+
+ tokens = {
+ 'root': [
+ (r"[0-9]+", Name.Label),
+ (r"(\*)([^\n]*)",
+ bygroups(Keyword.Pseudo, Comment.Special)),
+ (r"", Whitespace, 'code'),
+ ],
+
+ 'code': [
+ (r"(REM)([^\n]*)",
+ bygroups(Keyword.Declaration, Comment.Single)),
+ (r'\n', Whitespace, 'root'),
+ (r'\s+', Whitespace),
+ (r':', Comment.Preproc),
+
+ # Some special cases to make functions come out nicer
+ (r'(DEF)(\s*)(FN|PROC)([A-Za-z_@][\w@]*)',
+ bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration, Name.Function)),
+ (r'(FN|PROC)([A-Za-z_@][\w@]*)',
+ bygroups(Keyword, Name.Function)),
+
+ (r'(GOTO|GOSUB|THEN|RESTORE)(\s*)(\d+)',
+ bygroups(Keyword, Whitespace, Name.Label)),
+
+ (r'(TRUE|FALSE)', Keyword.Constant),
+ (r'(PAGE|LOMEM|HIMEM|TIME|WIDTH|ERL|ERR|REPORT\$|POS|VPOS|VOICES)', Keyword.Pseudo),
+
+ (words(base_keywords), Keyword),
+ (words(basic5_keywords), Keyword),
+
+ ('"', String.Double, 'string'),
+
+ ('%[01]{1,32}', Number.Bin),
+ ('&[0-9a-f]{1,8}', Number.Hex),
+
+ (r'[+-]?[0-9]+\.[0-9]*(E[+-]?[0-9]+)?', Number.Float),
+ (r'[+-]?\.[0-9]+(E[+-]?[0-9]+)?', Number.Float),
+ (r'[+-]?[0-9]+E[+-]?[0-9]+', Number.Float),
+ (r'[+-]?\d+', Number.Integer),
+
+ (r'([A-Za-z_@][\w@]*[%$]?)', Name.Variable),
+ (r'([+\-]=|[$!|?+\-*/%^=><();]|>=|<=|<>|<<|>>|>>>|,)', Operator),
+ ],
+ 'string': [
+ (r'[^"\n]+', String.Double),
+ (r'"', String.Double, '#pop'),
+ (r'\n', Error, 'root'), # Unterminated string
+ ],
+ }
+
+ def analyse_text(text):
+ if text.startswith('10REM >') or text.startswith('REM >'):
+ return 0.9
diff --git a/pygments/lexers/boa.py b/pygments/lexers/boa.py
new file mode 100644
index 00000000..dda31eb4
--- /dev/null
+++ b/pygments/lexers/boa.py
@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.boa
+ ~~~~~~~~~~~~~~~~~~~~
+
+ Lexers for the Boa language.
+
+ :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+import re
+
+from pygments.lexer import RegexLexer, words
+from pygments.token import *
+
+__all__ = ['BoaLexer']
+
+line_re = re.compile('.*?\n')
+
+
+class BoaLexer(RegexLexer):
+ """
+ Lexer for the `Boa <http://boa.cs.iastate.edu/docs/>`_ language.
+
+ .. versionadded:: 2.4
+ """
+ name = 'Boa'
+ aliases = ['boa']
+ filenames = ['*.boa']
+
+ reserved = words(
+ ('input', 'output', 'of', 'weight', 'before', 'after', 'stop', 'ifall', 'foreach', 'exists', 'function',
+ 'break', 'switch', 'case', 'visitor', 'default', 'return', 'visit', 'while', 'if', 'else'),
+ suffix=r'\b', prefix=r'\b')
+ keywords = words(
+ ('bottom', 'collection', 'maximum', 'mean', 'minimum', 'set', 'sum', 'top', 'string', 'int', 'bool', 'float',
+ 'time', 'false', 'true', 'array', 'map', 'stack', 'enum', 'type'), suffix=r'\b', prefix=r'\b')
+ classes = words(
+ ('Project', 'ForgeKind', 'CodeRepository', 'Revision', 'RepositoryKind', 'ChangedFile', 'FileKind', 'ASTRoot',
+ 'Namespace', 'Declaration', 'Type', 'Method', 'Variable', 'Statement', 'Expression', 'Modifier',
+ 'StatementKind', 'ExpressionKind', 'ModifierKind', 'Visibility', 'TypeKind', 'Person', 'ChangeKind'),
+ suffix=r'\b', prefix=r'\b')
+ operators = ('->', ':=', ':', '=', '<<', '!', '++', '||', '&&', '+', '-', '*', ">", "<")
+ string_sep = ('`', '\"')
+ built_in_functions = words(
+ (
+ # Array functions
+ 'new', 'sort',
+ # Date & Time functions
+ 'yearof', 'dayofyear', 'hourof', 'minuteof', 'secondof', 'now', 'addday', 'addmonth', 'addweek', 'addyear',
+ 'dayofmonth', 'dayofweek', 'dayofyear', 'formattime', 'trunctoday', 'trunctohour', 'trunctominute',
+ 'trunctomonth', 'trunctosecond', 'trunctoyear',
+ # Map functions
+ 'clear', 'haskey', 'keys', 'lookup', 'remove', 'values',
+ # Math functions
+ 'abs', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'cos', 'cosh', 'exp', 'floor',
+ 'highbit', 'isfinite', 'isinf', 'isnan', 'isnormal', 'log', 'log10', 'max', 'min', 'nrand', 'pow', 'rand',
+ 'round', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc',
+ # Other functions
+ 'def', 'hash', 'len',
+ # Set functions
+ 'add', 'contains', 'remove',
+ # String functions
+ 'format', 'lowercase', 'match', 'matchposns', 'matchstrs', 'regex', 'split', 'splitall', 'splitn',
+ 'strfind', 'strreplace', 'strrfind', 'substring', 'trim', 'uppercase',
+ # Type Conversion functions
+ 'bool', 'float', 'int', 'string', 'time',
+ # Domain-Specific functions
+ 'getast', 'getsnapshot', 'hasfiletype', 'isfixingrevision', 'iskind', 'isliteral',
+ ),
+ prefix=r'\b',
+ suffix=r'\(')
+
+ tokens = {
+ 'root': [
+ (r'#.*?$', Comment.Single),
+ (r'/\*.*?\*/', Comment.Multiline),
+ (reserved, Keyword.Reserved),
+ (built_in_functions, Name.Function),
+ (keywords, Keyword.Type),
+ (classes, Name.Classes),
+ (words(operators), Operator),
+ (r'[][(),;{}\\.]', Punctuation),
+ (r'"(\\\\|\\"|[^"])*"', String),
+ (r'`(\\\\|\\`|[^`])*`', String),
+ (words(string_sep), String.Delimeter),
+ (r'[a-zA-Z_]+', Name.Variable),
+ (r'[0-9]+', Number.Integer),
+ (r'\s+?', Text), # Whitespace
+ ]
+ }
diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py
index 206ec360..1984bf36 100644
--- a/pygments/lexers/configs.py
+++ b/pygments/lexers/configs.py
@@ -21,7 +21,7 @@ __all__ = ['IniLexer', 'RegeditLexer', 'PropertiesLexer', 'KconfigLexer',
'Cfengine3Lexer', 'ApacheConfLexer', 'SquidConfLexer',
'NginxConfLexer', 'LighttpdConfLexer', 'DockerLexer',
'TerraformLexer', 'TermcapLexer', 'TerminfoLexer',
- 'PkgConfigLexer', 'PacmanConfLexer']
+ 'PkgConfigLexer', 'PacmanConfLexer', 'AugeasLexer', 'TOMLLexer']
class IniLexer(RegexLexer):
@@ -301,7 +301,7 @@ class ApacheConfLexer(RegexLexer):
'root': [
(r'\s+', Text),
(r'(#.*?)$', Comment),
- (r'(<[^\s>]+)(?:(\s+)(.*?))?(>)',
+ (r'(<[^\s>]+)(?:(\s+)(.*))?(>)',
bygroups(Name.Tag, Text, String, Name.Tag)),
(r'([a-z]\w*)(\s+)',
bygroups(Name.Builtin, Text), 'value'),
@@ -838,3 +838,97 @@ class PacmanConfLexer(RegexLexer):
(r'.', Text),
],
}
+
+
+class AugeasLexer(RegexLexer):
+ """
+ Lexer for `Augeas <http://augeas.net>`_.
+
+ .. versionadded:: 2.4
+ """
+ name = 'Augeas'
+ aliases = ['augeas']
+ filenames = ['*.aug']
+
+ tokens = {
+ 'root': [
+ (r'(module)(\s*)([^\s=]+)', bygroups(Keyword.Namespace, Text, Name.Namespace)),
+ (r'(let)(\s*)([^\s=]+)', bygroups(Keyword.Declaration, Text, Name.Variable)),
+ (r'(del|store|value|counter|seq|key|label|autoload|incl|excl|transform|test|get|put)(\s+)', bygroups(Name.Builtin, Text)),
+ (r'(\()([^:]+)(\:)(unit|string|regexp|lens|tree|filter)(\))', bygroups(Punctuation, Name.Variable, Punctuation, Keyword.Type, Punctuation)),
+ (r'\(\*', Comment.Multiline, 'comment'),
+ (r'[*+\-.;=?|]', Operator),
+ (r'[()\[\]{}]', Operator),
+ (r'"', String.Double, 'string'),
+ (r'\/', String.Regex, 'regex'),
+ (r'([A-Z]\w*)(\.)(\w+)', bygroups(Name.Namespace, Punctuation, Name.Variable)),
+ (r'.', Name.Variable),
+ (r'\s', Text),
+ ],
+ 'string': [
+ (r'\\.', String.Escape),
+ (r'[^"]', String.Double),
+ (r'"', String.Double, '#pop'),
+ ],
+ 'regex': [
+ (r'\\.', String.Escape),
+ (r'[^/]', String.Regex),
+ (r'\/', String.Regex, '#pop'),
+ ],
+ 'comment': [
+ (r'[^*)]', Comment.Multiline),
+ (r'\(\*', Comment.Multiline, '#push'),
+ (r'\*\)', Comment.Multiline, '#pop'),
+ (r'[)*]', Comment.Multiline)
+ ],
+ }
+
+
+class TOMLLexer(RegexLexer):
+ """
+ Lexer for `TOML <https://github.com/toml-lang/toml>`_, a simple language
+ for config files.
+
+ .. versionadded:: 2.4
+ """
+
+ name = 'TOML'
+ aliases = ['toml']
+ filenames = ['*.toml']
+
+ tokens = {
+ 'root': [
+
+ # Basics, comments, strings
+ (r'\s+', Text),
+ (r'#.*?$', Comment.Single),
+ # Basic string
+ (r'"(\\\\|\\"|[^"])*"', String),
+ # Literal string
+ (r'\'\'\'(.*)\'\'\'', String),
+ (r'\'[^\']*\'', String),
+ (r'(true|false)$', Keyword.Constant),
+ (r'[a-zA-Z_][\w\-]*', Name),
+
+ (r'\[.*?\]$', Keyword),
+ # Datetime
+ # TODO this needs to be expanded, as TOML is rather flexible:
+ # https://github.com/toml-lang/toml#offset-date-time
+ (r'\d{4}-\d{2}-\d{2}(?:T| )\d{2}:\d{2}:\d{2}(?:Z|[-+]\d{2}:\d{2})', Number.Integer),
+
+ # Numbers
+ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
+ (r'\d+[eE][+-]?[0-9]+j?', Number.Float),
+ # Handle +-inf, +-infinity, +-nan
+ (r'[+-]?(?:(inf(?:inity)?)|nan)', Number.Float),
+ (r'[+-]?\d+', Number.Integer),
+
+ # Punctuation
+ (r'[]{}:(),;[]', Punctuation),
+ (r'\.', Punctuation),
+
+ # Operators
+ (r'=', Operator)
+
+ ]
+ }
diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py
index 27ae77c5..1d3b1f38 100644
--- a/pygments/lexers/dotnet.py
+++ b/pygments/lexers/dotnet.py
@@ -541,16 +541,13 @@ class VbNetAspxLexer(DelegatingLexer):
# Very close to functional.OcamlLexer
class FSharpLexer(RegexLexer):
"""
- For the F# language (version 3.0).
-
- AAAAACK Strings
- http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/spec.html#_Toc335818775
+ For the `F# language <https://fsharp.org/>`_ (version 3.0).
.. versionadded:: 1.5
"""
- name = 'FSharp'
- aliases = ['fsharp']
+ name = 'F#'
+ aliases = ['fsharp', 'f#']
filenames = ['*.fs', '*.fsi']
mimetypes = ['text/x-fsharp']
diff --git a/pygments/lexers/freefem.py b/pygments/lexers/freefem.py
new file mode 100644
index 00000000..fd534915
--- /dev/null
+++ b/pygments/lexers/freefem.py
@@ -0,0 +1,967 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.freefem
+ ~~~~~~~~~~~~~~~~~~~~~~
+
+ Lexer for FreeFem++ language.
+
+ :copyright: see README.md.
+ :license: GPLv3, see LICENSE for details.
+"""
+
+import re
+
+from pygments.lexer import RegexLexer, include, bygroups, inherit, words, \
+ default
+from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
+ Number, Punctuation
+
+from pygments.lexers.c_cpp import CLexer, CppLexer
+from pygments.lexers import _mql_builtins
+
+__all__ = ['FreeFemLexer']
+
+
+class FreeFemLexer(CppLexer):
+ """
+ For `FreeFem++ <https://freefem.org/>`_ source.
+
+ This is an extension of the CppLexer, as the FreeFem Language is a superset
+ of C++
+ """
+
+ name = 'Freefem'
+ aliases = ['freefem']
+ filenames = ['*.edp']
+ mimetypes = ['text/x-freefem']
+
+ # Language operators
+ operators = set(('+', '-', '*', '.*', '/', './', '%', '^', '^-1', ':', '\''))
+
+ # types
+ types = set((
+ 'bool',
+ 'border',
+ 'complex',
+ 'dmatrix',
+ 'fespace',
+ 'func',
+ 'gslspline',
+ 'ifstream',
+ 'int',
+ 'macro',
+ 'matrix',
+ 'mesh',
+ 'mesh3',
+ 'mpiComm',
+ 'mpiGroup',
+ 'mpiRequest',
+ 'NewMacro',
+ 'EndMacro',
+ 'ofstream',
+ 'Pmmap',
+ 'problem',
+ 'Psemaphore',
+ 'real',
+ 'solve',
+ 'string',
+ 'varf'
+ ))
+
+ # finite element spaces
+ fespaces = set((
+ 'BDM1',
+ 'BDM1Ortho',
+ 'Edge03d',
+ 'Edge13d',
+ 'Edge23d',
+ 'FEQF',
+ 'HCT',
+ 'P0',
+ 'P03d',
+ 'P0Edge',
+ 'P1',
+ 'P13d',
+ 'P1b',
+ 'P1b3d',
+ 'P1bl',
+ 'P1bl3d',
+ 'P1dc',
+ 'P1Edge',
+ 'P1nc',
+ 'P2',
+ 'P23d',
+ 'P2b',
+ 'P2BR',
+ 'P2dc',
+ 'P2Edge',
+ 'P2h',
+ 'P2Morley',
+ 'P2pnc',
+ 'P3',
+ 'P3dc',
+ 'P3Edge',
+ 'P4',
+ 'P4dc',
+ 'P4Edge',
+ 'P5Edge',
+ 'RT0',
+ 'RT03d',
+ 'RT0Ortho',
+ 'RT1',
+ 'RT1Ortho',
+ 'RT2',
+ 'RT2Ortho'
+ ))
+
+ # preprocessor
+ preprocessor = set((
+ 'ENDIFMACRO',
+ 'include',
+ 'IFMACRO',
+ 'load'
+ ))
+
+ # Language keywords
+ keywords = set((
+ 'adj',
+ 'append',
+ 'area',
+ 'ARGV',
+ 'be',
+ 'binary',
+ 'BoundaryEdge',
+ 'bordermeasure',
+ 'CG',
+ 'Cholesky',
+ 'cin',
+ 'cout',
+ 'Crout',
+ 'default',
+ 'diag',
+ 'edgeOrientation',
+ 'endl',
+ 'false',
+ 'ffind',
+ 'FILE',
+ 'find',
+ 'fixed',
+ 'flush',
+ 'GMRES',
+ 'good',
+ 'hTriangle',
+ 'im',
+ 'imax',
+ 'imin',
+ 'InternalEdge',
+ 'l1',
+ 'l2',
+ 'label',
+ 'lenEdge',
+ 'length',
+ 'LINE',
+ 'linfty',
+ 'LU',
+ 'm',
+ 'max',
+ 'measure',
+ 'min',
+ 'mpiAnySource',
+ 'mpiBAND',
+ 'mpiBXOR',
+ 'mpiCommWorld',
+ 'mpiLAND',
+ 'mpiLOR',
+ 'mpiLXOR',
+ 'mpiMAX',
+ 'mpiMIN',
+ 'mpiPROD',
+ 'mpirank',
+ 'mpisize',
+ 'mpiSUM',
+ 'mpiUndefined',
+ 'n',
+ 'N',
+ 'nbe',
+ 'ndof',
+ 'ndofK',
+ 'noshowbase',
+ 'noshowpos',
+ 'notaregion',
+ 'nt',
+ 'nTonEdge',
+ 'nuEdge',
+ 'nuTriangle',
+ 'nv',
+ 'P',
+ 'pi',
+ 'precision',
+ 'qf1pE',
+ 'qf1pElump',
+ 'qf1pT',
+ 'qf1pTlump',
+ 'qfV1',
+ 'qfV1lump',
+ 'qf2pE',
+ 'qf2pT',
+ 'qf2pT4P1',
+ 'qfV2',
+ 'qf3pE',
+ 'qf4pE',
+ 'qf5pE',
+ 'qf5pT',
+ 'qfV5',
+ 'qf7pT',
+ 'qf9pT',
+ 'qfnbpE',
+ 'quantile',
+ 're',
+ 'region',
+ 'rfind',
+ 'scientific',
+ 'searchMethod',
+ 'setw',
+ 'showbase',
+ 'showpos',
+ 'sparsesolver',
+ 'sum',
+ 'tellp',
+ 'true',
+ 'UMFPACK',
+ 'unused',
+ 'whoinElement',
+ 'verbosity',
+ 'version',
+ 'volume',
+ 'x',
+ 'y',
+ 'z'
+ ))
+
+ # Language shipped functions and class ( )
+ functions = set((
+ 'abs',
+ 'acos',
+ 'acosh',
+ 'adaptmesh',
+ 'adj',
+ 'AffineCG',
+ 'AffineGMRES',
+ 'arg',
+ 'asin',
+ 'asinh',
+ 'assert',
+ 'atan',
+ 'atan2',
+ 'atanh',
+ 'atof',
+ 'atoi',
+ 'BFGS',
+ 'broadcast',
+ 'buildlayers',
+ 'buildmesh',
+ 'ceil',
+ 'chi',
+ 'complexEigenValue',
+ 'copysign',
+ 'change',
+ 'checkmovemesh',
+ 'clock',
+ 'cmaes',
+ 'conj',
+ 'convect',
+ 'cos',
+ 'cosh',
+ 'cube',
+ 'd',
+ 'dd',
+ 'dfft',
+ 'diffnp',
+ 'diffpos',
+ 'dimKrylov',
+ 'dist',
+ 'dumptable',
+ 'dx',
+ 'dxx',
+ 'dxy',
+ 'dxz',
+ 'dy',
+ 'dyx',
+ 'dyy',
+ 'dyz',
+ 'dz',
+ 'dzx',
+ 'dzy',
+ 'dzz',
+ 'EigenValue',
+ 'emptymesh',
+ 'erf',
+ 'erfc',
+ 'exec',
+ 'exit',
+ 'exp',
+ 'fdim',
+ 'floor',
+ 'fmax',
+ 'fmin',
+ 'fmod',
+ 'freeyams',
+ 'getARGV',
+ 'getline',
+ 'gmshload',
+ 'gmshload3',
+ 'gslcdfugaussianP',
+ 'gslcdfugaussianQ',
+ 'gslcdfugaussianPinv',
+ 'gslcdfugaussianQinv',
+ 'gslcdfgaussianP',
+ 'gslcdfgaussianQ',
+ 'gslcdfgaussianPinv',
+ 'gslcdfgaussianQinv',
+ 'gslcdfgammaP',
+ 'gslcdfgammaQ',
+ 'gslcdfgammaPinv',
+ 'gslcdfgammaQinv',
+ 'gslcdfcauchyP',
+ 'gslcdfcauchyQ',
+ 'gslcdfcauchyPinv',
+ 'gslcdfcauchyQinv',
+ 'gslcdflaplaceP',
+ 'gslcdflaplaceQ',
+ 'gslcdflaplacePinv',
+ 'gslcdflaplaceQinv',
+ 'gslcdfrayleighP',
+ 'gslcdfrayleighQ',
+ 'gslcdfrayleighPinv',
+ 'gslcdfrayleighQinv',
+ 'gslcdfchisqP',
+ 'gslcdfchisqQ',
+ 'gslcdfchisqPinv',
+ 'gslcdfchisqQinv',
+ 'gslcdfexponentialP',
+ 'gslcdfexponentialQ',
+ 'gslcdfexponentialPinv',
+ 'gslcdfexponentialQinv',
+ 'gslcdfexppowP',
+ 'gslcdfexppowQ',
+ 'gslcdftdistP',
+ 'gslcdftdistQ',
+ 'gslcdftdistPinv',
+ 'gslcdftdistQinv',
+ 'gslcdffdistP',
+ 'gslcdffdistQ',
+ 'gslcdffdistPinv',
+ 'gslcdffdistQinv',
+ 'gslcdfbetaP',
+ 'gslcdfbetaQ',
+ 'gslcdfbetaPinv',
+ 'gslcdfbetaQinv',
+ 'gslcdfflatP',
+ 'gslcdfflatQ',
+ 'gslcdfflatPinv',
+ 'gslcdfflatQinv',
+ 'gslcdflognormalP',
+ 'gslcdflognormalQ',
+ 'gslcdflognormalPinv',
+ 'gslcdflognormalQinv',
+ 'gslcdfgumbel1P',
+ 'gslcdfgumbel1Q',
+ 'gslcdfgumbel1Pinv',
+ 'gslcdfgumbel1Qinv',
+ 'gslcdfgumbel2P',
+ 'gslcdfgumbel2Q',
+ 'gslcdfgumbel2Pinv',
+ 'gslcdfgumbel2Qinv',
+ 'gslcdfweibullP',
+ 'gslcdfweibullQ',
+ 'gslcdfweibullPinv',
+ 'gslcdfweibullQinv',
+ 'gslcdfparetoP',
+ 'gslcdfparetoQ',
+ 'gslcdfparetoPinv',
+ 'gslcdfparetoQinv',
+ 'gslcdflogisticP',
+ 'gslcdflogisticQ',
+ 'gslcdflogisticPinv',
+ 'gslcdflogisticQinv',
+ 'gslcdfbinomialP',
+ 'gslcdfbinomialQ',
+ 'gslcdfpoissonP',
+ 'gslcdfpoissonQ',
+ 'gslcdfgeometricP',
+ 'gslcdfgeometricQ',
+ 'gslcdfnegativebinomialP',
+ 'gslcdfnegativebinomialQ',
+ 'gslcdfpascalP',
+ 'gslcdfpascalQ',
+ 'gslinterpakima',
+ 'gslinterpakimaperiodic',
+ 'gslinterpcsplineperiodic',
+ 'gslinterpcspline',
+ 'gslinterpsteffen',
+ 'gslinterplinear',
+ 'gslinterppolynomial',
+ 'gslranbernoullipdf',
+ 'gslranbeta',
+ 'gslranbetapdf',
+ 'gslranbinomialpdf',
+ 'gslranexponential',
+ 'gslranexponentialpdf',
+ 'gslranexppow',
+ 'gslranexppowpdf',
+ 'gslrancauchy',
+ 'gslrancauchypdf',
+ 'gslranchisq',
+ 'gslranchisqpdf',
+ 'gslranerlang',
+ 'gslranerlangpdf',
+ 'gslranfdist',
+ 'gslranfdistpdf',
+ 'gslranflat',
+ 'gslranflatpdf',
+ 'gslrangamma',
+ 'gslrangammaint',
+ 'gslrangammapdf',
+ 'gslrangammamt',
+ 'gslrangammaknuth',
+ 'gslrangaussian',
+ 'gslrangaussianratiomethod',
+ 'gslrangaussianziggurat',
+ 'gslrangaussianpdf',
+ 'gslranugaussian',
+ 'gslranugaussianratiomethod',
+ 'gslranugaussianpdf',
+ 'gslrangaussiantail',
+ 'gslrangaussiantailpdf',
+ 'gslranugaussiantail',
+ 'gslranugaussiantailpdf',
+ 'gslranlandau',
+ 'gslranlandaupdf',
+ 'gslrangeometricpdf',
+ 'gslrangumbel1',
+ 'gslrangumbel1pdf',
+ 'gslrangumbel2',
+ 'gslrangumbel2pdf',
+ 'gslranlogistic',
+ 'gslranlogisticpdf',
+ 'gslranlognormal',
+ 'gslranlognormalpdf',
+ 'gslranlogarithmicpdf',
+ 'gslrannegativebinomialpdf',
+ 'gslranpascalpdf',
+ 'gslranpareto',
+ 'gslranparetopdf',
+ 'gslranpoissonpdf',
+ 'gslranrayleigh',
+ 'gslranrayleighpdf',
+ 'gslranrayleightail',
+ 'gslranrayleightailpdf',
+ 'gslrantdist',
+ 'gslrantdistpdf',
+ 'gslranlaplace',
+ 'gslranlaplacepdf',
+ 'gslranlevy',
+ 'gslranweibull',
+ 'gslranweibullpdf',
+ 'gslsfairyAi',
+ 'gslsfairyBi',
+ 'gslsfairyAiscaled',
+ 'gslsfairyBiscaled',
+ 'gslsfairyAideriv',
+ 'gslsfairyBideriv',
+ 'gslsfairyAiderivscaled',
+ 'gslsfairyBiderivscaled',
+ 'gslsfairyzeroAi',
+ 'gslsfairyzeroBi',
+ 'gslsfairyzeroAideriv',
+ 'gslsfairyzeroBideriv',
+ 'gslsfbesselJ0',
+ 'gslsfbesselJ1',
+ 'gslsfbesselJn',
+ 'gslsfbesselY0',
+ 'gslsfbesselY1',
+ 'gslsfbesselYn',
+ 'gslsfbesselI0',
+ 'gslsfbesselI1',
+ 'gslsfbesselIn',
+ 'gslsfbesselI0scaled',
+ 'gslsfbesselI1scaled',
+ 'gslsfbesselInscaled',
+ 'gslsfbesselK0',
+ 'gslsfbesselK1',
+ 'gslsfbesselKn',
+ 'gslsfbesselK0scaled',
+ 'gslsfbesselK1scaled',
+ 'gslsfbesselKnscaled',
+ 'gslsfbesselj0',
+ 'gslsfbesselj1',
+ 'gslsfbesselj2',
+ 'gslsfbesseljl',
+ 'gslsfbessely0',
+ 'gslsfbessely1',
+ 'gslsfbessely2',
+ 'gslsfbesselyl',
+ 'gslsfbesseli0scaled',
+ 'gslsfbesseli1scaled',
+ 'gslsfbesseli2scaled',
+ 'gslsfbesselilscaled',
+ 'gslsfbesselk0scaled',
+ 'gslsfbesselk1scaled',
+ 'gslsfbesselk2scaled',
+ 'gslsfbesselklscaled',
+ 'gslsfbesselJnu',
+ 'gslsfbesselYnu',
+ 'gslsfbesselInuscaled',
+ 'gslsfbesselInu',
+ 'gslsfbesselKnuscaled',
+ 'gslsfbesselKnu',
+ 'gslsfbessellnKnu',
+ 'gslsfbesselzeroJ0',
+ 'gslsfbesselzeroJ1',
+ 'gslsfbesselzeroJnu',
+ 'gslsfclausen',
+ 'gslsfhydrogenicR1',
+ 'gslsfdawson',
+ 'gslsfdebye1',
+ 'gslsfdebye2',
+ 'gslsfdebye3',
+ 'gslsfdebye4',
+ 'gslsfdebye5',
+ 'gslsfdebye6',
+ 'gslsfdilog',
+ 'gslsfmultiply',
+ 'gslsfellintKcomp',
+ 'gslsfellintEcomp',
+ 'gslsfellintPcomp',
+ 'gslsfellintDcomp',
+ 'gslsfellintF',
+ 'gslsfellintE',
+ 'gslsfellintRC',
+ 'gslsferfc',
+ 'gslsflogerfc',
+ 'gslsferf',
+ 'gslsferfZ',
+ 'gslsferfQ',
+ 'gslsfhazard',
+ 'gslsfexp',
+ 'gslsfexpmult',
+ 'gslsfexpm1',
+ 'gslsfexprel',
+ 'gslsfexprel2',
+ 'gslsfexpreln',
+ 'gslsfexpintE1',
+ 'gslsfexpintE2',
+ 'gslsfexpintEn',
+ 'gslsfexpintE1scaled',
+ 'gslsfexpintE2scaled',
+ 'gslsfexpintEnscaled',
+ 'gslsfexpintEi',
+ 'gslsfexpintEiscaled',
+ 'gslsfShi',
+ 'gslsfChi',
+ 'gslsfexpint3',
+ 'gslsfSi',
+ 'gslsfCi',
+ 'gslsfatanint',
+ 'gslsffermidiracm1',
+ 'gslsffermidirac0',
+ 'gslsffermidirac1',
+ 'gslsffermidirac2',
+ 'gslsffermidiracint',
+ 'gslsffermidiracmhalf',
+ 'gslsffermidirachalf',
+ 'gslsffermidirac3half',
+ 'gslsffermidiracinc0',
+ 'gslsflngamma',
+ 'gslsfgamma',
+ 'gslsfgammastar',
+ 'gslsfgammainv',
+ 'gslsftaylorcoeff',
+ 'gslsffact',
+ 'gslsfdoublefact',
+ 'gslsflnfact',
+ 'gslsflndoublefact',
+ 'gslsflnchoose',
+ 'gslsfchoose',
+ 'gslsflnpoch',
+ 'gslsfpoch',
+ 'gslsfpochrel',
+ 'gslsfgammaincQ',
+ 'gslsfgammaincP',
+ 'gslsfgammainc',
+ 'gslsflnbeta',
+ 'gslsfbeta',
+ 'gslsfbetainc',
+ 'gslsfgegenpoly1',
+ 'gslsfgegenpoly2',
+ 'gslsfgegenpoly3',
+ 'gslsfgegenpolyn',
+ 'gslsfhyperg0F1',
+ 'gslsfhyperg1F1int',
+ 'gslsfhyperg1F1',
+ 'gslsfhypergUint',
+ 'gslsfhypergU',
+ 'gslsfhyperg2F0',
+ 'gslsflaguerre1',
+ 'gslsflaguerre2',
+ 'gslsflaguerre3',
+ 'gslsflaguerren',
+ 'gslsflambertW0',
+ 'gslsflambertWm1',
+ 'gslsflegendrePl',
+ 'gslsflegendreP1',
+ 'gslsflegendreP2',
+ 'gslsflegendreP3',
+ 'gslsflegendreQ0',
+ 'gslsflegendreQ1',
+ 'gslsflegendreQl',
+ 'gslsflegendrePlm',
+ 'gslsflegendresphPlm',
+ 'gslsflegendrearraysize',
+ 'gslsfconicalPhalf',
+ 'gslsfconicalPmhalf',
+ 'gslsfconicalP0',
+ 'gslsfconicalP1',
+ 'gslsfconicalPsphreg',
+ 'gslsfconicalPcylreg',
+ 'gslsflegendreH3d0',
+ 'gslsflegendreH3d1',
+ 'gslsflegendreH3d',
+ 'gslsflog',
+ 'gslsflogabs',
+ 'gslsflog1plusx',
+ 'gslsflog1plusxmx',
+ 'gslsfpowint',
+ 'gslsfpsiint',
+ 'gslsfpsi',
+ 'gslsfpsi1piy',
+ 'gslsfpsi1int',
+ 'gslsfpsi1',
+ 'gslsfpsin',
+ 'gslsfsynchrotron1',
+ 'gslsfsynchrotron2',
+ 'gslsftransport2',
+ 'gslsftransport3',
+ 'gslsftransport4',
+ 'gslsftransport5',
+ 'gslsfsin',
+ 'gslsfcos',
+ 'gslsfhypot',
+ 'gslsfsinc',
+ 'gslsflnsinh',
+ 'gslsflncosh',
+ 'gslsfanglerestrictsymm',
+ 'gslsfanglerestrictpos',
+ 'gslsfzetaint',
+ 'gslsfzeta',
+ 'gslsfzetam1',
+ 'gslsfzetam1int',
+ 'gslsfhzeta',
+ 'gslsfetaint',
+ 'gslsfeta',
+ 'imag',
+ 'int1d',
+ 'int2d',
+ 'int3d',
+ 'intalledges',
+ 'intallfaces',
+ 'interpolate',
+ 'invdiff',
+ 'invdiffnp',
+ 'invdiffpos',
+ 'Isend',
+ 'isInf',
+ 'isNaN',
+ 'isoline',
+ 'Irecv',
+ 'j0',
+ 'j1',
+ 'jn',
+ 'jump',
+ 'lgamma',
+ 'LinearCG',
+ 'LinearGMRES',
+ 'log',
+ 'log10',
+ 'lrint',
+ 'lround',
+ 'max',
+ 'mean',
+ 'medit',
+ 'min',
+ 'mmg3d',
+ 'movemesh',
+ 'movemesh23',
+ 'mpiAlltoall',
+ 'mpiAlltoallv',
+ 'mpiAllgather',
+ 'mpiAllgatherv',
+ 'mpiAllReduce',
+ 'mpiBarrier',
+ 'mpiGather',
+ 'mpiGatherv',
+ 'mpiRank',
+ 'mpiReduce',
+ 'mpiScatter',
+ 'mpiScatterv',
+ 'mpiSize',
+ 'mpiWait',
+ 'mpiWaitAny',
+ 'mpiWtick',
+ 'mpiWtime',
+ 'mshmet',
+ 'NaN',
+ 'NLCG',
+ 'on',
+ 'plot',
+ 'polar',
+ 'Post',
+ 'pow',
+ 'processor',
+ 'processorblock',
+ 'projection',
+ 'randinit',
+ 'randint31',
+ 'randint32',
+ 'random',
+ 'randreal1',
+ 'randreal2',
+ 'randreal3',
+ 'randres53',
+ 'Read',
+ 'readmesh',
+ 'readmesh3',
+ 'Recv',
+ 'rint',
+ 'round',
+ 'savemesh',
+ 'savesol',
+ 'savevtk',
+ 'seekg',
+ 'Sent',
+ 'set',
+ 'sign',
+ 'signbit',
+ 'sin',
+ 'sinh',
+ 'sort',
+ 'splitComm',
+ 'splitmesh',
+ 'sqrt',
+ 'square',
+ 'srandom',
+ 'srandomdev',
+ 'Stringification',
+ 'swap',
+ 'system',
+ 'tan',
+ 'tanh',
+ 'tellg',
+ 'tetg',
+ 'tetgconvexhull',
+ 'tetgreconstruction',
+ 'tetgtransfo',
+ 'tgamma',
+ 'triangulate',
+ 'trunc',
+ 'Wait',
+ 'Write',
+ 'y0',
+ 'y1',
+ 'yn'
+ ))
+
+ # function parameters
+ parameters = set((
+ 'A',
+ 'A1',
+ 'abserror',
+ 'absolute',
+ 'aniso',
+ 'aspectratio',
+ 'B',
+ 'B1',
+ 'bb',
+ 'beginend',
+ 'bin',
+ 'boundary',
+ 'bw',
+ 'close',
+ 'cmm',
+ 'coef',
+ 'composante',
+ 'cutoff',
+ 'datafilename',
+ 'dataname',
+ 'dim',
+ 'distmax',
+ 'displacement',
+ 'doptions',
+ 'dparams',
+ 'eps',
+ 'err',
+ 'errg',
+ 'facemerge',
+ 'facetcl',
+ 'factorize',
+ 'file',
+ 'fill',
+ 'fixedborder',
+ 'flabel',
+ 'flags',
+ 'floatmesh',
+ 'floatsol',
+ 'fregion',
+ 'gradation',
+ 'grey',
+ 'hmax',
+ 'hmin',
+ 'holelist',
+ 'hsv',
+ 'init',
+ 'inquire',
+ 'inside',
+ 'IsMetric',
+ 'iso',
+ 'ivalue',
+ 'keepbackvertices',
+ 'label',
+ 'labeldown',
+ 'labelmid',
+ 'labelup',
+ 'levelset',
+ 'loptions',
+ 'lparams',
+ 'maxit',
+ 'maxsubdiv',
+ 'meditff',
+ 'mem',
+ 'memory',
+ 'metric',
+ 'mode',
+ 'nbarrow',
+ 'nbiso',
+ 'nbiter',
+ 'nbjacoby',
+ 'nboffacetcl',
+ 'nbofholes',
+ 'nbofregions',
+ 'nbregul',
+ 'nbsmooth',
+ 'nbvx',
+ 'ncv',
+ 'nev',
+ 'nomeshgeneration',
+ 'normalization',
+ 'omega',
+ 'op',
+ 'optimize',
+ 'option',
+ 'options',
+ 'order',
+ 'orientation',
+ 'periodic',
+ 'power',
+ 'precon',
+ 'prev',
+ 'ps',
+ 'ptmerge',
+ 'qfe',
+ 'qforder',
+ 'qft',
+ 'qfV',
+ 'ratio',
+ 'rawvector',
+ 'reffacelow',
+ 'reffacemid',
+ 'reffaceup',
+ 'refnum',
+ 'reftet',
+ 'reftri',
+ 'region',
+ 'regionlist',
+ 'renumv',
+ 'rescaling',
+ 'ridgeangle',
+ 'save',
+ 'sigma',
+ 'sizeofvolume',
+ 'smoothing',
+ 'solver',
+ 'sparams',
+ 'split',
+ 'splitin2',
+ 'splitpbedge',
+ 'stop',
+ 'strategy',
+ 'swap',
+ 'switch',
+ 'sym',
+ 't',
+ 'tgv',
+ 'thetamax',
+ 'tol',
+ 'tolpivot',
+ 'tolpivotsym',
+ 'transfo',
+ 'U2Vc',
+ 'value',
+ 'varrow',
+ 'vector',
+ 'veps',
+ 'viso',
+ 'wait',
+ 'width',
+ 'withsurfacemesh',
+ 'WindowIndex',
+ 'which',
+ 'zbound'
+ ))
+
+ # deprecated
+ deprecated = set((
+ 'fixeborder'
+ ))
+
+ # do not highlight
+ suppress_highlight = set((
+ 'alignof',
+ 'asm',
+ 'constexpr',
+ 'decltype',
+ 'div',
+ 'double',
+ 'grad',
+ 'mutable',
+ 'namespace',
+ 'noexcept',
+ 'restrict',
+ 'static_assert',
+ 'template',
+ 'this',
+ 'thread_local',
+ 'typeid',
+ 'typename',
+ 'using'
+ ))
+
+ def get_tokens_unprocessed(self, text):
+ for index, token, value in CppLexer.get_tokens_unprocessed(self, text):
+ if value in self.operators:
+ yield index, Operator, value
+ elif value in self.types:
+ yield index, Keyword.Type, value
+ elif value in self.fespaces:
+ yield index, Name.Class, value
+ elif value in self.preprocessor:
+ yield index, Comment.Preproc, value
+ elif value in self.keywords:
+ yield index, Keyword.Reserved, value
+ elif value in self.functions:
+ yield index, Name.Function, value
+ elif value in self.parameters:
+ yield index, Keyword.Pseudo, value
+ elif value in self.suppress_highlight:
+ yield index, Name, value
+ else:
+ yield index, token, value
diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py
index 0507375f..57e1161e 100644
--- a/pygments/lexers/javascript.py
+++ b/pygments/lexers/javascript.py
@@ -482,7 +482,7 @@ class TypeScriptLexer(RegexLexer):
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
(r'[})\].]', Punctuation),
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
- r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
+ r'throw|try|catch|finally|new|delete|typeof|instanceof|void|of|'
r'this)\b', Keyword, 'slashstartsregex'),
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
diff --git a/pygments/lexers/make.py b/pygments/lexers/make.py
index b222b672..c1e2f3a9 100644
--- a/pygments/lexers/make.py
+++ b/pygments/lexers/make.py
@@ -102,8 +102,8 @@ class BaseMakefileLexer(RegexLexer):
(r'\$\(', Keyword, 'expansion'),
],
'expansion': [
- (r'[^$a-zA-Z_()]+', Text),
- (r'[a-zA-Z_]+', Name.Variable),
+ (r'[^\w$().-]+', Text),
+ (r'[\w.-]+', Name.Variable),
(r'\$', Keyword),
(r'\(', Keyword, '#push'),
(r'\)', Keyword, '#pop'),
diff --git a/pygments/lexers/pony.py b/pygments/lexers/pony.py
new file mode 100644
index 00000000..13239047
--- /dev/null
+++ b/pygments/lexers/pony.py
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.pony
+ ~~~~~~~~~~~~~~~~~~~~
+
+ Lexers for Pony and related languages.
+
+ :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.lexer import RegexLexer, bygroups, words
+from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
+ Number, Punctuation
+
+__all__ = ['PonyLexer']
+
+
+class PonyLexer(RegexLexer):
+ """
+ For Pony source code.
+
+ .. versionadded:: 2.4
+ """
+
+ name = 'Pony'
+ aliases = ['pony']
+ filenames = ['*.pony']
+
+ _caps = r'(iso|trn|ref|val|box|tag)'
+
+ tokens = {
+ 'root': [
+ (r'\n', Text),
+ (r'[^\S\n]+', Text),
+ (r'//.*\n', Comment.Single),
+ (r'/\*', Comment.Multiline, 'nested_comment'),
+ (r'"""(?:.|\n)*?"""', String.Doc),
+ (r'"', String, 'string'),
+ (r'\'.*\'', String.Char),
+ (r'=>|[]{}:().~;,|&!^?[]', Punctuation),
+ (words((
+ 'addressof', 'and', 'as', 'consume', 'digestof', 'is', 'isnt',
+ 'not', 'or'),
+ suffix=r'\b'),
+ Operator.Word),
+ (r'!=|==|<<|>>|[-+/*%=<>]', Operator),
+ (words((
+ 'box', 'break', 'compile_error', 'compile_intrinsic',
+ 'continue', 'do', 'else', 'elseif', 'embed', 'end', 'error',
+ 'for', 'if', 'ifdef', 'in', 'iso', 'lambda', 'let', 'match',
+ 'object', 'recover', 'ref', 'repeat', 'return', 'tag', 'then',
+ 'this', 'trn', 'try', 'until', 'use', 'var', 'val', 'where',
+ 'while', 'with', '#any', '#read', '#send', '#share'),
+ suffix=r'\b'),
+ Keyword),
+ (r'(actor|class|struct|primitive|interface|trait|type)((?:\s)+)',
+ bygroups(Keyword, Text), 'typename'),
+ (r'(new|fun|be)((?:\s)+)', bygroups(Keyword, Text), 'methodname'),
+ (words((
+ 'I8', 'U8', 'I16', 'U16', 'I32', 'U32', 'I64', 'U64', 'I128',
+ 'U128', 'ILong', 'ULong', 'ISize', 'USize', 'F32', 'F64',
+ 'Bool', 'Pointer', 'None', 'Any', 'Array', 'String',
+ 'Iterator'),
+ suffix=r'\b'),
+ Name.Builtin.Type),
+ (r'_?[A-Z]\w*', Name.Type),
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float),
+ (r'0x[0-9a-fA-F]+', Number.Hex),
+ (r'\d+', Number.Integer),
+ (r'(true|false)\b', Name.Builtin),
+ (r'_\d*', Name),
+ (r'_?[a-z][\w\'_]*', Name)
+ ],
+ 'typename': [
+ (_caps + r'?((?:\s)*)(_?[A-Z]\w*)',
+ bygroups(Keyword, Text, Name.Class), '#pop')
+ ],
+ 'methodname': [
+ (_caps + r'?((?:\s)*)(_?[a-z]\w*)',
+ bygroups(Keyword, Text, Name.Function), '#pop')
+ ],
+ 'nested_comment': [
+ (r'[^*/]+', Comment.Multiline),
+ (r'/\*', Comment.Multiline, '#push'),
+ (r'\*/', Comment.Multiline, '#pop'),
+ (r'[*/]', Comment.Multiline)
+ ],
+ 'string': [
+ (r'"', String, '#pop'),
+ (r'\\"', String),
+ (r'[^\\"]+', String)
+ ]
+ }
diff --git a/pygments/lexers/prolog.py b/pygments/lexers/prolog.py
index 58e762b0..daf8db96 100644
--- a/pygments/lexers/prolog.py
+++ b/pygments/lexers/prolog.py
@@ -31,7 +31,6 @@ class PrologLexer(RegexLexer):
tokens = {
'root': [
- (r'^#.*', Comment.Single),
(r'/\*', Comment.Multiline, 'nested-comment'),
(r'%.*', Comment.Single),
# character literal
diff --git a/pygments/lexers/rdf.py b/pygments/lexers/rdf.py
index 27bbe154..72efdfad 100644
--- a/pygments/lexers/rdf.py
+++ b/pygments/lexers/rdf.py
@@ -268,3 +268,10 @@ class TurtleLexer(RegexLexer):
],
}
+
+ # Turtle and Tera Term macro files share the same file extension
+ # but each has a recognizable and distinct syntax.
+ def analyse_text(text):
+ for t in ('@base ', 'BASE ', '@prefix ', 'PREFIX '):
+ if re.search(r'^\s*%s' % t, text):
+ return 0.80
diff --git a/pygments/lexers/rust.py b/pygments/lexers/rust.py
index 10097fba..b7b8cb7e 100644
--- a/pygments/lexers/rust.py
+++ b/pygments/lexers/rust.py
@@ -29,7 +29,7 @@ class RustLexer(RegexLexer):
keyword_types = (
words(('u8', 'u16', 'u32', 'u64', 'i8', 'i16', 'i32', 'i64',
- 'usize', 'isize', 'f32', 'f64', 'str', 'bool'),
+ 'i128', 'u128', 'usize', 'isize', 'f32', 'f64', 'str', 'bool'),
suffix=r'\b'),
Keyword.Type)
diff --git a/pygments/lexers/shell.py b/pygments/lexers/shell.py
index 31bc7e94..9fd6bf20 100644
--- a/pygments/lexers/shell.py
+++ b/pygments/lexers/shell.py
@@ -540,7 +540,7 @@ class MSDOSSessionLexer(ShellSessionBaseLexer):
mimetypes = []
_innerLexerCls = BatchLexer
- _ps1rgx = r'^([^>]+>)(.*\n?)'
+ _ps1rgx = r'^([^>]*>)(.*\n?)'
_ps2 = 'More? '
diff --git a/pygments/lexers/slash.py b/pygments/lexers/slash.py
new file mode 100644
index 00000000..bd73d463
--- /dev/null
+++ b/pygments/lexers/slash.py
@@ -0,0 +1,187 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.slash
+ ~~~~~~~~~~~~~~~~~~~~~
+
+ Lexer for the `Slash <https://github.com/arturadib/Slash-A>`_ programming
+ language.
+
+ :copyright: Copyright 2012 by GitHub, Inc
+ :license: BSD, see LICENSE for details.
+"""
+
+import re
+
+from pygments.lexer import ExtendedRegexLexer, bygroups, DelegatingLexer
+from pygments.token import Name, Number, String, Comment, Punctuation, \
+ Other, Keyword, Operator, Whitespace
+
+__all__ = ['SlashLexer']
+
+
+class SlashLanguageLexer(ExtendedRegexLexer):
+ _nkw = r'(?=[^a-zA-Z_0-9])'
+
+ def move_state(new_state):
+ return ("#pop", new_state)
+
+ def right_angle_bracket(lexer, match, ctx):
+ if len(ctx.stack) > 1 and ctx.stack[-2] == "string":
+ ctx.stack.pop()
+ yield match.start(), String.Interpol, "}"
+ ctx.pos = match.end()
+ pass
+
+ tokens = {
+ "root": [
+ (r"<%=", Comment.Preproc, move_state("slash")),
+ (r"<%!!", Comment.Preproc, move_state("slash")),
+ (r"<%#.*?%>", Comment.Multiline),
+ (r"<%", Comment.Preproc, move_state("slash")),
+ (r".|\n", Other),
+ ],
+ "string": [
+ (r"\\", String.Escape, move_state("string_e")),
+ (r"\"", String, move_state("slash")),
+ (r"#\{", String.Interpol, "slash"),
+ (r'.|\n', String),
+ ],
+ "string_e": [
+ (r'n', String.Escape, move_state("string")),
+ (r't', String.Escape, move_state("string")),
+ (r'r', String.Escape, move_state("string")),
+ (r'e', String.Escape, move_state("string")),
+ (r'x[a-fA-F0-9]{2}', String.Escape, move_state("string")),
+ (r'.', String.Escape, move_state("string")),
+ ],
+ "regexp": [
+ (r'}[a-z]*', String.Regex, move_state("slash")),
+ (r'\\(.|\n)', String.Regex),
+ (r'{', String.Regex, "regexp_r"),
+ (r'.|\n', String.Regex),
+ ],
+ "regexp_r": [
+ (r'}[a-z]*', String.Regex, "#pop"),
+ (r'\\(.|\n)', String.Regex),
+ (r'{', String.Regex, "regexp_r"),
+ ],
+ "slash": [
+ (r"%>", Comment.Preproc, move_state("root")),
+ (r"\"", String, move_state("string")),
+ (r"'[a-zA-Z0-9_]+", String),
+ (r'%r{', String.Regex, move_state("regexp")),
+ (r'/\*.*?\*/', Comment.Multiline),
+ (r"(#|//).*?\n", Comment.Single),
+ (r'-?[0-9]+e[+-]?[0-9]+', Number.Float),
+ (r'-?[0-9]+\.[0-9]+(e[+-]?[0-9]+)?', Number.Float),
+ (r'-?[0-9]+', Number.Integer),
+ (r'nil'+_nkw, Name.Builtin),
+ (r'true'+_nkw, Name.Builtin),
+ (r'false'+_nkw, Name.Builtin),
+ (r'self'+_nkw, Name.Builtin),
+ (r'(class)(\s+)([A-Z][a-zA-Z0-9_\']*)',
+ bygroups(Keyword, Whitespace, Name.Class)),
+ (r'class'+_nkw, Keyword),
+ (r'extends'+_nkw, Keyword),
+ (r'(def)(\s+)(self)(\s*)(\.)(\s*)([a-z_][a-zA-Z0-9_\']*=?|<<|>>|==|<=>|<=|<|>=|>|\+|-(self)?|~(self)?|\*|/|%|^|&&|&|\||\[\]=?)',
+ bygroups(Keyword, Whitespace, Name.Builtin, Whitespace, Punctuation, Whitespace, Name.Function)),
+ (r'(def)(\s+)([a-z_][a-zA-Z0-9_\']*=?|<<|>>|==|<=>|<=|<|>=|>|\+|-(self)?|~(self)?|\*|/|%|^|&&|&|\||\[\]=?)',
+ bygroups(Keyword, Whitespace, Name.Function)),
+ (r'def'+_nkw, Keyword),
+ (r'if'+_nkw, Keyword),
+ (r'elsif'+_nkw, Keyword),
+ (r'else'+_nkw, Keyword),
+ (r'unless'+_nkw, Keyword),
+ (r'for'+_nkw, Keyword),
+ (r'in'+_nkw, Keyword),
+ (r'while'+_nkw, Keyword),
+ (r'until'+_nkw, Keyword),
+ (r'and'+_nkw, Keyword),
+ (r'or'+_nkw, Keyword),
+ (r'not'+_nkw, Keyword),
+ (r'lambda'+_nkw, Keyword),
+ (r'try'+_nkw, Keyword),
+ (r'catch'+_nkw, Keyword),
+ (r'return'+_nkw, Keyword),
+ (r'next'+_nkw, Keyword),
+ (r'last'+_nkw, Keyword),
+ (r'throw'+_nkw, Keyword),
+ (r'use'+_nkw, Keyword),
+ (r'switch'+_nkw, Keyword),
+ (r'\\', Keyword),
+ (r'λ', Keyword),
+ (r'__FILE__'+_nkw, Name.Builtin.Pseudo),
+ (r'__LINE__'+_nkw, Name.Builtin.Pseudo),
+ (r'[A-Z][a-zA-Z0-9_\']*'+_nkw, Name.Constant),
+ (r'[a-z_][a-zA-Z0-9_\']*'+_nkw, Name),
+ (r'@[a-z_][a-zA-Z0-9_\']*'+_nkw, Name.Variable.Instance),
+ (r'@@[a-z_][a-zA-Z0-9_\']*'+_nkw, Name.Variable.Class),
+ (r'\(', Punctuation),
+ (r'\)', Punctuation),
+ (r'\[', Punctuation),
+ (r'\]', Punctuation),
+ (r'\{', Punctuation),
+ (r'\}', right_angle_bracket),
+ (r';', Punctuation),
+ (r',', Punctuation),
+ (r'<<=', Operator),
+ (r'>>=', Operator),
+ (r'<<', Operator),
+ (r'>>', Operator),
+ (r'==', Operator),
+ (r'!=', Operator),
+ (r'=>', Operator),
+ (r'=', Operator),
+ (r'<=>', Operator),
+ (r'<=', Operator),
+ (r'>=', Operator),
+ (r'<', Operator),
+ (r'>', Operator),
+ (r'\+\+', Operator),
+ (r'\+=', Operator),
+ (r'-=', Operator),
+ (r'\*\*=', Operator),
+ (r'\*=', Operator),
+ (r'\*\*', Operator),
+ (r'\*', Operator),
+ (r'/=', Operator),
+ (r'\+', Operator),
+ (r'-', Operator),
+ (r'/', Operator),
+ (r'%=', Operator),
+ (r'%', Operator),
+ (r'^=', Operator),
+ (r'&&=', Operator),
+ (r'&=', Operator),
+ (r'&&', Operator),
+ (r'&', Operator),
+ (r'\|\|=', Operator),
+ (r'\|=', Operator),
+ (r'\|\|', Operator),
+ (r'\|', Operator),
+ (r'!', Operator),
+ (r'\.\.\.', Operator),
+ (r'\.\.', Operator),
+ (r'\.', Operator),
+ (r'::', Operator),
+ (r':', Operator),
+ (r'(\s|\n)+', Whitespace),
+ (r'[a-z_][a-zA-Z0-9_\']*', Name.Variable),
+ ],
+ }
+
+
+class SlashLexer(DelegatingLexer):
+ """
+ Lexer for the Slash programming language.
+
+ .. versionadded:: 2.4
+ """
+
+ name = 'Slash'
+ aliases = ['slash']
+ filenames = ['*.sl']
+
+ def __init__(self, **options):
+ from pygments.lexers.web import HtmlLexer
+ super(SlashLexer, self).__init__(HtmlLexer, SlashLanguageLexer, **options)
diff --git a/pygments/lexers/teraterm.py b/pygments/lexers/teraterm.py
new file mode 100644
index 00000000..100a89e0
--- /dev/null
+++ b/pygments/lexers/teraterm.py
@@ -0,0 +1,158 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.teraterm
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Lexer for Tera Term macro files.
+
+ :copyright: Copyright 2006-2018 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+import re
+
+from pygments.lexer import RegexLexer, include, bygroups
+from pygments.token import Text, Comment, Operator, Name, String, \
+ Number, Keyword
+
+__all__ = ['TeraTermLexer']
+
+
+class TeraTermLexer(RegexLexer):
+ """
+ For `Tera Term <https://ttssh2.osdn.jp/>`_ macro source code.
+
+ .. versionadded:: 2.4
+ """
+ name = 'Tera Term macro'
+ aliases = ['ttl', 'teraterm', 'teratermmacro']
+ filenames = ['*.ttl']
+ mimetypes = ['text/x-teratermmacro']
+
+ tokens = {
+ 'root': [
+ include('comments'),
+ include('labels'),
+ include('commands'),
+ include('builtin-variables'),
+ include('user-variables'),
+ include('operators'),
+ include('numeric-literals'),
+ include('string-literals'),
+ include('all-whitespace'),
+ (r'[^\s]', Text),
+ ],
+ 'comments': [
+ (r';[^\r\n]*', Comment.Single),
+ (r'/\*', Comment.Multiline, 'in-comment'),
+ ],
+ 'in-comment': [
+ (r'\*/', Comment.Multiline, '#pop'),
+ (r'[^*/]+', Comment.Multiline),
+ (r'[*/]', Comment.Multiline)
+ ],
+ 'labels': [
+ (r'(?i)^(\s*)(:[0-9a-z_]+)', bygroups(Text, Name.Label)),
+ ],
+ 'commands': [
+ (
+ r'(?i)\b('
+ r'basename|beep|bplusrecv|bplussend|break|bringupbox|'
+ r'callmenu|changedir|checksum16|checksum16file|'
+ r'checksum32|checksum32file|checksum8|checksum8file|'
+ r'clearscreen|clipb2var|closesbox|closett|code2str|'
+ r'connect|continue|crc16|crc16file|crc32|crc32file|'
+ r'cygconnect|delpassword|dirname|dirnamebox|disconnect|'
+ r'dispstr|do|else|elseif|enablekeyb|end|endif|enduntil|'
+ r'endwhile|exec|execcmnd|exit|expandenv|fileclose|'
+ r'fileconcat|filecopy|filecreate|filedelete|filelock|'
+ r'filemarkptr|filenamebox|fileopen|fileread|filereadln|'
+ r'filerename|filesearch|fileseek|fileseekback|filestat|'
+ r'filestrseek|filestrseek2|filetruncate|fileunlock|'
+ r'filewrite|filewriteln|findclose|findfirst|findnext|'
+ r'flushrecv|foldercreate|folderdelete|foldersearch|for|'
+ r'getdate|getdir|getenv|getfileattr|gethostname|'
+ r'getipv4addr|getipv6addr|getmodemstatus|getpassword|'
+ r'getspecialfolder|gettime|gettitle|getttdir|getver|'
+ r'if|ifdefined|include|inputbox|int2str|intdim|'
+ r'ispassword|kmtfinish|kmtget|kmtrecv|kmtsend|listbox|'
+ r'loadkeymap|logautoclosemode|logclose|loginfo|logopen|'
+ r'logpause|logrotate|logstart|logwrite|loop|makepath|'
+ r'messagebox|mpause|next|passwordbox|pause|quickvanrecv|'
+ r'quickvansend|random|recvln|regexoption|restoresetup|'
+ r'return|rotateleft|rotateright|scprecv|scpsend|send|'
+ r'sendbreak|sendbroadcast|sendfile|sendkcode|sendln|'
+ r'sendlnbroadcast|sendlnmulticast|sendmulticast|setbaud|'
+ r'setdate|setdebug|setdir|setdlgpos|setdtr|setecho|'
+ r'setenv|setexitcode|setfileattr|setflowctrl|'
+ r'setmulticastname|setpassword|setrts|setsync|settime|'
+ r'settitle|show|showtt|sprintf|sprintf2|statusbox|'
+ r'str2code|str2int|strcompare|strconcat|strcopy|strdim|'
+ r'strinsert|strjoin|strlen|strmatch|strremove|'
+ r'strreplace|strscan|strspecial|strsplit|strtrim|'
+ r'testlink|then|tolower|toupper|unlink|until|uptime|'
+ r'var2clipb|wait|wait4all|waitevent|waitln|waitn|'
+ r'waitrecv|waitregex|while|xmodemrecv|xmodemsend|'
+ r'yesnobox|ymodemrecv|ymodemsend|zmodemrecv|zmodemsend'
+ r')\b',
+ Keyword,
+ ),
+ (
+ r'(?i)(call|goto)([ \t]+)([0-9a-z_]+)',
+ bygroups(Keyword, Text, Name.Label),
+ )
+ ],
+ 'builtin-variables': [
+ (
+ r'(?i)('
+ r'groupmatchstr1|groupmatchstr2|groupmatchstr3|'
+ r'groupmatchstr4|groupmatchstr5|groupmatchstr6|'
+ r'groupmatchstr7|groupmatchstr8|groupmatchstr9|'
+ r'param1|param2|param3|param4|param5|param6|'
+ r'param7|param8|param9|paramcnt|params|'
+ r'inputstr|matchstr|mtimeout|result|timeout'
+ r')\b',
+ Name.Builtin
+ ),
+ ],
+ 'user-variables': [
+ (r'(?i)[A-Z_][A-Z0-9_]*', Name.Variable),
+ ],
+ 'numeric-literals': [
+ (r'(-?)([0-9]+)', bygroups(Operator, Number.Integer)),
+ (r'(?i)\$[0-9a-f]+', Number.Hex),
+ ],
+ 'string-literals': [
+ (r'(?i)#(?:[0-9]+|\$[0-9a-f]+)', String.Char),
+ (r"'", String.Single, 'in-single-string'),
+ (r'"', String.Double, 'in-double-string'),
+ ],
+ 'in-general-string': [
+ (r'[\\][\\nt]', String.Escape), # Only three escapes are supported.
+ (r'.', String),
+ ],
+ 'in-single-string': [
+ (r"'", String.Single, '#pop'),
+ include('in-general-string'),
+ ],
+ 'in-double-string': [
+ (r'"', String.Double, '#pop'),
+ include('in-general-string'),
+ ],
+ 'operators': [
+ (r'and|not|or|xor', Operator.Word),
+ (r'[!%&*+<=>^~\|\/-]+', Operator),
+ (r'[()]', String.Symbol),
+ ],
+ 'all-whitespace': [
+ (r'[\s]+', Text),
+ ],
+ }
+
+ # Turtle and Tera Term macro files share the same file extension
+ # but each has a recognizable and distinct syntax.
+ def analyse_text(text):
+ result = 0.0
+ if re.search(TeraTermLexer.tokens['commands'][0][0], text):
+ result += 0.60
+ return result
diff --git a/pygments/lexers/theorem.py b/pygments/lexers/theorem.py
index e84a398b..e7619c33 100644
--- a/pygments/lexers/theorem.py
+++ b/pygments/lexers/theorem.py
@@ -98,7 +98,6 @@ class CoqLexer(RegexLexer):
operators = r'[!$%&*+\./:<=>?@^|~-]'
prefix_syms = r'[!?~]'
infix_syms = r'[=<>@^|&+\*/$%-]'
- primitives = ('unit', 'nat', 'bool', 'string', 'ascii', 'list')
tokens = {
'root': [
@@ -115,7 +114,6 @@ class CoqLexer(RegexLexer):
(r'\b([A-Z][\w\']*)', Name),
(r'(%s)' % '|'.join(keyopts[::-1]), Operator),
(r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator),
- (r'\b(%s)\b' % '|'.join(primitives), Keyword.Type),
(r"[^\W\d][\w']*", Name),