broomhlda 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.md +201 -0
- data/lib/hl/define.ay +131 -0
- data/lib/hl/formatters/html.ay +26 -0
- data/lib/hl/lexer.ay +99 -0
- data/lib/hl/lexers/atomy.ay +122 -0
- data/lib/hl/lexers/haskell.ay +89 -0
- data/lib/hl/lexers/imported/abap.ay +43 -0
- data/lib/hl/lexers/imported/actionscript.ay +31 -0
- data/lib/hl/lexers/imported/actionscript3.ay +47 -0
- data/lib/hl/lexers/imported/ada.ay +107 -0
- data/lib/hl/lexers/imported/antlr.ay +95 -0
- data/lib/hl/lexers/imported/apacheconf.ay +29 -0
- data/lib/hl/lexers/imported/applescript.ay +48 -0
- data/lib/hl/lexers/imported/aspectj.ay +42 -0
- data/lib/hl/lexers/imported/asymptote.ay +64 -0
- data/lib/hl/lexers/imported/autohotkey.ay +76 -0
- data/lib/hl/lexers/imported/autoit.ay +64 -0
- data/lib/hl/lexers/imported/awk.ay +42 -0
- data/lib/hl/lexers/imported/bash.ay +63 -0
- data/lib/hl/lexers/imported/batch.ay +45 -0
- data/lib/hl/lexers/imported/bbcode.ay +23 -0
- data/lib/hl/lexers/imported/befunge.ay +26 -0
- data/lib/hl/lexers/imported/blitzmax.ay +44 -0
- data/lib/hl/lexers/imported/boo.ay +55 -0
- data/lib/hl/lexers/imported/brainfuck.ay +28 -0
- data/lib/hl/lexers/imported/bro.ay +57 -0
- data/lib/hl/lexers/imported/bugs.ay +31 -0
- data/lib/hl/lexers/imported/c.ay +84 -0
- data/lib/hl/lexers/imported/ca65.ay +26 -0
- data/lib/hl/lexers/imported/cbmbasicv2.ay +25 -0
- data/lib/hl/lexers/imported/ceylon.ay +47 -0
- data/lib/hl/lexers/imported/cfengine3.ay +50 -0
- data/lib/hl/lexers/imported/clojure.ay +32 -0
- data/lib/hl/lexers/imported/cmake.ay +38 -0
- data/lib/hl/lexers/imported/cobol.ay +44 -0
- data/lib/hl/lexers/imported/coffeescript.ay +79 -0
- data/lib/hl/lexers/imported/coldfusion.ay +36 -0
- data/lib/hl/lexers/imported/commonlisp.ay +65 -0
- data/lib/hl/lexers/imported/coq.ay +59 -0
- data/lib/hl/lexers/imported/croc.ay +37 -0
- data/lib/hl/lexers/imported/css.ay +55 -0
- data/lib/hl/lexers/imported/cuda.ay +84 -0
- data/lib/hl/lexers/imported/cython.ay +128 -0
- data/lib/hl/lexers/imported/d.ay +102 -0
- data/lib/hl/lexers/imported/darcspatch.ay +45 -0
- data/lib/hl/lexers/imported/dart.ay +84 -0
- data/lib/hl/lexers/imported/debiancontrol.ay +51 -0
- data/lib/hl/lexers/imported/dg.ay +61 -0
- data/lib/hl/lexers/imported/diff.ay +22 -0
- data/lib/hl/lexers/imported/django.ay +46 -0
- data/lib/hl/lexers/imported/dtd.ay +62 -0
- data/lib/hl/lexers/imported/dylan.ay +60 -0
- data/lib/hl/lexers/imported/dylanlid.ay +17 -0
- data/lib/hl/lexers/imported/ecl.ay +57 -0
- data/lib/hl/lexers/imported/elixir.ay +93 -0
- data/lib/hl/lexers/imported/erlang.ay +47 -0
- data/lib/hl/lexers/imported/factor.ay +89 -0
- data/lib/hl/lexers/imported/fancy.ay +54 -0
- data/lib/hl/lexers/imported/fantom.ay +149 -0
- data/lib/hl/lexers/imported/felix.ay +140 -0
- data/lib/hl/lexers/imported/fortran.ay +39 -0
- data/lib/hl/lexers/imported/foxpro.ay +37 -0
- data/lib/hl/lexers/imported/fsharp.ay +61 -0
- data/lib/hl/lexers/imported/gas.ay +51 -0
- data/lib/hl/lexers/imported/gettext.ay +21 -0
- data/lib/hl/lexers/imported/gherkin.ay +97 -0
- data/lib/hl/lexers/imported/glshader.ay +31 -0
- data/lib/hl/lexers/imported/gnuplot.ay +111 -0
- data/lib/hl/lexers/imported/go.ay +40 -0
- data/lib/hl/lexers/imported/gooddatacl.ay +33 -0
- data/lib/hl/lexers/imported/gosu.ay +58 -0
- data/lib/hl/lexers/imported/groff.ay +38 -0
- data/lib/hl/lexers/imported/groovy.ay +45 -0
- data/lib/hl/lexers/imported/haskell.ay +89 -0
- data/lib/hl/lexers/imported/haxe.ay +186 -0
- data/lib/hl/lexers/imported/hxml.ay +22 -0
- data/lib/hl/lexers/imported/hybris.ay +42 -0
- data/lib/hl/lexers/imported/idl.ay +23 -0
- data/lib/hl/lexers/imported/ini.ay +18 -0
- data/lib/hl/lexers/imported/io.ay +34 -0
- data/lib/hl/lexers/imported/ioke.ay +88 -0
- data/lib/hl/lexers/imported/irclogs.ay +24 -0
- data/lib/hl/lexers/imported/jags.ay +36 -0
- data/lib/hl/lexers/imported/java.ay +42 -0
- data/lib/hl/lexers/imported/javascript.ay +45 -0
- data/lib/hl/lexers/imported/json.ay +47 -0
- data/lib/hl/lexers/imported/julia.ay +60 -0
- data/lib/hl/lexers/imported/kconfig.ay +71 -0
- data/lib/hl/lexers/imported/koka.ay +104 -0
- data/lib/hl/lexers/imported/lasso.ay +143 -0
- data/lib/hl/lexers/imported/lighttpdconf.ay +24 -0
- data/lib/hl/lexers/imported/livescript.ay +82 -0
- data/lib/hl/lexers/imported/llvm.ay +36 -0
- data/lib/hl/lexers/imported/logtalk.ay +133 -0
- data/lib/hl/lexers/imported/lua.ay +56 -0
- data/lib/hl/lexers/imported/maql.ay +32 -0
- data/lib/hl/lexers/imported/matlab.ay +43 -0
- data/lib/hl/lexers/imported/minid.ay +37 -0
- data/lib/hl/lexers/imported/modula2.ay +63 -0
- data/lib/hl/lexers/imported/moinwiki.ay +33 -0
- data/lib/hl/lexers/imported/monkey.ay +84 -0
- data/lib/hl/lexers/imported/moocode.ay +26 -0
- data/lib/hl/lexers/imported/moonscript.ay +52 -0
- data/lib/hl/lexers/imported/mscgen.ay +35 -0
- data/lib/hl/lexers/imported/mupad.ay +36 -0
- data/lib/hl/lexers/imported/mysql.ay +37 -0
- data/lib/hl/lexers/imported/nasm.ay +52 -0
- data/lib/hl/lexers/imported/newlisp.ay +34 -0
- data/lib/hl/lexers/imported/newspeak.ay +49 -0
- data/lib/hl/lexers/imported/nginxconf.ay +41 -0
- data/lib/hl/lexers/imported/nimrod.ay +84 -0
- data/lib/hl/lexers/imported/nsis.ay +55 -0
- data/lib/hl/lexers/imported/numpy.ay +116 -0
- data/lib/hl/lexers/imported/objectivej.ay +120 -0
- data/lib/hl/lexers/imported/ocaml.ay +59 -0
- data/lib/hl/lexers/imported/octave.ay +39 -0
- data/lib/hl/lexers/imported/ooc.ay +45 -0
- data/lib/hl/lexers/imported/opa.ay +153 -0
- data/lib/hl/lexers/imported/openedge.ay +40 -0
- data/lib/hl/lexers/imported/perl.ay +130 -0
- data/lib/hl/lexers/imported/php.ay +63 -0
- data/lib/hl/lexers/imported/postscript.ay +39 -0
- data/lib/hl/lexers/imported/povray.ay +28 -0
- data/lib/hl/lexers/imported/powershell.ay +49 -0
- data/lib/hl/lexers/imported/prolog.ay +39 -0
- data/lib/hl/lexers/imported/properties.ay +17 -0
- data/lib/hl/lexers/imported/protobuf.ay +43 -0
- data/lib/hl/lexers/imported/puppet.ay +50 -0
- data/lib/hl/lexers/imported/pypylog.ay +44 -0
- data/lib/hl/lexers/imported/python.ay +116 -0
- data/lib/hl/lexers/imported/python3.ay +113 -0
- data/lib/hl/lexers/imported/qml.ay +47 -0
- data/lib/hl/lexers/imported/racket.ay +62 -0
- data/lib/hl/lexers/imported/ragel.ay +70 -0
- data/lib/hl/lexers/imported/rd.ay +22 -0
- data/lib/hl/lexers/imported/redcode.ay +23 -0
- data/lib/hl/lexers/imported/regedit.ay +25 -0
- data/lib/hl/lexers/imported/rpmspec.ay +57 -0
- data/lib/hl/lexers/imported/rust.ay +56 -0
- data/lib/hl/lexers/imported/s.ay +61 -0
- data/lib/hl/lexers/imported/scala.ay +72 -0
- data/lib/hl/lexers/imported/scheme.ay +31 -0
- data/lib/hl/lexers/imported/scilab.ay +37 -0
- data/lib/hl/lexers/imported/scss.ay +115 -0
- data/lib/hl/lexers/imported/smali.ay +71 -0
- data/lib/hl/lexers/imported/smalltalk.ay +93 -0
- data/lib/hl/lexers/imported/snobol.ay +42 -0
- data/lib/hl/lexers/imported/sourcepawn.ay +58 -0
- data/lib/hl/lexers/imported/sourceslist.ay +37 -0
- data/lib/hl/lexers/imported/sql.ay +31 -0
- data/lib/hl/lexers/imported/squidconf.ay +29 -0
- data/lib/hl/lexers/imported/stan.ay +38 -0
- data/lib/hl/lexers/imported/systemverilog.ay +65 -0
- data/lib/hl/lexers/imported/tcl.ay +110 -0
- data/lib/hl/lexers/imported/tcsh.ay +52 -0
- data/lib/hl/lexers/imported/tex.ay +49 -0
- data/lib/hl/lexers/imported/typescript.ay +51 -0
- data/lib/hl/lexers/imported/vala.ay +70 -0
- data/lib/hl/lexers/imported/vbnet.ay +62 -0
- data/lib/hl/lexers/imported/velocity.ay +50 -0
- data/lib/hl/lexers/imported/verilog.ay +61 -0
- data/lib/hl/lexers/imported/vgl.ay +25 -0
- data/lib/hl/lexers/imported/vhdl.ay +54 -0
- data/lib/hl/lexers/imported/vim.ay +28 -0
- data/lib/hl/lexers/imported/xml.ay +38 -0
- data/lib/hl/lexers/imported/xslt.ay +38 -0
- data/lib/hl/lexers/imported/xtend.ay +48 -0
- data/lib/hl/lexers/ruby.ay +238 -0
- data/lib/hl/state.ay +31 -0
- data/lib/hl/token.ay +8 -0
- data/lib/hl.ay +17 -0
- metadata +244 -0
@@ -0,0 +1,116 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "NumPy"
|
6
|
+
aliases: ["numpy"]
|
7
|
+
extensions: []
|
8
|
+
mimetypes: []
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(tsqs):
|
13
|
+
r"'''" is(literal.string) -> pop
|
14
|
+
any-of(strings)
|
15
|
+
any-of(nl)
|
16
|
+
|
17
|
+
lex(builtins):
|
18
|
+
r"(?<!\.)(__import__|abs|all|any|apply|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|exit|file|filter|float|frozenset|getattr|globals|hasattr|hash|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b" is(name.builtin)
|
19
|
+
r"(?<!\.)(self|None|Ellipsis|NotImplemented|False|True)\b" is(name.builtin.pseudo)
|
20
|
+
r"(?<!\.)(ArithmeticError|AssertionError|AttributeError|BaseException|DeprecationWarning|EOFError|EnvironmentError|Exception|FloatingPointError|FutureWarning|GeneratorExit|IOError|ImportError|ImportWarning|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|NotImplemented|NotImplementedError|OSError|OverflowError|OverflowWarning|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|TypeError|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|UnicodeWarning|UserWarning|ValueError|VMSError|Warning|WindowsError|ZeroDivisionError)\b" is(name.exception)
|
21
|
+
|
22
|
+
lex(name):
|
23
|
+
r"@[a-zA-Z0-9_.]+" is(name.decorator)
|
24
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name)
|
25
|
+
|
26
|
+
lex(dqs):
|
27
|
+
r"\"" is(literal.string) -> pop
|
28
|
+
r"\\\\|\\\"|\\\n" is(literal.string.escape)
|
29
|
+
any-of(strings)
|
30
|
+
|
31
|
+
lex(sqs):
|
32
|
+
r"'" is(literal.string) -> pop
|
33
|
+
r"\\\\|\\'|\\\n" is(literal.string.escape)
|
34
|
+
any-of(strings)
|
35
|
+
|
36
|
+
lex(tdqs):
|
37
|
+
r"\"\"\"" is(literal.string) -> pop
|
38
|
+
any-of(strings)
|
39
|
+
any-of(nl)
|
40
|
+
|
41
|
+
lex(backtick):
|
42
|
+
r"`.*?`" is(literal.string.backtick)
|
43
|
+
|
44
|
+
lex(funcname):
|
45
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name.function) -> pop
|
46
|
+
|
47
|
+
lex(classname):
|
48
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name.class) -> pop
|
49
|
+
|
50
|
+
lex(stringescape):
|
51
|
+
r"\\([\\abfnrtv\"\']|\n|N{.*?}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})" is(literal.string.escape)
|
52
|
+
|
53
|
+
lex(numbers):
|
54
|
+
r"(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?" is(literal.number.float)
|
55
|
+
r"\d+[eE][+-]?[0-9]+j?" is(literal.number.float)
|
56
|
+
r"0[0-7]+j?" is(literal.number.oct)
|
57
|
+
r"0[xX][a-fA-F0-9]+" is(literal.number.hex)
|
58
|
+
r"\d+L" is(literal.number.integer.long)
|
59
|
+
r"\d+j?" is(literal.number.integer)
|
60
|
+
|
61
|
+
lex(keywords):
|
62
|
+
r"(assert|break|continue|del|elif|else|except|exec|finally|for|global|if|lambda|pass|print|raise|return|try|while|yield(\s+from)?|as|with)\b" is(keyword)
|
63
|
+
|
64
|
+
lex(import):
|
65
|
+
r"(?:[ \t]|\\\n)+" is(text)
|
66
|
+
r"as\b" is(keyword.namespace)
|
67
|
+
r"," is(operator)
|
68
|
+
r"[a-zA-Z_][a-zA-Z0-9_.]*" is(name.namespace)
|
69
|
+
r"" is(text) -> pop
|
70
|
+
|
71
|
+
lex(nl):
|
72
|
+
r"\n" is(literal.string)
|
73
|
+
|
74
|
+
lex(root):
|
75
|
+
r"\n" is(text)
|
76
|
+
r"^(\s*)([rRuU]{,2}\"\"\"(?:.|\n)*?\"\"\")" is(by-groups(text, literal.string.doc))
|
77
|
+
r"^(\s*)([rRuU]{,2}'''(?:.|\n)*?''')" is(by-groups(text, literal.string.doc))
|
78
|
+
r"[^\S\n]+" is(text)
|
79
|
+
r"\#.*$" is(comment)
|
80
|
+
r"[\]{}:(),;\[]" is(punctuation)
|
81
|
+
r"\\\n" is(text)
|
82
|
+
r"\\" is(text)
|
83
|
+
r"(in|is|and|or|not)\b" is(operator.word)
|
84
|
+
r"!=|==|<<|>>|[-\126+/*%=<>&^|.]" is(operator)
|
85
|
+
any-of(keywords)
|
86
|
+
r"(def)((?:\s|\\\s)+)" is(by-groups(keyword, text)) -> go-to(funcname)
|
87
|
+
r"(class)((?:\s|\\\s)+)" is(by-groups(keyword, text)) -> go-to(classname)
|
88
|
+
r"(from)((?:\s|\\\s)+)" is(by-groups(keyword.namespace, text)) -> go-to(fromimport)
|
89
|
+
r"(import)((?:\s|\\\s)+)" is(by-groups(keyword.namespace, text)) -> go-to(import)
|
90
|
+
any-of(builtins)
|
91
|
+
any-of(backtick)
|
92
|
+
r"(?:[rR]|[uU][rR]|[rR][uU])\"\"\"" is(literal.string) -> go-to(tdqs)
|
93
|
+
r"(?:[rR]|[uU][rR]|[rR][uU])'''" is(literal.string) -> go-to(tsqs)
|
94
|
+
r"(?:[rR]|[uU][rR]|[rR][uU])\"" is(literal.string) -> go-to(dqs)
|
95
|
+
r"(?:[rR]|[uU][rR]|[rR][uU])'" is(literal.string) -> go-to(sqs)
|
96
|
+
r"[uU]?\"\"\"" is(literal.string) -> combined(stringescape, tdqs)
|
97
|
+
r"[uU]?'''" is(literal.string) -> combined(stringescape, tsqs)
|
98
|
+
r"[uU]?\"" is(literal.string) -> combined(stringescape, dqs)
|
99
|
+
r"[uU]?'" is(literal.string) -> combined(stringescape, sqs)
|
100
|
+
any-of(name)
|
101
|
+
any-of(numbers)
|
102
|
+
|
103
|
+
lex(strings):
|
104
|
+
r"%(\([a-zA-Z0-9_]+\))?[-\#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[diouxXeEfFgGcrs%]" is(literal.string.interpol)
|
105
|
+
r"[^\\\'\"%\n]+" is(literal.string)
|
106
|
+
r"[\'\"\\]" is(literal.string)
|
107
|
+
r"%" is(literal.string)
|
108
|
+
|
109
|
+
lex(fromimport):
|
110
|
+
r"(?:[ \t]|\\\n)+" is(text)
|
111
|
+
r"import\b" is(keyword.namespace) -> pop
|
112
|
+
r"None\b" is(name.builtin.pseudo) -> pop
|
113
|
+
r"[a-zA-Z_.][a-zA-Z0-9_.]*" is(name.namespace)
|
114
|
+
r"" is(text) -> pop
|
115
|
+
|
116
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,120 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Objective-J"
|
6
|
+
aliases: ["objective-j", "objectivej", "obj-j", "objj"]
|
7
|
+
extensions: [".j"]
|
8
|
+
mimetypes: ["text/x-objective-j"]
|
9
|
+
start: .root
|
10
|
+
flags: Regexp MULTILINE
|
11
|
+
|
12
|
+
lex(statements):
|
13
|
+
r"(L|@)?\"" is(literal.string) -> go-to(string)
|
14
|
+
r"(L|@)?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'" is(literal.string.char)
|
15
|
+
r"\"(\\\\|\\\"|[^\"])*\"" is(literal.string.double)
|
16
|
+
r"'(\\\\|\\'|[^'])*'" is(literal.string.single)
|
17
|
+
r"(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?" is(literal.number.float)
|
18
|
+
r"(\d+\.\d*|\.\d+|\d+[fF])[fF]?" is(literal.number.float)
|
19
|
+
r"0x[0-9a-fA-F]+[Ll]?" is(literal.number.hex)
|
20
|
+
r"0[0-7]+[Ll]?" is(literal.number.oct)
|
21
|
+
r"\d+[Ll]?" is(literal.number.integer)
|
22
|
+
r"^(?=\s|/|<!--)" is(text) -> go-to(slashstartsregex)
|
23
|
+
r"\+\+|--|\126|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?" is(operator) -> go-to(slashstartsregex)
|
24
|
+
r"[{(\[;,]" is(punctuation) -> go-to(slashstartsregex)
|
25
|
+
r"[})\].]" is(punctuation)
|
26
|
+
r"(for|in|while|do|break|return|continue|switch|case|default|if|else|throw|try|catch|finally|new|delete|typeof|instanceof|void|prototype|__proto__)\b" is(keyword) -> go-to(slashstartsregex)
|
27
|
+
r"(var|with|function)\b" is(keyword.declaration) -> go-to(slashstartsregex)
|
28
|
+
r"(@selector|@private|@protected|@public|@encode|@synchronized|@try|@throw|@catch|@finally|@end|@property|@synthesize|@dynamic|@for|@accessors|new)\b" is(keyword)
|
29
|
+
r"(int|long|float|short|double|char|unsigned|signed|void|id|BOOL|bool|boolean|IBOutlet|IBAction|SEL|@outlet|@action)\b" is(keyword.type)
|
30
|
+
r"(self|super)\b" is(name.builtin)
|
31
|
+
r"(TRUE|YES|FALSE|NO|Nil|nil|NULL)\b" is(keyword.constant)
|
32
|
+
r"(true|false|null|NaN|Infinity|undefined)\b" is(keyword.constant)
|
33
|
+
r"(ABS|ASIN|ACOS|ATAN|ATAN2|SIN|COS|TAN|EXP|POW|CEIL|FLOOR|ROUND|MIN|MAX|RAND|SQRT|E|LN2|LN10|LOG2E|LOG10E|PI|PI2|PI_2|SQRT1_2|SQRT2)\b" is(keyword.constant)
|
34
|
+
r"(Array|Boolean|Date|Error|Function|Math|netscape|Number|Object|Packages|RegExp|String|sun|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|window)\b" is(name.builtin)
|
35
|
+
r"([$a-zA-Z_][a-zA-Z0-9_]*)((?:\s|//.*?\n|/[*].*?[*]/)*)(?=\()" is(by-groups(name.function, using(self class)))
|
36
|
+
r"[$a-zA-Z_][a-zA-Z0-9_]*" is(name)
|
37
|
+
|
38
|
+
lex(string):
|
39
|
+
r"\"" is(literal.string) -> pop
|
40
|
+
r"\\([\\abfnrtv\"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})" is(literal.string.escape)
|
41
|
+
r"[^\\\"\n]+" is(literal.string)
|
42
|
+
r"\\\n" is(literal.string)
|
43
|
+
r"\\" is(literal.string)
|
44
|
+
|
45
|
+
lex(function-signature):
|
46
|
+
any-of(whitespace)
|
47
|
+
r"(\((?:\s|//.*?\n|/[*].*?[*]/)*)([a-zA-Z_][a-zA-Z0-9_]+)((?:\s|//.*?\n|/[*].*?[*]/)*\)(?:\s|//.*?\n|/[*].*?[*]/)*)([$a-zA-Z_][a-zA-Z0-9_]+(?:\s|//.*?\n|/[*].*?[*]/)*:)" is(by-groups(using(self class), keyword.type, using(self class), name.function)) -> go-to(function-parameters)
|
48
|
+
r"(\((?:\s|//.*?\n|/[*].*?[*]/)*)([a-zA-Z_][a-zA-Z0-9_]+)((?:\s|//.*?\n|/[*].*?[*]/)*\)(?:\s|//.*?\n|/[*].*?[*]/)*)([$a-zA-Z_][a-zA-Z0-9_]+)" is(by-groups(using(self class), keyword.type, using(self class), name.function)) -> pop
|
49
|
+
r"([$a-zA-Z_][a-zA-Z0-9_]+(?:\s|//.*?\n|/[*].*?[*]/)*:)" is(by-groups(name.function)) -> go-to(function-parameters)
|
50
|
+
r"([$a-zA-Z_][a-zA-Z0-9_]+)" is(by-groups(name.function)) -> pop
|
51
|
+
r"" is(text) -> pop
|
52
|
+
|
53
|
+
lex(classname):
|
54
|
+
r"([a-zA-Z_][a-zA-Z0-9_]*)((?:\s|//.*?\n|/[*].*?[*]/)*:(?:\s|//.*?\n|/[*].*?[*]/)*)([a-zA-Z_][a-zA-Z0-9_]*)?" is(by-groups(name.class, using(self class), name.class)) -> pop
|
55
|
+
r"([a-zA-Z_][a-zA-Z0-9_]*)((?:\s|//.*?\n|/[*].*?[*]/)*\()([a-zA-Z_][a-zA-Z0-9_]*)(\))" is(by-groups(name.class, using(self class), name.label, text)) -> pop
|
56
|
+
r"([a-zA-Z_][a-zA-Z0-9_]*)" is(name.class) -> pop
|
57
|
+
|
58
|
+
lex(forward-classname):
|
59
|
+
r"([a-zA-Z_][a-zA-Z0-9_]*)(\s*,\s*)" is(by-groups(name.class, text)) -> push
|
60
|
+
r"([a-zA-Z_][a-zA-Z0-9_]*)(\s*;?)" is(by-groups(name.class, text)) -> pop
|
61
|
+
|
62
|
+
lex(badregex):
|
63
|
+
r"\n" is(text) -> pop
|
64
|
+
|
65
|
+
lex(function-parameters):
|
66
|
+
any-of(whitespace)
|
67
|
+
r"(\((?:\s|//.*?\n|/[*].*?[*]/)*)([^\)]+)((?:\s|//.*?\n|/[*].*?[*]/)*\)(?:\s|//.*?\n|/[*].*?[*]/)*)([$a-zA-Z_][a-zA-Z0-9_]+)" is(by-groups(using(self class), keyword.type, using(self class), text))
|
68
|
+
r"([$a-zA-Z_][a-zA-Z0-9_]+(?:\s|//.*?\n|/[*].*?[*]/)*:)" is(name.function)
|
69
|
+
r"(:)" is(name.function)
|
70
|
+
r"(,(?:\s|//.*?\n|/[*].*?[*]/)*\.\.\.)" is(using(self class))
|
71
|
+
r"([$a-zA-Z_][a-zA-Z0-9_]+)" is(text)
|
72
|
+
|
73
|
+
lex(if0):
|
74
|
+
r"^\s*\#if.*?(?<!\\)\n" is(comment.preproc) -> push
|
75
|
+
r"^\s*\#endif.*?(?<!\\)\n" is(comment.preproc) -> pop
|
76
|
+
r".*?\n" is(comment)
|
77
|
+
|
78
|
+
lex(whitespace):
|
79
|
+
r"(@import)(\s+)(\"(?:\\\\|\\\"|[^\"])*\")" is(by-groups(comment.preproc, text, literal.string.double))
|
80
|
+
r"(@import)(\s+)(<(?:\\\\|\\>|[^>])*>)" is(by-groups(comment.preproc, text, literal.string.double))
|
81
|
+
r"(\#(?:include|import))(\s+)(\"(?:\\\\|\\\"|[^\"])*\")" is(by-groups(comment.preproc, text, literal.string.double))
|
82
|
+
r"(\#(?:include|import))(\s+)(<(?:\\\\|\\>|[^>])*>)" is(by-groups(comment.preproc, text, literal.string.double))
|
83
|
+
r"\#if\s+0" is(comment.preproc) -> go-to(if0)
|
84
|
+
r"\#" is(comment.preproc) -> go-to(macro)
|
85
|
+
r"\n" is(text)
|
86
|
+
r"\s+" is(text)
|
87
|
+
r"\\\n" is(text)
|
88
|
+
r"//(\n|(.|\n)*?[^\\]\n)" is(comment.single)
|
89
|
+
r"/(\\\n)?[*](.|\n)*?[*](\\\n)?/" is(comment.multiline)
|
90
|
+
r"<!--" is(comment)
|
91
|
+
|
92
|
+
lex(root):
|
93
|
+
any-of(whitespace)
|
94
|
+
r"^((?:\s|//.*?\n|/[*].*?[*]/)*[\+-](?:\s|//.*?\n|/[*].*?[*]/)*)([\(a-zA-Z_].*?[^\(])((?:\s|//.*?\n|/[*].*?[*]/)*{)" is(by-groups(using(self class), using(self class), using(self class)))
|
95
|
+
r"(@interface|@implementation)(\s+)" is(by-groups(keyword, text)) -> go-to(classname)
|
96
|
+
r"(@class|@protocol)(\s*)" is(by-groups(keyword, text)) -> go-to(forward-classname)
|
97
|
+
r"(\s*)(@end)(\s*)" is(by-groups(text, keyword, text))
|
98
|
+
any-of(statements)
|
99
|
+
r"[{\(\)}]" is(punctuation)
|
100
|
+
r";" is(punctuation)
|
101
|
+
|
102
|
+
lex(slashstartsregex):
|
103
|
+
any-of(whitespace)
|
104
|
+
r"/(\\.|[^\[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)" is(literal.string.regex) -> pop
|
105
|
+
r"(?=/)" is(text) -> do-all(pop, go-to(badregex))
|
106
|
+
r"" is(text) -> pop
|
107
|
+
|
108
|
+
lex(macro):
|
109
|
+
r"[^/\n]+" is(comment.preproc)
|
110
|
+
r"/[*](.|\n)*?[*]/" is(comment.multiline)
|
111
|
+
r"//.*?\n" is(comment.single) -> pop
|
112
|
+
r"/" is(comment.preproc)
|
113
|
+
r"(?<=\\)\n" is(comment.preproc)
|
114
|
+
r"\n" is(comment.preproc) -> pop
|
115
|
+
|
116
|
+
lex(expression):
|
117
|
+
r"([$a-zA-Z_][a-zA-Z0-9_]*)(\()" is(by-groups(name.function, punctuation))
|
118
|
+
r"(\))" is(punctuation) -> pop
|
119
|
+
|
120
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,59 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "OCaml"
|
6
|
+
aliases: ["ocaml"]
|
7
|
+
extensions: [".ml", ".mli", ".mll", ".mly"]
|
8
|
+
mimetypes: ["text/x-ocaml"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(comment):
|
13
|
+
r"[^(*)]+" is(comment)
|
14
|
+
r"\(\*" is(comment) -> push
|
15
|
+
r"\*\)" is(comment) -> pop
|
16
|
+
r"[(*)]" is(comment)
|
17
|
+
|
18
|
+
lex(root):
|
19
|
+
r"\s+" is(text)
|
20
|
+
r"false|true|\(\)|\[\]" is(name.builtin.pseudo)
|
21
|
+
r"\b([A-Z][A-Za-z0-9_\']*)(?=\s*\.)" is(name.namespace) -> go-to(dotted)
|
22
|
+
r"\b([A-Z][A-Za-z0-9_\']*)" is(name.class)
|
23
|
+
r"\(\*(?![)])" is(comment) -> go-to(comment)
|
24
|
+
r"\b(as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|false|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|object|of|open|private|raise|rec|sig|struct|then|to|true|try|type|value|val|virtual|when|while|with)\b" is(keyword)
|
25
|
+
r"(\126|}|\|]|\||{<|{|`|_|]|\[\||\[>|\[<|\[|\?\?|\?|>}|>]|>|=|<-|<|;;|;|:>|:=|::|:|\.\.|\.|->|-\.|-|,|\+|\*|\)|\(|&&|&|\#|!=)" is(operator)
|
26
|
+
r"([=<>@^|&+\*/$%-]|[!?\126])?[!$%&*+\./:<=>?@^|\126-]" is(operator)
|
27
|
+
r"\b(and|asr|land|lor|lsl|lxor|mod|or)\b" is(operator.word)
|
28
|
+
r"\b(unit|int|float|bool|string|char|list|array)\b" is(keyword.type)
|
29
|
+
r"[^\W\d][\w']*" is(name)
|
30
|
+
r"-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)" is(literal.number.float)
|
31
|
+
r"0[xX][\da-fA-F][\da-fA-F_]*" is(literal.number.hex)
|
32
|
+
r"0[oO][0-7][0-7_]*" is(literal.number.oct)
|
33
|
+
r"0[bB][01][01_]*" is(literal.number.binary)
|
34
|
+
r"\d[\d_]*" is(literal.number.integer)
|
35
|
+
r"'(?:(\\[\\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'" is(literal.string.char)
|
36
|
+
r"'.'" is(literal.string.char)
|
37
|
+
r"'" is(keyword)
|
38
|
+
r"\"" is(literal.string.double) -> go-to(string)
|
39
|
+
r"[\126?][a-z][\w\']*:" is(name.variable)
|
40
|
+
|
41
|
+
lex(string):
|
42
|
+
r"[^\\\"]+" is(literal.string.double)
|
43
|
+
any-of(escape-sequence)
|
44
|
+
r"\\\n" is(literal.string.double)
|
45
|
+
r"\"" is(literal.string.double) -> pop
|
46
|
+
|
47
|
+
lex(escape-sequence):
|
48
|
+
r"\\[\\\\"\'ntbr]" is(literal.string.escape)
|
49
|
+
r"\\[0-9]{3}" is(literal.string.escape)
|
50
|
+
r"\\x[0-9a-fA-F]{2}" is(literal.string.escape)
|
51
|
+
|
52
|
+
lex(dotted):
|
53
|
+
r"\s+" is(text)
|
54
|
+
r"\." is(punctuation)
|
55
|
+
r"[A-Z][A-Za-z0-9_\']*(?=\s*\.)" is(name.namespace)
|
56
|
+
r"[A-Z][A-Za-z0-9_\']*" is(name.class) -> pop
|
57
|
+
r"[a-z_][A-Za-z0-9_\']*" is(name) -> pop
|
58
|
+
|
59
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Octave"
|
6
|
+
aliases: ["octave"]
|
7
|
+
extensions: [".m"]
|
8
|
+
mimetypes: ["text/octave"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(deffunc):
|
13
|
+
r"(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)" is(by-groups(text.whitespace, text, text.whitespace, punctuation, text.whitespace, name.function, punctuation, text, punctuation, text.whitespace)) -> pop
|
14
|
+
|
15
|
+
lex(root):
|
16
|
+
r"[%\#].*$" is(comment)
|
17
|
+
r"^\s*function" is(keyword) -> go-to(deffunc)
|
18
|
+
r"(__FILE__|__LINE__|break|case|catch|classdef|continue|do|else|elseif|end|end_try_catch|end_unwind_protect|endclassdef|endevents|endfor|endfunction|endif|endmethods|endproperties|endswitch|endwhile|events|for|function|get|global|if|methods|otherwise|persistent|properties|return|set|static|switch|try|until|unwind_protect|unwind_protect_cleanup|while)\b" is(keyword)
|
19
|
+
r"(addlistener|addpath|addproperty|all|and|any|argnames|argv|assignin|atexit|autoload|available_graphics_toolkits|beep_on_error|bitand|bitmax|bitor|bitshift|bitxor|cat|cell|cellstr|char|class|clc|columns|command_line_path|completion_append_char|completion_matches|complex|confirm_recursive_rmdir|cputime|crash_dumps_octave_core|ctranspose|cumprod|cumsum|debug_on_error|debug_on_interrupt|debug_on_warning|default_save_options|dellistener|diag|diff|disp|doc_cache_file|do_string_escapes|double|drawnow|e|echo_executing_commands|eps|eq|errno|errno_list|error|eval|evalin|exec|exist|exit|eye|false|fclear|fclose|fcntl|fdisp|feof|ferror|feval|fflush|fgetl|fgets|fieldnames|file_in_loadpath|file_in_path|filemarker|filesep|find_dir_in_path|fixed_point_format|fnmatch|fopen|fork|formula|fprintf|fputs|fread|freport|frewind|fscanf|fseek|fskipl|ftell|functions|fwrite|ge|genpath|get|getegid|getenv|geteuid|getgid|getpgrp|getpid|getppid|getuid|glob|gt|gui_mode|history_control|history_file|history_size|history_timestamp_format_string|home|horzcat|hypot|ifelse|ignore_function_time_stamp|inferiorto|info_file|info_program|inline|input|intmax|intmin|ipermute|is_absolute_filename|isargout|isbool|iscell|iscellstr|ischar|iscomplex|isempty|isfield|isfloat|isglobal|ishandle|isieee|isindex|isinteger|islogical|ismatrix|ismethod|isnull|isnumeric|isobject|isreal|is_rooted_relative_filename|issorted|isstruct|isvarname|kbhit|keyboard|kill|lasterr|lasterror|lastwarn|ldivide|le|length|link|linspace|logical|lstat|lt|make_absolute_filename|makeinfo_program|max_recursion_depth|merge|methods|mfilename|minus|mislocked|mkdir|mkfifo|mkstemp|mldivide|mlock|mouse_wheel_zoom|mpower|mrdivide|mtimes|munlock|nargin|nargout|native_float_format|ndims|ne|nfields|nnz|norm|not|numel|nzmax|octave_config_info|octave_core_file_limit|octave_core_file_name|octave_core_file_options|ones|or|output_max_field_width|output_precision|page_output_immediately|page_screen_output|path|pathsep|pause|pclose|permute|pi|pipe|plus|popen|power|print_empty_dimensions|printf|print_struct_array_contents|prod|program_invocation_name|program_name|putenv|puts|pwd|quit|rats|rdivide|readdir|readlink|read_readline_init_file|realmax|realmin|rehash|rename|repelems|re_read_readline_init_file|reset|reshape|resize|restoredefaultpath|rethrow|rmdir|rmfield|rmpath|rows|save_header_format_string|save_precision|saving_history|scanf|set|setenv|shell_cmd|sighup_dumps_octave_core|sigterm_dumps_octave_core|silent_functions|single|size|size_equal|sizemax|sizeof|sleep|source|sparse_auto_mutate|split_long_rows|sprintf|squeeze|sscanf|stat|stderr|stdin|stdout|strcmp|strcmpi|string_fill_char|strncmp|strncmpi|struct|struct_levels_to_print|strvcat|subsasgn|subsref|sum|sumsq|superiorto|suppress_verbose_help_message|symlink|system|tic|tilde_expand|times|tmpfile|tmpnam|toc|toupper|transpose|true|typeinfo|umask|uminus|uname|undo_string_escapes|unlink|uplus|upper|usage|usleep|vec|vectorize|vertcat|waitpid|warning|warranty|whos_line_format|yes_or_no|zeros|inf|Inf|nan|NaN|close|load|who|whos|accumarray|accumdim|acosd|acotd|acscd|addtodate|allchild|ancestor|anova|arch_fit|arch_rnd|arch_test|area|arma_rnd|arrayfun|ascii|asctime|asecd|asind|assert|atand|autoreg_matrix|autumn|axes|axis|bar|barh|bartlett|bartlett_test|beep|betacdf|betainv|betapdf|betarnd|bicgstab|bicubic|binary|binocdf|binoinv|binopdf|binornd|bitcmp|bitget|bitset|blackman|blanks|blkdiag|bone|box|brighten|calendar|cast|cauchy_cdf|cauchy_inv|cauchy_pdf|cauchy_rnd|caxis|celldisp|center|cgs|chisquare_test_homogeneity|chisquare_test_independence|circshift|cla|clabel|clf|clock|cloglog|closereq|colon|colorbar|colormap|colperm|comet|common_size|commutation_matrix|compan|compare_versions|compass|computer|cond|condest|contour|contourc|contourf|contrast|conv|convhull|cool|copper|copyfile|cor|corrcoef|cor_test|cosd|cotd|cov|cplxpair|cross|cscd|cstrcat|csvread|csvwrite|ctime|cumtrapz|curl|cut|cylinder|date|datenum|datestr|datetick|datevec|dblquad|deal|deblank|deconv|delaunay|delaunayn|delete|demo|detrend|diffpara|diffuse|dir|discrete_cdf|discrete_inv|discrete_pdf|discrete_rnd|display|divergence|dlmwrite|dos|dsearch|dsearchn|duplication_matrix|durbinlevinson|ellipsoid|empirical_cdf|empirical_inv|empirical_pdf|empirical_rnd|eomday|errorbar|etime|etreeplot|example|expcdf|expinv|expm|exppdf|exprnd|ezcontour|ezcontourf|ezmesh|ezmeshc|ezplot|ezpolar|ezsurf|ezsurfc|factor|factorial|fail|fcdf|feather|fftconv|fftfilt|fftshift|figure|fileattrib|fileparts|fill|findall|findobj|findstr|finv|flag|flipdim|fliplr|flipud|fpdf|fplot|fractdiff|freqz|freqz_plot|frnd|fsolve|f_test_regression|ftp|fullfile|fzero|gamcdf|gaminv|gampdf|gamrnd|gca|gcbf|gcbo|gcf|genvarname|geocdf|geoinv|geopdf|geornd|getfield|ginput|glpk|gls|gplot|gradient|graphics_toolkit|gray|grid|griddata|griddatan|gtext|gunzip|gzip|hadamard|hamming|hankel|hanning|hggroup|hidden|hilb|hist|histc|hold|hot|hotelling_test|housh|hsv|hurst|hygecdf|hygeinv|hygepdf|hygernd|idivide|ifftshift|image|imagesc|imfinfo|imread|imshow|imwrite|index|info|inpolygon|inputname|interpft|interpn|intersect|invhilb|iqr|isa|isdefinite|isdir|is_duplicate_entry|isequal|isequalwithequalnans|isfigure|ishermitian|ishghandle|is_leap_year|isletter|ismac|ismember|ispc|isprime|isprop|isscalar|issquare|isstrprop|issymmetric|isunix|is_valid_file_id|isvector|jet|kendall|kolmogorov_smirnov_cdf|kolmogorov_smirnov_test|kruskal_wallis_test|krylov|kurtosis|laplace_cdf|laplace_inv|laplace_pdf|laplace_rnd|legend|legendre|license|line|linkprop|list_primes|loadaudio|loadobj|logistic_cdf|logistic_inv|logistic_pdf|logistic_rnd|logit|loglog|loglogerr|logm|logncdf|logninv|lognpdf|lognrnd|logspace|lookfor|ls_command|lsqnonneg|magic|mahalanobis|manova|matlabroot|mcnemar_test|mean|meansq|median|menu|mesh|meshc|meshgrid|meshz|mexext|mget|mkpp|mode|moment|movefile|mpoles|mput|namelengthmax|nargchk|nargoutchk|nbincdf|nbininv|nbinpdf|nbinrnd|nchoosek|ndgrid|newplot|news|nonzeros|normcdf|normest|norminv|normpdf|normrnd|now|nthroot|null|ocean|ols|onenormest|optimget|optimset|orderfields|orient|orth|pack|pareto|parseparams|pascal|patch|pathdef|pcg|pchip|pcolor|pcr|peaks|periodogram|perl|perms|pie|pink|planerot|playaudio|plot|plotmatrix|plotyy|poisscdf|poissinv|poisspdf|poissrnd|polar|poly|polyaffine|polyarea|polyderiv|polyfit|polygcd|polyint|polyout|polyreduce|polyval|polyvalm|postpad|powerset|ppder|ppint|ppjumps|ppplot|ppval|pqpnonneg|prepad|primes|print|print_usage|prism|probit|qp|qqplot|quadcc|quadgk|quadl|quadv|quiver|qzhess|rainbow|randi|range|rank|ranks|rat|reallog|realpow|realsqrt|record|rectangle_lw|rectangle_sw|rectint|refresh|refreshdata|regexptranslate|repmat|residue|ribbon|rindex|roots|rose|rosser|rotdim|rref|run|run_count|rundemos|run_test|runtests|saveas|saveaudio|saveobj|savepath|scatter|secd|semilogx|semilogxerr|semilogy|semilogyerr|setaudio|setdiff|setfield|setxor|shading|shift|shiftdim|sign_test|sinc|sind|sinetone|sinewave|skewness|slice|sombrero|sortrows|spaugment|spconvert|spdiags|spearman|spectral_adf|spectral_xdf|specular|speed|spencer|speye|spfun|sphere|spinmap|spline|spones|sprand|sprandn|sprandsym|spring|spstats|spy|sqp|stairs|statistics|std|stdnormal_cdf|stdnormal_inv|stdnormal_pdf|stdnormal_rnd|stem|stft|strcat|strchr|strjust|strmatch|strread|strsplit|strtok|strtrim|strtrunc|structfun|studentize|subplot|subsindex|subspace|substr|substruct|summer|surf|surface|surfc|surfl|surfnorm|svds|swapbytes|sylvester_matrix|symvar|synthesis|table|tand|tar|tcdf|tempdir|tempname|test|text|textread|textscan|tinv|title|toeplitz|tpdf|trace|trapz|treelayout|treeplot|triangle_lw|triangle_sw|tril|trimesh|triplequad|triplot|trisurf|triu|trnd|tsearchn|t_test|t_test_regression|type|unidcdf|unidinv|unidpdf|unidrnd|unifcdf|unifinv|unifpdf|unifrnd|union|unique|unix|unmkpp|unpack|untabify|untar|unwrap|unzip|u_test|validatestring|vander|var|var_test|vech|ver|version|view|voronoi|voronoin|waitforbuttonpress|wavread|wavwrite|wblcdf|wblinv|wblpdf|wblrnd|weekday|welch_test|what|white|whitebg|wienrnd|wilcoxon_test|wilkinson|winter|xlabel|xlim|ylabel|yulewalker|zip|zlabel|z_test|airy|amd|balance|besselh|besseli|besselj|besselk|bessely|bitpack|bsxfun|builtin|ccolamd|cellfun|cellslices|chol|choldelete|cholinsert|cholinv|cholshift|cholupdate|colamd|colloc|convhulln|convn|csymamd|cummax|cummin|daspk|daspk_options|dasrt|dasrt_options|dassl|dassl_options|dbclear|dbdown|dbstack|dbstatus|dbstop|dbtype|dbup|dbwhere|det|dlmread|dmperm|dot|eig|eigs|endgrent|endpwent|etree|fft|fftn|fftw|filter|find|full|gcd|getgrent|getgrgid|getgrnam|getpwent|getpwnam|getpwuid|getrusage|givens|gmtime|gnuplot_binary|hess|ifft|ifftn|inv|isdebugmode|issparse|kron|localtime|lookup|lsode|lsode_options|lu|luinc|luupdate|matrix_type|max|min|mktime|pinv|qr|qrdelete|qrinsert|qrshift|qrupdate|quad|quad_options|qz|rand|rande|randg|randn|randp|randperm|rcond|regexp|regexpi|regexprep|schur|setgrent|setpwent|sort|spalloc|sparse|spparms|sprank|sqrtm|strfind|strftime|strptime|strrep|svd|svd_driver|syl|symamd|symbfact|symrcm|time|tsearch|typecast|urlread|urlwrite|abs|acos|acosh|acot|acoth|acsc|acsch|angle|arg|asec|asech|asin|asinh|atan|atanh|beta|betainc|betaln|bincoeff|cbrt|ceil|conj|cos|cosh|cot|coth|csc|csch|erf|erfc|erfcx|erfinv|exp|finite|fix|floor|fmod|gamma|gammainc|gammaln|imag|isalnum|isalpha|isascii|iscntrl|isdigit|isfinite|isgraph|isinf|islower|isna|isnan|isprint|ispunct|isspace|isupper|isxdigit|lcm|lgamma|log|lower|mod|real|rem|round|roundb|sec|sech|sign|sin|sinh|sqrt|tan|tanh|toascii|tolower|xor)\b" is(name.builtin)
|
20
|
+
r"(EDITOR|EXEC_PATH|I|IMAGE_PATH|NA|OCTAVE_HOME|OCTAVE_VERSION|PAGER|PAGER_FLAGS|SEEK_CUR|SEEK_END|SEEK_SET|SIG|S_ISBLK|S_ISCHR|S_ISDIR|S_ISFIFO|S_ISLNK|S_ISREG|S_ISSOCK|WCONTINUE|WCOREDUMP|WEXITSTATUS|WIFCONTINUED|WIFEXITED|WIFSIGNALED|WIFSTOPPED|WNOHANG|WSTOPSIG|WTERMSIG|WUNTRACED)\b" is(name.constant)
|
21
|
+
r"-=|!=|!|/=|--" is(operator)
|
22
|
+
r"-|==|\126=|<|>|<=|>=|&&|&|\126|\|\|?" is(operator)
|
23
|
+
r"\*=|\+=|\^=|\/=|\\=|\*\*|\+\+|\.\*\*" is(operator)
|
24
|
+
r"\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\" is(operator)
|
25
|
+
r"\[|\]|\(|\)|\{|\}|:|@|\.|," is(punctuation)
|
26
|
+
r"=|:|;" is(punctuation)
|
27
|
+
r"\"[^\"]*\"" is(literal.string)
|
28
|
+
r"(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?" is(literal.number.float)
|
29
|
+
r"\d+[eEf][+-]?[0-9]+" is(literal.number.float)
|
30
|
+
r"\d+" is(literal.number.integer)
|
31
|
+
r"(?<=[\w\)\]])\'" is(operator)
|
32
|
+
r"(?<![\w\)\]])\'" is(literal.string) -> go-to(string)
|
33
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name)
|
34
|
+
r"." is(text)
|
35
|
+
|
36
|
+
lex(string):
|
37
|
+
r"[^']*'" is(literal.string) -> pop
|
38
|
+
|
39
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Ooc"
|
6
|
+
aliases: ["ooc"]
|
7
|
+
extensions: [".ooc"]
|
8
|
+
mimetypes: ["text/x-ooc"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(include):
|
13
|
+
r"[\w/]+" is(name)
|
14
|
+
r"," is(punctuation)
|
15
|
+
r"[ \t]" is(text)
|
16
|
+
r"[;\n]" is(text) -> pop
|
17
|
+
|
18
|
+
lex(root):
|
19
|
+
r"\b(class|interface|implement|abstract|extends|from|this|super|new|const|final|static|import|use|extern|inline|proto|break|continue|fallthrough|operator|if|else|for|while|do|switch|case|as|in|version|return|true|false|null)\b" is(keyword)
|
20
|
+
r"include\b" is(keyword) -> go-to(include)
|
21
|
+
r"(cover)([ \t]+)(from)([ \t]+)([a-zA-Z0-9_]+[*@]?)" is(by-groups(keyword, text, keyword, text, name.class))
|
22
|
+
r"(func)((?:[ \t]|\\\n)+)(\126[a-z_][a-zA-Z0-9_]*)" is(by-groups(keyword, text, name.function))
|
23
|
+
r"\bfunc\b" is(keyword)
|
24
|
+
r"//.*" is(comment)
|
25
|
+
r"(?m)/\*.*?\*/" is(comment.multiline)
|
26
|
+
r"(==?|\+=?|-[=>]?|\*=?|/=?|:=|!=?|%=?|\?|>{1,3}=?|<{1,3}=?|\.\.|&&?|\|\|?|\^=?)" is(operator)
|
27
|
+
r"(\.)([ \t]*)([a-z]\w*)" is(by-groups(operator, text, name.function))
|
28
|
+
r"[A-Z][A-Z0-9_]+" is(name.constant)
|
29
|
+
r"[A-Z][a-zA-Z0-9_]*([@*]|\[[ \t]*\])?" is(name.class)
|
30
|
+
r"([a-z][a-zA-Z0-9_]*(?:\126[a-z][a-zA-Z0-9_]*)?)((?:[ \t]|\\\n)*)(?=\()" is(by-groups(name.function, text))
|
31
|
+
r"[a-z][a-zA-Z0-9_]*" is(name.variable)
|
32
|
+
r"[:(){}\[\];,]" is(punctuation)
|
33
|
+
r"0x[0-9a-fA-F]+" is(literal.number.hex)
|
34
|
+
r"0c[0-9]+" is(literal.number.oct)
|
35
|
+
r"0b[01]+" is(literal.number.binary)
|
36
|
+
r"[0-9_]\.[0-9_]*(?!\.)" is(literal.number.float)
|
37
|
+
r"[0-9_]+" is(literal.number.decimal)
|
38
|
+
r"\"(?:\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\\"])*\"" is(literal.string.double)
|
39
|
+
r"'(?:\\.|\\[0-9]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'" is(literal.string.char)
|
40
|
+
r"@" is(punctuation)
|
41
|
+
r"\." is(punctuation)
|
42
|
+
r"\\[ \t\n]" is(text)
|
43
|
+
r"[ \t]+" is(text)
|
44
|
+
|
45
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,153 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Opa"
|
6
|
+
aliases: ["opa"]
|
7
|
+
extensions: [".opa"]
|
8
|
+
mimetypes: ["text/x-opa"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(html-attr):
|
13
|
+
r"\s+" is(text)
|
14
|
+
r"[\w\-:]+=" is(literal.string.single) -> go-to(html-attr-value)
|
15
|
+
r"/>" is(literal.string.single) -> pop
|
16
|
+
r">" is(literal.string.single) -> do-all(pop, go-to(html-content))
|
17
|
+
|
18
|
+
lex(html-open-tag):
|
19
|
+
r"[\w\-:]+" is(literal.string.single) -> do-all(pop, go-to(html-attr))
|
20
|
+
r">" is(literal.string.single) -> do-all(pop, go-to(html-content))
|
21
|
+
|
22
|
+
lex(html-content):
|
23
|
+
r"<!--" is(comment) -> go-to(html-comment)
|
24
|
+
r"</" is(literal.string.single) -> do-all(pop, go-to(html-end-tag))
|
25
|
+
r"<" is(literal.string.single) -> go-to(html-open-tag)
|
26
|
+
r"{" is(operator) -> go-to(root)
|
27
|
+
r"[^<{]+" is(literal.string.single)
|
28
|
+
|
29
|
+
lex(string):
|
30
|
+
r"[^\\\"{]+" is(literal.string.double)
|
31
|
+
r"\"" is(literal.string.double) -> pop
|
32
|
+
r"{" is(operator) -> go-to(root)
|
33
|
+
any-of(escape-sequence)
|
34
|
+
|
35
|
+
lex(html-attr-value):
|
36
|
+
r"'" is(literal.string.single) -> do-all(pop, go-to(single-string))
|
37
|
+
r"\"" is(literal.string.single) -> do-all(pop, go-to(string))
|
38
|
+
r"\#(([a-zA-Z_]\w*)|(`[^`]*`))" is(literal.string.single) -> pop
|
39
|
+
r"\#(?={)" is(literal.string.single) -> do-all(pop, go-to(root))
|
40
|
+
r"[^\"\'{`=<>]+" is(literal.string.single) -> pop
|
41
|
+
r"{" is(operator) -> do-all(pop, go-to(root))
|
42
|
+
|
43
|
+
lex(type-tuple):
|
44
|
+
any-of(comments-and-spaces)
|
45
|
+
r"[^\(\)/*]+" is(keyword.type)
|
46
|
+
r"[/*]" is(keyword.type)
|
47
|
+
r"\(" is(keyword.type) -> push
|
48
|
+
r"\)" is(keyword.type) -> pop
|
49
|
+
|
50
|
+
lex(html-comment):
|
51
|
+
r"-->" is(comment) -> pop
|
52
|
+
r"[^\-]+|-" is(comment)
|
53
|
+
|
54
|
+
lex(comments-and-spaces):
|
55
|
+
any-of(comments)
|
56
|
+
r"\s+" is(text)
|
57
|
+
|
58
|
+
lex(nested-comment):
|
59
|
+
r"[^/*]+" is(comment)
|
60
|
+
r"/\*" is(comment) -> push
|
61
|
+
r"\*/" is(comment) -> pop
|
62
|
+
r"[/*]" is(comment)
|
63
|
+
|
64
|
+
lex(type-lhs-1):
|
65
|
+
any-of(comments-and-spaces)
|
66
|
+
r"->" is(keyword.type) -> do-all(pop, go-to(type))
|
67
|
+
r"(?=,)" is(keyword.type) -> do-all(pop, go-to(type-arrow))
|
68
|
+
r"" is(keyword.type) -> pop
|
69
|
+
|
70
|
+
lex(escape-sequence):
|
71
|
+
r"\\[\\\\"\'ntr}]" is(literal.string.escape)
|
72
|
+
r"\\[0-9]{3}" is(literal.string.escape)
|
73
|
+
r"\\x[0-9a-fA-F]{2}" is(literal.string.escape)
|
74
|
+
|
75
|
+
lex(type-arrow):
|
76
|
+
any-of(comments-and-spaces)
|
77
|
+
r",(?=[^:]*?->)" is(keyword.type) -> go-to(type-with-slash)
|
78
|
+
r"->" is(keyword.type) -> do-all(pop, go-to(type))
|
79
|
+
r"" is(keyword.type) -> pop
|
80
|
+
|
81
|
+
lex(type-record):
|
82
|
+
any-of(comments-and-spaces)
|
83
|
+
r"[^{}/*]+" is(keyword.type)
|
84
|
+
r"[/*]" is(keyword.type)
|
85
|
+
r"{" is(keyword.type) -> push
|
86
|
+
r"}" is(keyword.type) -> pop
|
87
|
+
|
88
|
+
lex(comments):
|
89
|
+
r"/\*" is(comment) -> go-to(nested-comment)
|
90
|
+
r"//.*?$" is(comment)
|
91
|
+
|
92
|
+
lex(slash-type-1):
|
93
|
+
any-of(comments-and-spaces)
|
94
|
+
r"/" is(keyword.type) -> do-all(pop, go-to(type-1))
|
95
|
+
r"" is(keyword.type) -> pop
|
96
|
+
|
97
|
+
lex(type):
|
98
|
+
any-of(comments-and-spaces)
|
99
|
+
r"->" is(keyword.type)
|
100
|
+
r"" is(keyword.type) -> do-all(pop, go-to(type-lhs-1), go-to(type-with-slash))
|
101
|
+
|
102
|
+
lex(type-1):
|
103
|
+
any-of(comments-and-spaces)
|
104
|
+
r"\(" is(keyword.type) -> do-all(pop, go-to(type-tuple))
|
105
|
+
r"\126?{" is(keyword.type) -> do-all(pop, go-to(type-record))
|
106
|
+
r"(([a-zA-Z_]\w*)|(`[^`]*`))\(" is(keyword.type) -> do-all(pop, go-to(type-tuple))
|
107
|
+
r"(([a-zA-Z_]\w*)|(`[^`]*`))" is(keyword.type) -> pop
|
108
|
+
r"'(([a-zA-Z_]\w*)|(`[^`]*`))" is(keyword.type)
|
109
|
+
r"" is(keyword.type) -> pop
|
110
|
+
|
111
|
+
lex(root):
|
112
|
+
any-of(comments-and-spaces)
|
113
|
+
r"\b(and|as|begin|css|database|db|do|else|end|external|forall|if|import|match|package|parser|rec|server|then|type|val|with|xml_parser)\b" is(keyword)
|
114
|
+
r"@(([a-zA-Z_]\w*)|(`[^`]*`))\b" is(name.builtin.pseudo)
|
115
|
+
r"-?.[\d]+([eE][+\-]?\d+)" is(literal.number.float)
|
116
|
+
r"-?\d+.\d*([eE][+\-]?\d+)" is(literal.number.float)
|
117
|
+
r"-?\d+[eE][+\-]?\d+" is(literal.number.float)
|
118
|
+
r"0[xX][\da-fA-F]+" is(literal.number.hex)
|
119
|
+
r"0[oO][0-7]+" is(literal.number.oct)
|
120
|
+
r"0[bB][01]+" is(literal.number.binary)
|
121
|
+
r"\d+" is(literal.number.integer)
|
122
|
+
r"\#[\da-fA-F]{3,6}" is(literal.number.integer)
|
123
|
+
r"\"" is(literal.string.double) -> go-to(string)
|
124
|
+
r"'(?:(\\[\\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2})|.)'" is(literal.string.char)
|
125
|
+
r"{" is(operator) -> push
|
126
|
+
r"}" is(operator) -> pop
|
127
|
+
r"<(?=[a-zA-Z>])" is(literal.string.single) -> go-to(html-open-tag)
|
128
|
+
r"[@?!]?(/\w+)+(\[_\])?" is(name.variable)
|
129
|
+
r"<-(?![.=\-<>,@\126%/+?*&^!])" is(name.variable)
|
130
|
+
r"\b([A-Z]\w*)(?=\.)" is(name.namespace)
|
131
|
+
r"=(?![.=\-<>,@\126%/+?*&^!])" is(keyword)
|
132
|
+
r"([.=\-<>,@\126%/+?*&^!])+" is(operator)
|
133
|
+
r"([()\[\],;|])+" is(operator)
|
134
|
+
r":" is(operator) -> go-to(type)
|
135
|
+
r"'(([a-zA-Z_]\w*)|(`[^`]*`))" is(keyword.type)
|
136
|
+
r"\#(([a-zA-Z_]\w*)|(`[^`]*`))" is(literal.string.single)
|
137
|
+
r"\#(?={)" is(literal.string.single)
|
138
|
+
r"(([a-zA-Z_]\w*)|(`[^`]*`))" is(text)
|
139
|
+
|
140
|
+
lex(html-end-tag):
|
141
|
+
r"[\w\-:]*>" is(literal.string.single) -> pop
|
142
|
+
|
143
|
+
lex(type-with-slash):
|
144
|
+
any-of(comments-and-spaces)
|
145
|
+
r"" is(keyword.type) -> do-all(pop, go-to(slash-type-1), go-to(type-1))
|
146
|
+
|
147
|
+
lex(single-string):
|
148
|
+
r"[^\\\'{]+" is(literal.string.double)
|
149
|
+
r"\'" is(literal.string.double) -> pop
|
150
|
+
r"{" is(operator) -> go-to(root)
|
151
|
+
any-of(escape-sequence)
|
152
|
+
|
153
|
+
const-set(.Lexer, lexer)
|