]> git.mdlowis.com Git - archive/dlang.git/commitdiff
Added pattern class and updated assignment rule in preparation for macro expansion...
authorMike D. Lowis <mike@mdlowis.com>
Tue, 6 Mar 2012 18:31:45 +0000 (13:31 -0500)
committerMike D. Lowis <mike@mdlowis.com>
Tue, 6 Mar 2012 18:31:45 +0000 (13:31 -0500)
source/dlparser/dlparser.cpp
source/dlparser/macro/pattern.cpp [new file with mode: 0644]
source/dlparser/macro/pattern.h [new file with mode: 0644]

index f6fd6c345cd7988c3d6cca695a1fe34fc8004487..6a1f668298737324525f08ae0e70266d87817e73 100644 (file)
@@ -81,10 +81,6 @@ AST* DLParser::Expression(void)
     {
         ret = MacroDefinition();
     }
-    //else if( isMacro( lookaheadToken(1) ) )
-    //{
-    //    ret = MacroExpansion();
-    //}
     else
     {
         ret = AssignExpr();
@@ -95,12 +91,19 @@ AST* DLParser::Expression(void)
 AST* DLParser::AssignExpr(void)
 {
     AST* ret = NULL;
-    ret = LogicalExpr();
-    if(lookaheadType(1) == ASSIGN)
-    {
-        match(ASSIGN);
-        ret = new AST(ASSIGN, 2, ret, LogicalExpr());
-    }
+    //if( isMacro( lookaheadToken(1) ) )
+    //{
+    //    ret = MacroExpansion();
+    //}
+    //else
+    //{
+        ret = LogicalExpr();
+        if(lookaheadType(1) == ASSIGN)
+        {
+            match(ASSIGN);
+            ret = new AST(ASSIGN, 2, ret, LogicalExpr());
+        }
+    //}
     return ret;
 }
 
diff --git a/source/dlparser/macro/pattern.cpp b/source/dlparser/macro/pattern.cpp
new file mode 100644 (file)
index 0000000..c29cec4
--- /dev/null
@@ -0,0 +1,10 @@
+#include "pattern.h"
+
+Pattern::Pattern(const std::list<PatternType_T>& patt, const AST* ast) : pattern(patt), expr_ast(ast)
+{
+}
+
+Pattern::~Pattern()
+{
+}
+
diff --git a/source/dlparser/macro/pattern.h b/source/dlparser/macro/pattern.h
new file mode 100644 (file)
index 0000000..00d3688
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef PATTERN_H
+#define PATTERN_H
+
+#include <list>
+#include "ast.h"
+
+typedef enum {
+    MAP_TYP,
+    VECT_TYP,
+    LiST_TYP,
+    BLK_TYP,
+    ID_TYP,
+    NUM_TYP,
+    CHAR_TYP,
+    STR_TYP,
+    SYM_TYP,
+    EXPR_TYP
+} PatternType_T;
+
+class Pattern {
+    private:
+        std::list<PatternType_T> pattern;
+        const AST* expr_ast;
+    public:
+        Pattern(const std::list<PatternType_T>& patt, const AST* ast);
+        ~Pattern();
+};
+
+#endif