diff --git a/src/kiss/Reader.hx b/src/kiss/Reader.hx index 1c96c93f..dbfb7445 100644 --- a/src/kiss/Reader.hx +++ b/src/kiss/Reader.hx @@ -38,6 +38,9 @@ class Reader { readTable[":"] = (stream) -> TypedExp(nextToken(stream, "a type path"), assertRead(stream, readTable)); + // Because macro keys are sorted by length and peekChars(0) returns "", this will be used as the default reader macro: + readTable[""] = (stream) -> Symbol(nextToken(stream, "a symbol name")); + return readTable; } @@ -74,7 +77,7 @@ class Reader { } } - return Some(Symbol(nextToken(stream, "a symbol name"))); + throw 'No macro to read next expression'; } public static function readExpArray(stream:Stream, end:String, readTable:Map):Array { diff --git a/src/test/cases/BasicTestCase.hx b/src/test/cases/BasicTestCase.hx index 8b73882b..6fb50aa0 100644 --- a/src/test/cases/BasicTestCase.hx +++ b/src/test/cases/BasicTestCase.hx @@ -128,6 +128,7 @@ class BasicTestCase extends Test { })); } + // TODO to really test typed variable definitions, check for compilation failure on a bad example function testTypedDefvar() { Assert.equals(8, BasicTestCase.myInt); }