]> gitweb.factorcode.org Git - factor.git/blob - misc/atom/grammars/factor.cson
40cb92dee7cd48d0b4986c7b3e10e315e952f1d9
[factor.git] / misc / atom / grammars / factor.cson
1 fileTypes: [
2   "factor"
3   "facts"
4 ]
5 foldingStartMarker: "^\\s*(M|C)?:|#(V|H|C)\\{"
6 foldingStopMarker: "^\\s*$"
7 name: "Factor"
8 patterns: [
9   {
10     captures:
11       "2":
12         name: "keyword.colon.factor"
13       "3":
14         name: "entity.name.function.factor"
15       "4":
16         name: "comment.stack-effect.factor"
17     match: "(^|(?<=\\s))(::?)\\s+([^\\s]+)\\s"
18     name: "definition.word.factor"
19   }
20   {
21     captures:
22       "2":
23         name: "keyword.colon.factor"
24       "3":
25         name: "entity.name.method.factor"
26       "4":
27         name: "comment.stack-effect.factor"
28     match: "(^|(?<=\\s))(C:)\\s+([^\\s]+)\\s"
29     name: "definition.word.class.factor"
30   }
31   {
32     captures:
33       "2":
34         name: "keyword.colon.factor"
35       "3":
36         name: "entity.name.class.factor"
37       "4":
38         name: "entity.name.method.factor"
39       "5":
40         name: "comment.stack-effect.factor"
41     match: "(^|(?<=\\s))(M:)\\s+([^\\s]+)\\s+([^\\s]+)\\s"
42     name: "definition.word.method.factor"
43   }
44   {
45     captures:
46       "2":
47         name: "keyword.colon.factor"
48       "3":
49         name: "entity.name.generic.factor"
50       "5":
51         name: "comment.stack-effect.factor"
52     match: "(^|(?<=\\s))(GENERIC:)\\s+([^\\s]+)\\s"
53     name: "definition.word.generic.factor"
54   }
55   {
56     captures:
57       "2":
58         name: "keyword.colon.factor"
59       "3":
60         name: "entity.name.generic.factor"
61       "5":
62         name: "comment.stack-effect.factor"
63     match: "(^|(?<=\\s))(GENERIC#:)\\s+([^\\s]+)\\s(\\d+)\\s"
64     name: "definition.word.generic.factor"
65   }
66   {
67     captures:
68       "2":
69         name: "storage.type.factor"
70       "3":
71         name: "entity.name.class.factor"
72     match: "(^|(?<=\\s))(TUPLE:|BUILTIN:)\\s+([^\\s]+)\\s+(([^\\s]+)+)"
73     name: "meta.class.factor"
74   }
75   {
76     match: "(^|(?<=\\s))(>boolean|<wrapper>|\\(clone\\)|-rot|2bi|2bi@|2bi\\*|2curry|2dip|2drop|2dup|2keep|2nip|2over|2tri|2tri@|2tri\\*|2with|3bi|3curry|3dip|3drop|3dup|3keep|3tri|4dip|4drop|4dup|4keep|=|\\?|\\?if|and|assert|assert=|assert\\?|bi|bi-curry|bi-curry@|bi-curry\\*|bi@|bi\\*|boa|boolean|boolean\\?|both\\?|build|call|callstack|callstack>array|callstack\\?|clear|clone|compose|compose\\?|curry|curry\\?|datastack|die|dip|do|drop|dup|dupd|either\\?|eq\\?|equal\\?|execute|hashcode|hashcode\\*|identity-hashcode|identity-tuple|identity-tuple\\?|if|if\\*|keep|loop|most|new|nip|not|null|object|or|over|pick|prepose|retainstack|rot|same\\?|swap|swapd|throw|tri|tri-curry|tri-curry@|tri-curry\\*|tri@|tri\\*|tuple|tuple\\?|unless|unless\\*|until|when|when\\*|while|with|wrapper|wrapper\\?|xor)(\\s|$)"
77     name: "keyword.control.kernel.factor"
78   }
79   {
80     match: "(^|(?<=\\s))(\\+@|change|change-global|counter|dec|get|get-global|global|inc|init-namespaces|initialize|is-global|namespace|namestack|off|on|set|set-global|set-namestack|toggle|with-global|with-scope|with-variable|with-variables)(\\s|$)"
81     name: "keyword.control.namespaces.factor"
82   }
83   {
84     match: "(^|(?<=\\s))(>alist|<enumerated>|2cache|\\?at|\\?of|assoc|assoc>map|assoc-all\\?|assoc-any\\?|assoc-clone-like|assoc-combine|assoc-diff|assoc-diff!|assoc-differ|assoc-each|assoc-empty\\?|assoc-filter|assoc-filter!|assoc-filter-as|assoc-find|assoc-hashcode|assoc-intersect|assoc-like|assoc-map|assoc-map-as|assoc-partition|assoc-refine|assoc-size|assoc-stack|assoc-subset\\?|assoc-union|assoc-union!|assoc=|assoc\\?|at|at\\*|at\\+|cache|change-at|clear-assoc|delete-at|delete-at\\*|enum|enum\\?|extract-keys|inc-at|key\\?|keys|map>assoc|maybe-set-at|new-assoc|of|push-at|rename-at|set-at|sift-keys|sift-values|substitute|unzip|value-at|value-at\\*|value\\?|values|zip|zip-as|zip-index|zip-index-as)(\\s|$)"
85     name: "keyword.control.assocs.factor"
86   }
87   {
88     match: "(^|(?<=\\s))(2cleave|2cleave>quot|3cleave|3cleave>quot|4cleave|4cleave>quot|alist>quot|call-effect|case|case>quot|case-find|cleave|cleave>quot|cond|cond>quot|deep-spread>quot|execute-effect|linear-case-quot|no-case|no-case\\?|no-cond|no-cond\\?|recursive-hashcode|shallow-spread>quot|spread|to-fixed-point|wrong-values|wrong-values\\?)(\\s|$)"
89     name: "keyword.control.combinators.factor"
90   }
91   {
92     match: "(^|(?<=\\s))(>|>=|>bignum|>fixnum|>float|>integer|<|<=|<fp-nan>|\\(all-integers\\?\\)|\\(each-integer\\)|\\(find-integer\\)|-|/|/f|/i|/mod|2/|2^|\\*|\\+|\\?1\\+|abs|align|all-integers\\?|bignum|bignum\\?|bit\\?|bitand|bitnot|bitor|bits>double|bits>float|bitxor|complex|complex\\?|denominator|double>bits|each-integer|even\\?|find-integer|find-last-integer|fixnum|fixnum\\?|float|float>bits|float\\?|fp-bitwise=|fp-infinity\\?|fp-nan-payload|fp-nan\\?|fp-qnan\\?|fp-sign|fp-snan\\?|fp-special\\?|if-zero|imaginary-part|integer|integer>fixnum|integer>fixnum-strict|integer\\?|log2|log2-expects-positive|log2-expects-positive\\?|mod|neg|neg\\?|next-float|next-power-of-2|number|number=|number\\?|numerator|odd\\?|power-of-2\\?|prev-float|ratio|ratio\\?|rational|rational\\?|real|real-part|real\\?|recip|rem|sgn|shift|sq|times|u>|u>=|u<|u<=|unless-zero|unordered\\?|when-zero|zero\\?)(\\s|$)"
93     name: "keyword.control.math.factor"
94   }
95   {
96     match: "(^|(?<=\\s))(<repetition>|<reversed>|<slice>|1sequence|2all\\?|2each|2map|2map-as|2map-reduce|2reduce|2selector|2sequence|3append|3append-as|3each|3map|3map-as|3sequence|4sequence|\\?first|\\?last|\\?nth|\\?second|\\?set-nth|accumulate|accumulate!|accumulate-as|all\\?|any\\?|append|append!|append-as|assert-sequence|assert-sequence=|assert-sequence\\?|binary-reduce|bounds-check|bounds-check\\?|bounds-error|bounds-error\\?|but-last|but-last-slice|cartesian-each|cartesian-map|cartesian-product|change-nth|check-slice|check-slice-error|clone-like|collapse-slice|collector|collector-for|concat|concat-as|copy|count|cut|cut-slice|cut\\*|delete-all|delete-slice|drop-prefix|each|each-from|each-index|empty\\?|exchange|filter|filter!|filter-as|find|find-from|find-index|find-index-from|find-last|find-last-from|first|first2|first3|first4|flip|follow|fourth|glue|halves|harvest|head|head-slice|head-slice\\*|head\\*|head\\?|if-empty|immutable|immutable-sequence|immutable-sequence\\?|immutable\\?|index|index-from|indices|infimum|infimum-by|insert-nth|interleave|iota|iota-tuple|iota-tuple\\?|join|join-as|last|last-index|last-index-from|length|lengthen|like|longer|longer\\?|longest|map|map!|map-as|map-find|map-find-last|map-index|map-index-as|map-integers|map-reduce|map-sum|max-length|member-eq\\?|member\\?|midpoint@|min-length|mismatch|move|new-like|new-resizable|new-sequence|non-negative-integer-expected|non-negative-integer-expected\\?|nth|nths|pad-head|pad-tail|padding|partition|pop|pop\\*|prefix|prepend|prepend-as|produce|produce-as|product|push|push-all|push-either|push-if|reduce|reduce-index|remove|remove!|remove-eq|remove-eq!|remove-nth|remove-nth!|repetition|repetition\\?|replace-slice|replicate|replicate-as|rest|rest-slice|reverse|reverse!|reversed|reversed\\?|second|selector|selector-for|sequence|sequence-hashcode|sequence=|sequence\\?|set-first|set-fourth|set-last|set-length|set-nth|set-second|set-third|short|shorten|shorter|shorter\\?|shortest|sift|slice|slice-error|slice-error\\?|slice\\?|snip|snip-slice|start|start\\*|subseq|subseq\\?|suffix|suffix!|sum|sum-lengths|supremum|supremum-by|surround|tail|tail-slice|tail-slice\\*|tail\\*|tail\\?|third|trim|trim-head|trim-head-slice|trim-slice|trim-tail|trim-tail-slice|unclip|unclip-last|unclip-last-slice|unclip-slice|unless-empty|virtual-exemplar|virtual-sequence|virtual-sequence\\?|virtual@|when-empty)(\\s|$)"
97     name: "keyword.control.sequences.factor"
98   }
99   {
100     match: "(^|(?<=\\s))(>array|<array>|1array|2array|3array|4array|array|array\\?|pair|pair\\?|resize-array)(\\s|$)"
101     name: "keyword.control.arrays.factor"
102   }
103   {
104     match: "(^|(?<=\\s))(\\(each-stream-block-slice\\)|\\(each-stream-block\\)|\\(stream-contents-by-block\\)|\\(stream-contents-by-element\\)|\\(stream-contents-by-length-or-block\\)|\\(stream-contents-by-length\\)|\\+byte\\+|\\+character\\+|bad-seek-type|bad-seek-type\\?|bl|contents|each-block|each-block-size|each-block-slice|each-line|each-morsel|each-stream-block|each-stream-block-slice|each-stream-line|error-stream|flush|input-stream|input-stream\\?|invalid-read-buffer|invalid-read-buffer\\?|lines|nl|output-stream|output-stream\\?|print|read|read-into|read-partial|read-partial-into|read-until|read1|readln|seek-absolute|seek-absolute\\?|seek-end|seek-end\\?|seek-input|seek-output|seek-relative|seek-relative\\?|stream-bl|stream-contents|stream-contents\\*|stream-copy|stream-copy\\*|stream-element-type|stream-flush|stream-length|stream-lines|stream-nl|stream-print|stream-read|stream-read-into|stream-read-partial|stream-read-partial-into|stream-read-partial-unsafe|stream-read-unsafe|stream-read-until|stream-read1|stream-readln|stream-seek|stream-seekable\\?|stream-tell|stream-write|stream-write1|tell-input|tell-output|with-error>output|with-error-stream|with-error-stream\\*|with-input-output\\+error-streams|with-input-output\\+error-streams\\*|with-input-stream|with-input-stream\\*|with-output>error|with-output-stream|with-output-stream\\*|with-output\\+error-stream|with-output\\+error-stream\\*|with-streams|with-streams\\*|write|write1)(\\s|$)"
105     name: "keyword.control.io.factor"
106   }
107   {
108     match: "(^|(?<=\\s))(>string|<string>|1string|resize-string|string|string\\?)(\\s|$)"
109     name: "keyword.control.strings.factor"
110   }
111   {
112     match: "(^|(?<=\\s))(>vector|<vector>|1vector|\\?push|vector|vector\\?)(\\s|$)"
113     name: "keyword.control.vectors.factor"
114   }
115   {
116     match: "(^|(?<=\\s))(<condition>|<continuation>|<restart>|attempt-all|attempt-all-error|attempt-all-error\\?|callback-error-hook|callcc0|callcc1|cleanup|compute-restarts|condition|condition\\?|continuation|continuation\\?|continue|continue-restart|continue-with|current-continuation|error|error-continuation|error-in-thread|error-thread|ifcc|ignore-errors|in-callback\\?|original-error|recover|restart|restart\\?|restarts|rethrow|rethrow-restarts|return|return-continuation|thread-error-hook|throw-continue|throw-restarts|with-datastack|with-return)(\\s|$)"
117     name: "keyword.control.continuations.factor"
118   }
119   {
120     begin: "(^|(?<=\\s))(USING:)"
121     end: "(?<=\\s);(\\s|$)"
122     name: "keyword.control.using.factor"
123     patterns: [
124       {
125         match: "(^|(?<=\\s))[^\\s]+(\\s|$)"
126         name: "constant.namespace.factor"
127       }
128     ]
129   }
130   {
131     match: "(^|(?<=\\s))(f|t)(\\s|$)"
132     name: "constant.language.factor"
133   }
134   {
135     match: "(^|(?<=\\s))CHAR:\\s+[^\\s]+(\\s|$)"
136     name: "constant.character.factor"
137   }
138   {
139     match: "(^|(?<=\\s))[+-]?\\d([\\d,]*\\d)?(\\s|$)"
140     name: "constant.numeric.integer.factor"
141   }
142   {
143     match: "(^|(?<=\\s))[+-]?(\\d([\\d,]*\\d)?)?\\.\\d([\\d,]*\\d)?([Ee][+-]?\\d([\\d,]*\\d)?)?(\\s|$)"
144     name: "constant.numeric.float.factor"
145   }
146   {
147     match: "(^|(?<=\\s))(-\\d([\\d,]*\\d)?)?-?\\d([\\d,]*\\d)?/\\d([\\d,]*\\d)?(\\s|$)"
148     name: "constant.numeric.neg-ratio.factor"
149   }
150   {
151     match: "(^|(?<=\\s))\\+?(\\d([\\d,]*\\d)?\\+?)?\\d([\\d,]*\\d)?/\\d([\\d,]*\\d)?(\\s|$)"
152     name: "constant.numeric.pos-ratio.factor"
153   }
154   {
155     match: "(^|(?<=\\s))[+-]?0b[01]([01,]*[01])?(\\s|$)"
156     name: "constant.numeric.binary.factor"
157   }
158   {
159     match: "(^|(?<=\\s))[+-]?0o[0-7]([0-7,]*[0-7])?(\\s|$)"
160     name: "constant.numeric.octal.factor"
161   }
162   {
163     match: "(^|(?<=\\s))[+-]?0x[0-9a-fA-Fp]([0-9a-fA-F,]*[0-9a-fA-F])?(p[0-9a-fA-Fp]([0-9a-fA-F,]*[0-9a-fA-F])?)?(\\s|$)"
164     name: "constant.numeric.hex.factor"
165   }
166   {
167     begin: "\""
168     end: "\""
169     name: "string.quoted.double.factor"
170     patterns: [
171       {
172         include: "#escaped_characters"
173       }
174     ]
175   }
176   {
177     begin: "<\""
178     end: "\">"
179     name: "string.quoted.double.multiline.factor"
180     patterns: [
181       {
182         include: "#escaped_characters"
183       }
184     ]
185   }
186   {
187     begin: "(^|(?<=\\s))(STRING:)\\s+(\\S+)"
188     captures:
189       "2":
190         name: "keyword.colon.factor"
191       "3":
192         name: "entity.name.heredoc.factor"
193     contentName: "string.unquoted.heredoc.factor"
194     end: "^;$"
195     name: "definition.word.heredoc.factor"
196   }
197   {
198     match: "inline|foldable"
199     name: "storage.modifier.factor"
200   }
201   {
202     match: "(^|(?<=\\s))#?!(\\s.*)?$"
203     name: "comment.line.factor"
204   }
205   {
206     begin: "\\((?=\\s)"
207     end: "(^|(?<=\\s))\\)"
208     name: "comment.parens.factor"
209   }
210   {
211     match: "\\b[^\\s]+:\\s+[^\\s]+(\\s|$)"
212     name: "keyword.control.postpone.factor"
213   }
214 ]
215 repository:
216   escaped_characters:
217     patterns: [
218       {
219         match: "\\\\(\\\\|[abefnrtsv0\"]|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{6})"
220         name: "constant.character.escape.factor"
221       }
222       {
223         match: "\\\\."
224         name: "invalid.illegal.unknown-escape.factor"
225       }
226     ]
227 scopeName: "source.factor"