modern: Don't allow patterns like ``foo: ;``
parent
c06f0eb5f7
commit
137384cdea
|
@ -11,7 +11,6 @@ ERROR: string-expected-got-eof n string ;
|
||||||
ERROR: long-opening-mismatch tag open n string ch ;
|
ERROR: long-opening-mismatch tag open n string ch ;
|
||||||
|
|
||||||
SYMBOL: strict-upper
|
SYMBOL: strict-upper
|
||||||
|
|
||||||
SYMBOL: delimiter-stack
|
SYMBOL: delimiter-stack
|
||||||
: push-delimiter-stack ( obj -- ) delimiter-stack get push ;
|
: push-delimiter-stack ( obj -- ) delimiter-stack get push ;
|
||||||
: pop-delimiter-stack ( -- obj ) delimiter-stack get pop ;
|
: pop-delimiter-stack ( -- obj ) delimiter-stack get pop ;
|
||||||
|
@ -150,8 +149,18 @@ MACRO:: read-matched ( ch -- quot: ( n string tag -- n' string slice' ) )
|
||||||
merge-slice-til-whitespace
|
merge-slice-til-whitespace
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
|
: terminator? ( slice -- ? )
|
||||||
|
{
|
||||||
|
[ ";" sequence= ]
|
||||||
|
} 1|| ;
|
||||||
|
|
||||||
|
ERROR: token-expected n string obj ;
|
||||||
|
ERROR: unexpected-terminator n string slice ;
|
||||||
: read-lowercase-colon ( n string slice -- n' string lowercase-colon )
|
: read-lowercase-colon ( n string slice -- n' string lowercase-colon )
|
||||||
[ lex-factor ] dip swap 2array ;
|
[
|
||||||
|
lex-factor dup [ token-expected ] unless
|
||||||
|
dup terminator? [ unexpected-terminator ] when
|
||||||
|
] dip swap 2array ;
|
||||||
|
|
||||||
: strict-upper? ( string -- ? )
|
: strict-upper? ( string -- ? )
|
||||||
[ { [ CHAR: A CHAR: Z between? ] [ ":-" member? ] } 1|| ] all? ;
|
[ { [ CHAR: A CHAR: Z between? ] [ ":-" member? ] } 1|| ] all? ;
|
||||||
|
|
|
@ -95,7 +95,7 @@ ERROR: unexpected-end n string ;
|
||||||
n string f f
|
n string f f
|
||||||
] if ; inline
|
] if ; inline
|
||||||
|
|
||||||
: skip-whitespace ( n string -- n' string )
|
: skip-whitespace ( n/f string -- n'/f string )
|
||||||
slice-til-not-whitespace 2drop ;
|
slice-til-not-whitespace 2drop ;
|
||||||
|
|
||||||
: empty-slice-end ( seq -- slice )
|
: empty-slice-end ( seq -- slice )
|
||||||
|
@ -169,7 +169,7 @@ ERROR: unexpected-end n string ;
|
||||||
[ [ 1 - ] change-to ] dip
|
[ [ 1 - ] change-to ] dip
|
||||||
] when ;
|
] when ;
|
||||||
|
|
||||||
:: slice-til-either ( n string tokens -- n'/f string slice/f ch )
|
:: slice-til-either ( n string tokens -- n'/f string slice/f ch/f )
|
||||||
n [
|
n [
|
||||||
n string '[ tokens member? ] find-from
|
n string '[ tokens member? ] find-from
|
||||||
dup "\s\r\n" member? [
|
dup "\s\r\n" member? [
|
||||||
|
|
Loading…
Reference in New Issue