diff --git a/moo/kernel/test-001.moo b/moo/kernel/test-001.moo index c18cd98..981011f 100644 --- a/moo/kernel/test-001.moo +++ b/moo/kernel/test-001.moo @@ -29,14 +29,14 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. } class MyObject(TestObject) { - #declare(#classinst) t1 t2. + var(#classinst) t1, t2. method(#class) xxxx { | g1 g2 | diff --git a/moo/kernel/test-002.moo b/moo/kernel/test-002.moo index 8ce6585..4376134 100644 --- a/moo/kernel/test-002.moo +++ b/moo/kernel/test-002.moo @@ -29,14 +29,14 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. } class MyObject(TestObject) { - #declare(#classinst) t1 t2. + var(#classinst) t1, t2. method(#class) xxxx { | g1 g2 | diff --git a/moo/kernel/test-003.moo b/moo/kernel/test-003.moo index ab0ef03..3e1e93c 100644 --- a/moo/kernel/test-003.moo +++ b/moo/kernel/test-003.moo @@ -29,14 +29,15 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. } class MyObject(TestObject) { - #declare(#classinst) t1 t2. + var(#classinst) t1, t2. + method(#class) xxxx { | g1 g2 | diff --git a/moo/kernel/test-004.moo b/moo/kernel/test-004.moo index 4a8a616..a91947b 100644 --- a/moo/kernel/test-004.moo +++ b/moo/kernel/test-004.moo @@ -29,14 +29,15 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. } class MyObject(TestObject) { - #declare(#classinst) t1 t2. + var(#classinst) t1, t2. + method(#class) xxxx { | g1 g2 | diff --git a/moo/kernel/test-005.moo b/moo/kernel/test-005.moo index b612777..4ac6b64 100644 --- a/moo/kernel/test-005.moo +++ b/moo/kernel/test-005.moo @@ -29,14 +29,14 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) t1 t2. + var(#class) Q, R. + var(#classinst) t1, t2. } class MyObject(TestObject) { - dcl(#class) C B A. + var(#class) C, B, A. method getTrue { @@ -116,11 +116,11 @@ class MyObject(TestObject) #[ 1 2 3] dump. #[ 4 5 6] dump. - #(abc:def: 2 'string is good' 3 4 (5 6) (7 (8 9)) 10) dump. - #([] #[]) dump. + #(#abc:def: 2 'string is good' 3 4 #(5 6) #(7 #(8 9)) 10) dump. + #(#[] #[]) dump. - a := #(abc:def: -2 'string is good' 3 #[2 3 4] 4 (5 6) (7 (8 [4 56] 'hello' 9)) 10 -93952 self true false nil thisContext super). + a := #(#abc:def: -2 'string is good' 3 #[2 3 4] 4 #(5 6) #(7 #(8 #[4 56] 'hello' 9)) 10 -93952 #self true false nil #thisContext #super). a at: 3 put: 'hello world'; dump. @@ -224,10 +224,10 @@ class MyObject(TestObject) [self getTen] value dump. } - method(#class) abc + (*method(#class) abc { - } + }*) method(#class) a: a b: b c: c { @@ -441,16 +441,16 @@ PROCESS TESTING '====================' dump. [ :a :b | a dump. b dump. a := 20. b := [ a + 20 ]. b value.] value dump. ## not sufficient arguments. it must fail -"[ :a :b | a dump. b dump. a := 20. b := [ a + 20 ]. b value.] on: Exception do: [:ex | 'Exception' dump]." +##[ :a :b | a dump. b dump. a := 20. b := [ a + 20 ]. b value.] on: Exception do: [:ex | 'Exception' dump]. -" +(* FFI isNil dump. FFI notNil dump. nil isNil dump. nil notNil dump. nil class dump. nil class class class dump. -" +*) } } diff --git a/moo/kernel/test-006.moo b/moo/kernel/test-006.moo index 9897023..fd1e67c 100644 --- a/moo/kernel/test-006.moo +++ b/moo/kernel/test-006.moo @@ -29,14 +29,14 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) t1 t2. + var(#class) Q, R. + var(#classinst) t1, t2. } class MyObject(TestObject) { - dcl(#class) C B A. + var(#class) C, B, A. method getTrue { diff --git a/moo/kernel/test-007.moo b/moo/kernel/test-007.moo index 32ecf5f..89bf8ae 100644 --- a/moo/kernel/test-007.moo +++ b/moo/kernel/test-007.moo @@ -29,14 +29,14 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) t1 t2. + var(#class) Q, R. + var(#classinst) t1, t2. } class MyObject(TestObject) { - dcl(#class) C B A. + var(#class) C, B, A. method getTrue { @@ -65,11 +65,11 @@ class MyObject(TestObject) { | p p2 | 'START OF MAIN' dump. - ##p := [ :a :b :c :d | a dump. b dump. (c + d) dump. ^10. ] newProcessWith: #(abc def 10 20). - p := [ :a :b :c :d | a dump. b dump. (c + d) dump. ] newProcessWith: #(abc def 10 20). + ##p := [ :a :b :c :d | a dump. b dump. (c + d) dump. ^10. ] newProcessWith: #(#abc #def 10 20). + p := [ :a :b :c :d | a dump. b dump. (c + d) dump. ] newProcessWith: #(#abc #def 10 20). p2 := [ :a :b :c :d | a dump. b dump. a dump. b dump. (c + d) dump. ^10000 ] newProcessWith: #( - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB + #AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + #BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 1000000000000000 299999999999999999999999999999999999999999 ). diff --git a/moo/kernel/test-008.moo b/moo/kernel/test-008.moo index 8455c9f..ab3e9f8 100644 --- a/moo/kernel/test-008.moo +++ b/moo/kernel/test-008.moo @@ -29,14 +29,14 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. } class MyObject(TestObject) { - #declare(#classinst) t1 t2 t3. + var(#classinst) t1, t2, t3. method(#class) xxxx { | g1 g2 | @@ -57,9 +57,6 @@ class MyObject(TestObject) t2 := t2 value. 'END OF t2 value' dump. t2 dump. - - - } } diff --git a/moo/kernel/test-009.moo b/moo/kernel/test-009.moo index 053f337..03d1e73 100644 --- a/moo/kernel/test-009.moo +++ b/moo/kernel/test-009.moo @@ -29,14 +29,14 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. } class MyObject(TestObject) { - #declare(#classinst) t1 t2. + var(#classinst) t1, t2. method(#class) main2 { diff --git a/moo/kernel/test-010.moo b/moo/kernel/test-010.moo index 8987c3a..83e4280 100644 --- a/moo/kernel/test-010.moo +++ b/moo/kernel/test-010.moo @@ -29,8 +29,8 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. method test999 { @@ -40,8 +40,8 @@ class TestObject(Object) class B.TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. method test000 { @@ -51,7 +51,7 @@ class B.TestObject(Object) pooldic ABC { - #KKK := 20. + KKK := 20. } diff --git a/moo/kernel/test-011.moo b/moo/kernel/test-011.moo index b000100..a11d0c0 100644 --- a/moo/kernel/test-011.moo +++ b/moo/kernel/test-011.moo @@ -29,8 +29,8 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. } diff --git a/moo/kernel/test-012.moo b/moo/kernel/test-012.moo index 8d314c3..d778798 100644 --- a/moo/kernel/test-012.moo +++ b/moo/kernel/test-012.moo @@ -29,8 +29,8 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. method test999 { @@ -40,8 +40,8 @@ class TestObject(Object) class B.TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. method test000 { @@ -51,7 +51,7 @@ class B.TestObject(Object) pooldic ABC { - #KKK := 20. + KKK := 20. } @@ -65,12 +65,12 @@ class MyObject(TestObject) k := 99. [ [ - ##[ Exception signal: 'simulated error' ] ensure: [('ensure 1 ', (k asString)) dump ]. - [ ^ 20 ] ensure: [ ('ensure 1 ', (k asString)) dump. ]. + ##[ Exception signal: 'simulated error' ] ensure: [('ensure 1 ' & (k asString)) dump ]. + [ ^ 20 ] ensure: [ ('ensure 1 ' & (k asString)) dump. ]. ] ensure: ['ensure 2' dump ]. ] ensure: ['ensure 3' dump ]. ] on: Exception do: [:ex | - ('EXCETION - ' , ex messageText) dump. + ('EXCETION - ' & ex messageText) dump. ## Exception signal: 'qqq'. ]. ^v1 @@ -88,11 +88,11 @@ class MyObject(TestObject) ##[ Exception signal: 'simulated error' ] on: Exception do: [:ex | 'CAUGHT...' dump. Exception signal: 'jjjjjjj' ]. - "[ + (*[ [ Exception signal: 'simulated error' ] ensure: ['ensure 1' dump ]. - ] on: Exception do: [:ex | ('EXCETION - ' , ex messageText) dump. Exception signal: 'qqq'. ]." + ] on: Exception do: [:ex | ('EXCETION - ' & ex messageText) dump. Exception signal: 'qqq'. ]. - "[1 xxx] ifCurtailed: ['XXXXXXXX CURTAILED XXXXXXXXX' dump. Exception signal: 'jjjj']." + [1 xxx] ifCurtailed: ['XXXXXXXX CURTAILED XXXXXXXXX' dump. Exception signal: 'jjjj']. *) v1 := [ [ @@ -103,7 +103,7 @@ class MyObject(TestObject) [ '@@@@@' dump. Exception signal: 'simulated error'. '^^^^^^' dump. ] ensure: [ - ('ensure 11 ', (k asString)) dump. + ('ensure 11 ' & (k asString)) dump. Exception signal: 'qqq'. ]. @@ -115,7 +115,7 @@ class MyObject(TestObject) 'JJJJJJJJJJJJJJJJJJJJJJJJJJJ' dump. ] ensure: ['ensure 3' dump ]. ] on: Exception do: [:ex | - ('>>>> EXCETION - ' , ex messageText) dump. + ('>>>> EXCETION - ' & ex messageText) dump. ex pass. ##Exception signal: 'XXXXXXXXXXXXx'. @@ -125,10 +125,10 @@ class MyObject(TestObject) 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ' dump. ] on: PrimitiveFailureException do: [:ex | - ('PRIMITIVE FAILURE EXCETION AT OUTER - ' , ex messageText) dump. + ('PRIMITIVE FAILURE EXCETION AT OUTER - ' & ex messageText) dump. ] on: Exception do: [:ex | - ('>>>> EXCETION AT OUTER - ' , ex messageText) dump. + ('>>>> EXCETION AT OUTER - ' & ex messageText) dump. ]. diff --git a/moo/kernel/test-013.moo b/moo/kernel/test-013.moo index 644a07b..bdcf2bb 100644 --- a/moo/kernel/test-013.moo +++ b/moo/kernel/test-013.moo @@ -29,8 +29,8 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. method test999 { @@ -40,8 +40,8 @@ class TestObject(Object) class B.TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. method test000 { @@ -51,7 +51,7 @@ class B.TestObject(Object) pooldic ABC { - #KKK := 20. + KKK := 20. } @@ -67,7 +67,7 @@ class MyObject(TestObject) ] on: Exception do: [:ex | - System logNl: ('Exception: ', ex messageText). + System logNl: ('Exception: ' & ex messageText). ex return: 10. ##ex retry. System logNl: '--- THIS MUST NOT BE PRINTED ---'. diff --git a/moo/kernel/test-014.moo b/moo/kernel/test-014.moo index ff0d49e..83e0ca0 100644 --- a/moo/kernel/test-014.moo +++ b/moo/kernel/test-014.moo @@ -29,8 +29,8 @@ extend SmallInteger class TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + var(#class) Q, R. + var(#classinst) a1, a2. method test999 { @@ -40,8 +40,8 @@ class TestObject(Object) class B.TestObject(Object) { - dcl(#class) Q R. - dcl(#classinst) a1 a2. + dcl(#class) Q, R. + dcl(#classinst) a1, a2. method test000 { @@ -90,8 +90,9 @@ class MyConsole(Console) class MyObject(TestObject) { - dcl(#pooldic) ABC SRX.ABC. - + ##import(#pooldic) ABC, SRX.ABC. + import ABC, SRX.ABC. + method(#class) main { | v1 v2 | diff --git a/moo/lib/comp.c b/moo/lib/comp.c index 9a92a4b..83157d9 100644 --- a/moo/lib/comp.c +++ b/moo/lib/comp.c @@ -945,12 +945,13 @@ static int get_ident (moo_t* moo, moo_ooci_t char_read_ahead) ADD_TOKEN_CHAR(moo, char_read_ahead); } - do + /* while() instead of do..while() because when char_read_ahead is not EOF + * c may not be a identifier character */ + while (is_identchar(c)) { ADD_TOKEN_CHAR (moo, c); GET_CHAR_TO (moo, c); } - while (is_identchar(c)); if (c == '(' && is_token_word(moo, VOCA_ERROR)) { @@ -3322,10 +3323,27 @@ static int compile_class_level_imports (moo_t* moo) /* it falls back to the name space of the class */ ns_oop = moo->c->cls.ns_oop; } - else break; + else if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA || TOKEN_TYPE(moo) == MOO_IOTOK_EOF || TOKEN_TYPE(moo) == MOO_IOTOK_PERIOD) + { + /* no variable name is present */ + set_syntax_error (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo)); + return -1; + } + else + { + break; + } if (import_pool_dictionary(moo, ns_oop, &last, TOKEN_NAME(moo), TOKEN_LOC(moo)) <= -1) return -1; GET_TOKEN (moo); + + if (TOKEN_TYPE(moo) == MOO_IOTOK_IDENT_DOTTED || TOKEN_TYPE(moo) == MOO_IOTOK_IDENT) + { + set_syntax_error (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo)); + return -1; + } + else if (TOKEN_TYPE(moo) != MOO_IOTOK_COMMA) break; /* hopefully . */ + GET_TOKEN (moo); } while (1); diff --git a/moo/lib/exec.c b/moo/lib/exec.c index 99aabb2..c615c1d 100644 --- a/moo/lib/exec.c +++ b/moo/lib/exec.c @@ -104,7 +104,7 @@ /* the old intel c code builder doesn't support __FUNCTION__ */ # define __PRIMITIVE_NAME__ "<>" #else -# define __PRIMITIVE_NAME__ (&__FUNCTION__[4]) +# define __PRIMITIVE_NAME__ (&__FUNCTION__[0]) #endif static void signal_io_semaphore (moo_t* moo, moo_ooi_t mask, void* ctx);