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,88 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Ioke"
|
6
|
+
aliases: ["ioke", "ik"]
|
7
|
+
extensions: [".ik"]
|
8
|
+
mimetypes: ["text/x-iokesrc"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(squareRegexp):
|
13
|
+
r"(?<!\\)][oxpniums]*" is(literal.string.regex) -> pop
|
14
|
+
any-of(interpolatableText)
|
15
|
+
r"\\]" is(literal.string.regex)
|
16
|
+
r"[^\]]" is(literal.string.regex)
|
17
|
+
|
18
|
+
lex(textInterpolationRoot):
|
19
|
+
r"}" is(punctuation) -> pop
|
20
|
+
any-of(root)
|
21
|
+
|
22
|
+
lex(interpolatableText):
|
23
|
+
r"(\\b|\\e|\\t|\\n|\\f|\\r|\\\"|\\\\|\\\#|\\\Z|\\u[0-9a-fA-F]{1,4}|\\[0-3]?[0-7]?[0-7])" is(literal.string.escape)
|
24
|
+
r"\#{" is(punctuation) -> go-to(textInterpolationRoot)
|
25
|
+
|
26
|
+
lex(text):
|
27
|
+
r"(?<!\\)\"" is(literal.string) -> pop
|
28
|
+
any-of(interpolatableText)
|
29
|
+
r"[^\"]" is(literal.string)
|
30
|
+
|
31
|
+
lex(documentation):
|
32
|
+
r"(?<!\\)\"" is(literal.string.doc) -> pop
|
33
|
+
any-of(interpolatableText)
|
34
|
+
r"[^\"]" is(literal.string.doc)
|
35
|
+
|
36
|
+
lex(slashRegexp):
|
37
|
+
r"(?<!\\)/[oxpniums]*" is(literal.string.regex) -> pop
|
38
|
+
any-of(interpolatableText)
|
39
|
+
r"\\/" is(literal.string.regex)
|
40
|
+
r"[^/]" is(literal.string.regex)
|
41
|
+
|
42
|
+
lex(squareText):
|
43
|
+
r"(?<!\\)]" is(literal.string) -> pop
|
44
|
+
any-of(interpolatableText)
|
45
|
+
r"[^\]]" is(literal.string)
|
46
|
+
|
47
|
+
lex(root):
|
48
|
+
r"\n" is(text)
|
49
|
+
r"\s+" is(text)
|
50
|
+
r";(.*?)\n" is(comment)
|
51
|
+
r"\A\#!(.*?)\n" is(comment)
|
52
|
+
r"\#/" is(literal.string.regex) -> go-to(slashRegexp)
|
53
|
+
r"\#r\[" is(literal.string.regex) -> go-to(squareRegexp)
|
54
|
+
r":[a-zA-Z0-9_!:?]+" is(literal.string.symbol)
|
55
|
+
r"[a-zA-Z0-9_!:?]+:(?![a-zA-Z0-9_!?])" is(literal.string.other)
|
56
|
+
r":\"(\\\\|\\\"|[^\"])*\"" is(literal.string.symbol)
|
57
|
+
r"((?<=fn\()|(?<=fnx\()|(?<=method\()|(?<=macro\()|(?<=lecro\()|(?<=syntax\()|(?<=dmacro\()|(?<=dlecro\()|(?<=dlecrox\()|(?<=dsyntax\())\s*\"" is(literal.string.doc) -> go-to(documentation)
|
58
|
+
r"\"" is(literal.string) -> go-to(text)
|
59
|
+
r"\#\[" is(literal.string) -> go-to(squareText)
|
60
|
+
r"[a-zA-Z0-9_][a-zA-Z0-9!?_:]+(?=\s*=.*mimic\s)" is(name.entity)
|
61
|
+
r"[a-zA-Z_][a-zA-Z0-9_!:?]*(?=[\s]*[+*/-]?=[^=].*($|\.))" is(name.variable)
|
62
|
+
r"(break|cond|continue|do|ensure|for|for:dict|for:set|if|let|loop|p:for|p:for:dict|p:for:set|return|unless|until|while|with)(?![a-zA-Z0-9!:_?])" is(keyword.reserved)
|
63
|
+
r"(eval|mimic|print|println)(?![a-zA-Z0-9!:_?])" is(keyword)
|
64
|
+
r"(cell\?|cellNames|cellOwner\?|cellOwner|cells|cell|documentation|hash|identity|mimic|removeCell\!|undefineCell\!)(?![a-zA-Z0-9!:_?])" is(keyword)
|
65
|
+
r"(stackTraceAsText)(?![a-zA-Z0-9!:_?])" is(keyword)
|
66
|
+
r"(dict|list|message|set)(?![a-zA-Z0-9!:_?])" is(keyword.reserved)
|
67
|
+
r"(case|case:and|case:else|case:nand|case:nor|case:not|case:or|case:otherwise|case:xor)(?![a-zA-Z0-9!:_?])" is(keyword.reserved)
|
68
|
+
r"(asText|become\!|derive|freeze\!|frozen\?|in\?|is\?|kind\?|mimic\!|mimics|mimics\?|prependMimic\!|removeAllMimics\!|removeMimic\!|same\?|send|thaw\!|uniqueHexId)(?![a-zA-Z0-9!:_?])" is(keyword)
|
69
|
+
r"(after|around|before)(?![a-zA-Z0-9!:_?])" is(keyword.reserved)
|
70
|
+
r"(kind|cellDescriptionDict|cellSummary|genSym|inspect|notice)(?![a-zA-Z0-9!:_?])" is(keyword)
|
71
|
+
r"(use|destructuring)" is(keyword.reserved)
|
72
|
+
r"(cell\?|cellOwner\?|cellOwner|cellNames|cells|cell|documentation|identity|removeCell!|undefineCell)(?![a-zA-Z0-9!:_?])" is(keyword)
|
73
|
+
r"(internal:compositeRegexp|internal:concatenateText|internal:createDecimal|internal:createNumber|internal:createRegexp|internal:createText)(?![a-zA-Z0-9!:_?])" is(keyword.reserved)
|
74
|
+
r"(availableRestarts|bind|error\!|findRestart|handle|invokeRestart|rescue|restart|signal\!|warn\!)(?![a-zA-Z0-9!:_?])" is(keyword.reserved)
|
75
|
+
r"(nil|false|true)(?![a-zA-Z0-9!:_?])" is(name.constant)
|
76
|
+
r"(Arity|Base|Call|Condition|DateTime|Aspects|Pointcut|Assignment|BaseBehavior|Boolean|Case|AndCombiner|Else|NAndCombiner|NOrCombiner|NotCombiner|OrCombiner|XOrCombiner|Conditions|Definitions|FlowControl|Internal|Literals|Reflection|DefaultMacro|DefaultMethod|DefaultSyntax|Dict|FileSystem|Ground|Handler|Hook|IO|IokeGround|Struct|LexicalBlock|LexicalMacro|List|Message|Method|Mixins|NativeMethod|Number|Origin|Pair|Range|Reflector|Regexp Match|Regexp|Rescue|Restart|Runtime|Sequence|Set|Symbol|System|Text|Tuple)(?![a-zA-Z0-9!:_?])" is(name.builtin)
|
77
|
+
r"(generateMatchMethod|aliasMethod|\955|\654|fnx|fn|method|dmacro|dlecro|syntax|macro|dlecrox|lecrox|lecro|syntax)(?![a-zA-Z0-9!:_?])" is(name.function)
|
78
|
+
r"-?0[xX][0-9a-fA-F]+" is(literal.number.hex)
|
79
|
+
r"-?(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?" is(literal.number.float)
|
80
|
+
r"-?\d+" is(literal.number.integer)
|
81
|
+
r"\#\(" is(punctuation)
|
82
|
+
r"(&&>>|\|\|>>|\*\*>>|:::|::|\.\.\.|===|\*\*>|\*\*=|&&>|&&=|\|\|>|\|\|=|\->>|\+>>|!>>|<>>>|<>>|&>>|%>>|\#>>|@>>|/>>|\*>>|\?>>|\|>>|\^>>|\126>>|\$>>|=>>|<<=|>>=|<=>|<\->|=\126|!\126|=>|\+\+|\-\-|<=|>=|==|!=|&&|\.\.|\+=|\-=|\*=|\/=|%=|&=|\^=|\|=|<\-|\+>|!>|<>|&>|%>|\#>|\@>|\/>|\*>|\?>|\|>|\^>|\126>|\$>|<\->|\->|<<|>>|\*\*|\?\||\?&|\|\||>|<|\*|\/|%|\+|\-|&|\^|\||=|\$|!|\126|\?|\#|\8800|\8728|\8712|\8713)" is(operator)
|
83
|
+
r"(and|nand|or|xor|nor|return|import)(?![a-zA-Z0-9_!?])" is(operator)
|
84
|
+
r"(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|{|})" is(punctuation)
|
85
|
+
r"[A-Z][a-zA-Z0-9_!:?]*" is(name.class)
|
86
|
+
r"[a-z_][a-zA-Z0-9_!:?]*" is(name)
|
87
|
+
|
88
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "IRC logs"
|
6
|
+
aliases: ["irc"]
|
7
|
+
extensions: [".weechatlog"]
|
8
|
+
mimetypes: ["text/x-irclog"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(msg):
|
13
|
+
r"\S+:(?!//)" is(name.attribute)
|
14
|
+
r".*\n" is(text) -> pop
|
15
|
+
|
16
|
+
lex(root):
|
17
|
+
r"^\*\*\*\*(.*)\*\*\*\*$" is(comment)
|
18
|
+
r"^\10 (\10 \# irssi / xchat and others\10 (?: \[|\()? \# Opening bracket or paren for the timestamp\10 (?: \# Timestamp\10 (?: (?:\d{1,4} [-/]?)+ \# Date as - or /-separated groups of digits\10 [T ])? \# Date/time separator: T or space\10 (?: \d?\d [:.]?)+ \# Time as :/.-separated groups of 1 or 2 digits\10 )\10 (?: \]|\))?\s+ \# Closing bracket or paren for the timestamp\10 |\10 \# weechat\10 \d{4}\s\w{3}\s\d{2}\s \# Date\10 \d{2}:\d{2}:\d{2}\s+ \# Time + Whitespace\10 |\10 \# xchat\10 \w{3}\s\d{2}\s \# Date\10 \d{2}:\d{2}:\d{2}\s+ \# Time + Whitespace\10 )?\10 (\s*<[^>]*>\s*)$" is(by-groups(comment.preproc, name.tag))
|
19
|
+
r"^\10 (\10 \# irssi / xchat and others\10 (?: \[|\()? \# Opening bracket or paren for the timestamp\10 (?: \# Timestamp\10 (?: (?:\d{1,4} [-/]?)+ \# Date as - or /-separated groups of digits\10 [T ])? \# Date/time separator: T or space\10 (?: \d?\d [:.]?)+ \# Time as :/.-separated groups of 1 or 2 digits\10 )\10 (?: \]|\))?\s+ \# Closing bracket or paren for the timestamp\10 |\10 \# weechat\10 \d{4}\s\w{3}\s\d{2}\s \# Date\10 \d{2}:\d{2}:\d{2}\s+ \# Time + Whitespace\10 |\10 \# xchat\10 \w{3}\s\d{2}\s \# Date\10 \d{2}:\d{2}:\d{2}\s+ \# Time + Whitespace\10 )?\10 \10 (\s*<.*?>\s*) \# Nick " is(by-groups(comment.preproc, name.tag)) -> go-to(msg)
|
20
|
+
r"^\10 (\10 \# irssi / xchat and others\10 (?: \[|\()? \# Opening bracket or paren for the timestamp\10 (?: \# Timestamp\10 (?: (?:\d{1,4} [-/]?)+ \# Date as - or /-separated groups of digits\10 [T ])? \# Date/time separator: T or space\10 (?: \d?\d [:.]?)+ \# Time as :/.-separated groups of 1 or 2 digits\10 )\10 (?: \]|\))?\s+ \# Closing bracket or paren for the timestamp\10 |\10 \# weechat\10 \d{4}\s\w{3}\s\d{2}\s \# Date\10 \d{2}:\d{2}:\d{2}\s+ \# Time + Whitespace\10 |\10 \# xchat\10 \w{3}\s\d{2}\s \# Date\10 \d{2}:\d{2}:\d{2}\s+ \# Time + Whitespace\10 )?\10 \10 (\s*[*]\s+) \# Star\10 (\S+\s+.*?\n) \# Nick + rest of message " is(by-groups(comment.preproc, keyword, generic.inserted))
|
21
|
+
r"^\10 (\10 \# irssi / xchat and others\10 (?: \[|\()? \# Opening bracket or paren for the timestamp\10 (?: \# Timestamp\10 (?: (?:\d{1,4} [-/]?)+ \# Date as - or /-separated groups of digits\10 [T ])? \# Date/time separator: T or space\10 (?: \d?\d [:.]?)+ \# Time as :/.-separated groups of 1 or 2 digits\10 )\10 (?: \]|\))?\s+ \# Closing bracket or paren for the timestamp\10 |\10 \# weechat\10 \d{4}\s\w{3}\s\d{2}\s \# Date\10 \d{2}:\d{2}:\d{2}\s+ \# Time + Whitespace\10 |\10 \# xchat\10 \w{3}\s\d{2}\s \# Date\10 \d{2}:\d{2}:\d{2}\s+ \# Time + Whitespace\10 )?\10 \10 (\s*(?:\*{3}|<?-[!@=P]?->?)\s*) \# Star(s) or symbols\10 (\S+\s+) \# Nick + Space\10 (.*?\n) \# Rest of message " is(by-groups(comment.preproc, keyword, literal.string, comment))
|
22
|
+
r"^.*?\n" is(text)
|
23
|
+
|
24
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "JAGS"
|
6
|
+
aliases: ["jags"]
|
7
|
+
extensions: [".jag", ".bug"]
|
8
|
+
mimetypes: []
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(root):
|
13
|
+
any-of(comments)
|
14
|
+
any-of(whitespace)
|
15
|
+
r"(model|data)(\s+)({)" is(by-groups(keyword.namespace, text, punctuation))
|
16
|
+
r"var(?![0-9a-zA-Z\._])" is(keyword.declaration)
|
17
|
+
r"(for|in)(?![0-9a-zA-Z\._])" is(keyword.reserved)
|
18
|
+
r"(abs|arccos|arccosh|arcsin|arcsinh|arctan|arctanh|cos|cosh|cloglog|equals|exp|icloglog|ifelse|ilogit|log|logfact|loggam|logit|phi|pow|probit|round|sin|sinh|sqrt|step|tan|tanh|trunc|inprod|interp.lin|logdet|max|mean|min|prod|sum|sd|inverse|rank|sort|t|acos|acosh|asin|asinh|atan|T|I|[dpq]bern|[dpq]beta|[dpq]dchiqsqr|[dpq]ddexp|[dpq]dexp|[dpq]df|[dpq]gamma|[dpq]gen.gamma|[dpq]logis|[dpq]lnorm|[dpq]negbin|[dpq]nchisqr|[dpq]norm|[dpq]par|[dpq]pois|[dpq]weib|dt|dunif|dbetabin|dbern|dbin|dcat|dhyper|ddirch|dmnorm|dwish|dmt|dmulti|dbinom|dchisq|dnbinom|dweibull|ddirich)(?=\s*\()" is(name.builtin)
|
19
|
+
any-of(names)
|
20
|
+
r"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?" is(literal.number)
|
21
|
+
r"\[|\]|\(|\)|:|,|;" is(punctuation)
|
22
|
+
r"<-|\126" is(operator)
|
23
|
+
r"\+|-|\*|\/|\|\|[&]{2}|[<>=]=?|\^|%.*?%" is(operator)
|
24
|
+
r"[{}]" is(punctuation)
|
25
|
+
|
26
|
+
lex(whitespace):
|
27
|
+
r"\s+" is(text)
|
28
|
+
|
29
|
+
lex(comments):
|
30
|
+
r"(?m)/\*.*?\*/" is(comment.multiline)
|
31
|
+
r"\#.*$" is(comment.single)
|
32
|
+
|
33
|
+
lex(names):
|
34
|
+
r"[a-zA-Z][a-zA-Z0-9_.]*\b" is(name)
|
35
|
+
|
36
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Java"
|
6
|
+
aliases: ["java"]
|
7
|
+
extensions: [".java"]
|
8
|
+
mimetypes: ["text/x-java"]
|
9
|
+
start: .root
|
10
|
+
flags: Regexp MULTILINE
|
11
|
+
|
12
|
+
lex(import):
|
13
|
+
r"[a-zA-Z0-9_.]+\*?" is(name.namespace) -> pop
|
14
|
+
|
15
|
+
lex(root):
|
16
|
+
r"^(\s*(?:[a-zA-Z_][a-zA-Z0-9_\.\[\]<>]*\s+)+?)([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(\()" is(by-groups(using(self class), name.function, text, operator))
|
17
|
+
r"[^\S\n]+" is(text)
|
18
|
+
r"//.*?\n" is(comment.single)
|
19
|
+
r"/\*.*?\*/" is(comment.multiline)
|
20
|
+
r"@[a-zA-Z_][a-zA-Z0-9_\.]*" is(name.decorator)
|
21
|
+
r"(assert|break|case|catch|continue|default|do|else|finally|for|if|goto|instanceof|new|return|switch|this|throw|try|while)\b" is(keyword)
|
22
|
+
r"(abstract|const|enum|extends|final|implements|native|private|protected|public|static|strictfp|super|synchronized|throws|transient|volatile)\b" is(keyword.declaration)
|
23
|
+
r"(boolean|byte|char|double|float|int|long|short|void)\b" is(keyword.type)
|
24
|
+
r"(package)(\s+)" is(by-groups(keyword.namespace, text))
|
25
|
+
r"(true|false|null)\b" is(keyword.constant)
|
26
|
+
r"(class|interface)(\s+)" is(by-groups(keyword.declaration, text)) -> go-to(class)
|
27
|
+
r"(import)(\s+)" is(by-groups(keyword.namespace, text)) -> go-to(import)
|
28
|
+
r"\"(\\\\|\\\"|[^\"])*\"" is(literal.string)
|
29
|
+
r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'" is(literal.string.char)
|
30
|
+
r"(\.)([a-zA-Z_][a-zA-Z0-9_]*)" is(by-groups(operator, name.attribute))
|
31
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*:" is(name.label)
|
32
|
+
r"[a-zA-Z_\$][a-zA-Z0-9_]*" is(name)
|
33
|
+
r"[\126\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]" is(operator)
|
34
|
+
r"[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?" is(literal.number.float)
|
35
|
+
r"0x[0-9a-fA-F]+" is(literal.number.hex)
|
36
|
+
r"[0-9]+L?" is(literal.number.integer)
|
37
|
+
r"\n" is(text)
|
38
|
+
|
39
|
+
lex(class):
|
40
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name.class) -> pop
|
41
|
+
|
42
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "JavaScript"
|
6
|
+
aliases: ["js", "javascript"]
|
7
|
+
extensions: [".js"]
|
8
|
+
mimetypes: ["application/javascript", "application/x-javascript", "text/x-javascript", "text/javascript"]
|
9
|
+
start: .root
|
10
|
+
flags: Regexp MULTILINE
|
11
|
+
|
12
|
+
lex(commentsandwhitespace):
|
13
|
+
r"\s+" is(text)
|
14
|
+
r"<!--" is(comment)
|
15
|
+
r"//.*?\n" is(comment.single)
|
16
|
+
r"/\*.*?\*/" is(comment.multiline)
|
17
|
+
|
18
|
+
lex(root):
|
19
|
+
r"^(?=\s|/|<!--)" is(text) -> go-to(slashstartsregex)
|
20
|
+
any-of(commentsandwhitespace)
|
21
|
+
r"\+\+|--|\126|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?" is(operator) -> go-to(slashstartsregex)
|
22
|
+
r"[{(\[;,]" is(punctuation) -> go-to(slashstartsregex)
|
23
|
+
r"[})\].]" is(punctuation)
|
24
|
+
r"(for|in|while|do|break|return|continue|switch|case|default|if|else|throw|try|catch|finally|new|delete|typeof|instanceof|void|this)\b" is(keyword) -> go-to(slashstartsregex)
|
25
|
+
r"(var|let|with|function)\b" is(keyword.declaration) -> go-to(slashstartsregex)
|
26
|
+
r"(abstract|boolean|byte|char|class|const|debugger|double|enum|export|extends|final|float|goto|implements|import|int|interface|long|native|package|private|protected|public|short|static|super|synchronized|throws|transient|volatile)\b" is(keyword.reserved)
|
27
|
+
r"(true|false|null|NaN|Infinity|undefined)\b" is(keyword.constant)
|
28
|
+
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)
|
29
|
+
r"[$a-zA-Z_][a-zA-Z0-9_]*" is(name.other)
|
30
|
+
r"[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?" is(literal.number.float)
|
31
|
+
r"0x[0-9a-fA-F]+" is(literal.number.hex)
|
32
|
+
r"[0-9]+" is(literal.number.integer)
|
33
|
+
r"\"(\\\\|\\\"|[^\"])*\"" is(literal.string.double)
|
34
|
+
r"'(\\\\|\\'|[^'])*'" is(literal.string.single)
|
35
|
+
|
36
|
+
lex(slashstartsregex):
|
37
|
+
any-of(commentsandwhitespace)
|
38
|
+
r"/(\\.|[^\[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)" is(literal.string.regex) -> pop
|
39
|
+
r"(?=/)" is(text) -> do-all(pop, go-to(badregex))
|
40
|
+
r"" is(text) -> pop
|
41
|
+
|
42
|
+
lex(badregex):
|
43
|
+
r"\n" is(text) -> pop
|
44
|
+
|
45
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "JSON"
|
6
|
+
aliases: ["json"]
|
7
|
+
extensions: [".json"]
|
8
|
+
mimetypes: ["application/json"]
|
9
|
+
start: .root
|
10
|
+
flags: Regexp MULTILINE
|
11
|
+
|
12
|
+
lex(objectattribute):
|
13
|
+
any-of(value)
|
14
|
+
r":" is(punctuation)
|
15
|
+
r"," is(punctuation) -> pop
|
16
|
+
r"}" is(punctuation) -> do-all(pop, pop)
|
17
|
+
|
18
|
+
lex(whitespace):
|
19
|
+
r"\s+" is(text)
|
20
|
+
|
21
|
+
lex(root):
|
22
|
+
any-of(value)
|
23
|
+
|
24
|
+
lex(simplevalue):
|
25
|
+
r"(true|false|null)\b" is(keyword.constant)
|
26
|
+
r"-?(0|[1-9]\d*)(\.\d+[eE](\+|-)?\d+|[eE](\+|-)?\d+|\.\d+)" is(literal.number.float)
|
27
|
+
r"-?(0|[1-9]\d*)" is(literal.number.integer)
|
28
|
+
r"\"(\\\\|\\\"|[^\"])*\"" is(literal.string.double)
|
29
|
+
|
30
|
+
lex(value):
|
31
|
+
any-of(whitespace)
|
32
|
+
any-of(simplevalue)
|
33
|
+
r"{" is(punctuation) -> go-to(objectvalue)
|
34
|
+
r"\[" is(punctuation) -> go-to(arrayvalue)
|
35
|
+
|
36
|
+
lex(arrayvalue):
|
37
|
+
any-of(whitespace)
|
38
|
+
any-of(value)
|
39
|
+
r"," is(punctuation)
|
40
|
+
r"]" is(punctuation) -> pop
|
41
|
+
|
42
|
+
lex(objectvalue):
|
43
|
+
any-of(whitespace)
|
44
|
+
r"\"(\\\\|\\\"|[^\"])*\"" is(name.tag) -> go-to(objectattribute)
|
45
|
+
r"}" is(punctuation) -> pop
|
46
|
+
|
47
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Julia"
|
6
|
+
aliases: ["julia", "jl"]
|
7
|
+
extensions: [".jl"]
|
8
|
+
mimetypes: ["text/x-julia", "application/x-julia"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(typename):
|
13
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name.class) -> pop
|
14
|
+
|
15
|
+
lex(stringescape):
|
16
|
+
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)
|
17
|
+
|
18
|
+
lex(root):
|
19
|
+
r"\n" is(text)
|
20
|
+
r"[^\S\n]+" is(text)
|
21
|
+
r"\#.*$" is(comment)
|
22
|
+
r"[\]{}:(),;\[@]" is(punctuation)
|
23
|
+
r"\\\n" is(text)
|
24
|
+
r"\\" is(text)
|
25
|
+
r"(begin|while|for|in|return|break|continue|macro|quote|let|if|elseif|else|try|catch|end|bitstype|ccall|do|using|module|import|export|importall|baremodule)\b" is(keyword)
|
26
|
+
r"(local|global|const)\b" is(keyword.declaration)
|
27
|
+
r"(Bool|Int|Int8|Int16|Int32|Int64|Uint|Uint8|Uint16|Uint32|Uint64|Float32|Float64|Complex64|Complex128|Any|Nothing|None)\b" is(keyword.type)
|
28
|
+
r"(function)((?:\s|\\\s)+)" is(by-groups(keyword, name.function)) -> go-to(funcname)
|
29
|
+
r"(type|typealias|abstract)((?:\s|\\\s)+)" is(by-groups(keyword, name.class)) -> go-to(typename)
|
30
|
+
r"==|!=|<=|>=|->|&&|\|\||::|<:|[-\126+/*%=<>&^|.?!$]" is(operator)
|
31
|
+
r"\.\*|\.\^|\.\\|\.\/|\\" is(operator)
|
32
|
+
r"(exit|whos|edit|load|is|isa|isequal|typeof|tuple|ntuple|uid|hash|finalizer|convert|promote|subtype|typemin|typemax|realmin|realmax|sizeof|eps|promote_type|method_exists|applicable|invoke|dlopen|dlsym|system|error|throw|assert|new|Inf|Nan|pi|im)\b" is(name.builtin)
|
33
|
+
r"`(?m).*?`" is(literal.string.backtick)
|
34
|
+
r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'" is(literal.string.char)
|
35
|
+
r"(?<=[.\w\)\]])\'+" is(operator)
|
36
|
+
r"(?:[IL])\"" is(literal.string) -> go-to(string)
|
37
|
+
r"[E]?\"" is(literal.string) -> combined(stringescape, string)
|
38
|
+
r"@[a-zA-Z0-9_.]+" is(name.decorator)
|
39
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name)
|
40
|
+
r"(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?" is(literal.number.float)
|
41
|
+
r"\d+[eEf][+-]?[0-9]+" is(literal.number.float)
|
42
|
+
r"0b[01]+" is(literal.number.binary)
|
43
|
+
r"0o[0-7]+" is(literal.number.oct)
|
44
|
+
r"0x[a-fA-F0-9]+" is(literal.number.hex)
|
45
|
+
r"\d+" is(literal.number.integer)
|
46
|
+
|
47
|
+
lex(string):
|
48
|
+
r"\"" is(literal.string) -> pop
|
49
|
+
r"\\\\|\\\"|\\\n" is(literal.string.escape)
|
50
|
+
r"\$(\([a-zA-Z0-9_]+\))?[-\#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?" is(literal.string.interpol)
|
51
|
+
r"[^\\\"$]+" is(literal.string)
|
52
|
+
r"[\"\\]" is(literal.string)
|
53
|
+
r"\$" is(literal.string)
|
54
|
+
|
55
|
+
lex(funcname):
|
56
|
+
r"[a-zA-Z_][a-zA-Z0-9_]*" is(name.function) -> pop
|
57
|
+
r"\([^\s\w{]{1,2}\)" is(operator) -> pop
|
58
|
+
r"[^\s\w{]{1,2}" is(operator) -> pop
|
59
|
+
|
60
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,71 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Kconfig"
|
6
|
+
aliases: ["kconfig", "menuconfig", "linux-config", "kernel-config"]
|
7
|
+
extensions: ["Kconfig", "Config.in", "external.in", "standard-modules.in"]
|
8
|
+
mimetypes: ["text/x-kconfig"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
11
|
+
|
12
|
+
lex(indent1):
|
13
|
+
r"(?:\t| {1,7}\t| {8}){1}.*\n" is(literal.string.doc)
|
14
|
+
r"\s*\n" is(text)
|
15
|
+
r"" is(generic) -> pop(2)
|
16
|
+
|
17
|
+
lex(indent3):
|
18
|
+
r"(?:\t| {1,7}\t| {8}){3}.*\n" is(literal.string.doc)
|
19
|
+
r"\s*\n" is(text)
|
20
|
+
r"" is(generic) -> pop(2)
|
21
|
+
|
22
|
+
lex(indent2):
|
23
|
+
r"(?:\t| {1,7}\t| {8}){2}.*\n" is(literal.string.doc)
|
24
|
+
r"\s*\n" is(text)
|
25
|
+
r"" is(generic) -> pop(2)
|
26
|
+
|
27
|
+
lex(indent5):
|
28
|
+
r"(?:\t| {1,7}\t| {8}){5}.*\n" is(literal.string.doc)
|
29
|
+
r"\s*\n" is(text)
|
30
|
+
r"" is(generic) -> pop(2)
|
31
|
+
|
32
|
+
lex(help):
|
33
|
+
r"\s*\n" is(text)
|
34
|
+
r"(?:\t| {1,7}\t| {8}){7}.*\n" is(literal.string.doc) -> go-to(indent7)
|
35
|
+
r"(?:\t| {1,7}\t| {8}){6}.*\n" is(literal.string.doc) -> go-to(indent6)
|
36
|
+
r"(?:\t| {1,7}\t| {8}){5}.*\n" is(literal.string.doc) -> go-to(indent5)
|
37
|
+
r"(?:\t| {1,7}\t| {8}){4}.*\n" is(literal.string.doc) -> go-to(indent4)
|
38
|
+
r"(?:\t| {1,7}\t| {8}){3}.*\n" is(literal.string.doc) -> go-to(indent3)
|
39
|
+
r"(?:\t| {1,7}\t| {8}){2}.*\n" is(literal.string.doc) -> go-to(indent2)
|
40
|
+
r"(?:\t| {1,7}\t| {8}){1}.*\n" is(literal.string.doc) -> go-to(indent1)
|
41
|
+
r"" is(text) -> pop
|
42
|
+
|
43
|
+
lex(indent7):
|
44
|
+
r"(?:\t| {1,7}\t| {8}){7}.*\n" is(literal.string.doc)
|
45
|
+
r"\s*\n" is(text)
|
46
|
+
r"" is(generic) -> pop(2)
|
47
|
+
|
48
|
+
lex(indent6):
|
49
|
+
r"(?:\t| {1,7}\t| {8}){6}.*\n" is(literal.string.doc)
|
50
|
+
r"\s*\n" is(text)
|
51
|
+
r"" is(generic) -> pop(2)
|
52
|
+
|
53
|
+
lex(root):
|
54
|
+
r"\s+" is(text)
|
55
|
+
r"\#.*?\n" is(comment.single)
|
56
|
+
r"(mainmenu|config|menuconfig|choice|endchoice|comment|menu|endmenu|visible if|if|endif|source|prompt|select|depends on|default|range|option)\b" is(keyword)
|
57
|
+
r"(---help---|help)[\t ]*\n" is(keyword) -> go-to(help)
|
58
|
+
r"(bool|tristate|string|hex|int|defconfig_list|modules|env)\b" is(name.builtin)
|
59
|
+
r"[!=&|]" is(operator)
|
60
|
+
r"[()]" is(punctuation)
|
61
|
+
r"[0-9]+" is(literal.number.integer)
|
62
|
+
r"'(''|[^'])*'" is(literal.string.single)
|
63
|
+
r"\"(\"\"|[^\"])*\"" is(literal.string.double)
|
64
|
+
r"\S+" is(text)
|
65
|
+
|
66
|
+
lex(indent4):
|
67
|
+
r"(?:\t| {1,7}\t| {8}){4}.*\n" is(literal.string.doc)
|
68
|
+
r"\s*\n" is(text)
|
69
|
+
r"" is(generic) -> pop(2)
|
70
|
+
|
71
|
+
const-set(.Lexer, lexer)
|
@@ -0,0 +1,104 @@
|
|
1
|
+
use(require("atomy"))
|
2
|
+
use(require("hl/define"))
|
3
|
+
|
4
|
+
lexer = lexer:
|
5
|
+
name: "Koka"
|
6
|
+
aliases: ["koka"]
|
7
|
+
extensions: [".kk", ".kki"]
|
8
|
+
mimetypes: ["text/x-koka"]
|
9
|
+
start: .root
|
10
|
+
flags: 0
|
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(string):
|
19
|
+
r"[^\\\"\n]+" is(literal.string.double)
|
20
|
+
any-of(escape-sequence)
|
21
|
+
r"[\"\n]" is(literal.string.double) -> pop
|
22
|
+
|
23
|
+
lex(type-nested):
|
24
|
+
r"[\)\]>]" is(keyword.type) -> pop
|
25
|
+
r"[\(\[<]" is(keyword.type) -> go-to(type-nested)
|
26
|
+
r"," is(keyword.type)
|
27
|
+
r"([a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)(\s*)(:)(?!:)" is(by-groups(name.variable, text, keyword.type))
|
28
|
+
any-of(type-content)
|
29
|
+
|
30
|
+
lex(char):
|
31
|
+
r"[^\\\'\n]+" is(literal.string.char)
|
32
|
+
any-of(escape-sequence)
|
33
|
+
r"[\'\n]" is(literal.string.char) -> pop
|
34
|
+
|
35
|
+
lex(alias-type):
|
36
|
+
r"=" is(keyword)
|
37
|
+
any-of(type)
|
38
|
+
|
39
|
+
lex(litstring):
|
40
|
+
r"[^\"]+" is(literal.string.double)
|
41
|
+
r"\"\"" is(literal.string.escape)
|
42
|
+
r"\"" is(literal.string.double) -> pop
|
43
|
+
|
44
|
+
lex(whitespace):
|
45
|
+
r"\s+" is(text)
|
46
|
+
r"/\*" is(comment.multiline) -> go-to(comment)
|
47
|
+
r"//.*$" is(comment.single)
|
48
|
+
|
49
|
+
lex(struct-type):
|
50
|
+
r"(?=\((?!,*\)))" is(punctuation) -> pop
|
51
|
+
any-of(type)
|
52
|
+
|
53
|
+
lex(root):
|
54
|
+
any-of(whitespace)
|
55
|
+
r"::?(?![\$%&\*\+@!/\\^\126=\.:\-\?\|<>]+)" is(keyword.type) -> go-to(type)
|
56
|
+
r"alias(?![a-zA-Z0-9_\-])" is(keyword) -> go-to(alias-type)
|
57
|
+
r"struct(?![a-zA-Z0-9_\-])" is(keyword) -> go-to(struct-type)
|
58
|
+
r"(type|cotype|rectype|alias|struct|enum)(?![a-zA-Z0-9_\-])" is(keyword) -> go-to(type)
|
59
|
+
r"(module)(\s*)((?:interface)?)(\s*)((?:[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*\.)*[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)" is(by-groups(keyword, text, keyword, text, name.namespace))
|
60
|
+
r"(import)(\s+)((?:[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*\.)*[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)(\s*)((?:as)?)((?:[A-Z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)?)" is(by-groups(keyword, text, name.namespace, text, keyword, name.namespace))
|
61
|
+
r"(forall|exists|some|with)(?![a-zA-Z0-9_\-])" is(keyword.type)
|
62
|
+
r"(infix|infixr|infixl|prefix|postfix|type|cotype|rectype|alias|struct|con|fun|function|val|var|external|if|then|else|elif|return|match|private|public|private|module|import|as|include|inline|rec|try|yield|enum|interface|instance)(?![a-zA-Z0-9_\-])" is(keyword)
|
63
|
+
r"(for|while|repeat|foreach|foreach-indexed|error|catch|finally|cs|js|file|ref|assigned)(?![a-zA-Z0-9_\-])" is(keyword.pseudo)
|
64
|
+
r"::|:=|\->|[=\.:](?![\$%&\*\+@!/\\^\126=\.:\-\?\|<>]+)" is(keyword)
|
65
|
+
r"\-(?![\$%&\*\+@!/\\^\126=\.:\-\?\|<>]+)" is(generic.strong)
|
66
|
+
r"[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?=\.)" is(name.namespace)
|
67
|
+
r"[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?!\.)" is(name.class)
|
68
|
+
r"[a-z]([a-zA-Z0-9_]|\-[a-zA-Z])*" is(name)
|
69
|
+
r"_([a-zA-Z0-9_]|\-[a-zA-Z])*" is(name.variable)
|
70
|
+
r"@\"" is(literal.string.double) -> go-to(litstring)
|
71
|
+
r"[\$%&\*\+@!/\\^\126=\.:\-\?\|<>]+" is(operator)
|
72
|
+
r"`" is(operator)
|
73
|
+
r"[\{\}\(\)\[\];,]" is(punctuation)
|
74
|
+
r"[0-9]+\.[0-9]+([eE][\-\+]?[0-9]+)?" is(literal.number.float)
|
75
|
+
r"0[xX][0-9a-fA-F]+" is(literal.number.hex)
|
76
|
+
r"[0-9]+" is(literal.number.integer)
|
77
|
+
r"'" is(literal.string.char) -> go-to(char)
|
78
|
+
r"\"" is(literal.string.double) -> go-to(string)
|
79
|
+
|
80
|
+
lex(escape-sequence):
|
81
|
+
r"\\[abfnrtv0\\\\"\'\?]" is(literal.string.escape)
|
82
|
+
r"\\x[0-9a-fA-F]{2}" is(literal.string.escape)
|
83
|
+
r"\\u[0-9a-fA-F]{4}" is(literal.string.escape)
|
84
|
+
r"\\U[0-9a-fA-F]{6}" is(literal.string.escape)
|
85
|
+
|
86
|
+
lex(type-content):
|
87
|
+
any-of(whitespace)
|
88
|
+
r"(forall|exists|some|with)(?![a-zA-Z0-9_\-])" is(keyword.type)
|
89
|
+
r"(?=((infix|infixr|infixl|prefix|postfix|type|cotype|rectype|alias|struct|con|fun|function|val|var|external|if|then|else|elif|return|match|private|public|private|module|import|as|include|inline|rec|try|yield|enum|interface|instance)(?![a-zA-Z0-9_\-])))" is(keyword) -> pop
|
90
|
+
r"[EPH](?![a-zA-Z0-9_\-])" is(keyword.type)
|
91
|
+
r"[*!]" is(keyword.type)
|
92
|
+
r"[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?=\.)" is(name.namespace)
|
93
|
+
r"[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?!\.)" is(name.class)
|
94
|
+
r"[a-z][0-9]*(?![a-zA-Z_\-])" is(keyword.type)
|
95
|
+
r"_([a-zA-Z0-9_]|\-[a-zA-Z])*" is(keyword.type)
|
96
|
+
r"[a-z]([a-zA-Z0-9_]|\-[a-zA-Z])*" is(keyword.type)
|
97
|
+
r"::|\->|[\.:|]" is(keyword.type)
|
98
|
+
r"" is(text) -> pop
|
99
|
+
|
100
|
+
lex(type):
|
101
|
+
r"[\(\[<]" is(keyword.type) -> go-to(type-nested)
|
102
|
+
any-of(type-content)
|
103
|
+
|
104
|
+
const-set(.Lexer, lexer)
|