Merge branch 'for-slava' of git://git.rfc1149.net/factor
commit
c5dfcf5755
|
@ -2,7 +2,7 @@ USING: help.markup help.syntax kernel math sequences ;
|
|||
IN: persistent.vectors
|
||||
|
||||
HELP: PV{
|
||||
{ $syntax "elements... }" }
|
||||
{ $syntax "PV{ elements... }" }
|
||||
{ $description "Parses a literal " { $link persistent-vector } "." } ;
|
||||
|
||||
HELP: >persistent-vector
|
||||
|
|
|
@ -29,7 +29,7 @@ HELP: <lexer-error>
|
|||
|
||||
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)." } ;
|
||||
{ $description "Skips to the first space character (if " { $snippet "boolean" } " is " { $link f } ") or the first non-space character (otherwise). Tabulations used as separators instead of spaces will be flagged as an error." } ;
|
||||
|
||||
HELP: change-lexer-column
|
||||
{ $values { "lexer" lexer } { "quot" { $quotation "( col line -- newcol )" } } }
|
||||
|
|
|
@ -22,9 +22,17 @@ TUPLE: lexer text line line-text line-length column ;
|
|||
: <lexer> ( text -- lexer )
|
||||
lexer new-lexer ;
|
||||
|
||||
ERROR: unexpected want got ;
|
||||
|
||||
PREDICATE: unexpected-tab < unexpected
|
||||
got>> CHAR: \t = ;
|
||||
|
||||
: forbid-tab ( c -- c )
|
||||
[ CHAR: \t eq? [ "[space]" "[tab]" unexpected ] when ] keep ;
|
||||
|
||||
: skip ( i seq ? -- n )
|
||||
over length
|
||||
[ [ swap CHAR: \s eq? xor ] curry find-from drop ] dip or ;
|
||||
[ [ swap forbid-tab CHAR: \s eq? xor ] curry find-from drop ] dip or ;
|
||||
|
||||
: change-lexer-column ( lexer quot -- )
|
||||
[ [ column>> ] [ line-text>> ] bi ] prepose keep
|
||||
|
@ -65,8 +73,6 @@ M: lexer skip-word ( lexer -- )
|
|||
|
||||
: scan ( -- str/f ) lexer get parse-token ;
|
||||
|
||||
ERROR: unexpected want got ;
|
||||
|
||||
PREDICATE: unexpected-eof < unexpected
|
||||
got>> not ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue