]> git.mdlowis.com Git - archive/dlang.git/commitdiff
Fixed error macro error message and scheme output for member access.
authorMike D. Lowis <mike@mdlowis.com>
Mon, 2 Apr 2012 17:10:45 +0000 (13:10 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Mon, 2 Apr 2012 17:10:45 +0000 (13:10 -0400)
example.dl
source/dlparser/dlparser.cpp
source/visitors/scheme/scheme.cpp

index 6f2f20307881053c853caaea45283b64a5ccea90..935f6ed205e7f4f3977a2c93011f445a2a47c4a3 100644 (file)
@@ -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)()
 
index c7d58b751b8fdd304e4fec3012f3a0237af03c30..8d92bc71eb9a44ef70ecadbe1155462620cdfedf 100644 (file)
@@ -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<Pattern>::iterator patt_it;
 
     match(ID);
@@ -56,7 +57,9 @@ AST* DLParser::MacroExpansion()
 
     if (ret == NULL)
     {
-        throw "Did not find a matching pattern for keyword <macro-name>";
+        Exception ex;
+        ex << "Did not find a matching pattern for keyword " << macro_name << ".";
+        throw ex;
     }
 
     return ret;
index 7d6ba290e1132d6324fb2112715c245fcf0f6274..7ba2eaeb0b5d587c54b8b0dc9c13e8897b230433 100644 (file)
@@ -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: