misc: more syntax tests.

master
John Benediktsson 2020-08-14 13:22:34 -07:00
parent d535b62f50
commit 5176b270d2
1 changed files with 28 additions and 16 deletions

View File

@ -29,6 +29,7 @@
DEFER: word
FORGET: word
POSTPONE: word
SLOT: name
! Classes
@ -84,8 +85,8 @@ drop ! wrong
GENERIC#: word 1 ! comment
drop ! wrong
MATH: + ( x y -- z ) foldable flushable
SLOT: name
C: <foo> foo
CONSTRUCTOR: <circle> circle ( radius -- obj ) ;
! Private definitions
@ -103,7 +104,6 @@ drop ! wrong
HOOK: word variable ( stack -- effect )
GENERIC#: word 1 ( stack -- effect )
MATH: + ( x y -- z ) foldable flushable
SLOT: name
C: <foo> foo
PRIVATE>
@ -128,8 +128,6 @@ PRIVATE>
SYMBOL: word
SYMBOLS: words ... ;
C: <foo> foo
! Math
1 2 +
@ -227,16 +225,35 @@ PRIVATE>
{ CHAR: c CHAR: H }
{ CHAR: d CHAR: C }
! New number literals:
! Bin
0b10101
0B10101
! Oct
0o432
0O1234567
0o1234567
0o7
! Hex
0xCAFEBABE
0o432
0b10101
0XCAFEBABE
0x1AB4p30
! Dec
1,000
10,000
! Float
1e10
-1.5e-5
! Weird numbers
1,234+56/78
@ -250,17 +267,12 @@ PRIVATE>
-1.5e30
1.5e-30
1,000.1,2
0XCAFEBABE
0x1AB4p30
0B10101
0O1234567
NAN: CAFE1234 0,. ! third token wrong
0,. ! wrong, next line also wrong
0,.
NAN: ! ff 0xff comment
xCAFE1234 ! wrong
ff ! shouldn't match as a hex number
0o7
NAN: 0
drop
NAN: !
@ -269,9 +281,13 @@ PRIVATE>
NAN:
f,
NAN: ALKSJDflKJ ! XXX: should error
! Not numbers
,0.1
.
-.
1foo
1.5bar
+foo
@ -321,7 +337,6 @@ boolean -- q: boolean )
flushablething
flushable
<PRIVATEfoo
"asdf"foo
<< 5 1 + . >> 1
@ -335,7 +350,6 @@ pair?
tail?
0.1
,0.1 ! wrong
10,0.1
1.23
.1
@ -343,8 +357,6 @@ tail?
-0.1
-0,1.1
1.
. ! other
-. ! other
! Numeral comma separator parsing (!: wrong, ~: other):
! int