scripts and highlighters fixes/extensions
[sxed.git] / config / syntax / urforth.sxh
blobf56f8338095b6747bb257997c3ecabc10ed66bf9
1 /*
2  * SXED -- sexy text editor engine, 2022
3  *
4  * coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
5  * Understanding is not required. Only obedience.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, version 3 of the License ONLY.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 // spaces between `=` are NOT optional!
20 name = "UrForth"
21 globs = +(*.f)
23 default-style = c-default
24 code-block-chars = !empty!
25 // bracket-chars = !empty!
26 // this resets word jump chars
27 word-chars = !non-blank!
28 // setup word jump chars again
29 word-jump-chars = !default!
31 @case-insensitive
34 keyword {
38 keyword type @separate @any-end {
39   /[^:\s]+[:]/
40   // /UFO[:]\S+/
41   // /URASM[:]\S+/
44 keyword special {
45   recurse
46   compile
48   false
49   true
51   if
52   "+if"
53   "-if"
54   "+0if"
55   "-0if"
56   ifnot
57   else
58   endif
59   then
61   case
62   endcase
64   "?OF"
65   "IF-OF"
66   "IFNOT-OF"
67   "OF"
68   "NOT-OF"
69   "<OF"
70   "<=OF"
71   ">OF"
72   ">=OF"
73   "U<OF"
74   "U<=OF"
75   "U>OF"
76   "U>=OF"
77   "&OF"
78   "AND-OF"
79   "~AND-OF"
80   "WITHIN-OF"
81   "UWITHIN-OF"
82   "BOUNDS-OF"
84   endof
85   otherwise
89 keyword internal {
90   ":"
91   ";"
93   [compile]
94   [char]
95   [']
97   break
98   continue
100   exit
102   /[:]\S+/
103   create
104   "create;"
106   args:
107   locals:
109   $IF
110   $ENDIF
111   $ELSE
112   $ELSIF
116 keyword hi begin {
117   begin
118   again
119   repeat
120   loop
121   do
122   "+loop"
123   until
124   "not-until"
125   "+until"
126   "-until"
127   "+0until"
128   "-0until"
129   for
130   endfor
134 keyword hi loop {
135   while
136   "not-while"
137   "+while"
138   "-while"
139   "+0while"
140   "-0while"
144 keyword type {
145   "[:"
146   ";]"
148   to
153 punct {
154   /[-!%&()*+,\/:<=>?\[\]^{|}~.]/
159 // to make semicolons more visible
161 semi {
162   ;
167 comment single-line start @auto-start @any-end {
168   ";;"
169   "\\"
170   "--"
171   "//"
174 comment single-line end {
175   /\n/
179 comment single-line parens start @auto-start @word-end {
180   /[(]/
183 comment single-line parens end {
184   /[)]/
187 comment multiline start @any-start @any-end {
188   /\(\*/
191 comment multiline end {
192   /\*\)/
195 /* this is nested. sigh. */
196 comment multiline nested start @any-start @any-end {
197   /\(\(/
200 comment multiline nested end {
201   /\)\)/
204 #include "inc/comment_escapes.sxi"
207 keyword number {
208   // decimal
209   /0d[0-9][0-9_]*/
210   /[0-9][0-9_]*/
212   // octal
213   /0o[0-7][0-7_]*/
215   // hex
216   /0[xX][0-9A-Fa-f][0-9A-Fa-f_]*/
218   // bin
219   /0b[0-1][0-1_]*/
220 // this conflicts with decimal for some reason
221 //  /[%][0-1][0-1_]*/
226 string rq start @any-start @word-end {
227   /[`]/
230 string rq end @any-start @any-end {
231   /[`]/
235 string dq start @any-start @any-end {
236   /["][\x01-\x09\x0b-\x20]/
237   /[$]value\s+["]/
238   /[$]vocabheader\s+["]/
241 string dq end @any-start @any-end {
242   /["]/
245 // we need "@any", because match ends with a word char
246 string dq escape @any-start @any-end {
247   /\\\\./