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\\\""
213 URL" http://google.com"
222 ! Triple quote strings (old Factor)
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]=====]
237 [======[this is a weird new string]======]
275 ! Symbols are colored wrong:
277 : rock ( -- ) \ rock computer play. ;
279 ! SBUF is colored wrong:
281 SBUF" " clone swap [ " " append ] [ number>string append ] interleave
283 ! Update to new library words:
285 key? and assoc-empty? are not colored
286 tail* is not highlighted
288 ! IN poker, unicode characters:
296 CHAR: symbol-for-end-of-transmission
347 NAN: CAFE1234 0,. ! third token wrong
348 0,. ! wrong, next line also wrong
350 NAN: ! ff 0xff comment
352 ff ! shouldn't match as a hex number
361 NAN: ALKSJDflKJ ! XXX: should error
378 ! Comments in STRUCT: definitions
379 ! STRUCT: features like bitfields, etc.
382 { a int initial: 0 } ! a comment
397 ( quot: ( a -- b ) -- )
398 ( x quot: ( a -- b ) -- y )
399 ( ..a quot: ( ..a x -- ..b ) -- ..b )
403 ( p: ! inline comment
404 boolean -- q: boolean )
405 ( m: integer -- n: float )
406 ( :integer -- :float )
424 : foo ( x -- y ) foo>> + ; inline
441 ! Numeral comma separator parsing (!: wrong, ~: other):
444 /* ! */ ,0 ,00 0,, 00,, +,0 -,,0 +0, -0,, /* ~ */ , +, -,,
447 0,0e0 0e0,0 0,0e0,0 +0,0e+0,0 -0,0e-0,0
448 /* ~ */ e e, ,e ,e, +e -e +e, -e,
449 /* ~ */ +e -e +,e -,e +e+, -e-, +,e-,, -,,e+,
450 /* ~ */ +e -e +,e -,e +e+, -e-, +,e-,, -,,e+,
451 /* ! */ e0, -e,0 ,0e, 0,e, +,e0 -,e-0 0,e0 +0,0e+ -0,0e-,, 0e+ -0e-
452 /* ! */ +0e+0, -0e-,,0
455 0,0. .0,0 /* ! */ 0,. .,0 ,.0 0., ,0. .0,
457 0,0.0,0e0 0,0.0,0e0,0
458 0,0.0,0e+0,0 0,0.0,0e-0,0
461 /* ~ */ / /. +/ -/ ,/ /, 0/ /0
462 0/1 1/1 1/1. 1/0. 0/0. /* ! */ 0/0 1/0 1./1
463 1/2 +1/2 -1/2 +2/2 /* ! */ 1/+2 1/-2 1/+0 +2/+2
464 +1+1/2 -0-1/2 /* ! */ +1+2/2 +1+1/2. +0-1/2 -0+1/2
466 ! Regexp is colored wrong (on Github):
471 : using-line ( source -- vocabs )
472 R/ USING: [^;]* ;/s all-matching-subseqs ?first
473 [ { } ] [ " \n" split rest but-last ] if-empty ;