5 ! Normal comments ( -- x )
16 /* multline ( x -- y )
18 6 /* something else */ 2 +
20 ![[this is a weird new string]]
21 ![=[this is a weird new string]=]
22 ![==[this is a weird new string]==]
23 ![===[this is a weird new string]===]
24 ![====[this is a weird new string]====]
25 ![=====[this is a weird new string]=====]
26 ![======[this is a weird new string]======]
38 USING: vocabularies ... ;
42 FROM: vocab => words ... ;
43 EXCLUDE: vocab => words ... ;
45 QUALIFIED-WITH: vocab word-prefix
46 RENAME: word vocab => new-name
47 ALIAS: new-word existing-word
56 TUPLE: class slots ... ;
57 TUPLE: foo a b c d e f g h i j ;
58 TUPLE: foo < object { x initial: 0 } ;
59 TUPLE: foo < object { x fixnum initial: 0 } ;
60 TUPLE: foo < fixnum { x read-only } ;
61 TUPLE: class < superclass slots ... ;
62 BUILTIN: class slots ... ;
63 ERROR: class a b c { x fixnum initial: 12 } ;
64 INSTANCE: instance mixin
66 SINGLETONS: words ... ;
67 PREDICATE: class < superclass predicate... ;
71 TUPLE: interval-map { array array read-only } ;
73 TUPLE: foo < bar d e f ;
74 BUILTIN: string { length array-capacity read-only initial: 0 } aux ;
78 : word ( x -- y ) ! foo ;
79 : foo ( x -- y ) 1 + ;
84 :: word ( x -- ) x drop ;
85 TYPED: word ( a b: class ... -- x: class y ... ) body ;
86 TYPED: word ( a b: class ... -- x: class y ... ) body ;
87 TYPED:: word ( a b: class ... -- x: class y ... ) body ;
88 MACRO: word ( inputs... -- ) definition... ;
89 MACRO:: word ( vars... -- outputs... ) definition... ;
90 M: object explain drop "an object" print ;
91 M: class generic definition... ;
92 M:: class generic ( vars... -- outputs... ) body... ;
93 M:: class generic error body... ;
94 GENERIC: word ( stack -- effect )
99 GENERIC: word ! comment
101 GENERIC: word drop ! 3rd token wrong
102 GENERIC: word ! next line wrong
106 HOOK: word variable ( stack -- effect )
107 GENERIC#: word 1 ( stack -- effect )
109 word 1 ( stack -- effect )
110 GENERIC#: word 1 ( stack -- effect ) drop ! last token other
111 GENERIC#: word ! 2 should GENERIC# stack effect error
112 1 2 ( stack -- effect )
113 GENERIC#: word ! 2nd eff. should be independent of GENERIC#,
114 1 ! and 2 & 3 shouldn't GENERIC# highlight
115 ( stack -- effect ) ( independent -- effect ) 2 3 ;
116 GENERIC#: word 1 ! comment
118 MATH: + ( x y -- z ) foldable flushable
120 CONSTRUCTOR: <circle> circle ( radius -- obj ) ;
121 CONSTRUCTOR: <circle> circle ( radius -- obj ) definition... ;
122 PRIMITIVE: word-code ( word -- start end )
124 ! Private definitions
128 : word ( x -- ) drop ;
129 :: word ( x -- ) x drop ;
130 TYPED: word ( a b: class ... -- x: class y ... ) body ;
131 TYPED:: word ( a b: class ... -- x: class y ... ) body ;
132 MACRO: word ( inputs... -- ) definition... ;
133 MACRO:: word ( vars... -- outputs... ) definition... ;
134 M: class generic definition... ;
135 M:: class generic ( vars... -- outputs... ) body... ;
136 GENERIC: word ( stack -- effect )
137 HOOK: word variable ( stack -- effect )
138 GENERIC#: word 1 ( stack -- effect )
139 MATH: + ( x y -- z ) foldable flushable
141 CONSTRUCTOR: <circle> circle ( radius -- obj ) ;
142 CONSTRUCTOR: <circle> circle ( radius -- obj ) definition... ;
143 PRIMITIVE: word-code ( word -- start end )
149 SYNTAX: URL" parse-string >url suffix! ;
156 ENUM: type words... ;
157 ENUM: type < base-type words...
158 FUNCTION: return name ( parameters ) ;
159 FUNCTION-ALIAS: factor-name return name ( parameters ) ;
161 ! Symbols and literals
191 H{ ?{ { } } } assoc-empty?
209 "\a\b\e\f\n\r\t\s\v\s\0\\\""
212 URL" http://google.com"
221 ! Triple quote strings (old Factor)
230 [[this is a weird new string]]
231 [=[this is a weird new string]=]
232 [==[this is a weird new string]==]
233 [===[this is a weird new string]===]
234 [====[this is a weird new string]====]
235 [=====[this is a weird new string]=====]
236 [======[this is a weird new string]======]
274 ! Symbols are colored wrong:
276 : rock ( -- ) \ rock computer play. ;
278 ! SBUF is colored wrong:
280 SBUF" " clone swap [ " " append ] [ number>string append ] interleave
282 ! Update to new library words:
284 key? and assoc-empty? are not colored
285 tail* is not highlighted
287 ! IN poker, unicode characters:
295 CHAR: symbol-for-end-of-transmission
346 NAN: CAFE1234 0,. ! third token wrong
347 0,. ! wrong, next line also wrong
349 NAN: ! ff 0xff comment
351 ff ! shouldn't match as a hex number
360 NAN: ALKSJDflKJ ! XXX: should error
377 ! Comments in STRUCT: definitions
378 ! STRUCT: features like bitfields, etc.
381 { a int initial: 0 } ! a comment
396 ( quot: ( a -- b ) -- )
397 ( x quot: ( a -- b ) -- y )
398 ( ..a quot: ( ..a x -- ..b ) -- ..b )
402 ( p: ! inline comment
403 boolean -- q: boolean )
404 ( m: integer -- n: float )
405 ( :integer -- :float )
423 : foo ( x -- y ) foo>> + ; inline
440 ! Numeral comma separator parsing (!: wrong, ~: other):
443 /* ! */ ,0 ,00 0,, 00,, +,0 -,,0 +0, -0,, /* ~ */ , +, -,,
446 0,0e0 0e0,0 0,0e0,0 +0,0e+0,0 -0,0e-0,0
447 /* ~ */ e e, ,e ,e, +e -e +e, -e,
448 /* ~ */ +e -e +,e -,e +e+, -e-, +,e-,, -,,e+,
449 /* ~ */ +e -e +,e -,e +e+, -e-, +,e-,, -,,e+,
450 /* ! */ e0, -e,0 ,0e, 0,e, +,e0 -,e-0 0,e0 +0,0e+ -0,0e-,, 0e+ -0e-
451 /* ! */ +0e+0, -0e-,,0
454 0,0. .0,0 /* ! */ 0,. .,0 ,.0 0., ,0. .0,
456 0,0.0,0e0 0,0.0,0e0,0
457 0,0.0,0e+0,0 0,0.0,0e-0,0
460 /* ~ */ / /. +/ -/ ,/ /, 0/ /0
461 0/1 1/1 1/1. 1/0. 0/0. /* ! */ 0/0 1/0 1./1
462 1/2 +1/2 -1/2 +2/2 /* ! */ 1/+2 1/-2 1/+0 +2/+2
463 +1+1/2 -0-1/2 /* ! */ +1+2/2 +1+1/2. +0-1/2 -0+1/2
465 ! Regexp is colored wrong (on Github):
470 : using-line ( source -- vocabs )
471 R/ USING: [^;]* ;/s all-matching-subseqs ?first
472 [ { } ] [ " \n" split rest but-last ] if-empty ;