broomhlda 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,17 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "DylanLID"
|
6
|
+
aliases: ["dylan-lid", "lid"]
|
7
|
+
extensions: [".lid", ".hdp"]
|
8
|
+
mimetypes: ["text/x-dylan-lid"]
|
9
|
+
start: .root
|
10
|
+
flags: Regexp IGNORECASE
|
11
|
+
|
12
|
+
lex(root):
|
13
|
+
r"\s+" is(text)
|
14
|
+
r"//.*?\n" is(comment.single)
|
15
|
+
r"(.*?)(:)([ \t]*)(.*(?:\n[ \t].+)*)" is(by-groups(name.attribute, operator, text, literal.string))
|
16
|
+
|
17
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "ECL"
|
6
|
+
aliases: ["ecl"]
|
7
|
+
extensions: [".ecl"]
|
8
|
+
mimetypes: ["application/x-ecl"]
|
9
|
+
start: .root
|
10
|
+
flags: Regexp IGNORECASE
|
11
|
+
|
12
|
+
lex(functions):
|
13
|
+
r"(ABS|ACOS|ALLNODES|ASCII|ASIN|ASSTRING|ATAN|ATAN2|AVE|CASE|CHOOSE|CHOOSEN|CHOOSESETS|CLUSTERSIZE|COMBINE|CORRELATION|COS|COSH|COUNT|COVARIANCE|CRON|DATASET|DEDUP|DEFINE|DENORMALIZE|DISTRIBUTE|DISTRIBUTED|DISTRIBUTION|EBCDIC|ENTH|ERROR|EVALUATE|EVENT|EVENTEXTRA|EVENTNAME|EXISTS|EXP|FAILCODE|FAILMESSAGE|FETCH|FROMUNICODE|GETISVALID|GLOBAL|GRAPH|GROUP|HASH|HASH32|HASH64|HASHCRC|HASHMD5|HAVING|IF|INDEX|INTFORMAT|ISVALID|ITERATE|JOIN|KEYUNICODE|LENGTH|LIBRARY|LIMIT|LN|LOCAL|LOG|LOOP|MAP|MATCHED|MATCHLENGTH|MATCHPOSITION|MATCHTEXT|MATCHUNICODE|MAX|MERGE|MERGEJOIN|MIN|NOLOCAL|NONEMPTY|NORMALIZE|PARSE|PIPE|POWER|PRELOAD|PROCESS|PROJECT|PULL|RANDOM|RANGE|RANK|RANKED|REALFORMAT|RECORDOF|REGEXFIND|REGEXREPLACE|REGROUP|REJECTED|ROLLUP|ROUND|ROUNDUP|ROW|ROWDIFF|SAMPLE|SET|SIN|SINH|SIZEOF|SOAPCALL|SORT|SORTED|SQRT|STEPPED|STORED|SUM|TABLE|TAN|TANH|THISNODE|TOPN|TOUNICODE|TRANSFER|TRIM|TRUNCATE|TYPEOF|UNGROUP|UNICODEORDER|VARIANCE|WHICH|WORKUNIT|XMLDECODE|XMLENCODE|XMLTEXT|XMLUNICODE)\b" is(name.function)
|
14
|
+
|
15
|
+
lex(statements):
|
16
|
+
any-of(types)
|
17
|
+
any-of(keywords)
|
18
|
+
any-of(functions)
|
19
|
+
any-of(hash)
|
20
|
+
r"\"" is(literal.string) -> go-to(string)
|
21
|
+
r"\'" is(literal.string) -> go-to(string)
|
22
|
+
r"(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*" is(literal.number.float)
|
23
|
+
r"(\d+\.\d*|\.\d+|\d+[fF])[fF]?" is(literal.number.float)
|
24
|
+
r"0x[0-9a-fA-F]+[LlUu]*" is(literal.number.hex)
|
25
|
+
r"0[0-7]+[LlUu]*" is(literal.number.oct)
|
26
|
+
r"\d+[LlUu]*" is(literal.number.integer)
|
27
|
+
r"\*/" is(error)
|
28
|
+
r"[\126!%^&*+=|?:<>/-]+" is(operator)
|
29
|
+
r"[{}()\[\],.;]" is(punctuation)
|
30
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name)
|
31
|
+
|
32
|
+
lex(whitespace):
|
33
|
+
r"\s+" is(text)
|
34
|
+
r"\/\/.*" is(comment.single)
|
35
|
+
r"/(\\\n)?\*(.|\n)*?\*(\\\n)?/" is(comment.multiline)
|
36
|
+
|
37
|
+
lex(keywords):
|
38
|
+
r"(APPLY|ASSERT|BUILD|BUILDINDEX|EVALUATE|FAIL|KEYDIFF|KEYPATCH|LOADXML|NOTHOR|NOTIFY|OUTPUT|PARALLEL|SEQUENTIAL|SOAPCALL|WAITCHECKPOINT|DEPRECATED|FAILCODE|FAILMESSAGE|FAILURE|GLOBAL|INDEPENDENT|ONWARNING|PERSIST|PRIORITY|RECOVERY|STORED|SUCCESS|WAIT|WHEN)\b" is(keyword.reserved)
|
39
|
+
r"(ALL|AND|ANY|AS|ATMOST|BEFORE|BEGINC\+\+|BEST|BETWEEN|CASE|CONST|COUNTER|CSV|DESCEND|ENCRYPT|ENDC\+\+|ENDMACRO|EXCEPT|EXCLUSIVE|EXPIRE|EXPORT|EXTEND|FALSE|FEW|FIRST|FLAT|FULL|FUNCTION|GROUP|HEADER|HEADING|HOLE|IFBLOCK|IMPORT|IN|JOINED|KEEP|KEYED|LAST|LEFT|LIMIT|LOAD|LOCAL|LOCALE|LOOKUP|MACRO|MANY|MAXCOUNT|MAXLENGTH|MIN SKEW|MODULE|INTERFACE|NAMED|NOCASE|NOROOT|NOSCAN|NOSORT|NOT|OF|ONLY|OPT|OR|OUTER|OVERWRITE|PACKED|PARTITION|PENALTY|PHYSICALLENGTH|PIPE|QUOTE|RELATIONSHIP|REPEAT|RETURN|RIGHT|SCAN|SELF|SEPARATOR|SERVICE|SHARED|SKEW|SKIP|SQL|STORE|TERMINATOR|THOR|THRESHOLD|TOKEN|TRANSFORM|TRIM|TRUE|TYPE|UNICODEORDER|UNSORTED|VALIDATE|VIRTUAL|WHOLE|WILD|WITHIN|XML|XPATH|__COMPRESSED__)\b" is(keyword.reserved)
|
40
|
+
|
41
|
+
lex(hash):
|
42
|
+
r"^\#.*$" is(comment.preproc)
|
43
|
+
|
44
|
+
lex(root):
|
45
|
+
any-of(whitespace)
|
46
|
+
any-of(statements)
|
47
|
+
|
48
|
+
lex(types):
|
49
|
+
r"(RECORD|END)\D" is(keyword.declaration)
|
50
|
+
r"((?:ASCII|BIG_ENDIAN|BOOLEAN|DATA|DECIMAL|EBCDIC|INTEGER|PATTERN|QSTRING|REAL|RECORD|RULE|SET OF|STRING|TOKEN|UDECIMAL|UNICODE|UNSIGNED|VARSTRING|VARUNICODE)\d*)(\s+)" is(by-groups(keyword.type, text))
|
51
|
+
|
52
|
+
lex(string):
|
53
|
+
r"\"" is(literal.string) -> pop
|
54
|
+
r"\'" is(literal.string) -> pop
|
55
|
+
r"[^\"\']+" is(literal.string)
|
56
|
+
|
57
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,93 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Elixir"
|
6
|
+
aliases: ["elixir", "ex", "exs"]
|
7
|
+
extensions: [".ex", ".exs"]
|
8
|
+
mimetypes: ["text/x-elixir"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(enddoublestr):
|
13
|
+
any-of(interpoling)
|
14
|
+
r"[^\#\"]+" is(literal.string.double)
|
15
|
+
|
16
|
+
lex(interpoling-symbol):
|
17
|
+
r"\"" is(literal.string.symbol) -> pop
|
18
|
+
any-of(interpoling)
|
19
|
+
r"[^\#\"]+" is(literal.string.symbol)
|
20
|
+
|
21
|
+
lex(sbno-intp):
|
22
|
+
r".*\][a-z]*" is(literal.string.double) -> pop
|
23
|
+
|
24
|
+
lex(sbintp):
|
25
|
+
r"\][a-z]*" is(literal.string.double) -> pop
|
26
|
+
any-of(enddoublestr)
|
27
|
+
|
28
|
+
lex(interpoling-string):
|
29
|
+
r"}" is(literal.string.interpol) -> pop
|
30
|
+
any-of(root)
|
31
|
+
|
32
|
+
lex(dqs):
|
33
|
+
r"\"" is(literal.string.double) -> pop
|
34
|
+
any-of(enddoublestr)
|
35
|
+
|
36
|
+
lex(paintp):
|
37
|
+
r"\)[a-z]*" is(literal.string.double) -> pop
|
38
|
+
any-of(enddoublestr)
|
39
|
+
|
40
|
+
lex(ltintp):
|
41
|
+
r"\>[a-z]*" is(literal.string.double) -> pop
|
42
|
+
any-of(enddoublestr)
|
43
|
+
|
44
|
+
lex(cbintp):
|
45
|
+
r"\}[a-z]*" is(literal.string.double) -> pop
|
46
|
+
any-of(enddoublestr)
|
47
|
+
|
48
|
+
lex(pano-intp):
|
49
|
+
r".*\)[a-z]*" is(literal.string.double) -> pop
|
50
|
+
|
51
|
+
lex(interpoling):
|
52
|
+
r"\#{" is(literal.string.interpol) -> go-to(interpoling-string)
|
53
|
+
|
54
|
+
lex(cbno-intp):
|
55
|
+
r".*\}[a-z]*" is(literal.string.double) -> pop
|
56
|
+
|
57
|
+
lex(root):
|
58
|
+
r"\s+" is(text)
|
59
|
+
r"\#.*$" is(comment.single)
|
60
|
+
r"\b(case|cond|end|bc|lc|if|unless|try|loop|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defmacrop?|defdelegate|defexception|exit|raise|throw|unless|after|rescue|catch|else)\b(?![?!])|(?<!\.)\b(do|\-\>)\b\s*" is(keyword)
|
61
|
+
r"\b(import|require|use|recur|quote|unquote|super|refer)\b(?![?!])" is(keyword.namespace)
|
62
|
+
r"(?<!\.)\b(and|not|or|when|xor|in)\b" is(operator.word)
|
63
|
+
r"%=|\*=|\*\*=|\+=|\-=|\^=|\|\|=|<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=\126|!=|!\126|(?=[ \t])\?|(?<=[ \t])!+|&&|\|\||\^|\*|\+|\-|/|\||\+\+|\-\-|\*\*|\/\/|\<\-|\<\>|<<|>>|=|\." is(operator)
|
64
|
+
r"(?<!:)(:)([a-zA-Z_]\w*([?!]|=(?![>=]))?|\<\>|===?|>=?|<=?|<=>|&&?|%\(\)|%\[\]|%\{\}|\+\+?|\-\-?|\|\|?|\!|//|[%&`/\|]|\*\*?|=?\126|<\-)|([a-zA-Z_]\w*([?!])?)(:)(?!:)" is(literal.string.symbol)
|
65
|
+
r":\"" is(literal.string.symbol) -> go-to(interpoling-symbol)
|
66
|
+
r"\b(nil|true|false)\b(?![?!])|\b[A-Z]\w*\b" is(name.constant)
|
67
|
+
r"\b(__(FILE|LINE|MODULE|MAIN|FUNCTION)__)\b(?![?!])" is(name.builtin.pseudo)
|
68
|
+
r"[a-zA-Z_!][\w_]*[!\?]?" is(name)
|
69
|
+
r"[(){};,/\|:\\\[\]]" is(punctuation)
|
70
|
+
r"@[a-zA-Z_]\w*|&\d" is(name.variable)
|
71
|
+
r"\b(0[xX][0-9A-Fa-f]+|\d(_?\d)*(\.(?![^\d\s])(_?\d)*)?([eE][-+]?\d(_?\d)*)?|0[bB][01]+)\b" is(literal.number)
|
72
|
+
r"%r\/.*\/" is(literal.string.regex)
|
73
|
+
any-of(strings)
|
74
|
+
|
75
|
+
lex(strings):
|
76
|
+
r"(%[A-Ba-z])?\"\"\"(?:.|\n)*?\"\"\"" is(literal.string.doc)
|
77
|
+
r"'''(?:.|\n)*?'''" is(literal.string.doc)
|
78
|
+
r"\"" is(literal.string.double) -> go-to(dqs)
|
79
|
+
r"'.*'" is(literal.string.single)
|
80
|
+
r"(?<!\w)\?(\\(x\d{1,2}|\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b|[^x0MC])|(\\[MC]-)+\w|[^\s\\])" is(literal.string.other)
|
81
|
+
r"%[a-z]\{" is(literal.string.double) -> go-to(cbintp)
|
82
|
+
r"%[A-Z]\{" is(literal.string.double) -> go-to(cbno-intp)
|
83
|
+
r"%[a-z]\[" is(literal.string.double) -> go-to(sbintp)
|
84
|
+
r"%[A-Z]\[" is(literal.string.double) -> go-to(sbno-intp)
|
85
|
+
r"%[a-z]\(" is(literal.string.double) -> go-to(paintp)
|
86
|
+
r"%[A-Z]\(" is(literal.string.double) -> go-to(pano-intp)
|
87
|
+
r"%[a-z]\<" is(literal.string.double) -> go-to(ltintp)
|
88
|
+
r"%[A-Z]\<" is(literal.string.double) -> go-to(ltno-intp)
|
89
|
+
|
90
|
+
lex(ltno-intp):
|
91
|
+
r".*\>[a-z]*" is(literal.string.double) -> pop
|
92
|
+
|
93
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Erlang"
|
6
|
+
aliases: ["erlang"]
|
7
|
+
extensions: [".erl", ".hrl", ".es", ".escript"]
|
8
|
+
mimetypes: ["text/x-erlang"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(root):
|
13
|
+
r"\s+" is(text)
|
14
|
+
r"%.*\n" is(comment)
|
15
|
+
r"(after|begin|case|catch|cond|end|fun|if|let|of|query|receive|try|when)\b" is(keyword)
|
16
|
+
r"(abs|append_element|apply|atom_to_list|binary_to_list|bitstring_to_list|binary_to_term|bit_size|bump_reductions|byte_size|cancel_timer|check_process_code|delete_module|demonitor|disconnect_node|display|element|erase|exit|float|float_to_list|fun_info|fun_to_list|function_exported|garbage_collect|get|get_keys|group_leader|hash|hd|integer_to_list|iolist_to_binary|iolist_size|is_atom|is_binary|is_bitstring|is_boolean|is_builtin|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_process_alive|is_record|is_reference|is_tuple|length|link|list_to_atom|list_to_binary|list_to_bitstring|list_to_existing_atom|list_to_float|list_to_integer|list_to_pid|list_to_tuple|load_module|localtime_to_universaltime|make_tuple|md5|md5_final|md5_update|memory|module_loaded|monitor|monitor_node|node|nodes|open_port|phash|phash2|pid_to_list|port_close|port_command|port_connect|port_control|port_call|port_info|port_to_list|process_display|process_flag|process_info|purge_module|put|read_timer|ref_to_list|register|resume_process|round|send|send_after|send_nosuspend|set_cookie|setelement|size|spawn|spawn_link|spawn_monitor|spawn_opt|split_binary|start_timer|statistics|suspend_process|system_flag|system_info|system_monitor|system_profile|term_to_binary|tl|trace|trace_delivered|trace_info|trace_pattern|trunc|tuple_size|tuple_to_list|universaltime_to_localtime|unlink|unregister|whereis)\b" is(name.builtin)
|
17
|
+
r"(and|andalso|band|bnot|bor|bsl|bsr|bxor|div|not|or|orelse|rem|xor)\b" is(operator.word)
|
18
|
+
r"^-" is(punctuation) -> go-to(directive)
|
19
|
+
r"(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)" is(operator)
|
20
|
+
r"\"" is(literal.string) -> go-to(string)
|
21
|
+
r"<<" is(name.label)
|
22
|
+
r">>" is(name.label)
|
23
|
+
r"((?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]'))(:)" is(by-groups(name.namespace, punctuation))
|
24
|
+
r"(?:^|(?<=:))((?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]'))(\s*)(\()" is(by-groups(name.function, text, punctuation))
|
25
|
+
r"[+-]?(?:[2-9]|[12][0-9]|3[0-6])\#[0-9a-zA-Z]+" is(literal.number.integer)
|
26
|
+
r"[+-]?\d+" is(literal.number.integer)
|
27
|
+
r"[+-]?\d+.\d+" is(literal.number.float)
|
28
|
+
r"[\]\[:_@\\".{}()|;,]" is(punctuation)
|
29
|
+
r"(?:[A-Z_][a-zA-Z0-9_]*)" is(name.variable)
|
30
|
+
r"(?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]')" is(name)
|
31
|
+
r"\?(?:(?:[A-Z_][a-zA-Z0-9_]*)|(?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]'))" is(name.constant)
|
32
|
+
r"\$(?:(?:\\(?:[bdefnrstv\'\"\\/]|[0-7][0-7]?[0-7]?|\^[a-zA-Z]))|\\[ %]|[^\\])" is(literal.string.char)
|
33
|
+
r"\#(?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]')(:?\.(?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]'))?" is(name.label)
|
34
|
+
|
35
|
+
lex(string):
|
36
|
+
r"(?:\\(?:[bdefnrstv\'\"\\/]|[0-7][0-7]?[0-7]?|\^[a-zA-Z]))" is(literal.string.escape)
|
37
|
+
r"\"" is(literal.string) -> pop
|
38
|
+
r"\126[0-9.*]*[\126\#+bBcdefginpPswWxX]" is(literal.string.interpol)
|
39
|
+
r"[^\"\\\126]+" is(literal.string)
|
40
|
+
r"\126" is(literal.string)
|
41
|
+
|
42
|
+
lex(directive):
|
43
|
+
r"(define)(\s*)(\()((?:(?:[A-Z_][a-zA-Z0-9_]*)|(?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]')))" is(by-groups(name.entity, text, punctuation, name.constant)) -> pop
|
44
|
+
r"(record)(\s*)(\()((?:(?:[A-Z_][a-zA-Z0-9_]*)|(?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]')))" is(by-groups(name.entity, text, punctuation, name.label)) -> pop
|
45
|
+
r"(?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]')" is(name.entity) -> pop
|
46
|
+
|
47
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,89 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Factor"
|
6
|
+
aliases: ["factor"]
|
7
|
+
extensions: [".factor"]
|
8
|
+
mimetypes: ["text/x-factor"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(stackeffect):
|
13
|
+
r"\s*\(" is(name.function) -> go-to(stackeffect)
|
14
|
+
r"\)" is(name.function) -> pop
|
15
|
+
r"\-\-" is(name.function)
|
16
|
+
r"\s+" is(text)
|
17
|
+
r"\S+" is(name.variable)
|
18
|
+
|
19
|
+
lex(import):
|
20
|
+
r";" is(keyword) -> pop
|
21
|
+
r"\S+" is(name.namespace)
|
22
|
+
r"\s+" is(text)
|
23
|
+
|
24
|
+
lex(slots):
|
25
|
+
r"\s+" is(text)
|
26
|
+
r";\s" is(keyword) -> pop
|
27
|
+
r"\S+" is(name.variable)
|
28
|
+
|
29
|
+
lex(root):
|
30
|
+
r"(\s*)(:|::|MACRO:|MEMO:)(\s+)(\S+)" is(by-groups(text, keyword, text, name.function))
|
31
|
+
r"(\s*)(M:)(\s+)(\S+)(\s+)(\S+)" is(by-groups(text, keyword, text, name.class, text, name.function))
|
32
|
+
r"(\s*)(GENERIC:)(\s+)(\S+)" is(by-groups(text, keyword, text, name.function))
|
33
|
+
r"(\s*)(HOOK:|GENERIC\#)(\s+)(\S+)(\s+)(\S+)" is(by-groups(text, keyword, text, name.function, text, name.function))
|
34
|
+
r"(\()(\s+)" is(by-groups(name.function, text)) -> go-to(stackeffect)
|
35
|
+
r"\;\s" is(keyword)
|
36
|
+
r"(USING:)((?:\s|\\\s)+)" is(by-groups(keyword.namespace, text)) -> go-to(import)
|
37
|
+
r"(USE:)(\s+)(\S+)" is(by-groups(keyword.namespace, text, name.namespace))
|
38
|
+
r"(UNUSE:)(\s+)(\S+)" is(by-groups(keyword.namespace, text, name.namespace))
|
39
|
+
r"(QUALIFIED:)(\s+)(\S+)" is(by-groups(keyword.namespace, text, name.namespace))
|
40
|
+
r"(QUALIFIED-WITH:)(\s+)(\S+)" is(by-groups(keyword.namespace, text, name.namespace))
|
41
|
+
r"(FROM:|EXCLUDE:)(\s+)(\S+)(\s+)(=>)" is(by-groups(keyword.namespace, text, name.namespace, text, text))
|
42
|
+
r"(IN:)(\s+)(\S+)" is(by-groups(keyword.namespace, text, name.namespace))
|
43
|
+
r"(?:ALIAS|DEFER|FORGET|POSTPONE):" is(keyword.namespace)
|
44
|
+
r"(TUPLE:)(\s+)(\S+)(\s+<\s+)(\S+)" is(by-groups(keyword, text, name.class, text, name.class)) -> go-to(slots)
|
45
|
+
r"(TUPLE:)(\s+)(\S+)" is(by-groups(keyword, text, name.class)) -> go-to(slots)
|
46
|
+
r"(UNION:)(\s+)(\S+)" is(by-groups(keyword, text, name.class))
|
47
|
+
r"(INTERSECTION:)(\s+)(\S+)" is(by-groups(keyword, text, name.class))
|
48
|
+
r"(PREDICATE:)(\s+)(\S+)(\s+<\s+)(\S+)" is(by-groups(keyword, text, name.class, text, name.class))
|
49
|
+
r"(C:)(\s+)(\S+)(\s+)(\S+)" is(by-groups(keyword, text, name.function, text, name.class))
|
50
|
+
r"INSTANCE:" is(keyword)
|
51
|
+
r"SLOT:" is(keyword)
|
52
|
+
r"MIXIN:" is(keyword)
|
53
|
+
r"(?:SINGLETON|SINGLETONS):" is(keyword)
|
54
|
+
r"CONSTANT:" is(keyword)
|
55
|
+
r"(?:SYMBOL|SYMBOLS):" is(keyword)
|
56
|
+
r"ERROR:" is(keyword)
|
57
|
+
r"SYNTAX:" is(keyword)
|
58
|
+
r"(HELP:)(\s+)(\S+)" is(by-groups(keyword, text, name.function))
|
59
|
+
r"(MAIN:)(\s+)(\S+)" is(by-groups(keyword.namespace, text, name.function))
|
60
|
+
r"(?:ALIEN|TYPEDEF|FUNCTION|STRUCT):" is(keyword)
|
61
|
+
r"(?:<PRIVATE|PRIVATE>)" is(keyword.namespace)
|
62
|
+
r"\"\"\"\s+(?:.|\n)*?\s+\"\"\"" is(literal.string)
|
63
|
+
r"\"(?:\\\\|\\\"|[^\"])*\"" is(literal.string)
|
64
|
+
r"CHAR:\s+(\\[\\abfnrstv]*|\S)\s" is(literal.string.char)
|
65
|
+
r"\!\s+.*$" is(comment)
|
66
|
+
r"\#\!\s+.*$" is(comment)
|
67
|
+
r"(t|f)\s" is(name.constant)
|
68
|
+
r"-?\d+\.\d+\s" is(literal.number.float)
|
69
|
+
r"-?\d+\s" is(literal.number.integer)
|
70
|
+
r"HEX:\s+[a-fA-F\d]+\s" is(literal.number.hex)
|
71
|
+
r"BIN:\s+[01]+\s" is(literal.number.integer)
|
72
|
+
r"OCT:\s+[0-7]+\s" is(literal.number.oct)
|
73
|
+
r"[-+/*=<>^]\s" is(operator)
|
74
|
+
r"(?:deprecated|final|foldable|flushable|inline|recursive)\s" is(keyword)
|
75
|
+
r"(?:or|2bi|2tri|while|wrapper|nip|4dip|wrapper\\?|bi\\*|callstack>array|both\\?|hashcode|die|dupd|callstack|callstack\\?|3dup|tri@|pick|curry|build|\\?execute|3bi|prepose|>boolean|\\?if|clone|eq\\?|tri\\*|\\?|=|swapd|2over|2keep|3keep|clear|2dup|when|not|tuple\\?|dup|2bi\\*|2tri\\*|call|tri-curry|object|bi@|do|unless\\*|if\\*|loop|bi-curry\\*|drop|when\\*|assert=|retainstack|assert\\?|-rot|execute|2bi@|2tri@|boa|with|either\\?|3drop|bi|curry\\?|datastack|until|3dip|over|3curry|tri-curry\\*|tri-curry@|swap|and|2nip|throw|bi-curry|\\(clone\\)|hashcode\\*|compose|2dip|if|3tri|unless|compose\\?|tuple|keep|2curry|equal\\?|assert|tri|2drop|most|<wrapper>|boolean\\?|identity-hashcode|identity-tuple\\?|null|new|dip|bi-curry@|rot|xor|identity-tuple|boolean)\s" is(name.builtin)
|
76
|
+
r"(?:\\?at|assoc\\?|assoc-clone-like|assoc=|delete-at\\*|assoc-partition|extract-keys|new-assoc|value\\?|assoc-size|map>assoc|push-at|assoc-like|key\\?|assoc-intersect|assoc-refine|update|assoc-union|assoc-combine|at\\*|assoc-empty\\?|at\\+|set-at|assoc-all\\?|assoc-subset\\?|assoc-hashcode|change-at|assoc-each|assoc-diff|zip|values|value-at|rename-at|inc-at|enum\\?|at|cache|assoc>map|<enum>|assoc|assoc-map|enum|value-at\\*|assoc-map-as|>alist|assoc-filter-as|clear-assoc|assoc-stack|maybe-set-at|substitute|assoc-filter|2cache|delete-at|assoc-find|keys|assoc-any\\?|unzip)\s" is(name.builtin)
|
77
|
+
r"(?:case|execute-effect|no-cond|no-case\\?|3cleave>quot|2cleave|cond>quot|wrong-values\\?|no-cond\\?|cleave>quot|no-case|case>quot|3cleave|wrong-values|to-fixed-point|alist>quot|case-find|cond|cleave|call-effect|2cleave>quot|recursive-hashcode|linear-case-quot|spread|spread>quot)\s" is(name.builtin)
|
78
|
+
r"(?:number=|if-zero|next-power-of-2|each-integer|\\?1\\+|fp-special\\?|imaginary-part|unless-zero|float>bits|number\\?|fp-infinity\\?|bignum\\?|fp-snan\\?|denominator|fp-bitwise=|\\*|\\+|power-of-2\\?|-|u>=|/|>=|bitand|log2-expects-positive|<|log2|>|integer\\?|number|bits>double|2/|zero\\?|(find-integer)|bits>float|float\\?|shift|ratio\\?|even\\?|ratio|fp-sign|bitnot|>fixnum|complex\\?|/i|/f|byte-array>bignum|when-zero|sgn|>bignum|next-float|u<|u>|mod|recip|rational|find-last-integer|>float|(all-integers\\?)|2^|times|integer|fixnum\\?|neg|fixnum|sq|bignum|(each-integer)|bit\\?|fp-qnan\\?|find-integer|complex|<fp-nan>|real|double>bits|bitor|rem|fp-nan-payload|all-integers\\?|real-part|log2-expects-positive\\?|prev-float|align|unordered\\?|float|fp-nan\\?|abs|bitxor|u<=|odd\\?|<=|/mod|rational\\?|>integer|real\\?|numerator)\s" is(name.builtin)
|
79
|
+
r"(?:member-eq\\?|append|assert-sequence=|find-last-from|trim-head-slice|clone-like|3sequence|assert-sequence\\?|map-as|last-index-from|reversed|index-from|cut\\*|pad-tail|remove-eq!|concat-as|but-last|snip|trim-tail|nths|nth|2selector|sequence|slice\\?|<slice>|partition|remove-nth|tail-slice|empty\\?|tail\\*|if-empty|find-from|virtual-sequence\\?|member\\?|set-length|drop-prefix|unclip|unclip-last-slice|iota|map-sum|bounds-error\\?|sequence-hashcode-step|selector-for|accumulate-as|map|start|midpoint@|\\(accumulate\\)|rest-slice|prepend|fourth|sift|accumulate!|new-sequence|follow|map!|like|first4|1sequence|reverse|slice|unless-empty|padding|virtual@|repetition\\?|set-last|index|4sequence|max-length|set-second|immutable-sequence|first2|first3|replicate-as|reduce-index|unclip-slice|supremum|suffix!|insert-nth|trim-tail-slice|tail|3append|short|count|suffix|concat|flip|filter|sum|immutable\\?|reverse!|2sequence|map-integers|delete-all|start\\*|indices|snip-slice|check-slice|sequence\\?|head|map-find|filter!|append-as|reduce|sequence=|halves|collapse-slice|interleave|2map|filter-as|binary-reduce|slice-error\\?|product|bounds-check\\?|bounds-check|harvest|immutable|virtual-exemplar|find|produce|remove|pad-head|last|replicate|set-fourth|remove-eq|shorten|reversed\\?|map-find-last|3map-as|2unclip-slice|shorter\\?|3map|find-last|head-slice|pop\\*|2map-as|tail-slice\\*|but-last-slice|2map-reduce|iota\\?|collector-for|accumulate|each|selector|append!|new-resizable|cut-slice|each-index|head-slice\\*|2reverse-each|sequence-hashcode|pop|set-nth|\\?nth|<flat-slice>|second|join|when-empty|collector|immutable-sequence\\?|<reversed>|all\\?|3append-as|virtual-sequence|subseq\\?|remove-nth!|push-either|new-like|length|last-index|push-if|2all\\?|lengthen|assert-sequence|copy|map-reduce|move|third|first|3each|tail\\?|set-first|prefix|bounds-error|any\\?|<repetition>|trim-slice|exchange|surround|2reduce|cut|change-nth|min-length|set-third|produce-as|push-all|head\\?|delete-slice|rest|sum-lengths|2each|head\\*|infimum|remove!|glue|slice-error|subseq|trim|replace-slice|push|repetition|map-index|trim-head|unclip-last|mismatch)\s" is(name.builtin)
|
80
|
+
r"(?:global|\\+@|change|set-namestack|change-global|init-namespaces|on|off|set-global|namespace|set|with-scope|bind|with-variable|inc|dec|counter|initialize|namestack|get|get-global|make-assoc)\s" is(name.builtin)
|
81
|
+
r"(?:<array>|2array|3array|pair|>array|1array|4array|pair\\?|array|resize-array|array\\?)\s" is(name.builtin)
|
82
|
+
r"(?:\\+character\\+|bad-seek-type\\?|readln|each-morsel|stream-seek|read|print|with-output-stream|contents|write1|stream-write1|stream-copy|stream-element-type|with-input-stream|stream-print|stream-read|stream-contents|stream-tell|tell-output|bl|seek-output|bad-seek-type|nl|stream-nl|write|flush|stream-lines|\\+byte\\+|stream-flush|read1|seek-absolute\\?|stream-read1|lines|stream-readln|stream-read-until|each-line|seek-end|with-output-stream\\*|seek-absolute|with-streams|seek-input|seek-relative\\?|input-stream|stream-write|read-partial|seek-end\\?|seek-relative|error-stream|read-until|with-input-stream\\*|with-streams\\*|tell-input|each-block|output-stream|stream-read-partial|each-stream-block|each-stream-line)\s" is(name.builtin)
|
83
|
+
r"(?:resize-string|>string|<string>|1string|string|string\\?)\s" is(name.builtin)
|
84
|
+
r"(?:vector\\?|<vector>|\\?push|vector|>vector|1vector)\s" is(name.builtin)
|
85
|
+
r"(?:with-return|restarts|return-continuation|with-datastack|recover|rethrow-restarts|<restart>|ifcc|set-catchstack|>continuation<|cleanup|ignore-errors|restart\\?|compute-restarts|attempt-all-error|error-thread|continue|<continuation>|attempt-all-error\\?|condition\\?|<condition>|throw-restarts|error|catchstack|continue-with|thread-error-hook|continuation|rethrow|callcc1|error-continuation|callcc0|attempt-all|condition|continuation\\?|restart|return)\s" is(name.builtin)
|
86
|
+
r"\s+" is(text)
|
87
|
+
r"\S+" is(text)
|
88
|
+
|
89
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Fancy"
|
6
|
+
aliases: ["fancy", "fy"]
|
7
|
+
extensions: [".fy", ".fancypack"]
|
8
|
+
mimetypes: ["text/x-fancysrc"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(root):
|
13
|
+
r"\s+" is(text)
|
14
|
+
r"s{(\\\\|\\}|[^}])*}\s*" is(literal.string.regex) -> go-to(balanced-regex)
|
15
|
+
r"s<(\\\\|\\>|[^>])*>\s*" is(literal.string.regex) -> go-to(balanced-regex)
|
16
|
+
r"s\[(\\\\|\\\]|[^\]])*\]\s*" is(literal.string.regex) -> go-to(balanced-regex)
|
17
|
+
r"s\((\\\\|\\\)|[^\)])*\)\s*" is(literal.string.regex) -> go-to(balanced-regex)
|
18
|
+
r"m?/(\\\\|\\/|[^/\n])*/[gcimosx]*" is(literal.string.regex)
|
19
|
+
r"m(?=[/!\\{<\[\(@%\$])" is(literal.string.regex) -> go-to(balanced-regex)
|
20
|
+
r"\#(.*?)\n" is(comment.single)
|
21
|
+
r"\'([^\'\s\[\]\(\)\{\}]+|\[\])" is(literal.string.symbol)
|
22
|
+
r"\"\"\"(\\\\|\\\"|[^\"])*\"\"\"" is(literal.string)
|
23
|
+
r"\"(\\\\|\\\"|[^\"])*\"" is(literal.string)
|
24
|
+
r"(def|class|try|catch|finally|retry|return|return_local|match|case|->|=>)\b" is(keyword)
|
25
|
+
r"(self|super|nil|false|true)\b" is(name.constant)
|
26
|
+
r"[(){};,/?\|:\\]" is(punctuation)
|
27
|
+
r"(Object|Array|Hash|Directory|File|Class|String|Number|Enumerable|FancyEnumerable|Block|TrueClass|NilClass|FalseClass|Tuple|Symbol|Stack|Set|FancySpec|Method|Package|Range)\b" is(name.builtin)
|
28
|
+
r"[a-zA-Z]([a-zA-Z0-9_]|[-+?!=*/^><%])*:" is(name.function)
|
29
|
+
r"[-+*/\126,<>=&!?%^\[\]\.$]+" is(operator)
|
30
|
+
r"[A-Z][a-zA-Z0-9_]*" is(name.constant)
|
31
|
+
r"@[a-zA-Z_][a-zA-Z0-9_]*" is(name.variable.instance)
|
32
|
+
r"@@[a-zA-Z_][a-zA-Z0-9_]*" is(name.variable.class)
|
33
|
+
r"@@?" is(operator)
|
34
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name)
|
35
|
+
r"(0[oO]?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?" is(by-groups(literal.number.oct, text, operator))
|
36
|
+
r"(0[xX][0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?" is(by-groups(literal.number.hex, text, operator))
|
37
|
+
r"(0[bB][01]+(?:_[01]+)*)(\s*)([/?])?" is(by-groups(literal.number.bin, text, operator))
|
38
|
+
r"([\d]+(?:_\d+)*)(\s*)([/?])?" is(by-groups(literal.number.integer, text, operator))
|
39
|
+
r"\d+([eE][+-]?[0-9]+)|\d+\.\d+([eE][+-]?[0-9]+)?" is(literal.number.float)
|
40
|
+
r"\d+" is(literal.number.integer)
|
41
|
+
|
42
|
+
lex(balanced-regex):
|
43
|
+
r"/(\\\\|\\/|[^/])*/[egimosx]*" is(literal.string.regex) -> pop
|
44
|
+
r"!(\\\\|\\!|[^!])*![egimosx]*" is(literal.string.regex) -> pop
|
45
|
+
r"\\(\\\\|[^\\])*\\[egimosx]*" is(literal.string.regex) -> pop
|
46
|
+
r"{(\\\\|\\}|[^}])*}[egimosx]*" is(literal.string.regex) -> pop
|
47
|
+
r"<(\\\\|\\>|[^>])*>[egimosx]*" is(literal.string.regex) -> pop
|
48
|
+
r"\[(\\\\|\\\]|[^\]])*\][egimosx]*" is(literal.string.regex) -> pop
|
49
|
+
r"\((\\\\|\\\)|[^\)])*\)[egimosx]*" is(literal.string.regex) -> pop
|
50
|
+
r"@(\\\\|\\\@|[^\@])*@[egimosx]*" is(literal.string.regex) -> pop
|
51
|
+
r"%(\\\\|\\\%|[^\%])*%[egimosx]*" is(literal.string.regex) -> pop
|
52
|
+
r"\$(\\\\|\\\$|[^\$])*\$[egimosx]*" is(literal.string.regex) -> pop
|
53
|
+
|
54
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,149 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Fantom"
|
6
|
+
aliases: ["fan"]
|
7
|
+
extensions: [".fan"]
|
8
|
+
mimetypes: ["application/x-fantom"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(inheritance):
|
13
|
+
r"\s+" is(text)
|
14
|
+
r":|," is(punctuation)
|
15
|
+
r"(?:(\w+)(::))?(\w+)" is(by-groups(name.namespace, punctuation, name.class))
|
16
|
+
r"{" is(punctuation) -> pop
|
17
|
+
|
18
|
+
lex(facet):
|
19
|
+
r"\s+" is(text)
|
20
|
+
r"{" is(punctuation) -> go-to(facetFields)
|
21
|
+
r"" is(text) -> pop
|
22
|
+
|
23
|
+
lex(insideUri):
|
24
|
+
r"\\\\" is(literal.string.escape)
|
25
|
+
r"\\\"" is(literal.string.escape)
|
26
|
+
r"\\`" is(literal.string.escape)
|
27
|
+
r"\$\w+" is(literal.string.interpol)
|
28
|
+
r"\${.*?}" is(literal.string.interpol)
|
29
|
+
r"`" is(punctuation) -> pop
|
30
|
+
r"." is(literal.string.backtick)
|
31
|
+
|
32
|
+
lex(literals):
|
33
|
+
r"\b-?[\d_]+(ns|ms|sec|min|hr|day)" is(literal.number)
|
34
|
+
r"\b-?[\d_]*\.[\d_]+(ns|ms|sec|min|hr|day)" is(literal.number)
|
35
|
+
r"\b-?(\d+)?\.\d+(f|F|d|D)?" is(literal.number.float)
|
36
|
+
r"\b-?0x[0-9a-fA-F_]+" is(literal.number.hex)
|
37
|
+
r"\b-?[\d_]+" is(literal.number.integer)
|
38
|
+
r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'" is(literal.string.char)
|
39
|
+
r"\"" is(punctuation) -> go-to(insideStr)
|
40
|
+
r"`" is(punctuation) -> go-to(insideUri)
|
41
|
+
r"\b(true|false|null)\b" is(keyword.constant)
|
42
|
+
r"(?:(\w+)(::))?(\w+)(<\|)(.*?)(\|>)" is(by-groups(name.namespace, punctuation, name.class, punctuation, literal.string, punctuation))
|
43
|
+
r"(?:(\w+)(::))?(\w+)?(\#)(\w+)?" is(by-groups(name.namespace, punctuation, name.class, punctuation, name.function))
|
44
|
+
r"\[,\]" is(literal)
|
45
|
+
r"((?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?)(\[,\])" is(by-groups(using(self class), literal))
|
46
|
+
r"\[:\]" is(literal)
|
47
|
+
r"((?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?)(\[:\])" is(by-groups(using(self class), literal))
|
48
|
+
|
49
|
+
lex(methodKeywords):
|
50
|
+
r"\b(abstract|native|once|override|static|virtual|final)\b" is(keyword)
|
51
|
+
|
52
|
+
lex(using):
|
53
|
+
r"[ \t]+" is(text)
|
54
|
+
r"(\[)(\w+)(\])" is(by-groups(punctuation, comment.special, punctuation))
|
55
|
+
r"(\\")?([\w\.]+)(\\")?" is(by-groups(punctuation, name.namespace, punctuation))
|
56
|
+
r"::" is(punctuation) -> go-to(usingClass)
|
57
|
+
r"" is(text) -> pop
|
58
|
+
|
59
|
+
lex(protectionKeywords):
|
60
|
+
r"\b(public|protected|private|internal)\b" is(keyword)
|
61
|
+
|
62
|
+
lex(insideStr):
|
63
|
+
r"\\\\" is(literal.string.escape)
|
64
|
+
r"\\\"" is(literal.string.escape)
|
65
|
+
r"\\`" is(literal.string.escape)
|
66
|
+
r"\$\w+" is(literal.string.interpol)
|
67
|
+
r"\${.*?}" is(literal.string.interpol)
|
68
|
+
r"\"" is(punctuation) -> pop
|
69
|
+
r"." is(literal.string)
|
70
|
+
|
71
|
+
lex(operators):
|
72
|
+
r"\+\+|\-\-|\+|\-|\*|/|\|\||&&|<=>|<=|<|>=|>|=|!|\[|\]" is(operator)
|
73
|
+
|
74
|
+
lex(inType):
|
75
|
+
r"[\[\]\|\->:\?]" is(punctuation)
|
76
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name.class)
|
77
|
+
r"" is(text) -> pop
|
78
|
+
|
79
|
+
lex(facetFields):
|
80
|
+
any-of(comments)
|
81
|
+
any-of(literals)
|
82
|
+
any-of(operators)
|
83
|
+
r"\s+" is(text)
|
84
|
+
r"(\s*)(\w+)(\s*)(=)" is(by-groups(text, name, text, operator))
|
85
|
+
r"}" is(punctuation) -> pop
|
86
|
+
r"." is(text)
|
87
|
+
|
88
|
+
lex(comments):
|
89
|
+
r"(?m)/\*.*?\*/" is(comment.multiline)
|
90
|
+
r"//.*?\n" is(comment.single)
|
91
|
+
r"\*\*.*?\n" is(comment.special)
|
92
|
+
r"\#.*\n" is(comment.single)
|
93
|
+
|
94
|
+
lex(insideMethodDeclArgs):
|
95
|
+
r"\)" is(punctuation) -> pop
|
96
|
+
r"((?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(\))" is(by-groups(using(self class), text, name.variable, text, punctuation)) -> pop
|
97
|
+
any-of(root)
|
98
|
+
|
99
|
+
lex(usingClass):
|
100
|
+
r"[ \t]+" is(text)
|
101
|
+
r"(as)(\s+)(\w+)" is(by-groups(keyword.declaration, text, name.class)) -> pop(2)
|
102
|
+
r"[\w\$]+" is(name.class)
|
103
|
+
r"" is(text) -> pop(2)
|
104
|
+
|
105
|
+
lex(typeKeywords):
|
106
|
+
r"\b(abstract|final|const|native|facet|enum)\b" is(keyword)
|
107
|
+
|
108
|
+
lex(insideBrace):
|
109
|
+
r"\}" is(punctuation) -> pop
|
110
|
+
any-of(root)
|
111
|
+
|
112
|
+
lex(otherKeywords):
|
113
|
+
r"\b(try|catch|throw|finally|for|if|else|while|as|is|isnot|switch|case|default|continue|break|do|return|get|set)\b" is(keyword)
|
114
|
+
r"\b(it|this|super)\b" is(name.builtin.pseudo)
|
115
|
+
|
116
|
+
lex(fieldKeywords):
|
117
|
+
r"\b(abstract|const|final|native|override|static|virtual|readonly)\b" is(keyword)
|
118
|
+
|
119
|
+
lex(insideParen):
|
120
|
+
r"\)" is(punctuation) -> pop
|
121
|
+
any-of(root)
|
122
|
+
|
123
|
+
lex(root):
|
124
|
+
any-of(comments)
|
125
|
+
any-of(protectionKeywords)
|
126
|
+
any-of(typeKeywords)
|
127
|
+
any-of(methodKeywords)
|
128
|
+
any-of(fieldKeywords)
|
129
|
+
any-of(literals)
|
130
|
+
any-of(otherKeywords)
|
131
|
+
any-of(operators)
|
132
|
+
r"using\b" is(keyword.namespace) -> go-to(using)
|
133
|
+
r"@\w+" is(name.decorator) -> go-to(facet)
|
134
|
+
r"(class|mixin)(\s+)(\w+)" is(by-groups(keyword, text, name.class)) -> go-to(inheritance)
|
135
|
+
r"((?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?)([ \t]+)([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(:=)" is(by-groups(using(self class), text, name.variable, text, operator))
|
136
|
+
r"([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(:=)" is(by-groups(name.variable, text, operator))
|
137
|
+
r"(\.|(?:\->))([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(\()" is(by-groups(operator, name.function, text, punctuation)) -> go-to(insideParen)
|
138
|
+
r"(\.|(?:\->))([a-zA-Z_][a-zA-Z0-9_]*)" is(by-groups(operator, name.function))
|
139
|
+
r"(new)(\s+)(make\w*)(\s*)(\()" is(by-groups(keyword, text, name.function, text, punctuation)) -> go-to(insideMethodDeclArgs)
|
140
|
+
r"((?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?)([ \t]+)([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(\()" is(by-groups(using(self class), text, name.function, text, punctuation)) -> go-to(insideMethodDeclArgs)
|
141
|
+
r"((?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(,)" is(by-groups(using(self class), text, name.variable, text, punctuation))
|
142
|
+
r"((?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(\->)(\s*)((?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?)(\|)" is(by-groups(using(self class), text, name.variable, text, punctuation, text, using(self class), punctuation))
|
143
|
+
r"((?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(\|)" is(by-groups(using(self class), text, name.variable, text, punctuation))
|
144
|
+
r"((?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?)([ \t]+)([a-zA-Z_][a-zA-Z0-9_]*)" is(by-groups(using(self class), text, name.variable))
|
145
|
+
r"\(" is(punctuation) -> go-to(insideParen)
|
146
|
+
r"\{" is(punctuation) -> go-to(insideBrace)
|
147
|
+
r"." is(text)
|
148
|
+
|
149
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,140 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Felix"
|
6
|
+
aliases: ["felix", "flx"]
|
7
|
+
extensions: [".flx", ".flxh"]
|
8
|
+
mimetypes: ["text/x-felix"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(comment):
|
13
|
+
r"//(.*?)\n" is(comment.single)
|
14
|
+
r"/[*]" is(comment.multiline) -> go-to(comment2)
|
15
|
+
|
16
|
+
lex(modulename2):
|
17
|
+
any-of(whitespace)
|
18
|
+
r"([a-zA-Z_]\w*)" is(name.namespace) -> pop(2)
|
19
|
+
|
20
|
+
lex(modulename):
|
21
|
+
any-of(whitespace)
|
22
|
+
r"\[" is(punctuation) -> do-all(go-to(modulename2), go-to(tvarlist))
|
23
|
+
r"" is(error) -> go-to(modulename2)
|
24
|
+
|
25
|
+
lex(if0):
|
26
|
+
r"^\s*\#if.*?(?<!\\)\n" is(comment) -> push
|
27
|
+
r"^\s*\#endif.*?(?<!\\)\n" is(comment) -> pop
|
28
|
+
r".*?\n" is(comment)
|
29
|
+
|
30
|
+
lex(whitespace):
|
31
|
+
r"\n" is(text)
|
32
|
+
r"\s+" is(text)
|
33
|
+
any-of(comment)
|
34
|
+
r"\#\s*if\s+0" is(comment.preproc) -> go-to(if0)
|
35
|
+
r"\#" is(comment.preproc) -> go-to(macro)
|
36
|
+
|
37
|
+
lex(dqs):
|
38
|
+
r"\"" is(literal.string) -> pop
|
39
|
+
r"\\\\|\\\"|\\\n" is(literal.string.escape)
|
40
|
+
any-of(strings)
|
41
|
+
|
42
|
+
lex(sqs):
|
43
|
+
r"'" is(literal.string) -> pop
|
44
|
+
r"\\\\|\\'|\\\n" is(literal.string.escape)
|
45
|
+
any-of(strings)
|
46
|
+
|
47
|
+
lex(macro):
|
48
|
+
any-of(comment)
|
49
|
+
r"(import|include)(\s+)(<[^>]*?>)" is(by-groups(comment.preproc, text, literal.string)) -> pop
|
50
|
+
r"(import|include)(\s+)(\"[^\"]*?\")" is(by-groups(comment.preproc, text, literal.string)) -> pop
|
51
|
+
r"(import|include)(\s+)('[^']*?')" is(by-groups(comment.preproc, text, literal.string)) -> pop
|
52
|
+
r"[^/\n]+" is(comment.preproc)
|
53
|
+
r"/" is(comment.preproc)
|
54
|
+
r"(?<=\\)\n" is(comment.preproc)
|
55
|
+
r"\n" is(comment.preproc) -> pop
|
56
|
+
|
57
|
+
lex(operators):
|
58
|
+
r"(and|not|in|is|isin|or|xor)\b" is(operator.word)
|
59
|
+
r"!=|==|<<|>>|\|\||&&|[-\126+/*%=<>&^|.$]" is(operator)
|
60
|
+
|
61
|
+
lex(tsqs):
|
62
|
+
r"'''" is(literal.string) -> pop
|
63
|
+
any-of(strings)
|
64
|
+
any-of(nl)
|
65
|
+
|
66
|
+
lex(comment2):
|
67
|
+
r"[^\/*]" is(comment.multiline)
|
68
|
+
r"/[*]" is(comment.multiline) -> push
|
69
|
+
r"[*]/" is(comment.multiline) -> pop
|
70
|
+
r"[\/*]" is(comment.multiline)
|
71
|
+
|
72
|
+
lex(classname):
|
73
|
+
any-of(whitespace)
|
74
|
+
r"[a-zA-Z_]\w*" is(name.class) -> pop
|
75
|
+
r"(?=\{)" is(text) -> pop
|
76
|
+
|
77
|
+
lex(stringescape):
|
78
|
+
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)
|
79
|
+
|
80
|
+
lex(tdqs):
|
81
|
+
r"\"\"\"" is(literal.string) -> pop
|
82
|
+
any-of(strings)
|
83
|
+
any-of(nl)
|
84
|
+
|
85
|
+
lex(nl):
|
86
|
+
r"\n" is(literal.string)
|
87
|
+
|
88
|
+
lex(funcname):
|
89
|
+
any-of(whitespace)
|
90
|
+
r"[a-zA-Z_]\w*" is(name.function) -> pop
|
91
|
+
r"(?=\()" is(text) -> pop
|
92
|
+
|
93
|
+
lex(root):
|
94
|
+
any-of(whitespace)
|
95
|
+
r"(axiom|ctor|fun|gen|proc|reduce|union)\b" is(keyword) -> go-to(funcname)
|
96
|
+
r"(class|cclass|cstruct|obj|struct)\b" is(keyword) -> go-to(classname)
|
97
|
+
r"(instance|module|typeclass)\b" is(keyword) -> go-to(modulename)
|
98
|
+
r"(_|_deref|all|as|assert|attempt|call|callback|case|caseno|cclass|code|compound|ctypes|do|done|downto|elif|else|endattempt|endcase|endif|endmatch|enum|except|exceptions|expect|finally|for|forall|forget|fork|functor|goto|ident|if|incomplete|inherit|instance|interface|jump|lambda|loop|match|module|namespace|new|noexpand|nonterm|obj|of|open|parse|raise|regexp|reglex|regmatch|rename|return|the|then|to|type|typecase|typedef|typematch|typeof|upto|when|whilst|with|yield)\b" is(keyword)
|
99
|
+
r"(_gc_pointer|_gc_type|body|comment|const|export|header|inline|lval|macro|noinline|noreturn|package|private|pod|property|public|publish|requires|todo|virtual|use)\b" is(name.decorator)
|
100
|
+
r"(def|let|ref|val|var)\b" is(keyword.declaration)
|
101
|
+
r"(unit|void|any|bool|byte|offset|address|caddress|cvaddress|vaddress|tiny|short|int|long|vlong|utiny|ushort|vshort|uint|ulong|uvlong|int8|int16|int32|int64|uint8|uint16|uint32|uint64|float|double|ldouble|complex|dcomplex|lcomplex|imaginary|dimaginary|limaginary|char|wchar|uchar|charp|charcp|ucharp|ucharcp|string|wstring|ustring|cont|array|varray|list|lvalue|opt|slice)\b" is(keyword.type)
|
102
|
+
r"(false|true)\b" is(keyword.constant)
|
103
|
+
any-of(operators)
|
104
|
+
r"0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)[pP][+\-]?[0-9_]+[lLfFdD]?" is(literal.number.float)
|
105
|
+
r"[0-9_]+(\.[0-9_]+[eE][+\-]?[0-9_]+|\.[0-9_]*|[eE][+\-]?[0-9_]+)[lLfFdD]?" is(literal.number.float)
|
106
|
+
r"\.(0|[1-9][0-9_]*)([eE][+\-]?[0-9_]+)?[lLfFdD]?" is(literal.number.float)
|
107
|
+
r"0[Bb][01_]+([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?" is(literal.number)
|
108
|
+
r"0[0-7_]+([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?" is(literal.number.oct)
|
109
|
+
r"0[xX][0-9a-fA-F_]+([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?" is(literal.number.hex)
|
110
|
+
r"(0|[1-9][0-9_]*)([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?" is(literal.number.integer)
|
111
|
+
r"([rR][cC]?|[cC][rR])\"\"\"" is(literal.string) -> go-to(tdqs)
|
112
|
+
r"([rR][cC]?|[cC][rR])'''" is(literal.string) -> go-to(tsqs)
|
113
|
+
r"([rR][cC]?|[cC][rR])\"" is(literal.string) -> go-to(dqs)
|
114
|
+
r"([rR][cC]?|[cC][rR])'" is(literal.string) -> go-to(sqs)
|
115
|
+
r"[cCfFqQwWuU]?\"\"\"" is(literal.string) -> combined(stringescape, tdqs)
|
116
|
+
r"[cCfFqQwWuU]?'''" is(literal.string) -> combined(stringescape, tsqs)
|
117
|
+
r"[cCfFqQwWuU]?\"" is(literal.string) -> combined(stringescape, dqs)
|
118
|
+
r"[cCfFqQwWuU]?'" is(literal.string) -> combined(stringescape, sqs)
|
119
|
+
r"[\[\]{}:(),;?]" is(punctuation)
|
120
|
+
r"[a-zA-Z_]\w*:>" is(name.label)
|
121
|
+
r"(_svc|while)\b" is(name.builtin)
|
122
|
+
r"(root|self|this)\b" is(name.builtin.pseudo)
|
123
|
+
r"[a-zA-Z_]\w*" is(name)
|
124
|
+
|
125
|
+
lex(strings):
|
126
|
+
r"%(\([a-zA-Z0-9]+\))?[-\#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[diouxXeEfFgGcrs%]" is(literal.string.interpol)
|
127
|
+
r"[^\\\'\"%\n]+" is(literal.string)
|
128
|
+
r"[\'\"\\]" is(literal.string)
|
129
|
+
r"%" is(literal.string)
|
130
|
+
|
131
|
+
lex(tvarlist):
|
132
|
+
any-of(whitespace)
|
133
|
+
any-of(operators)
|
134
|
+
r"\[" is(punctuation) -> push
|
135
|
+
r"\]" is(punctuation) -> pop
|
136
|
+
r"," is(punctuation)
|
137
|
+
r"(with|where)\b" is(keyword)
|
138
|
+
r"[a-zA-Z_]\w*" is(name)
|
139
|
+
|
140
|
+
const-set(.Lexer, lexer)
|