Fixes
parent
9ff57d1952
commit
3131e96aa7
|
@ -224,7 +224,7 @@ HELP: skip
|
|||
{ $values { "i" "a starting index" } { "seq" sequence } { "?" "a boolean" } { "n" integer } }
|
||||
{ $description "Skips to the first space character (if " { $snippet "boolean" } " is " { $link f } ") or the first non-space character (otherwise)." } ;
|
||||
|
||||
HELP: change-column
|
||||
HELP: change-lexer-column
|
||||
{ $values { "lexer" lexer } { "quot" "a quotation with stack effect " { $snippet "( col line -- newcol )" } } }
|
||||
{ $description "Applies a quotation to the current column and line text to produce a new column, and moves the lexer position." } ;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ t parser-notes set-global
|
|||
[ swap CHAR: \s eq? xor ] curry find* drop
|
||||
[ r> drop ] [ r> length ] if* ;
|
||||
|
||||
: change-column ( lexer quot -- )
|
||||
: change-lexer-column ( lexer quot -- )
|
||||
swap
|
||||
[ dup lexer-column swap lexer-line-text rot call ] keep
|
||||
set-lexer-column ; inline
|
||||
|
@ -68,14 +68,14 @@ t parser-notes set-global
|
|||
GENERIC: skip-blank ( lexer -- )
|
||||
|
||||
M: lexer skip-blank ( lexer -- )
|
||||
[ t skip ] change-column ;
|
||||
[ t skip ] change-lexer-column ;
|
||||
|
||||
GENERIC: skip-word ( lexer -- )
|
||||
|
||||
M: lexer skip-word ( lexer -- )
|
||||
[
|
||||
2dup nth CHAR: " eq? [ drop 1+ ] [ f skip ] if
|
||||
] change-column ;
|
||||
] change-lexer-column ;
|
||||
|
||||
: still-parsing? ( lexer -- ? )
|
||||
dup lexer-line swap lexer-text length <= ;
|
||||
|
@ -153,7 +153,7 @@ name>char-hook global [
|
|||
: parse-string ( -- str )
|
||||
lexer get [
|
||||
[ swap tail-slice (parse-string) ] "" make swap
|
||||
] change-column ;
|
||||
] change-lexer-column ;
|
||||
|
||||
TUPLE: parse-error file line col text ;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ M: template-lexer skip-word
|
|||
{ [ 2dup swap tail-slice "%>" head? ] [ drop 2 + ] }
|
||||
{ [ t ] [ f skip ] }
|
||||
} cond
|
||||
] change-column ;
|
||||
] change-lexer-column ;
|
||||
|
||||
DEFER: <% delimiter
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ TUPLE: regexp source parser ignore-case? ;
|
|||
: parse-regexp ( accum end -- accum )
|
||||
lexer get dup skip-blank [
|
||||
[ index* dup 1+ swap ] 2keep swapd subseq swap
|
||||
] change-column
|
||||
] change-lexer-column
|
||||
lexer get (parse-token) parse-options <regexp> parsed ;
|
||||
|
||||
: R! CHAR: ! parse-regexp ; parsing
|
||||
|
|
Loading…
Reference in New Issue