v CHAR: \n n last-index -1 or 1 + -
n [ CHAR: \n = ] count 1 +
] ;
-
+
: store-pos ( v a -- )
- input swap at prepare-pos
- lexer get [ (>>line) ] keep (>>column) ;
+ input of prepare-pos
+ lexer get [ line<< ] keep column<< ;
M: lex-hash set-at
swap {
[ swap hash>> set-at ]
} case ;
-:: at-pos ( t l c -- p ) t l head-slice [ length ] map sum l 1 - + c + ;
+:: at-pos ( t l c -- p ) t l head-slice [ length ] map-sum l 1 - + c + ;
M: lex-hash at*
swap {
define-syntax word make-inline ;
SYNTAX: ON-BNF:
- CREATE-WORD reset-tokenizer ";ON-BNF" parse-multiline-string parse-ebnf
- main swap at create-bnf ;
+ scan-new-word reset-tokenizer ";ON-BNF" parse-multiline-string parse-ebnf
+ main of create-bnf ;
! Tokenizer like standard factor lexer
EBNF: factor