modern: Fix ': parsing.

modern-harvey2
Doug Coleman 2017-12-31 14:34:17 -08:00
parent 825891c7ef
commit f9991cd248
2 changed files with 14 additions and 2 deletions

View File

@ -11,6 +11,16 @@ IN: modern.tests
{ t } [ "FOO::" upper-colon? ] unit-test
{ t } [ "FOO:::" upper-colon? ] unit-test
! 'FOO:
{ f } [ "'" upper-colon? ] unit-test
{ t } [ "':" upper-colon? ] unit-test
{ t } [ "'::" upper-colon? ] unit-test
{ t } [ "':::" upper-colon? ] unit-test
{ t } [ "'FOO:" upper-colon? ] unit-test
{ t } [ "'FOO::" upper-colon? ] unit-test
{ t } [ "'FOO:::" upper-colon? ] unit-test
! \FOO: is not an upper-colon form, it is deactivated by the \
{ f } [ "\\" upper-colon? ] unit-test
{ f } [ "\\:" upper-colon? ] unit-test
{ f } [ "\\::" upper-colon? ] unit-test

View File

@ -158,12 +158,14 @@ ERROR: unexpected-terminator n string slice ;
: (strict-upper?) ( string -- ? )
{
! All chars must...
[
[
{ [ char: A char: Z between? ] [ ":-\\#" member? ] } 1||
{ [ char: A char: Z between? ] [ "':-\\#" member? ] } 1||
] all?
]
[ [ char: A char: Z between? ] any? ] ! XXX: what?
! At least one char must...
[ [ { [ char: A char: Z between? ] [ char: ' = ] } 1|| ] any? ]
} 1&& ;
: strict-upper? ( string -- ? )