]> gitweb.factorcode.org Git - factor.git/commitdiff
misc: more syntax tests.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 14 Aug 2020 20:22:34 +0000 (13:22 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 14 Aug 2020 20:22:34 +0000 (13:22 -0700)
misc/syntax-test.factor

index 6e9223770aef3c52ade67c7daa34e0ff49947907..01c6f39b02a53de01313c5c571c61f3c7322e056 100644 (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
 
-    0xCAFEBABE
-    0o432
     0b10101
+    0B10101
+
+! Oct
+
+    0o432
+    0O1234567
+    0o1234567
+    0o7
+
+! Hex
+
+    0xCAFEBABE
+    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