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,128 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Cython"
|
6
|
+
aliases: ["cython", "pyx"]
|
7
|
+
extensions: [".pyx", ".pxd", ".pxi"]
|
8
|
+
mimetypes: ["text/x-cython", "application/x-cython"]
|
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|NULL)\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|Warning|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]+)?" is(literal.number.float)
|
55
|
+
r"0\d+" is(literal.number.oct)
|
56
|
+
r"0[xX][a-fA-F0-9]+" is(literal.number.hex)
|
57
|
+
r"\d+L" is(literal.number.integer.long)
|
58
|
+
r"\d+" is(literal.number.integer)
|
59
|
+
|
60
|
+
lex(import):
|
61
|
+
r"(\s+)(as)(\s+)" is(by-groups(text, keyword, text))
|
62
|
+
r"[a-zA-Z_][a-zA-Z0-9_.]*" is(name.namespace)
|
63
|
+
r"(\s*)(,)(\s*)" is(by-groups(text, operator, text))
|
64
|
+
r"" is(text) -> pop
|
65
|
+
|
66
|
+
lex(keywords):
|
67
|
+
r"(assert|break|by|continue|ctypedef|del|elif|else|except\??|exec|finally|for|gil|global|if|include|lambda|nogil|pass|print|raise|return|try|while|yield|as|with)\b" is(keyword)
|
68
|
+
r"(DEF|IF|ELIF|ELSE)\b" is(comment.preproc)
|
69
|
+
|
70
|
+
lex(cdef):
|
71
|
+
r"(public|readonly|extern|api|inline)\b" is(keyword.reserved)
|
72
|
+
r"(struct|enum|union|class)\b" is(keyword)
|
73
|
+
r"([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(?=[(:\#=]|$)" is(by-groups(name.function, text)) -> pop
|
74
|
+
r"([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(,)" is(by-groups(name.function, text, punctuation))
|
75
|
+
r"from\b" is(keyword) -> pop
|
76
|
+
r"as\b" is(keyword)
|
77
|
+
r":" is(punctuation) -> pop
|
78
|
+
r"(?=[\"\'])" is(text) -> pop
|
79
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(keyword.type)
|
80
|
+
r"." is(text)
|
81
|
+
|
82
|
+
lex(nl):
|
83
|
+
r"\n" is(literal.string)
|
84
|
+
|
85
|
+
lex(root):
|
86
|
+
r"\n" is(text)
|
87
|
+
r"^(\s*)(\"\"\"(?:.|\n)*?\"\"\")" is(by-groups(text, literal.string.doc))
|
88
|
+
r"^(\s*)('''(?:.|\n)*?''')" is(by-groups(text, literal.string.doc))
|
89
|
+
r"[^\S\n]+" is(text)
|
90
|
+
r"\#.*$" is(comment)
|
91
|
+
r"[\]{}:(),;\[]" is(punctuation)
|
92
|
+
r"\\\n" is(text)
|
93
|
+
r"\\" is(text)
|
94
|
+
r"(in|is|and|or|not)\b" is(operator.word)
|
95
|
+
r"(<)([a-zA-Z0-9.?]+)(>)" is(by-groups(punctuation, keyword.type, punctuation))
|
96
|
+
r"!=|==|<<|>>|[-\126+/*%=<>&^|.?]" is(operator)
|
97
|
+
r"(from)(\d+)(<=)(\s+)(<)(\d+)(:)" is(by-groups(keyword, literal.number.integer, operator, name, operator, name, punctuation))
|
98
|
+
any-of(keywords)
|
99
|
+
r"(def|property)(\s+)" is(by-groups(keyword, text)) -> go-to(funcname)
|
100
|
+
r"(cp?def)(\s+)" is(by-groups(keyword, text)) -> go-to(cdef)
|
101
|
+
r"(class|struct)(\s+)" is(by-groups(keyword, text)) -> go-to(classname)
|
102
|
+
r"(from)(\s+)" is(by-groups(keyword, text)) -> go-to(fromimport)
|
103
|
+
r"(c?import)(\s+)" is(by-groups(keyword, text)) -> go-to(import)
|
104
|
+
any-of(builtins)
|
105
|
+
any-of(backtick)
|
106
|
+
r"(?:[rR]|[uU][rR]|[rR][uU])\"\"\"" is(literal.string) -> go-to(tdqs)
|
107
|
+
r"(?:[rR]|[uU][rR]|[rR][uU])'''" is(literal.string) -> go-to(tsqs)
|
108
|
+
r"(?:[rR]|[uU][rR]|[rR][uU])\"" is(literal.string) -> go-to(dqs)
|
109
|
+
r"(?:[rR]|[uU][rR]|[rR][uU])'" is(literal.string) -> go-to(sqs)
|
110
|
+
r"[uU]?\"\"\"" is(literal.string) -> combined(stringescape, tdqs)
|
111
|
+
r"[uU]?'''" is(literal.string) -> combined(stringescape, tsqs)
|
112
|
+
r"[uU]?\"" is(literal.string) -> combined(stringescape, dqs)
|
113
|
+
r"[uU]?'" is(literal.string) -> combined(stringescape, sqs)
|
114
|
+
any-of(name)
|
115
|
+
any-of(numbers)
|
116
|
+
|
117
|
+
lex(strings):
|
118
|
+
r"%(\([a-zA-Z0-9]+\))?[-\#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[diouxXeEfFgGcrs%]" is(literal.string.interpol)
|
119
|
+
r"[^\\\'\"%\n]+" is(literal.string)
|
120
|
+
r"[\'\"\\]" is(literal.string)
|
121
|
+
r"%" is(literal.string)
|
122
|
+
|
123
|
+
lex(fromimport):
|
124
|
+
r"(\s+)(c?import)\b" is(by-groups(text, keyword)) -> pop
|
125
|
+
r"[a-zA-Z_.][a-zA-Z0-9_.]*" is(name.namespace)
|
126
|
+
r"" is(text) -> pop
|
127
|
+
|
128
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,102 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "D"
|
6
|
+
aliases: ["d"]
|
7
|
+
extensions: [".d", ".di"]
|
8
|
+
mimetypes: ["text/x-dsrc"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(delimited-parenthesis):
|
13
|
+
r"[^\(\)]+" is(literal.string)
|
14
|
+
r"\(" is(literal.string) -> go-to(delimited-inside-parenthesis)
|
15
|
+
r"\)\"" is(literal.string) -> pop
|
16
|
+
|
17
|
+
lex(delimited-curly):
|
18
|
+
r"[^{}]+" is(literal.string)
|
19
|
+
r"{" is(literal.string) -> go-to(delimited-inside-curly)
|
20
|
+
r"}\"" is(literal.string) -> pop
|
21
|
+
|
22
|
+
lex(delimited-angle):
|
23
|
+
r"[^<>]+" is(literal.string)
|
24
|
+
r"<" is(literal.string) -> go-to(delimited-inside-angle)
|
25
|
+
r">\"" is(literal.string) -> pop
|
26
|
+
|
27
|
+
lex(delimited-inside-parenthesis):
|
28
|
+
r"[^\(\)]+" is(literal.string)
|
29
|
+
r"\(" is(literal.string) -> push
|
30
|
+
r"\)" is(literal.string) -> pop
|
31
|
+
|
32
|
+
lex(delimited-inside-curly):
|
33
|
+
r"[^{}]+" is(literal.string)
|
34
|
+
r"{" is(literal.string) -> push
|
35
|
+
r"}" is(literal.string) -> pop
|
36
|
+
|
37
|
+
lex(delimited-inside-bracket):
|
38
|
+
r"[^\[\]]+" is(literal.string)
|
39
|
+
r"\[" is(literal.string) -> push
|
40
|
+
r"\]" is(literal.string) -> pop
|
41
|
+
|
42
|
+
lex(token-string-nest):
|
43
|
+
r"{" is(punctuation) -> push
|
44
|
+
r"}" is(punctuation) -> pop
|
45
|
+
any-of(root)
|
46
|
+
|
47
|
+
lex(delimited-bracket):
|
48
|
+
r"[^\[\]]+" is(literal.string)
|
49
|
+
r"\[" is(literal.string) -> go-to(delimited-inside-bracket)
|
50
|
+
r"\]\"" is(literal.string) -> pop
|
51
|
+
|
52
|
+
lex(token-string):
|
53
|
+
r"{" is(punctuation) -> go-to(token-string-nest)
|
54
|
+
r"}" is(literal.string) -> pop
|
55
|
+
any-of(root)
|
56
|
+
|
57
|
+
lex(delimited-inside-angle):
|
58
|
+
r"[^<>]+" is(literal.string)
|
59
|
+
r"<" is(literal.string) -> push
|
60
|
+
r">" is(literal.string) -> pop
|
61
|
+
|
62
|
+
lex(root):
|
63
|
+
r"\n" is(text)
|
64
|
+
r"\s+" is(text)
|
65
|
+
r"//(.*?)\n" is(comment.single)
|
66
|
+
r"/(\\\n)?[*](.|\n)*?[*](\\\n)?/" is(comment.multiline)
|
67
|
+
r"/\+" is(comment.multiline) -> go-to(nested-comment)
|
68
|
+
r"(abstract|alias|align|asm|assert|auto|body|break|case|cast|catch|class|const|continue|debug|default|delegate|delete|deprecated|do|else|enum|export|extern|finally|final|foreach_reverse|foreach|for|function|goto|if|import|inout|interface|invariant|in|is|lazy|mixin|module|new|nothrow|out|override|package|pragma|private|protected|public|pure|ref|return|scope|static|struct|super|switch|synchronized|template|this|throw|try|typedef|typeid|typeof|union|unittest|version|volatile|while|with|__traits)\b" is(keyword)
|
69
|
+
r"(bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|float|idouble|ifloat|int|ireal|long|real|short|ubyte|ucent|uint|ulong|ushort|void|wchar)\b" is(keyword.type)
|
70
|
+
r"(false|true|null)\b" is(keyword.constant)
|
71
|
+
r"macro\b" is(keyword.reserved)
|
72
|
+
r"(string|wstring|dstring)\b" is(name.builtin)
|
73
|
+
r"0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)[pP][+\-]?[0-9_]+[fFL]?[i]?" is(literal.number.float)
|
74
|
+
r"[0-9_]+(\.[0-9_]+[eE][+\-]?[0-9_]+|\.[0-9_]*|[eE][+\-]?[0-9_]+)[fFL]?[i]?" is(literal.number.float)
|
75
|
+
r"\.(0|[1-9][0-9_]*)([eE][+\-]?[0-9_]+)?[fFL]?[i]?" is(literal.number.float)
|
76
|
+
r"0[Bb][01_]+" is(literal.number)
|
77
|
+
r"0[0-7_]+" is(literal.number.oct)
|
78
|
+
r"0[xX][0-9a-fA-F_]+" is(literal.number.hex)
|
79
|
+
r"(0|[1-9][0-9_]*)([LUu]|Lu|LU|uL|UL)?" is(literal.number.integer)
|
80
|
+
r"'(\\['\"?\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\&\w+;|.)'" is(literal.string.char)
|
81
|
+
r"r\"[^\"]*\"[cwd]?" is(literal.string)
|
82
|
+
r"`[^`]*`[cwd]?" is(literal.string)
|
83
|
+
r"\"(\\\\|\\\"|[^\"])*\"[cwd]?" is(literal.string)
|
84
|
+
r"\\(['\\"?\\abfnrtv]|x[0-9a-fA-F]{2}|[0-7]{1,3}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|&\w+;)" is(literal.string)
|
85
|
+
r"x\"[0-9a-fA-F_\s]*\"[cwd]?" is(literal.string)
|
86
|
+
r"q\"\[" is(literal.string) -> go-to(delimited-bracket)
|
87
|
+
r"q\"\(" is(literal.string) -> go-to(delimited-parenthesis)
|
88
|
+
r"q\"<" is(literal.string) -> go-to(delimited-angle)
|
89
|
+
r"q\"{" is(literal.string) -> go-to(delimited-curly)
|
90
|
+
r"q\"([a-zA-Z_]\w*)\n.*?\n\1\"" is(literal.string)
|
91
|
+
r"q\"(.).*?\1\"" is(literal.string)
|
92
|
+
r"q{" is(literal.string) -> go-to(token-string)
|
93
|
+
r"(\126=|\^=|%=|\*=|==|!>=|!<=|!<>=|!<>|!<|!>|!=|>>>=|>>>|>>=|>>|>=|<>=|<>|<<=|<<|<=|\+\+|\+=|--|-=|\|\||\|=|&&|&=|\.\.\.|\.\.|/=)|[/.&|\-+<>!()\[\]{}?,;:$=*%^\126]" is(punctuation)
|
94
|
+
r"[a-zA-Z_]\w*" is(name)
|
95
|
+
|
96
|
+
lex(nested-comment):
|
97
|
+
r"[^+/]+" is(comment.multiline)
|
98
|
+
r"/\+" is(comment.multiline) -> push
|
99
|
+
r"\+/" is(comment.multiline) -> pop
|
100
|
+
r"[+/]" is(comment.multiline)
|
101
|
+
|
102
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Darcs Patch"
|
6
|
+
aliases: ["dpatch"]
|
7
|
+
extensions: [".dpatch", ".darcspatch"]
|
8
|
+
mimetypes: []
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(comment):
|
13
|
+
r"[^\]].*\n" is(comment)
|
14
|
+
r"\]" is(operator) -> pop
|
15
|
+
|
16
|
+
lex(insert):
|
17
|
+
any-of(specialText)
|
18
|
+
r"\[" is(generic.inserted)
|
19
|
+
r"[^\n\[]+" is(generic.inserted)
|
20
|
+
|
21
|
+
lex(delete):
|
22
|
+
any-of(specialText)
|
23
|
+
r"\[" is(generic.deleted)
|
24
|
+
r"[^\n\[]+" is(generic.deleted)
|
25
|
+
|
26
|
+
lex(root):
|
27
|
+
r"<" is(operator)
|
28
|
+
r">" is(operator)
|
29
|
+
r"{" is(operator)
|
30
|
+
r"}" is(operator)
|
31
|
+
r"(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)(\])" is(by-groups(operator, keyword, name, text, name, operator, literal.date, text, operator))
|
32
|
+
r"(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)" is(by-groups(operator, keyword, name, text, name, operator, literal.date, text)) -> go-to(comment)
|
33
|
+
r"New patches:" is(generic.heading)
|
34
|
+
r"Context:" is(generic.heading)
|
35
|
+
r"Patch bundle hash:" is(generic.heading)
|
36
|
+
r"(\s*)(hunk|addfile|adddir|rmfile|rmdir|move|replace)(.*\n)" is(by-groups(text, keyword, text))
|
37
|
+
r"\+" is(generic.inserted) -> go-to(insert)
|
38
|
+
r"-" is(generic.deleted) -> go-to(delete)
|
39
|
+
r".*\n" is(text)
|
40
|
+
|
41
|
+
lex(specialText):
|
42
|
+
r"\n" is(text) -> pop
|
43
|
+
r"\[_[^_]*_]" is(operator)
|
44
|
+
|
45
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,84 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Dart"
|
6
|
+
aliases: ["dart"]
|
7
|
+
extensions: [".dart"]
|
8
|
+
mimetypes: ["text/x-dart"]
|
9
|
+
start: .root
|
10
|
+
flags: Regexp MULTILINE
|
11
|
+
|
12
|
+
lex(string-single-multiline):
|
13
|
+
r"'''" is(literal.string.single) -> pop
|
14
|
+
r"[^\'$\\]+" is(literal.string.single)
|
15
|
+
any-of(string-common)
|
16
|
+
r"(\$|\')+" is(literal.string.single)
|
17
|
+
|
18
|
+
lex(string-single):
|
19
|
+
r"'" is(literal.string.single) -> pop
|
20
|
+
r"[^\'$\\\n]+" is(literal.string.single)
|
21
|
+
any-of(string-common)
|
22
|
+
r"\$+" is(literal.string.single)
|
23
|
+
|
24
|
+
lex(string-common):
|
25
|
+
r"\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]*\}|[a-z\'\\"$\\])" is(literal.string.escape)
|
26
|
+
r"(\$)([a-zA-Z_][a-zA-Z0-9_]*)" is(by-groups(literal.string.interpol, name))
|
27
|
+
r"(\$\{)(.*?)(\})" is(by-groups(literal.string.interpol, using(self class), literal.string.interpol))
|
28
|
+
|
29
|
+
lex(string-literal):
|
30
|
+
r"r\"\"\"([\s|\S]*?)\"\"\"" is(literal.string.double)
|
31
|
+
r"r'''([\s|\S]*?)'''" is(literal.string.single)
|
32
|
+
r"r\"(.*?)\"" is(literal.string.double)
|
33
|
+
r"r'(.*?)'" is(literal.string.single)
|
34
|
+
r"\"\"\"" is(literal.string.double) -> go-to(string-double-multiline)
|
35
|
+
r"'''" is(literal.string.single) -> go-to(string-single-multiline)
|
36
|
+
r"\"" is(literal.string.double) -> go-to(string-double)
|
37
|
+
r"'" is(literal.string.single) -> go-to(string-single)
|
38
|
+
|
39
|
+
lex(string-double):
|
40
|
+
r"\"" is(literal.string.double) -> pop
|
41
|
+
r"[^\\"$\\\n]+" is(literal.string.double)
|
42
|
+
any-of(string-common)
|
43
|
+
r"\$+" is(literal.string.double)
|
44
|
+
|
45
|
+
lex(import-decl):
|
46
|
+
any-of(string-literal)
|
47
|
+
r"\s+" is(text)
|
48
|
+
r"\b(as|show|hide)\b" is(keyword)
|
49
|
+
r"[a-zA-Z_$][a-zA-Z0-9_]*" is(name)
|
50
|
+
r"\," is(punctuation)
|
51
|
+
r"\;" is(punctuation) -> pop
|
52
|
+
|
53
|
+
lex(string-double-multiline):
|
54
|
+
r"\"\"\"" is(literal.string.double) -> pop
|
55
|
+
r"[^\\"$\\]+" is(literal.string.double)
|
56
|
+
any-of(string-common)
|
57
|
+
r"(\$|\\")+" is(literal.string.double)
|
58
|
+
|
59
|
+
lex(root):
|
60
|
+
any-of(string-literal)
|
61
|
+
r"\#!(.*?)$" is(comment.preproc)
|
62
|
+
r"\b(import|export)\b" is(keyword) -> go-to(import-decl)
|
63
|
+
r"\b(library|source|part of|part)\b" is(keyword)
|
64
|
+
r"[^\S\n]+" is(text)
|
65
|
+
r"//.*?\n" is(comment.single)
|
66
|
+
r"/\*.*?\*/" is(comment.multiline)
|
67
|
+
r"\b(class)\b(\s+)" is(by-groups(keyword.declaration, text)) -> go-to(class)
|
68
|
+
r"\b(assert|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|this|throw|try|while)\b" is(keyword)
|
69
|
+
r"\b(abstract|const|extends|factory|final|get|implements|native|operator|set|static|typedef|var)\b" is(keyword.declaration)
|
70
|
+
r"\b(bool|double|Dynamic|int|num|Object|String|void)\b" is(keyword.type)
|
71
|
+
r"\b(false|null|true)\b" is(keyword.constant)
|
72
|
+
r"[\126!%^&*+=|?:<>/-]|as" is(operator)
|
73
|
+
r"[a-zA-Z_$][a-zA-Z0-9_]*:" is(name.label)
|
74
|
+
r"[a-zA-Z_$][a-zA-Z0-9_]*" is(name)
|
75
|
+
r"[(){}\[\],.;]" is(punctuation)
|
76
|
+
r"0[xX][0-9a-fA-F]+" is(literal.number.hex)
|
77
|
+
r"\d+(\.\d*)?([eE][+-]?\d+)?" is(literal.number)
|
78
|
+
r"\.\d+([eE][+-]?\d+)?" is(literal.number)
|
79
|
+
r"\n" is(text)
|
80
|
+
|
81
|
+
lex(class):
|
82
|
+
r"[a-zA-Z_$][a-zA-Z0-9_]*" is(name.class) -> pop
|
83
|
+
|
84
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Debian Control file"
|
6
|
+
aliases: ["control"]
|
7
|
+
extensions: ["control"]
|
8
|
+
mimetypes: []
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(maintainer):
|
13
|
+
r"<[^>]+>" is(generic.strong)
|
14
|
+
r"<[^>]+>$" is(generic.strong) -> pop
|
15
|
+
r",\n?" is(text)
|
16
|
+
r"." is(text)
|
17
|
+
|
18
|
+
lex(depends):
|
19
|
+
r":\s*" is(text)
|
20
|
+
r"(\$)(\{)(\w+\s*:\s*\w+)" is(by-groups(operator, text, name.entity))
|
21
|
+
r"\(" is(text) -> go-to(depend-vers)
|
22
|
+
r"," is(text)
|
23
|
+
r"\|" is(operator)
|
24
|
+
r"[\s]+" is(text)
|
25
|
+
r"[}\)]\s*$" is(text) -> pop
|
26
|
+
r"}" is(text)
|
27
|
+
r"[^,]$" is(name.function) -> pop
|
28
|
+
r"([\+\.a-zA-Z0-9-])(\s*)" is(by-groups(name.function, text))
|
29
|
+
r"\[.*?\]" is(name.entity)
|
30
|
+
|
31
|
+
lex(root):
|
32
|
+
r"^(Description)" is(keyword) -> go-to(description)
|
33
|
+
r"^(Maintainer)(:\s*)" is(by-groups(keyword, text)) -> go-to(maintainer)
|
34
|
+
r"^((Build-)?Depends)" is(keyword) -> go-to(depends)
|
35
|
+
r"^((?:Python-)?Version)(:\s*)(\S+)$" is(by-groups(keyword, text, literal.number))
|
36
|
+
r"^((?:Installed-)?Size)(:\s*)(\S+)$" is(by-groups(keyword, text, literal.number))
|
37
|
+
r"^(MD5Sum|SHA1|SHA256)(:\s*)(\S+)$" is(by-groups(keyword, text, literal.number))
|
38
|
+
r"^([a-zA-Z\-0-9\.]*?)(:\s*)(.*?)$" is(by-groups(keyword, text.whitespace, literal.string))
|
39
|
+
|
40
|
+
lex(description):
|
41
|
+
r"(.*)(Homepage)(: )(\S+)" is(by-groups(text, literal.string, name, name.class))
|
42
|
+
r":.*\n" is(generic.strong)
|
43
|
+
r" .*\n" is(text)
|
44
|
+
r"" is(text) -> pop
|
45
|
+
|
46
|
+
lex(depend-vers):
|
47
|
+
r"\)," is(text) -> pop
|
48
|
+
r"\)[^,]" is(text) -> pop(2)
|
49
|
+
r"([><=]+)(\s*)([^\)]+)" is(by-groups(operator, text, literal.number))
|
50
|
+
|
51
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,61 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "dg"
|
6
|
+
aliases: ["dg"]
|
7
|
+
extensions: [".dg"]
|
8
|
+
mimetypes: ["text/x-dg"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(tsqs):
|
13
|
+
r"'''" is(literal.string) -> pop
|
14
|
+
|
15
|
+
lex(string):
|
16
|
+
r"%(\([a-zA-Z0-9_]+\))?[-\#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[diouxXeEfFgGcrs%]" is(literal.string.interpol)
|
17
|
+
r"[^\\\'\"%\n]+" is(literal.string)
|
18
|
+
r"[\'\"\\]" is(literal.string)
|
19
|
+
r"%" is(literal.string)
|
20
|
+
r"\n" is(literal.string)
|
21
|
+
|
22
|
+
lex(dqs):
|
23
|
+
r"\"" is(literal.string) -> pop
|
24
|
+
|
25
|
+
lex(sqs):
|
26
|
+
r"'" is(literal.string) -> pop
|
27
|
+
|
28
|
+
lex(root):
|
29
|
+
r"\s+" is(text)
|
30
|
+
r"\#.*?$" is(comment.single)
|
31
|
+
r"0[bB][01]+" is(literal.number.bin)
|
32
|
+
r"0[oO][0-7]+" is(literal.number.oct)
|
33
|
+
r"0[xX][\da-fA-F]+" is(literal.number.hex)
|
34
|
+
r"[+-]?\d+\.\d+([eE][+-]?\d+)?[jJ]?" is(literal.number.float)
|
35
|
+
r"[+-]?\d+[eE][+-]?\d+[jJ]?" is(literal.number.float)
|
36
|
+
r"[+-]?\d+[jJ]?" is(literal.number.integer)
|
37
|
+
r"[br]*'''" is(literal.string) -> combined(stringescape, tsqs, string)
|
38
|
+
r"[br]*\"\"\"" is(literal.string) -> combined(stringescape, tdqs, string)
|
39
|
+
r"[br]*'" is(literal.string) -> combined(stringescape, sqs, string)
|
40
|
+
r"[br]*\"" is(literal.string) -> combined(stringescape, dqs, string)
|
41
|
+
r"`\w+'*`" is(operator)
|
42
|
+
r"\b(or|and|if|else|where|is|in)\b" is(operator.word)
|
43
|
+
r"[!$%&*+\-./:<-@\\^|\126;,]+" is(operator)
|
44
|
+
r"(?<!\.)(bool|bytearray|bytes|classmethod|complex|dict'?|float|frozenset|int|list'?|memoryview|object|property|range|set'?|slice|staticmethod|str|super|tuple'?|type)(?!['\w])" is(name.builtin)
|
45
|
+
r"(?<!\.)(__import__|abs|all|any|bin|bind|chr|cmp|compile|complex|delattr|dir|divmod|drop|dropwhile|enumerate|eval|filter|flip|foldl1?|format|fst|getattr|globals|hasattr|hash|head|hex|id|init|input|isinstance|issubclass|iter|iterate|last|len|locals|map|max|min|next|oct|open|ord|pow|print|repr|reversed|round|setattr|scanl1?|snd|sorted|sum|tail|take|takewhile|vars|zip)(?!['\w])" is(name.builtin)
|
46
|
+
r"(?<!\.)(self|Ellipsis|NotImplemented|None|True|False)(?!['\w])" is(name.builtin.pseudo)
|
47
|
+
r"(?<!\.)[A-Z]\w*(Error|Exception|Warning)'*(?!['\w])" is(name.exception)
|
48
|
+
r"(?<!\.)(KeyboardInterrupt|SystemExit|StopIteration|GeneratorExit)(?!['\w])" is(name.exception)
|
49
|
+
r"(?<![\.\w])(import|inherit|for|while|switch|not|raise|unsafe|yield|with)(?!['\w])" is(keyword.reserved)
|
50
|
+
r"[A-Z_']+\b" is(name)
|
51
|
+
r"[A-Z][\w']*\b" is(keyword.type)
|
52
|
+
r"\w+'*" is(name)
|
53
|
+
r"[()]" is(punctuation)
|
54
|
+
|
55
|
+
lex(stringescape):
|
56
|
+
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)
|
57
|
+
|
58
|
+
lex(tdqs):
|
59
|
+
r"\"\"\"" is(literal.string) -> pop
|
60
|
+
|
61
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Diff"
|
6
|
+
aliases: ["diff", "udiff"]
|
7
|
+
extensions: [".diff", ".patch"]
|
8
|
+
mimetypes: ["text/x-diff", "text/x-patch"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(root):
|
13
|
+
r" .*\n" is(text)
|
14
|
+
r"\+.*\n" is(generic.inserted)
|
15
|
+
r"-.*\n" is(generic.deleted)
|
16
|
+
r"!.*\n" is(generic.strong)
|
17
|
+
r"@.*\n" is(generic.subheading)
|
18
|
+
r"([Ii]ndex|diff).*\n" is(generic.heading)
|
19
|
+
r"=.*\n" is(generic.heading)
|
20
|
+
r".*\n" is(text)
|
21
|
+
|
22
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Django/Jinja"
|
6
|
+
aliases: ["django", "jinja"]
|
7
|
+
extensions: []
|
8
|
+
mimetypes: ["application/x-django-templating", "application/x-jinja"]
|
9
|
+
start: .root
|
10
|
+
flags: Regexp MULTILINE
|
11
|
+
|
12
|
+
lex(var):
|
13
|
+
r"\s+" is(text)
|
14
|
+
r"(-?)(\}\})" is(by-groups(text, comment.preproc)) -> pop
|
15
|
+
any-of(varnames)
|
16
|
+
|
17
|
+
lex(varnames):
|
18
|
+
r"(\|)(\s*)([a-zA-Z_][a-zA-Z0-9_]*)" is(by-groups(operator, text, name.function))
|
19
|
+
r"(is)(\s+)(not)?(\s+)?([a-zA-Z_][a-zA-Z0-9_]*)" is(by-groups(keyword, text, keyword, text, name.function))
|
20
|
+
r"(_|true|false|none|True|False|None)\b" is(keyword.pseudo)
|
21
|
+
r"(in|as|reversed|recursive|not|and|or|is|if|else|import|with(?:(?:out)?\s*context)?|scoped|ignore\s+missing)\b" is(keyword)
|
22
|
+
r"(loop|block|super|forloop)\b" is(name.builtin)
|
23
|
+
r"[a-zA-Z][a-zA-Z0-9_-]*" is(name.variable)
|
24
|
+
r"\.[a-zA-Z0-9_]+" is(name.variable)
|
25
|
+
r":?\"(\\\\|\\\"|[^\"])*\"" is(literal.string.double)
|
26
|
+
r":?'(\\\\|\\'|[^'])*'" is(literal.string.single)
|
27
|
+
r"([{}()\[\]+\-*/,:\126]|[><=]=?)" is(operator)
|
28
|
+
r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?" is(literal.number)
|
29
|
+
|
30
|
+
lex(root):
|
31
|
+
r"[^{]+" is(other)
|
32
|
+
r"\{\{" is(comment.preproc) -> go-to(var)
|
33
|
+
r"\{[*\#].*?[*\#]\}" is(comment)
|
34
|
+
r"(\{%)(-?\s*)(comment)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endcomment)(\s*-?)(%\})" is(by-groups(comment.preproc, text, keyword, text, comment.preproc, comment, comment.preproc, text, keyword, text, comment.preproc))
|
35
|
+
r"(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endraw)(\s*-?)(%\})" is(by-groups(comment.preproc, text, keyword, text, comment.preproc, text, comment.preproc, text, keyword, text, comment.preproc))
|
36
|
+
r"(\{%)(-?\s*)(filter)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)" is(by-groups(comment.preproc, text, keyword, text, name.function)) -> go-to(block)
|
37
|
+
r"(\{%)(-?\s*)([a-zA-Z_][a-zA-Z0-9_]*)" is(by-groups(comment.preproc, text, keyword)) -> go-to(block)
|
38
|
+
r"\{" is(other)
|
39
|
+
|
40
|
+
lex(block):
|
41
|
+
r"\s+" is(text)
|
42
|
+
r"(-?)(%\})" is(by-groups(text, comment.preproc)) -> pop
|
43
|
+
any-of(varnames)
|
44
|
+
r"." is(punctuation)
|
45
|
+
|
46
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,62 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "DTD"
|
6
|
+
aliases: ["dtd"]
|
7
|
+
extensions: [".dtd"]
|
8
|
+
mimetypes: ["application/xml-dtd"]
|
9
|
+
start: .root
|
10
|
+
flags: Regexp MULTILINE
|
11
|
+
|
12
|
+
lex(comment):
|
13
|
+
r"[^-]+" is(comment)
|
14
|
+
r"-->" is(comment) -> pop
|
15
|
+
r"-" is(comment)
|
16
|
+
|
17
|
+
lex(notation):
|
18
|
+
any-of(common)
|
19
|
+
r"SYSTEM|PUBLIC" is(keyword.constant)
|
20
|
+
r"[^>\s\|()?+*,]+" is(name.attribute)
|
21
|
+
r">" is(keyword) -> pop
|
22
|
+
|
23
|
+
lex(entity):
|
24
|
+
any-of(common)
|
25
|
+
r"SYSTEM|PUBLIC|NDATA" is(keyword.constant)
|
26
|
+
r"[^>\s\|()?+*,]+" is(name.entity)
|
27
|
+
r">" is(keyword) -> pop
|
28
|
+
|
29
|
+
lex(common):
|
30
|
+
r"\s+" is(text)
|
31
|
+
r"(%|&)[^;]*;" is(name.entity)
|
32
|
+
r"<!--" is(comment) -> go-to(comment)
|
33
|
+
r"[(|)*,?+]" is(operator)
|
34
|
+
r"\"[^\"]*\"" is(literal.string.double)
|
35
|
+
r"\'[^\']*\'" is(literal.string.single)
|
36
|
+
|
37
|
+
lex(element):
|
38
|
+
any-of(common)
|
39
|
+
r"EMPTY|ANY|\#PCDATA" is(keyword.constant)
|
40
|
+
r"[^>\s\|()?+*,]+" is(name.tag)
|
41
|
+
r">" is(keyword) -> pop
|
42
|
+
|
43
|
+
lex(root):
|
44
|
+
any-of(common)
|
45
|
+
r"(<!ELEMENT)(\s+)(\S+)" is(by-groups(keyword, text, name.tag)) -> go-to(element)
|
46
|
+
r"(<!ATTLIST)(\s+)(\S+)" is(by-groups(keyword, text, name.tag)) -> go-to(attlist)
|
47
|
+
r"(<!ENTITY)(\s+)(\S+)" is(by-groups(keyword, text, name.entity)) -> go-to(entity)
|
48
|
+
r"(<!NOTATION)(\s+)(\S+)" is(by-groups(keyword, text, name.tag)) -> go-to(notation)
|
49
|
+
r"(<!\[)([^\[\s]+)(\s*)(\[)" is(by-groups(keyword, name.entity, text, keyword))
|
50
|
+
r"(<!DOCTYPE)(\s+)([^>\s]+)" is(by-groups(keyword, text, name.tag))
|
51
|
+
r"PUBLIC|SYSTEM" is(keyword.constant)
|
52
|
+
r"[\[\]>]" is(keyword)
|
53
|
+
|
54
|
+
lex(attlist):
|
55
|
+
any-of(common)
|
56
|
+
r"CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITIES|ENTITY|NOTATION" is(keyword.constant)
|
57
|
+
r"\#REQUIRED|\#IMPLIED|\#FIXED" is(keyword.constant)
|
58
|
+
r"xml:space|xml:lang" is(keyword.reserved)
|
59
|
+
r"[^>\s\|()?+*,]+" is(name.attribute)
|
60
|
+
r">" is(keyword) -> pop
|
61
|
+
|
62
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Dylan"
|
6
|
+
aliases: ["dylan"]
|
7
|
+
extensions: [".dylan", ".dyl", ".intr"]
|
8
|
+
mimetypes: ["text/x-dylan"]
|
9
|
+
start: .root
|
10
|
+
flags: Regexp IGNORECASE
|
11
|
+
|
12
|
+
lex(comment):
|
13
|
+
r"[^*/]" is(comment.multiline)
|
14
|
+
r"/\*" is(comment.multiline) -> push
|
15
|
+
r"\*/" is(comment.multiline) -> pop
|
16
|
+
r"[*/]" is(comment.multiline)
|
17
|
+
|
18
|
+
lex(code):
|
19
|
+
r"\s+" is(text)
|
20
|
+
r"//.*?\n" is(comment.single)
|
21
|
+
r"/\*" is(comment.multiline) -> go-to(comment)
|
22
|
+
r"\"" is(literal.string) -> go-to(string)
|
23
|
+
r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'" is(literal.string.char)
|
24
|
+
r"\#[bB][01]+" is(literal.number)
|
25
|
+
r"\#[oO][0-7]+" is(literal.number.oct)
|
26
|
+
r"[-+]?(\d*\.\d+(e[-+]?\d+)?|\d+(\.\d*)?e[-+]?\d+)" is(literal.number.float)
|
27
|
+
r"[-+]?\d+" is(literal.number.integer)
|
28
|
+
r"\#[xX][0-9a-fA-F]+" is(literal.number.hex)
|
29
|
+
r"(\?\\?[a-zA-Z0-9\!\&\*\<\>\|\^\$\%\@\_\-\+\\126\?\/\=]+)(:)(token|name|variable|expression|body|case-body|\*)" is(by-groups(name.tag, operator, name.builtin))
|
30
|
+
r"(\?)(:)(token|name|variable|expression|body|case-body|\*)" is(by-groups(name.tag, operator, name.builtin))
|
31
|
+
r"\?\\?[a-zA-Z0-9\!\&\*\<\>\|\^\$\%\@\_\-\+\\126\?\/\=]+" is(name.tag)
|
32
|
+
r"(=>|::|\#\(|\#\[|\#\#|\?|\?\?|\?=|[(){}\[\],\.;])" is(punctuation)
|
33
|
+
r":=" is(operator)
|
34
|
+
r"\#[tf]" is(literal)
|
35
|
+
r"\#\"" is(literal.string.symbol) -> go-to(keyword)
|
36
|
+
r"\#[a-zA-Z0-9-]+" is(keyword)
|
37
|
+
r"\\?[a-zA-Z0-9\!\&\*\<\>\|\^\$\%\@\_\-\+\\126\?\/\=]+:" is(keyword)
|
38
|
+
r"<\\?[a-zA-Z0-9\!\&\*\<\>\|\^\$\%\@\_\-\+\\126\?\/\=]+>" is(name.class)
|
39
|
+
r"\*\\?[a-zA-Z0-9\!\&\*\<\>\|\^\$\%\@\_\-\+\\126\?\/\=]+\*" is(name.variable.global)
|
40
|
+
r"\$\\?[a-zA-Z0-9\!\&\*\<\>\|\^\$\%\@\_\-\+\\126\?\/\=]+" is(name.constant)
|
41
|
+
r"\\?[a-zA-Z0-9\!\&\*\<\>\|\^\$\%\@\_\-\+\\126\?\/\=]+" is(name)
|
42
|
+
|
43
|
+
lex(root):
|
44
|
+
r"\s+" is(text)
|
45
|
+
r"//.*?\n" is(comment.single)
|
46
|
+
r"([A-Za-z0-9-]+)(:)([ \t]*)(.*(?:\n[ \t].+)*)" is(by-groups(name.attribute, operator, text, literal.string))
|
47
|
+
r"" is(text) -> go-to(code)
|
48
|
+
|
49
|
+
lex(string):
|
50
|
+
r"\"" is(literal.string) -> pop
|
51
|
+
r"\\([\\abfnrtv\"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})" is(literal.string.escape)
|
52
|
+
r"[^\\\"\n]+" is(literal.string)
|
53
|
+
r"\\\n" is(literal.string)
|
54
|
+
r"\\" is(literal.string)
|
55
|
+
|
56
|
+
lex(keyword):
|
57
|
+
r"\"" is(literal.string.symbol) -> pop
|
58
|
+
r"[^\\\"]+" is(literal.string.symbol)
|
59
|
+
|
60
|
+
const-set(.Lexer, lexer)
|