broomhlda 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.md +201 -0
  3. data/lib/hl/define.ay +131 -0
  4. data/lib/hl/formatters/html.ay +26 -0
  5. data/lib/hl/lexer.ay +99 -0
  6. data/lib/hl/lexers/atomy.ay +122 -0
  7. data/lib/hl/lexers/haskell.ay +89 -0
  8. data/lib/hl/lexers/imported/abap.ay +43 -0
  9. data/lib/hl/lexers/imported/actionscript.ay +31 -0
  10. data/lib/hl/lexers/imported/actionscript3.ay +47 -0
  11. data/lib/hl/lexers/imported/ada.ay +107 -0
  12. data/lib/hl/lexers/imported/antlr.ay +95 -0
  13. data/lib/hl/lexers/imported/apacheconf.ay +29 -0
  14. data/lib/hl/lexers/imported/applescript.ay +48 -0
  15. data/lib/hl/lexers/imported/aspectj.ay +42 -0
  16. data/lib/hl/lexers/imported/asymptote.ay +64 -0
  17. data/lib/hl/lexers/imported/autohotkey.ay +76 -0
  18. data/lib/hl/lexers/imported/autoit.ay +64 -0
  19. data/lib/hl/lexers/imported/awk.ay +42 -0
  20. data/lib/hl/lexers/imported/bash.ay +63 -0
  21. data/lib/hl/lexers/imported/batch.ay +45 -0
  22. data/lib/hl/lexers/imported/bbcode.ay +23 -0
  23. data/lib/hl/lexers/imported/befunge.ay +26 -0
  24. data/lib/hl/lexers/imported/blitzmax.ay +44 -0
  25. data/lib/hl/lexers/imported/boo.ay +55 -0
  26. data/lib/hl/lexers/imported/brainfuck.ay +28 -0
  27. data/lib/hl/lexers/imported/bro.ay +57 -0
  28. data/lib/hl/lexers/imported/bugs.ay +31 -0
  29. data/lib/hl/lexers/imported/c.ay +84 -0
  30. data/lib/hl/lexers/imported/ca65.ay +26 -0
  31. data/lib/hl/lexers/imported/cbmbasicv2.ay +25 -0
  32. data/lib/hl/lexers/imported/ceylon.ay +47 -0
  33. data/lib/hl/lexers/imported/cfengine3.ay +50 -0
  34. data/lib/hl/lexers/imported/clojure.ay +32 -0
  35. data/lib/hl/lexers/imported/cmake.ay +38 -0
  36. data/lib/hl/lexers/imported/cobol.ay +44 -0
  37. data/lib/hl/lexers/imported/coffeescript.ay +79 -0
  38. data/lib/hl/lexers/imported/coldfusion.ay +36 -0
  39. data/lib/hl/lexers/imported/commonlisp.ay +65 -0
  40. data/lib/hl/lexers/imported/coq.ay +59 -0
  41. data/lib/hl/lexers/imported/croc.ay +37 -0
  42. data/lib/hl/lexers/imported/css.ay +55 -0
  43. data/lib/hl/lexers/imported/cuda.ay +84 -0
  44. data/lib/hl/lexers/imported/cython.ay +128 -0
  45. data/lib/hl/lexers/imported/d.ay +102 -0
  46. data/lib/hl/lexers/imported/darcspatch.ay +45 -0
  47. data/lib/hl/lexers/imported/dart.ay +84 -0
  48. data/lib/hl/lexers/imported/debiancontrol.ay +51 -0
  49. data/lib/hl/lexers/imported/dg.ay +61 -0
  50. data/lib/hl/lexers/imported/diff.ay +22 -0
  51. data/lib/hl/lexers/imported/django.ay +46 -0
  52. data/lib/hl/lexers/imported/dtd.ay +62 -0
  53. data/lib/hl/lexers/imported/dylan.ay +60 -0
  54. data/lib/hl/lexers/imported/dylanlid.ay +17 -0
  55. data/lib/hl/lexers/imported/ecl.ay +57 -0
  56. data/lib/hl/lexers/imported/elixir.ay +93 -0
  57. data/lib/hl/lexers/imported/erlang.ay +47 -0
  58. data/lib/hl/lexers/imported/factor.ay +89 -0
  59. data/lib/hl/lexers/imported/fancy.ay +54 -0
  60. data/lib/hl/lexers/imported/fantom.ay +149 -0
  61. data/lib/hl/lexers/imported/felix.ay +140 -0
  62. data/lib/hl/lexers/imported/fortran.ay +39 -0
  63. data/lib/hl/lexers/imported/foxpro.ay +37 -0
  64. data/lib/hl/lexers/imported/fsharp.ay +61 -0
  65. data/lib/hl/lexers/imported/gas.ay +51 -0
  66. data/lib/hl/lexers/imported/gettext.ay +21 -0
  67. data/lib/hl/lexers/imported/gherkin.ay +97 -0
  68. data/lib/hl/lexers/imported/glshader.ay +31 -0
  69. data/lib/hl/lexers/imported/gnuplot.ay +111 -0
  70. data/lib/hl/lexers/imported/go.ay +40 -0
  71. data/lib/hl/lexers/imported/gooddatacl.ay +33 -0
  72. data/lib/hl/lexers/imported/gosu.ay +58 -0
  73. data/lib/hl/lexers/imported/groff.ay +38 -0
  74. data/lib/hl/lexers/imported/groovy.ay +45 -0
  75. data/lib/hl/lexers/imported/haskell.ay +89 -0
  76. data/lib/hl/lexers/imported/haxe.ay +186 -0
  77. data/lib/hl/lexers/imported/hxml.ay +22 -0
  78. data/lib/hl/lexers/imported/hybris.ay +42 -0
  79. data/lib/hl/lexers/imported/idl.ay +23 -0
  80. data/lib/hl/lexers/imported/ini.ay +18 -0
  81. data/lib/hl/lexers/imported/io.ay +34 -0
  82. data/lib/hl/lexers/imported/ioke.ay +88 -0
  83. data/lib/hl/lexers/imported/irclogs.ay +24 -0
  84. data/lib/hl/lexers/imported/jags.ay +36 -0
  85. data/lib/hl/lexers/imported/java.ay +42 -0
  86. data/lib/hl/lexers/imported/javascript.ay +45 -0
  87. data/lib/hl/lexers/imported/json.ay +47 -0
  88. data/lib/hl/lexers/imported/julia.ay +60 -0
  89. data/lib/hl/lexers/imported/kconfig.ay +71 -0
  90. data/lib/hl/lexers/imported/koka.ay +104 -0
  91. data/lib/hl/lexers/imported/lasso.ay +143 -0
  92. data/lib/hl/lexers/imported/lighttpdconf.ay +24 -0
  93. data/lib/hl/lexers/imported/livescript.ay +82 -0
  94. data/lib/hl/lexers/imported/llvm.ay +36 -0
  95. data/lib/hl/lexers/imported/logtalk.ay +133 -0
  96. data/lib/hl/lexers/imported/lua.ay +56 -0
  97. data/lib/hl/lexers/imported/maql.ay +32 -0
  98. data/lib/hl/lexers/imported/matlab.ay +43 -0
  99. data/lib/hl/lexers/imported/minid.ay +37 -0
  100. data/lib/hl/lexers/imported/modula2.ay +63 -0
  101. data/lib/hl/lexers/imported/moinwiki.ay +33 -0
  102. data/lib/hl/lexers/imported/monkey.ay +84 -0
  103. data/lib/hl/lexers/imported/moocode.ay +26 -0
  104. data/lib/hl/lexers/imported/moonscript.ay +52 -0
  105. data/lib/hl/lexers/imported/mscgen.ay +35 -0
  106. data/lib/hl/lexers/imported/mupad.ay +36 -0
  107. data/lib/hl/lexers/imported/mysql.ay +37 -0
  108. data/lib/hl/lexers/imported/nasm.ay +52 -0
  109. data/lib/hl/lexers/imported/newlisp.ay +34 -0
  110. data/lib/hl/lexers/imported/newspeak.ay +49 -0
  111. data/lib/hl/lexers/imported/nginxconf.ay +41 -0
  112. data/lib/hl/lexers/imported/nimrod.ay +84 -0
  113. data/lib/hl/lexers/imported/nsis.ay +55 -0
  114. data/lib/hl/lexers/imported/numpy.ay +116 -0
  115. data/lib/hl/lexers/imported/objectivej.ay +120 -0
  116. data/lib/hl/lexers/imported/ocaml.ay +59 -0
  117. data/lib/hl/lexers/imported/octave.ay +39 -0
  118. data/lib/hl/lexers/imported/ooc.ay +45 -0
  119. data/lib/hl/lexers/imported/opa.ay +153 -0
  120. data/lib/hl/lexers/imported/openedge.ay +40 -0
  121. data/lib/hl/lexers/imported/perl.ay +130 -0
  122. data/lib/hl/lexers/imported/php.ay +63 -0
  123. data/lib/hl/lexers/imported/postscript.ay +39 -0
  124. data/lib/hl/lexers/imported/povray.ay +28 -0
  125. data/lib/hl/lexers/imported/powershell.ay +49 -0
  126. data/lib/hl/lexers/imported/prolog.ay +39 -0
  127. data/lib/hl/lexers/imported/properties.ay +17 -0
  128. data/lib/hl/lexers/imported/protobuf.ay +43 -0
  129. data/lib/hl/lexers/imported/puppet.ay +50 -0
  130. data/lib/hl/lexers/imported/pypylog.ay +44 -0
  131. data/lib/hl/lexers/imported/python.ay +116 -0
  132. data/lib/hl/lexers/imported/python3.ay +113 -0
  133. data/lib/hl/lexers/imported/qml.ay +47 -0
  134. data/lib/hl/lexers/imported/racket.ay +62 -0
  135. data/lib/hl/lexers/imported/ragel.ay +70 -0
  136. data/lib/hl/lexers/imported/rd.ay +22 -0
  137. data/lib/hl/lexers/imported/redcode.ay +23 -0
  138. data/lib/hl/lexers/imported/regedit.ay +25 -0
  139. data/lib/hl/lexers/imported/rpmspec.ay +57 -0
  140. data/lib/hl/lexers/imported/rust.ay +56 -0
  141. data/lib/hl/lexers/imported/s.ay +61 -0
  142. data/lib/hl/lexers/imported/scala.ay +72 -0
  143. data/lib/hl/lexers/imported/scheme.ay +31 -0
  144. data/lib/hl/lexers/imported/scilab.ay +37 -0
  145. data/lib/hl/lexers/imported/scss.ay +115 -0
  146. data/lib/hl/lexers/imported/smali.ay +71 -0
  147. data/lib/hl/lexers/imported/smalltalk.ay +93 -0
  148. data/lib/hl/lexers/imported/snobol.ay +42 -0
  149. data/lib/hl/lexers/imported/sourcepawn.ay +58 -0
  150. data/lib/hl/lexers/imported/sourceslist.ay +37 -0
  151. data/lib/hl/lexers/imported/sql.ay +31 -0
  152. data/lib/hl/lexers/imported/squidconf.ay +29 -0
  153. data/lib/hl/lexers/imported/stan.ay +38 -0
  154. data/lib/hl/lexers/imported/systemverilog.ay +65 -0
  155. data/lib/hl/lexers/imported/tcl.ay +110 -0
  156. data/lib/hl/lexers/imported/tcsh.ay +52 -0
  157. data/lib/hl/lexers/imported/tex.ay +49 -0
  158. data/lib/hl/lexers/imported/typescript.ay +51 -0
  159. data/lib/hl/lexers/imported/vala.ay +70 -0
  160. data/lib/hl/lexers/imported/vbnet.ay +62 -0
  161. data/lib/hl/lexers/imported/velocity.ay +50 -0
  162. data/lib/hl/lexers/imported/verilog.ay +61 -0
  163. data/lib/hl/lexers/imported/vgl.ay +25 -0
  164. data/lib/hl/lexers/imported/vhdl.ay +54 -0
  165. data/lib/hl/lexers/imported/vim.ay +28 -0
  166. data/lib/hl/lexers/imported/xml.ay +38 -0
  167. data/lib/hl/lexers/imported/xslt.ay +38 -0
  168. data/lib/hl/lexers/imported/xtend.ay +48 -0
  169. data/lib/hl/lexers/ruby.ay +238 -0
  170. data/lib/hl/state.ay +31 -0
  171. data/lib/hl/token.ay +8 -0
  172. data/lib/hl.ay +17 -0
  173. metadata +244 -0
@@ -0,0 +1,33 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "MoinMoin/Trac Wiki markup"
6
+ aliases: ["trac-wiki", "moin"]
7
+ extensions: []
8
+ mimetypes: ["text/x-trac-wiki"]
9
+ start: .root
10
+ flags: Regexp IGNORECASE
11
+
12
+ lex(root):
13
+ r"^\#.*$" is(comment)
14
+ r"(!)(\S+)" is(by-groups(keyword, text))
15
+ r"^(=+)([^=]+)(=+)(\s*\#.+)?$" is(by-groups(generic.heading, using(self class), generic.heading, literal.string))
16
+ r"({{{)(\n\#!.+)?" is(by-groups(name.builtin, name.namespace)) -> go-to(codeblock)
17
+ r"(\'\'\'?|\|\||`|__|\126\126|\^|,,|::)" is(comment)
18
+ r"^( +)([.*-])( )" is(by-groups(text, name.builtin, text))
19
+ r"^( +)([a-z]{1,5}\.)( )" is(by-groups(text, name.builtin, text))
20
+ r"\[\[\w+.*?\]\]" is(keyword)
21
+ r"(\[[^\s\]]+)(\s+[^\]]+?)?(\])" is(by-groups(keyword, literal.string, keyword))
22
+ r"^----+$" is(keyword)
23
+ r"[^\n\'\[{!_\126^,|]+" is(text)
24
+ r"\n" is(text)
25
+ r"." is(text)
26
+
27
+ lex(codeblock):
28
+ r"}}}" is(name.builtin) -> pop
29
+ r"{{{" is(text) -> push
30
+ r"[^{}]+" is(comment.preproc)
31
+ r"." is(comment.preproc)
32
+
33
+ const-set(.Lexer, lexer)
@@ -0,0 +1,84 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "Monkey"
6
+ aliases: ["monkey"]
7
+ extensions: [".monkey"]
8
+ mimetypes: ["text/x-monkey"]
9
+ start: .root
10
+ flags: 0
11
+
12
+ lex(comment):
13
+ r"(?i)^\#rem.*?" is(comment.multiline) -> push
14
+ r"(?i)^\#end.*?" is(comment.multiline) -> pop
15
+ r"\n" is(comment.multiline)
16
+ r".+" is(comment.multiline)
17
+
18
+ lex(string):
19
+ r"[^\"\126]+" is(literal.string.double)
20
+ r"\126q|\126n|\126r|\126t|\126z|\126\126" is(literal.string.escape)
21
+ r"\"" is(literal.string.double) -> pop
22
+
23
+ lex(variables):
24
+ r"[A-Z_][A-Z0-9_]*\b" is(name.constant)
25
+ r"[a-z_][a-zA-Z0-9_]*\b" is(name.variable)
26
+ r"[?%\#$]" is(keyword.type)
27
+ r"\s+" is(text)
28
+ r":" is(punctuation) -> go-to(classname)
29
+ r"," is(punctuation) -> push
30
+ r"" is(text) -> pop
31
+
32
+ lex(funcname):
33
+ r"(?i)[A-Z][a-zA-Z0-9_]*\b" is(name.function)
34
+ r":" is(punctuation) -> go-to(classname)
35
+ r"\s+" is(text)
36
+ r"\(" is(punctuation) -> go-to(variables)
37
+ r"\)" is(punctuation) -> pop
38
+
39
+ lex(classname):
40
+ r"[a-z0-9_]*\." is(name.namespace)
41
+ r"(?:Int|Float|String|Bool|Object|Array|Void)\b" is(keyword.type)
42
+ r"[A-Z][a-zA-Z0-9_]*\b" is(name.class)
43
+ r"(\[)(\s*)(\d*)(\s*)(\])" is(by-groups(punctuation, text, literal.number.integer, text, punctuation))
44
+ r"\s+(?!<)" is(text) -> pop
45
+ r"<" is(punctuation) -> push
46
+ r">" is(punctuation) -> pop
47
+ r"\n" is(text) -> pop
48
+ r"" is(text) -> pop
49
+
50
+ lex(root):
51
+ r"\s+" is(text)
52
+ r"'.*" is(comment)
53
+ r"(?i)^\#rem\b" is(comment.multiline) -> go-to(comment)
54
+ r"(?i)^(?:\#If|\#ElseIf|\#Else|\#EndIf|\#End|\#Print|\#Error)\b" is(comment.preproc)
55
+ r"^\#" is(comment.preproc) -> go-to(variables)
56
+ r"\"" is(literal.string.double) -> go-to(string)
57
+ r"[0-9]+\.[0-9]*(?!\.)" is(literal.number.float)
58
+ r"\.[0-9]+(?!\.)" is(literal.number.float)
59
+ r"[0-9]+" is(literal.number.integer)
60
+ r"\$[0-9a-fA-Z]+" is(literal.number.hex)
61
+ r"\%[10]+" is(literal.number)
62
+ r"\b(?:Int|Float|String|Bool|Object|Array|Void)\b" is(keyword.type)
63
+ r"(?i)\b(?:Try|Catch|Throw)\b" is(keyword.reserved)
64
+ r"Throwable" is(name.exception)
65
+ r"(?i)\b(?:Null|True|False)\b" is(name.builtin)
66
+ r"(?i)\b(?:Self|Super)\b" is(name.builtin.pseudo)
67
+ r"\b(?:HOST|LANG|TARGET|CONFIG)\b" is(name.constant)
68
+ r"(?i)^(Import)(\s+)(.*)(\n)" is(by-groups(keyword.namespace, text, name.namespace, text))
69
+ r"(?i)^Strict\b.*\n" is(keyword.reserved)
70
+ r"(?i)(Const|Local|Global|Field)(\s+)" is(by-groups(keyword.declaration, text)) -> go-to(variables)
71
+ r"(?i)(New|Class|Interface|Extends|Implements)(\s+)" is(by-groups(keyword.reserved, text)) -> go-to(classname)
72
+ r"(?i)(Function|Method)(\s+)" is(by-groups(keyword.reserved, text)) -> go-to(funcname)
73
+ r"(?i)(?:End|Return|Public|Private|Extern|Property|Final|Abstract)\b" is(keyword.reserved)
74
+ r"(?i)(?:If|Then|Else|ElseIf|EndIf|Select|Case|Default|While|Wend|Repeat|Until|Forever|For|To|Until|Step|EachIn|Next|Exit|Continue)\s+" is(keyword.reserved)
75
+ r"(?i)\b(?:Module|Inline)\b" is(keyword.reserved)
76
+ r"[\[\]]" is(punctuation)
77
+ r"<=|>=|<>|\*=|/=|\+=|-=|&=|\126=|\|=|[-&*/^+=<>|\126]" is(operator)
78
+ r"(?i)(?:Not|Mod|Shl|Shr|And|Or)" is(operator.word)
79
+ r"[\(\){}!\#,.:]" is(punctuation)
80
+ r"[A-Z_][A-Z0-9_]*\b" is(name.constant)
81
+ r"[A-Z][a-zA-Z0-9_]*\b" is(name.function)
82
+ r"[a-z_][a-zA-Z0-9_]*\b" is(name.variable)
83
+
84
+ const-set(.Lexer, lexer)
@@ -0,0 +1,26 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "MOOCode"
6
+ aliases: ["moocode"]
7
+ extensions: [".moo"]
8
+ mimetypes: ["text/x-moocode"]
9
+ start: .root
10
+ flags: 0
11
+
12
+ lex(root):
13
+ r"(0|[1-9][0-9_]*)" is(literal.number.integer)
14
+ r"\"(\\\\|\\\"|[^\"])*\"" is(literal.string)
15
+ r"(E_PERM|E_DIV)" is(name.exception)
16
+ r"((\#[-0-9]+)|(\$[a-z_A-Z0-9]+))" is(name.entity)
17
+ r"\b(if|else|elseif|endif|for|endfor|fork|endfork|while|endwhile|break|continue|return|try|except|endtry|finally|in)\b" is(keyword)
18
+ r"(random|length)" is(name.builtin)
19
+ r"(player|caller|this|args)" is(name.variable.instance)
20
+ r"\s+" is(text)
21
+ r"\n" is(text)
22
+ r"([!;=,{}&\|:\.\[\]@\(\)\<\>\?]+)" is(operator)
23
+ r"([a-z_A-Z0-9]+)(\()" is(by-groups(name.function, operator))
24
+ r"([a-zA-Z_0-9]+)" is(text)
25
+
26
+ const-set(.Lexer, lexer)
@@ -0,0 +1,52 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "MoonScript"
6
+ aliases: ["moon", "moonscript"]
7
+ extensions: [".moon"]
8
+ mimetypes: ["text/x-moonscript", "application/x-moonscript"]
9
+ start: .root
10
+ flags: 0
11
+
12
+ lex(sqs):
13
+ r"'" is(literal.string.single) -> pop
14
+ r"." is(literal.string)
15
+
16
+ lex(stringescape):
17
+ r"\\([abfnrtv\\\"']|\d{1,3})" is(literal.string.escape)
18
+
19
+ lex(base):
20
+ r"--.*$" is(comment.single)
21
+ r"(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?" is(literal.number.float)
22
+ r"(?i)\d+e[+-]?\d+" is(literal.number.float)
23
+ r"(?i)0x[0-9a-f]*" is(literal.number.hex)
24
+ r"\d+" is(literal.number.integer)
25
+ r"\n" is(text)
26
+ r"[^\S\n]+" is(text)
27
+ r"(?m)\[(=*)\[.*?\]\1\]" is(literal.string)
28
+ r"(->|=>)" is(name.function)
29
+ r":[a-zA-Z_][a-zA-Z0-9_]*" is(name.variable)
30
+ r"(==|!=|\126=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>\#!.\\:])" is(operator)
31
+ r"[;,]" is(punctuation)
32
+ r"[\[\]\{\}\(\)]" is(keyword.type)
33
+ r"[a-zA-Z_][a-zA-Z0-9_]*:" is(name.variable)
34
+ r"(class|extends|if|then|super|do|with|import|export|while|elseif|return|for|in|from|when|using|else|and|or|not|switch|break)\b" is(keyword)
35
+ r"(true|false|nil)\b" is(keyword.constant)
36
+ r"(and|or|not)\b" is(operator.word)
37
+ r"(self)\b" is(name.builtin.pseudo)
38
+ r"@@?([a-zA-Z_][a-zA-Z0-9_]*)?" is(name.variable.class)
39
+ r"[A-Z]\w*" is(name.class)
40
+ r"[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?" is(name)
41
+ r"'" is(literal.string.single) -> combined(stringescape, sqs)
42
+ r"\"" is(literal.string.double) -> combined(stringescape, dqs)
43
+
44
+ lex(root):
45
+ r"\#!(.*?)$" is(comment.preproc)
46
+ r"" is(text) -> go-to(base)
47
+
48
+ lex(dqs):
49
+ r"\"" is(literal.string.double) -> pop
50
+ r"." is(literal.string)
51
+
52
+ const-set(.Lexer, lexer)
@@ -0,0 +1,35 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "Mscgen"
6
+ aliases: ["mscgen", "msc"]
7
+ extensions: [".msc"]
8
+ mimetypes: []
9
+ start: .root
10
+ flags: 0
11
+
12
+ lex(root):
13
+ r"msc\b" is(keyword.type)
14
+ r"(hscale|HSCALE|width|WIDTH|wordwraparcs|WORDWRAPARCS|arcgradient|ARCGRADIENT)\b" is(name.property)
15
+ r"(abox|ABOX|rbox|RBOX|box|BOX|note|NOTE)\b" is(operator.word)
16
+ r"(\.|-|\|){3}" is(keyword)
17
+ r"(?:-|=|\.|:){2}|<<=>>|<->|<=>|<<>>|<:>|->|=>>|>>|=>|:>|-x|-X|<-|<<=|<<|<=|<:|x-|X-|=" is(operator)
18
+ r"\*" is(name.builtin)
19
+ r"([a-zA-Z0-9_]+|\"(?:\\\"|[^\"])*\")" is(name.variable)
20
+ r"\[" is(punctuation) -> go-to(attrs)
21
+ r"\{|\}|,|;" is(punctuation)
22
+ any-of(comments)
23
+
24
+ lex(attrs):
25
+ r"\]" is(punctuation) -> pop
26
+ r"([a-zA-Z0-9_]+|\"(?:\\\"|[^\"])*\")(\s*)(=)(\s*)([a-zA-Z0-9_]+|\"(?:\\\"|[^\"])*\")" is(by-groups(name.attribute, text.whitespace, operator, text.whitespace, literal.string))
27
+ r"," is(punctuation)
28
+ any-of(comments)
29
+
30
+ lex(comments):
31
+ r"(?://|\#).*?\n" is(comment.single)
32
+ r"/\*(?:.|\n)*?\*/" is(comment.multiline)
33
+ r"[ \t\r\n]+" is(text.whitespace)
34
+
35
+ const-set(.Lexer, lexer)
@@ -0,0 +1,36 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "MuPAD"
6
+ aliases: ["mupad"]
7
+ extensions: [".mu"]
8
+ mimetypes: []
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(root):
19
+ r"//.*?$" is(comment.single)
20
+ r"/\*" is(comment.multiline) -> go-to(comment)
21
+ r"\"(?:[^\"\\]|\\.)*\"" is(literal.string)
22
+ r"\(|\)|\[|\]|\{|\}" is(punctuation)
23
+ r"(?x)\b(?:\10 next|break|end|\10 axiom|end_axiom|category|end_category|domain|end_domain|inherits|\10 if|%if|then|elif|else|end_if|\10 case|of|do|otherwise|end_case|\10 while|end_while|\10 repeat|until|end_repeat|\10 for|from|to|downto|step|end_for|\10 proc|local|option|save|begin|end_proc|\10 delete|frame\10 )\b" is(keyword)
24
+ r"(?x)\b(?:\10 DOM_ARRAY|DOM_BOOL|DOM_COMPLEX|DOM_DOMAIN|DOM_EXEC|DOM_EXPR|\10 DOM_FAIL|DOM_FLOAT|DOM_FRAME|DOM_FUNC_ENV|DOM_HFARRAY|DOM_IDENT|\10 DOM_INT|DOM_INTERVAL|DOM_LIST|DOM_NIL|DOM_NULL|DOM_POLY|DOM_PROC|\10 DOM_PROC_ENV|DOM_RAT|DOM_SET|DOM_STRING|DOM_TABLE|DOM_VAR\10 )\b" is(name.class)
25
+ r"(?x)\b(?:\10 PI|EULER|E|CATALAN|\10 NIL|FAIL|undefined|infinity|\10 TRUE|FALSE|UNKNOWN\10 )\b" is(name.constant)
26
+ r"\b(?:dom|procname)\b" is(name.builtin.pseudo)
27
+ r"\.|,|:|;|=|\+|-|\*|/|\^|@|>|<|\$|\||!|\'|%|\126=" is(operator)
28
+ r"(?x)\b(?:\10 and|or|not|xor|\10 assuming|\10 div|mod|\10 union|minus|intersect|in|subset\10 )\b" is(operator.word)
29
+ r"\b(?:I|RDN_INF|RD_NINF|RD_NAN)\b" is(literal.number)
30
+ r"(?x)\10 ((?:[a-zA-Z_\#][a-zA-Z_\#0-9]*|`[^`]*`)\10 (?:::[a-zA-Z_\#][a-zA-Z_\#0-9]*|`[^`]*`)*)(\s*)([(])" is(by-groups(name.function, text, punctuation))
31
+ r"(?x)\10 (?:[a-zA-Z_\#][a-zA-Z_\#0-9]*|`[^`]*`)\10 (?:::[a-zA-Z_\#][a-zA-Z_\#0-9]*|`[^`]*`)*" is(name.variable)
32
+ r"[0-9]+(?:\.[0-9]*)?(?:e[0-9]+)?" is(literal.number)
33
+ r"\.[0-9]+(?:e[0-9]+)?" is(literal.number)
34
+ r"." is(text)
35
+
36
+ const-set(.Lexer, lexer)
@@ -0,0 +1,37 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "MySQL"
6
+ aliases: ["mysql"]
7
+ extensions: []
8
+ mimetypes: ["text/x-mysql"]
9
+ start: .root
10
+ flags: Regexp IGNORECASE
11
+
12
+ lex(multiline-comments):
13
+ r"/\*" is(comment.multiline) -> go-to(multiline-comments)
14
+ r"\*/" is(comment.multiline) -> pop
15
+ r"[^/\*]+" is(comment.multiline)
16
+ r"[/*]" is(comment.multiline)
17
+
18
+ lex(root):
19
+ r"\s+" is(text)
20
+ r"(\#|--\s+).*?\n" is(comment.single)
21
+ r"/\*" is(comment.multiline) -> go-to(multiline-comments)
22
+ r"[0-9]+" is(literal.number.integer)
23
+ r"[0-9]*\.[0-9]+(e[+-][0-9]+)" is(literal.number.float)
24
+ r"'(''|[^'])*'" is(literal.string.single)
25
+ r"\"(\"\"|[^\"])*\"" is(literal.string.double)
26
+ r"`(``|[^`])*`" is(literal.string.symbol)
27
+ r"[+*/<>=\126!@\#%^&|`?-]" is(operator)
28
+ r"\b(tinyint|smallint|mediumint|int|integer|bigint|date|datetime|time|bit|bool|tinytext|mediumtext|longtext|text|tinyblob|mediumblob|longblob|blob|float|double|double\s+precision|real|numeric|dec|decimal|timestamp|year|char|varchar|varbinary|varcharacter|enum|set)(\b\s*)(\()?" is(by-groups(keyword.type, text, punctuation))
29
+ r"\b(add|all|alter|analyze|and|as|asc|asensitive|before|between|bigint|binary|blob|both|by|call|cascade|case|change|char|character|check|collate|column|condition|constraint|continue|convert|create|cross|current_date|current_time|current_timestamp|current_user|cursor|database|databases|day_hour|day_microsecond|day_minute|day_second|dec|decimal|declare|default|delayed|delete|desc|describe|deterministic|distinct|distinctrow|div|double|drop|dual|each|else|elseif|enclosed|escaped|exists|exit|explain|fetch|float|float4|float8|for|force|foreign|from|fulltext|grant|group|having|high_priority|hour_microsecond|hour_minute|hour_second|if|ignore|in|index|infile|inner|inout|insensitive|insert|int|int1|int2|int3|int4|int8|integer|interval|into|is|iterate|join|key|keys|kill|leading|leave|left|like|limit|lines|load|localtime|localtimestamp|lock|long|loop|low_priority|match|minute_microsecond|minute_second|mod|modifies|natural|no_write_to_binlog|not|numeric|on|optimize|option|optionally|or|order|out|outer|outfile|precision|primary|procedure|purge|raid0|read|reads|real|references|regexp|release|rename|repeat|replace|require|restrict|return|revoke|right|rlike|schema|schemas|second_microsecond|select|sensitive|separator|set|show|smallint|soname|spatial|specific|sql|sql_big_result|sql_calc_found_rows|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|starting|straight_join|table|terminated|then|to|trailing|trigger|undo|union|unique|unlock|unsigned|update|usage|use|using|utc_date|utc_time|utc_timestamp|values|varying|when|where|while|with|write|x509|xor|year_month|zerofill)\b" is(keyword)
30
+ r"\b(auto_increment|engine|charset|tables)\b" is(keyword.pseudo)
31
+ r"(true|false|null)" is(name.constant)
32
+ r"([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(\()" is(by-groups(name.function, text, punctuation))
33
+ r"[a-zA-Z_][a-zA-Z0-9_]*" is(name)
34
+ r"@[A-Za-z0-9]*[._]*[A-Za-z0-9]*" is(name.variable)
35
+ r"[;:()\[\],\.]" is(punctuation)
36
+
37
+ const-set(.Lexer, lexer)
@@ -0,0 +1,52 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "NASM"
6
+ aliases: ["nasm"]
7
+ extensions: [".asm", ".ASM"]
8
+ mimetypes: ["text/x-nasm"]
9
+ start: .root
10
+ flags: Regexp IGNORECASE
11
+
12
+ lex(preproc):
13
+ r"[^;\n]+" is(comment.preproc)
14
+ r";.*?\n" is(comment.single) -> pop
15
+ r"\n" is(comment.preproc) -> pop
16
+
17
+ lex(punctuation):
18
+ r"[,():\[\]]+" is(punctuation)
19
+ r"[&|^<>+*/%\126-]+" is(operator)
20
+ r"[$]+" is(keyword.constant)
21
+ r"seg|wrt|strict" is(operator.word)
22
+ r"byte|[dq]?word" is(keyword.type)
23
+
24
+ lex(root):
25
+ any-of(whitespace)
26
+ r"^\s*%" is(comment.preproc) -> go-to(preproc)
27
+ r"[a-zA-Z$._?][a-zA-Z0-9$._?\#@\126]*:" is(name.label)
28
+ r"([a-zA-Z$._?][a-zA-Z0-9$._?\#@\126]*)(\s+)(equ)" is(by-groups(name.constant, keyword.declaration, keyword.declaration)) -> go-to(instruction-args)
29
+ r"BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|ORG|ALIGN|STRUC|ENDSTRUC|COMMON|CPU|GROUP|UPPERCASE|IMPORT|EXPORT|LIBRARY|MODULE" is(keyword) -> go-to(instruction-args)
30
+ r"(?:res|d)[bwdqt]|times" is(keyword.declaration) -> go-to(instruction-args)
31
+ r"[a-zA-Z$._?][a-zA-Z0-9$._?\#@\126]*" is(name.function) -> go-to(instruction-args)
32
+ r"[\r\n]+" is(text)
33
+
34
+ lex(whitespace):
35
+ r"\n" is(text)
36
+ r"[ \t]+" is(text)
37
+ r";.*" is(comment.single)
38
+
39
+ lex(instruction-args):
40
+ r"\"(\\\"|[^\"\n])*\"|'(\\'|[^'\n])*'|`(\\`|[^`\n])*`" is(literal.string)
41
+ r"(?:0[xX][0-9a-fA-F]+|$0[0-9a-fA-F]*|[0-9]+[0-9a-fA-F]*h)" is(literal.number.hex)
42
+ r"[0-7]+q" is(literal.number.oct)
43
+ r"[01]+b" is(literal.number)
44
+ r"[0-9]+\.e?[0-9]+" is(literal.number.float)
45
+ r"[0-9]+" is(literal.number.integer)
46
+ any-of(punctuation)
47
+ r"r[0-9][0-5]?[bwd]|[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]" is(name.builtin)
48
+ r"[a-zA-Z$._?][a-zA-Z0-9$._?\#@\126]*" is(name.variable)
49
+ r"[\r\n]+" is(text) -> pop
50
+ any-of(whitespace)
51
+
52
+ const-set(.Lexer, lexer)
@@ -0,0 +1,34 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "NewLisp"
6
+ aliases: ["newlisp"]
7
+ extensions: [".lsp", ".nl"]
8
+ mimetypes: ["text/x-newlisp", "application/x-newlisp"]
9
+ start: .root
10
+ flags: Regexp IGNORECASE
11
+
12
+ lex(bracestring):
13
+ r"{" is(literal.string) -> push
14
+ r"}" is(literal.string) -> pop
15
+ r"[^{}]+" is(literal.string)
16
+
17
+ lex(tagstring):
18
+ r"(?m)(.*?)(\[/text\])" is(literal.string) -> pop
19
+
20
+ lex(root):
21
+ r"\#!(.*?)$" is(comment.preproc)
22
+ r";.*$" is(comment.single)
23
+ r"\#.*$" is(comment.single)
24
+ r"\s+" is(text)
25
+ r"\"(\\\\|\\\"|[^\"])*\"" is(literal.string)
26
+ r"{" is(literal.string) -> go-to(bracestring)
27
+ r"\[text\]*" is(literal.string) -> go-to(tagstring)
28
+ r"('|:)" is(operator)
29
+ r"(\^\b|\-\-\b|\-\b|\:\b|\!\b|\!\=\b|\?\b|\@\b|\*\b|\/\b|\&\b|\%\b|\+\b|\+\+\b|\<\b|\<\<\b|\<\=\b|\=\b|\>\b|\>\=\b|\>\>\b|\|\b|\\126\b|\$\b|\$0\b|\$1\b|\$10\b|\$11\b|\$12\b|\$13\b|\$14\b|\$15\b|\$2\b|\$3\b|\$4\b|\$5\b|\$6\b|\$7\b|\$8\b|\$9\b|\$args\b|\$idx\b|\$it\b|\$main\-args\b|abort\b|abs\b|acos\b|acosh\b|add\b|address\b|amb\b|and\b|and\b|append\-file\b|append\b|apply\b|args\b|array\-list\b|array\?\b|array\b|asin\b|asinh\b|assoc\b|atan\b|atan2\b|atanh\b|atom\?\b|base64\-dec\b|base64\-enc\b|bayes\-query\b|bayes\-train\b|begin\b|begin\b|begin\b|beta\b|betai\b|bind\b|binomial\b|bits\b|callback\b|case\b|case\b|case\b|catch\b|ceil\b|change\-dir\b|char\b|chop\b|Class\b|clean\b|close\b|command\-event\b|cond\b|cond\b|cond\b|cons\b|constant\b|context\?\b|context\b|copy\-file\b|copy\b|cos\b|cosh\b|count\b|cpymem\b|crc32\b|crit\-chi2\b|crit\-z\b|current\-line\b|curry\b|date\-list\b|date\-parse\b|date\-value\b|date\b|debug\b|dec\b|def\-new\b|default\b|define\-macro\b|define\-macro\b|define\b|delete\-file\b|delete\-url\b|delete\b|destroy\b|det\b|device\b|difference\b|directory\?\b|directory\b|div\b|do\-until\b|do\-while\b|doargs\b|dolist\b|dostring\b|dotimes\b|dotree\b|dump\b|dup\b|empty\?\b|encrypt\b|ends\-with\b|env\b|erf\b|error\-event\b|eval\-string\b|eval\b|exec\b|exists\b|exit\b|exp\b|expand\b|explode\b|extend\b|factor\b|fft\b|file\-info\b|file\?\b|filter\b|find\-all\b|find\b|first\b|flat\b|float\?\b|float\b|floor\b|flt\b|fn\b|for\-all\b|for\b|fork\b|format\b|fv\b|gammai\b|gammaln\b|gcd\b|get\-char\b|get\-float\b|get\-int\b|get\-long\b|get\-string\b|get\-url\b|global\?\b|global\b|if\-not\b|if\b|ifft\b|import\b|inc\b|index\b|inf\?\b|int\b|integer\?\b|integer\b|intersect\b|invert\b|irr\b|join\b|lambda\-macro\b|lambda\?\b|lambda\b|last\-error\b|last\b|legal\?\b|length\b|let\b|let\b|let\b|letex\b|letn\b|letn\b|letn\b|list\?\b|list\b|load\b|local\b|log\b|lookup\b|lower\-case\b|macro\?\b|main\-args\b|MAIN\b|make\-dir\b|map\b|mat\b|match\b|max\b|member\b|min\b|mod\b|module\b|mul\b|multiply\b|NaN\?\b|net\-accept\b|net\-close\b|net\-connect\b|net\-error\b|net\-eval\b|net\-interface\b|net\-ipv\b|net\-listen\b|net\-local\b|net\-lookup\b|net\-packet\b|net\-peek\b|net\-peer\b|net\-ping\b|net\-receive\-from\b|net\-receive\-udp\b|net\-receive\b|net\-select\b|net\-send\-to\b|net\-send\-udp\b|net\-send\b|net\-service\b|net\-sessions\b|new\b|nil\?\b|nil\b|normal\b|not\b|now\b|nper\b|npv\b|nth\b|null\?\b|number\?\b|open\b|or\b|ostype\b|pack\b|parse\-date\b|parse\b|peek\b|pipe\b|pmt\b|pop\-assoc\b|pop\b|post\-url\b|pow\b|prefix\b|pretty\-print\b|primitive\?\b|print\b|println\b|prob\-chi2\b|prob\-z\b|process\b|prompt\-event\b|protected\?\b|push\b|put\-url\b|pv\b|quote\?\b|quote\b|rand\b|random\b|randomize\b|read\b|read\-char\b|read\-expr\b|read\-file\b|read\-key\b|read\-line\b|read\-utf8\b|read\b|reader\-event\b|real\-path\b|receive\b|ref\-all\b|ref\b|regex\-comp\b|regex\b|remove\-dir\b|rename\-file\b|replace\b|reset\b|rest\b|reverse\b|rotate\b|round\b|save\b|search\b|seed\b|seek\b|select\b|self\b|semaphore\b|send\b|sequence\b|series\b|set\-locale\b|set\-ref\-all\b|set\-ref\b|set\b|setf\b|setq\b|sgn\b|share\b|signal\b|silent\b|sin\b|sinh\b|sleep\b|slice\b|sort\b|source\b|spawn\b|sqrt\b|starts\-with\b|string\?\b|string\b|sub\b|swap\b|sym\b|symbol\?\b|symbols\b|sync\b|sys\-error\b|sys\-info\b|tan\b|tanh\b|term\b|throw\-error\b|throw\b|time\-of\-day\b|time\b|timer\b|title\-case\b|trace\-highlight\b|trace\b|transpose\b|Tree\b|trim\b|true\?\b|true\b|unicode\b|unify\b|unique\b|unless\b|unpack\b|until\b|upper\-case\b|utf8\b|utf8len\b|uuid\b|wait\-pid\b|when\b|while\b|write\b|write\-char\b|write\-file\b|write\-line\b|write\b|xfer\-event\b|xml\-error\b|xml\-parse\b|xml\-type\-tags\b|zero\?\b)" is(keyword)
30
+ r"(?<=\()([a-zA-Z0-9!$%&*+.,/<=>?@^_\126|-])+|(\[.*?\])+" is(name.variable)
31
+ r"([a-zA-Z0-9!$%&*+.,/<=>?@^_\126|-])+|(\[.*?\])+" is(literal.string.symbol)
32
+ r"(\(|\))" is(punctuation)
33
+
34
+ const-set(.Lexer, lexer)
@@ -0,0 +1,49 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "Newspeak"
6
+ aliases: ["newspeak"]
7
+ extensions: [".ns2"]
8
+ mimetypes: ["text/x-newspeak"]
9
+ start: .root
10
+ flags: 0
11
+
12
+ lex(literals):
13
+ r"\$." is(literal.string)
14
+ r"'[^']*'" is(literal.string)
15
+ r"\#'[^']*'" is(literal.string.symbol)
16
+ r"\#\w+:?" is(literal.string.symbol)
17
+ r"\#(\+|\/|\126|\*|<|>|=|@|%|\||&|\?|!|,|-)+" is(literal.string.symbol)
18
+
19
+ lex(root):
20
+ r"\b(Newsqueak2)\b" is(keyword.declaration)
21
+ r"'[^']*'" is(literal.string)
22
+ r"\b(class)(\s+)([a-zA-Z0-9_]+)(\s*)" is(by-groups(keyword.declaration, text, name.class, text))
23
+ r"\b(mixin|self|super|private|public|protected|nil|true|false)\b" is(keyword)
24
+ r"([a-zA-Z0-9_]+\:)(\s*)([a-zA-Z_]\w+)" is(by-groups(name.function, text, name.variable))
25
+ r"([a-zA-Z0-9_]+)(\s*)(=)" is(by-groups(name.attribute, text, operator))
26
+ r"<[a-zA-Z0-9_]+>" is(comment.special)
27
+ any-of(expressionstat)
28
+ any-of(whitespace)
29
+
30
+ lex(whitespace):
31
+ r"\s+" is(text)
32
+ r"\"[^\"]*\"" is(comment)
33
+
34
+ lex(expressionstat):
35
+ r"(\d+\.\d*|\.\d+|\d+[fF])[fF]?" is(literal.number.float)
36
+ r"\d+" is(literal.number.integer)
37
+ r":\w+" is(name.variable)
38
+ r"(\w+)(::)" is(by-groups(name.variable, operator))
39
+ r"\w+:" is(name.function)
40
+ r"\w+" is(name.variable)
41
+ r"\(|\)" is(punctuation)
42
+ r"\[|\]" is(punctuation)
43
+ r"\{|\}" is(punctuation)
44
+ r"(\^|\+|\/|\126|\*|<|>|=|@|%|\||&|\?|!|,|-|:)" is(operator)
45
+ r"\.|;" is(punctuation)
46
+ any-of(whitespace)
47
+ any-of(literals)
48
+
49
+ const-set(.Lexer, lexer)
@@ -0,0 +1,41 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "Nginx configuration file"
6
+ aliases: ["nginx"]
7
+ extensions: []
8
+ mimetypes: ["text/x-nginx-conf"]
9
+ start: .root
10
+ flags: 0
11
+
12
+ lex(base):
13
+ r"\#.*\n" is(comment.single)
14
+ r"on|off" is(name.constant)
15
+ r"\$[^\s;\#()]+" is(name.variable)
16
+ r"([a-z0-9.-]+)(:)([0-9]+)" is(by-groups(name, punctuation, literal.number.integer))
17
+ r"[a-z-]+/[a-z-+]+" is(literal.string)
18
+ r"[0-9]+[km]?\b" is(literal.number.integer)
19
+ r"(\126)(\s*)([^\s{]+)" is(by-groups(punctuation, text, literal.string.regex))
20
+ r"[:=\126]" is(punctuation)
21
+ r"[^\s;\#{}$]+" is(literal.string)
22
+ r"/[^\s;\#]*" is(name)
23
+ r"\s+" is(text)
24
+ r"[$;]" is(text)
25
+
26
+ lex(root):
27
+ r"(include)(\s+)([^\s;]+)" is(by-groups(keyword, text, name))
28
+ r"[^\s;\#]+" is(keyword) -> go-to(stmt)
29
+ any-of(base)
30
+
31
+ lex(stmt):
32
+ r"{" is(punctuation) -> go-to(block)
33
+ r";" is(punctuation) -> pop
34
+ any-of(base)
35
+
36
+ lex(block):
37
+ r"}" is(punctuation) -> pop(2)
38
+ r"[^\s;\#]+" is(keyword.namespace) -> go-to(stmt)
39
+ any-of(base)
40
+
41
+ const-set(.Lexer, lexer)
@@ -0,0 +1,84 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "Nimrod"
6
+ aliases: ["nimrod", "nim"]
7
+ extensions: [".nim", ".nimrod"]
8
+ mimetypes: ["text/x-nimrod"]
9
+ start: .root
10
+ flags: Regexp IGNORECASE
11
+
12
+ lex(rdqs):
13
+ r"\"(?!\")" is(literal.string) -> pop
14
+ r"\"\"" is(literal.string.escape)
15
+ any-of(strings)
16
+
17
+ lex(float-suffix):
18
+ r"\'[fF](32|64)" is(literal.number.float)
19
+ r"" is(text) -> pop
20
+
21
+ lex(chars):
22
+ r"\\([\\abcefnrtvl\"\']|x[a-fA-F0-9]{2}|[0-9]{1,3})" is(literal.string.escape)
23
+ r"'" is(literal.string.char) -> pop
24
+ r"." is(literal.string.char)
25
+
26
+ lex(float-number):
27
+ r"\.(?!\.)[0-9_]*" is(literal.number.float)
28
+ r"[eE][+-]?[0-9][0-9_]*" is(literal.number.float)
29
+ r"" is(text) -> pop
30
+
31
+ lex(int-suffix):
32
+ r"\'[iI](32|64)" is(literal.number.integer.long)
33
+ r"\'[iI](8|16)" is(literal.number.integer)
34
+ r"" is(text) -> pop
35
+
36
+ lex(nl):
37
+ r"\n" is(literal.string)
38
+
39
+ lex(dqs):
40
+ r"\\([\\abcefnrtvl\"\']|\n|x[a-fA-F0-9]{2}|[0-9]{1,3})" is(literal.string.escape)
41
+ r"\"" is(literal.string) -> pop
42
+ any-of(strings)
43
+
44
+ lex(root):
45
+ r"\#\#.*$" is(literal.string.doc)
46
+ r"\#.*$" is(comment)
47
+ r"\*|=|>|<|\+|-|/|@|\$|\126|&|%|\!|\?|\||\\|\[|\]" is(operator)
48
+ r"\.\.|\.|,|\[\.|\.\]|{\.|\.}|\(\.|\.\)|{|}|\(|\)|:|\^|`|;" is(punctuation)
49
+ r"(?:[\w]+)\"" is(literal.string) -> go-to(rdqs)
50
+ r"\"\"\"" is(literal.string) -> go-to(tdqs)
51
+ r"\"" is(literal.string) -> go-to(dqs)
52
+ r"'" is(literal.string.char) -> go-to(chars)
53
+ r"(a_?n_?d_?|o_?r_?|n_?o_?t_?|x_?o_?r_?|s_?h_?l_?|s_?h_?r_?|d_?i_?v_?|m_?o_?d_?|i_?n_?|n_?o_?t_?i_?n_?|i_?s_?|i_?s_?n_?o_?t_?)\b" is(operator.word)
54
+ r"(p_?r_?o_?c_?\s)(?![\(\[\]])" is(keyword) -> go-to(funcname)
55
+ r"(a_?d_?d_?r_?|a_?n_?d_?|a_?s_?|a_?s_?m_?|a_?t_?o_?m_?i_?c_?|b_?i_?n_?d_?|b_?l_?o_?c_?k_?|b_?r_?e_?a_?k_?|c_?a_?s_?e_?|c_?a_?s_?t_?|c_?o_?n_?s_?t_?|c_?o_?n_?t_?i_?n_?u_?e_?|c_?o_?n_?v_?e_?r_?t_?e_?r_?|d_?i_?s_?c_?a_?r_?d_?|d_?i_?s_?t_?i_?n_?c_?t_?|d_?i_?v_?|e_?l_?i_?f_?|e_?l_?s_?e_?|e_?n_?d_?|e_?n_?u_?m_?|e_?x_?c_?e_?p_?t_?|f_?i_?n_?a_?l_?l_?y_?|f_?o_?r_?|g_?e_?n_?e_?r_?i_?c_?|i_?f_?|i_?m_?p_?l_?i_?e_?s_?|i_?n_?|y_?i_?e_?l_?d_?|i_?s_?|i_?s_?n_?o_?t_?|i_?t_?e_?r_?a_?t_?o_?r_?|l_?a_?m_?b_?d_?a_?|l_?e_?t_?|m_?a_?c_?r_?o_?|m_?e_?t_?h_?o_?d_?|m_?o_?d_?|n_?o_?t_?|n_?o_?t_?i_?n_?|o_?b_?j_?e_?c_?t_?|o_?f_?|o_?r_?|o_?u_?t_?|p_?r_?o_?c_?|p_?t_?r_?|r_?a_?i_?s_?e_?|r_?e_?f_?|r_?e_?t_?u_?r_?n_?|s_?h_?l_?|s_?h_?r_?|t_?e_?m_?p_?l_?a_?t_?e_?|t_?r_?y_?|t_?u_?p_?l_?e_?|t_?y_?p_?e_?|w_?h_?e_?n_?|w_?h_?i_?l_?e_?|w_?i_?t_?h_?|w_?i_?t_?h_?o_?u_?t_?|x_?o_?r_?)\b" is(keyword)
56
+ r"(f_?r_?o_?m_?|i_?m_?p_?o_?r_?t_?|i_?n_?c_?l_?u_?d_?e_?)\b" is(keyword.namespace)
57
+ r"(v_?a_?r)\b" is(keyword.declaration)
58
+ r"(i_?n_?t_?|i_?n_?t_?8_?|i_?n_?t_?1_?6_?|i_?n_?t_?3_?2_?|i_?n_?t_?6_?4_?|f_?l_?o_?a_?t_?|f_?l_?o_?a_?t_?3_?2_?|f_?l_?o_?a_?t_?6_?4_?|b_?o_?o_?l_?|c_?h_?a_?r_?|r_?a_?n_?g_?e_?|a_?r_?r_?a_?y_?|s_?e_?q_?|s_?e_?t_?|s_?t_?r_?i_?n_?g_?)\b" is(keyword.type)
59
+ r"(n_?i_?l_?|t_?r_?u_?e_?|f_?a_?l_?s_?e_?)\b" is(keyword.pseudo)
60
+ r"\b((?![_\d])\w)(((?!_)\w)|(_(?!_)\w))*" is(name)
61
+ r"[0-9][0-9_]*(?=([eE.]|\'[fF](32|64)))" is(literal.number.float) -> do-all(go-to(float-suffix), go-to(float-number))
62
+ r"0[xX][a-fA-F0-9][a-fA-F0-9_]*" is(literal.number.hex) -> go-to(int-suffix)
63
+ r"0[bB][01][01_]*" is(literal.number) -> go-to(int-suffix)
64
+ r"0o[0-7][0-7_]*" is(literal.number.oct) -> go-to(int-suffix)
65
+ r"[0-9][0-9_]*" is(literal.number.integer) -> go-to(int-suffix)
66
+ r"\s+" is(text)
67
+ r".+$" is(error)
68
+
69
+ lex(funcname):
70
+ r"((?![\d_])\w)(((?!_)\w)|(_(?!_)\w))*" is(name.function) -> pop
71
+ r"`.+`" is(name.function) -> pop
72
+
73
+ lex(tdqs):
74
+ r"\"\"\"(?!\")" is(literal.string) -> pop
75
+ any-of(strings)
76
+ any-of(nl)
77
+
78
+ lex(strings):
79
+ r"(?<!\$)\$(\d+|\#|\w+)+" is(literal.string.interpol)
80
+ r"[^\\\'\"\$\n]+" is(literal.string)
81
+ r"[\'\"\\]" is(literal.string)
82
+ r"\$" is(literal.string)
83
+
84
+ const-set(.Lexer, lexer)
@@ -0,0 +1,55 @@
1
+ use(require("atomy"))
2
+ use(require("hl/define"))
3
+
4
+ lexer = lexer:
5
+ name: "NSIS"
6
+ aliases: ["nsis", "nsi", "nsh"]
7
+ extensions: [".nsi", ".nsh"]
8
+ mimetypes: ["text/x-nsis"]
9
+ start: .root
10
+ flags: Regexp IGNORECASE
11
+
12
+ lex(str-double):
13
+ r"\"" is(literal.string) -> pop
14
+ r"\$(\\[nrt\"]|\$)" is(literal.string.escape)
15
+ any-of(interpol)
16
+ r"." is(literal.string.double)
17
+
18
+ lex(macro):
19
+ r"\!(addincludedir(?:dir)?|addplugindir|appendfile|cd|define|delfilefile|echo(?:message)?|else|endif|error|execute|if(?:macro)?n?(?:def)?|include|insertmacro|macro(?:end)?|packhdr|search(?:parse|replace)|system|tempfilesymbol|undef|verbose|warning)\b" is(comment.preproc)
20
+
21
+ lex(str-backtick):
22
+ r"`" is(literal.string) -> pop
23
+ r"\$(\\[nrt\"]|\$)" is(literal.string.escape)
24
+ any-of(interpol)
25
+ r"." is(literal.string.double)
26
+
27
+ lex(basic):
28
+ r"(\n)(Function)(\s+)([._a-z][.\w]*)\b" is(by-groups(text, keyword, text, name.function))
29
+ r"\b([_a-z]\w*)(::)([a-z][a-z0-9]*)\b" is(by-groups(keyword.namespace, punctuation, name.function))
30
+ r"\b([_a-z]\w*)(:)" is(by-groups(name.label, punctuation))
31
+ r"(\b[ULS]|\B)([\!\<\>=]?=|\<\>?|\>)\B" is(operator)
32
+ r"[|+-]" is(operator)
33
+ r"\\" is(punctuation)
34
+ r"\b(Abort|Add(?:BrandingImage|Size)|Allow(?:RootDirInstall|SkipFiles)|AutoCloseWindow|BG(?:Font|Gradient)|BrandingText|BringToFront|Call(?:InstDLL)?|(?:Sub)?Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|Create(?:Directory|Font|Shortcut)|Delete(?:INI(?:Sec|Str)|Reg(?:Key|Value))?|DetailPrint|DetailsButtonText|Dir(?:Show|Text|Var|Verify)|(?:Disabled|Enabled)Bitmap|EnableWindow|EnumReg(?:Key|Value)|Exch|Exec(?:Shell|Wait)?|ExpandEnvStrings|File(?:BufSize|Close|ErrorText|Open|Read(?:Byte)?|Seek|Write(?:Byte)?)?|Find(?:Close|First|Next|Window)|FlushINI|Function(?:End)?|Get(?:CurInstType|CurrentAddress|DlgItem|DLLVersion(?:Local)?|ErrorLevel|FileTime(?:Local)?|FullPathName|FunctionAddress|InstDirError|LabelAddress|TempFileName)|Goto|HideWindow|Icon|If(?:Abort|Errors|FileExists|RebootFlag|Silent)|InitPluginsDir|Install(?:ButtonText|Colors|Dir(?:RegKey)?)|Inst(?:ProgressFlags|Type(?:[GS]etText)?)|Int(?:CmpU?|Fmt|Op)|IsWindow|LangString(?:UP)?|License(?:BkColor|Data|ForceSelection|LangString|Text)|LoadLanguageFile|LockWindow|Log(?:Set|Text)|MessageBox|MiscButtonText|Name|Nop|OutFile|(?:Uninst)?Page(?:Ex(?:End)?)?|PluginDir|Pop|Push|Quit|Read(?:(?:Env|INI|Reg)Str|RegDWORD)|Reboot|(?:Un)?RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(?:Divider|End|(?:(?:Get|Set)(?:Flags|InstTypes|Size|Text))|Group(?:End)?|In)?|SendMessage|Set(?:AutoClose|BrandingImage|Compress(?:ionLevel|or(?:DictSize)?)?|CtlColors|CurInstType|DatablockOptimize|DateSave|Details(?:Print|View)|Error(?:s|Level)|FileAttributes|Font|OutPath|Overwrite|PluginUnload|RebootFlag|ShellVarContext|Silent|StaticBkColor)|Show(?:(?:I|Uni)nstDetails|Window)|Silent(?:Un)?Install|Sleep|SpaceTexts|Str(?:CmpS?|Cpy|Len)|SubSection(?:End)?|Uninstall(?:ButtonText|(?:Sub)?Caption|EXEName|Icon|Text)|UninstPage|Var|VI(?:AddVersionKey|ProductVersion)|WindowIcon|Write(?:INIStr|Reg(:?Bin|DWORD|(?:Expand)?Str)|Uninstaller)|XPStyle)\b" is(keyword)
35
+ r"\b(CUR|END|(?:FILE_ATTRIBUTE_)?(?:ARCHIVE|HIDDEN|NORMAL|OFFLINE|READONLY|SYSTEM|TEMPORARY)|HK(CC|CR|CU|DD|LM|PD|U)|HKEY_(?:CLASSES_ROOT|CURRENT_(?:CONFIG|USER)|DYN_DATA|LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|ID(?:ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|MB_(?:ABORTRETRYIGNORE|DEFBUTTON[1-4]|ICON(?:EXCLAMATION|INFORMATION|QUESTION|STOP)|OK(?:CANCEL)?|RETRYCANCEL|RIGHT|SETFOREGROUND|TOPMOST|USERICON|YESNO(?:CANCEL)?)|SET|SHCTX|SW_(?:HIDE|SHOW(?:MAXIMIZED|MINIMIZED|NORMAL))|admin|all|auto|both|bottom|bzip2|checkbox|colored|current|false|force|hide|highest|if(?:diff|newer)|lastused|leave|left|listonly|lzma|nevershow|none|normal|off|on|pop|push|radiobuttons|right|show|silent|silentlog|smooth|textonly|top|true|try|user|zlib)\b" is(name.constant)
36
+
37
+ lex(interpol):
38
+ r"\$(R?[0-9])" is(name.builtin.pseudo)
39
+ r"\$(ADMINTOOLS|APPDATA|CDBURN_AREA|COOKIES|COMMONFILES(?:32|64)|DESKTOP|DOCUMENTS|EXE(?:DIR|FILE|PATH)|FAVORITES|FONTS|HISTORY|HWNDPARENT|INTERNET_CACHE|LOCALAPPDATA|MUSIC|NETHOOD|PICTURES|PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES(?:32|64)|QUICKLAUNCH|RECENT|RESOURCES(?:_LOCALIZED)?|SENDTO|SM(?:PROGRAMS|STARTUP)|STARTMENU|SYSDIR|TEMP(?:LATES)?|VIDEOS|WINDIR|\{NSISDIR\})" is(name.builtin)
40
+ r"\$(CMDLINE|INSTDIR|OUTDIR|LANGUAGE)" is(name.variable.global)
41
+ r"\$[a-z_]\w*" is(name.variable)
42
+
43
+ lex(root):
44
+ r"[;\\#].*\n" is(comment)
45
+ r"'.*'" is(literal.string.single)
46
+ r"\"" is(literal.string.double) -> go-to(str-double)
47
+ r"`" is(literal.string.backtick) -> go-to(str-backtick)
48
+ any-of(macro)
49
+ any-of(interpol)
50
+ any-of(basic)
51
+ r"\$\{[a-z_|][\w|]*\}" is(keyword.pseudo)
52
+ r"/[a-z_]\w*" is(name.attribute)
53
+ r"." is(text)
54
+
55
+ const-set(.Lexer, lexer)