modern: Still support ``\ foo`` for now.
parent
fbb5f871c4
commit
161a50c0b8
|
@ -62,7 +62,7 @@ IN: modern.tests
|
||||||
{ { "SYNTAX:" { "\\AVL{" } } }
|
{ { "SYNTAX:" { "\\AVL{" } } }
|
||||||
} [ "SYNTAX: \\AVL{" string>literals >strings ] unit-test
|
} [ "SYNTAX: \\AVL{" string>literals >strings ] unit-test
|
||||||
|
|
||||||
{ { "\\" } } [ "\\" string>literals >strings ] unit-test
|
[ "\\" string>literals >strings ] must-fail ! \ alone should be legal eventually (?)
|
||||||
{ { "\\FOO" } } [ "\\FOO" string>literals >strings ] unit-test
|
{ { "\\FOO" } } [ "\\FOO" string>literals >strings ] unit-test
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -81,4 +81,10 @@ IN: modern.tests
|
||||||
[ "char: {" string>literals >strings ] must-fail
|
[ "char: {" string>literals >strings ] must-fail
|
||||||
[ "char: \"" string>literals >strings ] must-fail
|
[ "char: \"" string>literals >strings ] must-fail
|
||||||
{ { { "char:" "\\\\" } } } [ "char: \\\\" string>literals >strings ] unit-test
|
{ { { "char:" "\\\\" } } } [ "char: \\\\" string>literals >strings ] unit-test
|
||||||
{ { { "char:" "\\" } } } [ "char: \\" string>literals >strings ] unit-test
|
|
||||||
|
[ "char: \\" string>literals >strings ] must-fail ! char: \ should be legal eventually
|
||||||
|
|
||||||
|
! \ backslash going away someday
|
||||||
|
|
||||||
|
{ { { "\\" "(" } } } [ "\\ (" string>literals >strings ] unit-test
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,15 @@ ERROR: colon-word-must-be-all-uppercase-or-lowercase n string word ;
|
||||||
dup { [ "!" sequence= ] [ "#!" sequence= ] } 1||
|
dup { [ "!" sequence= ] [ "#!" sequence= ] } 1||
|
||||||
[ take-comment ] [ merge-slice-til-whitespace ] if ;
|
[ take-comment ] [ merge-slice-til-whitespace ] if ;
|
||||||
|
|
||||||
ERROR: backslash-expects-whitespace slice ;
|
ERROR: no-backslash-payload n string slice ;
|
||||||
|
: read-backslash ( n string slice -- n' string obj )
|
||||||
|
merge-slice-til-whitespace dup "\\" tail? [
|
||||||
|
! \ foo, M\ foo
|
||||||
|
[
|
||||||
|
skip-blank-from slice-til-whitespace drop
|
||||||
|
dup [ no-backslash-payload ] unless
|
||||||
|
] dip swap 2array
|
||||||
|
] when ;
|
||||||
|
|
||||||
! If the slice is 0 width, we stopped on whitespace.
|
! If the slice is 0 width, we stopped on whitespace.
|
||||||
! Advance the index and read again!
|
! Advance the index and read again!
|
||||||
|
@ -267,6 +275,7 @@ ERROR: mismatched-terminator n string slice ;
|
||||||
[ "\"!:[{(<>\s\r\n" slice-til-either ] dip swap [ span-slices ] dip
|
[ "\"!:[{(<>\s\r\n" slice-til-either ] dip swap [ span-slices ] dip
|
||||||
over "\\" head? [
|
over "\\" head? [
|
||||||
drop
|
drop
|
||||||
|
dup "\\" sequence= [ read-backslash ] when
|
||||||
] [
|
] [
|
||||||
(lex-factor)
|
(lex-factor)
|
||||||
] if
|
] if
|
||||||
|
|
|
@ -131,7 +131,9 @@ ERROR: unexpected-end n string ;
|
||||||
] if ; inline
|
] if ; inline
|
||||||
|
|
||||||
: merge-slice-til-whitespace ( n string slice -- n' string slice' )
|
: merge-slice-til-whitespace ( n string slice -- n' string slice' )
|
||||||
[ slice-til-whitespace drop ] dip merge-slices ;
|
pick [
|
||||||
|
[ slice-til-whitespace drop ] dip merge-slices
|
||||||
|
] when ;
|
||||||
|
|
||||||
: merge-slice-til-eol ( n string slice -- n' string slice' )
|
: merge-slice-til-eol ( n string slice -- n' string slice' )
|
||||||
[ slice-til-eol drop ] dip merge-slices ;
|
[ slice-til-eol drop ] dip merge-slices ;
|
||||||
|
|
Loading…
Reference in New Issue