From: Mike D. Lowis Date: Mon, 2 Apr 2012 17:10:45 +0000 (-0400) Subject: Fixed error macro error message and scheme output for member access. X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=3bfb6e9d9bf3b54a0823579cd0ae5754d3f1f5ca;p=archive%2Fdlang.git Fixed error macro error message and scheme output for member access. --- diff --git a/example.dl b/example.dl index 6f2f203..935f6ed 100644 --- a/example.dl +++ b/example.dl @@ -133,7 +133,7 @@ foo = delay 1 + 1 foo = force foo #------------------------------------------------------------------------------ -# Prototype Classes +# Classes #------------------------------------------------------------------------------ # Define a macro for creating new classes @@ -159,6 +159,6 @@ Animal := class { # Animal is a constructor so call it to create a new cow Cow := Animal() -# And call the method to print the sound +# And call the method to print the sound (This syntax needs to be cleaned up a bit) (Cow.mating_call)() diff --git a/source/dlparser/dlparser.cpp b/source/dlparser/dlparser.cpp index c7d58b7..8d92bc7 100644 --- a/source/dlparser/dlparser.cpp +++ b/source/dlparser/dlparser.cpp @@ -41,7 +41,8 @@ bool DLParser::isMacro( Token& token ) AST* DLParser::MacroExpansion() { AST* ret = NULL; - Macro macro = macros[ lookaheadToken(1).text() ]; + string macro_name = lookaheadToken(1).text(); + Macro macro = macros[ macro_name ]; std::list::iterator patt_it; match(ID); @@ -56,7 +57,9 @@ AST* DLParser::MacroExpansion() if (ret == NULL) { - throw "Did not find a matching pattern for keyword "; + Exception ex; + ex << "Did not find a matching pattern for keyword " << macro_name << "."; + throw ex; } return ret; diff --git a/source/visitors/scheme/scheme.cpp b/source/visitors/scheme/scheme.cpp index 7d6ba29..7ba2eae 100644 --- a/source/visitors/scheme/scheme.cpp +++ b/source/visitors/scheme/scheme.cpp @@ -232,7 +232,7 @@ void Scheme::nodeTypeBeginAction(AST* cur) switch( cur->type() ) { case MEMB: - cur->children()->back()->type( STRING ); + cur->children()->back()->type( SYMBOL ); break; case BLOCK: