lexer: change skip back to public interface.
parent
9a989f8e9d
commit
8afe2dfe37
|
@ -2,9 +2,8 @@
|
||||||
! Copyright (C) 2006, 2010 Slava Pestov
|
! Copyright (C) 2006, 2010 Slava Pestov
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors combinators compiler.units html.templates io
|
USING: accessors combinators compiler.units html.templates io
|
||||||
io.encodings.utf8 io.files kernel lexer lexer.private math
|
io.encodings.utf8 io.files kernel lexer math namespaces parser
|
||||||
namespaces parser parser.notes quotations sequences splitting
|
parser.notes quotations sequences splitting vocabs.parser ;
|
||||||
vocabs.parser ;
|
|
||||||
IN: html.templates.fhtml
|
IN: html.templates.fhtml
|
||||||
|
|
||||||
! We use a custom lexer so that %> ends a token even if not
|
! We use a custom lexer so that %> ends a token even if not
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: help.markup help.syntax kernel lexer.private math
|
USING: help.markup help.syntax kernel math sequences strings
|
||||||
sequences strings words quotations ;
|
words quotations ;
|
||||||
IN: lexer
|
IN: lexer
|
||||||
|
|
||||||
HELP: lexer
|
HELP: lexer
|
||||||
|
|
|
@ -52,18 +52,14 @@ ERROR: unexpected want got ;
|
||||||
: forbid-tab ( c -- c )
|
: forbid-tab ( c -- c )
|
||||||
[ CHAR: \t eq? [ "[space]" "[tab]" unexpected ] when ] keep ; inline
|
[ CHAR: \t eq? [ "[space]" "[tab]" unexpected ] when ] keep ; inline
|
||||||
|
|
||||||
<PRIVATE
|
|
||||||
|
|
||||||
: skip ( i seq ? -- n )
|
: skip ( i seq ? -- n )
|
||||||
{ fixnum string boolean } declare
|
|
||||||
over length [
|
over length [
|
||||||
[ swap forbid-tab CHAR: \s eq? xor ] curry find-from drop
|
[ swap forbid-tab CHAR: \s eq? xor ] curry find-from drop
|
||||||
] dip or ;
|
] dip or ; inline
|
||||||
|
|
||||||
PRIVATE>
|
|
||||||
|
|
||||||
: change-lexer-column ( lexer quot -- )
|
: change-lexer-column ( lexer quot -- )
|
||||||
[ [ column>> ] [ line-text>> ] bi ] prepose keep column<< ; inline
|
[ check-lexer [ column>> ] [ line-text>> ] bi ] prepose
|
||||||
|
keep column<< ; inline
|
||||||
|
|
||||||
GENERIC: skip-blank ( lexer -- )
|
GENERIC: skip-blank ( lexer -- )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue