]> git.mdlowis.com Git - archive/dlang.git/commitdiff
Renamed macroprocessor
authorMike D. Lowis <mike@mdlowis.com>
Tue, 29 May 2012 20:33:18 +0000 (16:33 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Tue, 29 May 2012 20:33:18 +0000 (16:33 -0400)
source/dllexer/dllexer.cpp
source/dlparser/dlparser.cpp
source/visitors/expprocessor.cpp [new file with mode: 0644]
source/visitors/expprocessor.h [moved from source/visitors/macroprocessor.h with 75% similarity]
source/visitors/macroprocessor.cpp [deleted file]

index 7eaa420f5d707b8f4e709b27d2a7879d1f16fa33..98c9d8c93bcdebaf454dcdec921ef65d836f5e5b 100644 (file)
@@ -126,7 +126,6 @@ Token DLLexer::next(void)
     {
         ret.type( TERM );
     }
-    cout << terminator_string << " " << escaped << " " << ret.type() << " " << ret.text() << "|"<< endl;
 
     return ret;
 }
index 6b435ae8b2564e6aba7256fd53cb566b7b4991cd..bdea06cdb781c8a2fc47e7f5e783732286965856 100644 (file)
@@ -1,7 +1,7 @@
 #include "dlparser.h"
 #include "exception.h"
 #include "common.h"
-#include "macroprocessor.h"
+#include "expprocessor.h"
 
 using namespace std;
 
@@ -72,8 +72,8 @@ AST* DLParser::Expression(void)
         }
     }
 
-    // Register any new macros and expand any existing macros
-    MacroProcessor processor( macros );
+    // Register any new syntaxes and expand any existing syntax uses
+    ExpProcessor processor( macros );
     processor.visit( ret );
 
     return ret;
diff --git a/source/visitors/expprocessor.cpp b/source/visitors/expprocessor.cpp
new file mode 100644 (file)
index 0000000..4d558e3
--- /dev/null
@@ -0,0 +1,43 @@
+#include "expprocessor.h"
+
+ExpProcessor::ExpProcessor(std::map<std::string,Macro*> &macros) : macro_registry(macros)
+{
+}
+
+void ExpProcessor::beforeVisit(AST* cur, int depth)
+{
+}
+
+void ExpProcessor::afterVisit(AST* cur, int depth)
+{
+}
+
+void ExpProcessor::beforeChildren(AST* cur, int depth)
+{
+    // If we reached a syntax use then expand it
+    if (cur->type() == EXPAND)
+    {
+        //expandMacro(cur);
+    }
+}
+
+void ExpProcessor::afterChildren(AST* cur, int depth)
+{
+    // If we have a new syntax definition then register it
+    if (cur->type() == SYNTAX)
+    {
+        std::string name = (*(cur->children()->begin()))->text();
+        Macro* macro = new Macro();
+        macro->name( name );
+        macro_registry[ macro->name() ] = macro;
+    }
+}
+
+void ExpProcessor::beforeChild(AST* cur, int depth)
+{
+}
+
+void ExpProcessor::afterChild(AST* cur, int depth)
+{
+}
+
similarity index 75%
rename from source/visitors/macroprocessor.h
rename to source/visitors/expprocessor.h
index 99aae82311de8329f1340541e5192f1ea41383a8..36778ce0779b3a97dc124876afa7d8955c2cb60f 100644 (file)
@@ -1,16 +1,16 @@
-#ifndef MACRO_PROCESSOR_H
-#define MACRO_PROCESSOR_H
+#ifndef EXP_PROCESSOR_H
+#define EXP_PROCESSOR_H
 
 #include <map>
 #include "ivisitor.h"
 #include "dllexer.h"
 #include "macro.h"
 
-class MacroProcessor : public IVisitor {
+class ExpProcessor : public IVisitor {
     protected:
         std::map<std::string,Macro*>& macro_registry;
     public:
-        MacroProcessor(std::map<std::string,Macro*>& macros);
+        ExpProcessor(std::map<std::string,Macro*>& macros);
     private:
         void beforeVisit(AST* cur, int depth);
         void afterVisit(AST* cur, int depth);
diff --git a/source/visitors/macroprocessor.cpp b/source/visitors/macroprocessor.cpp
deleted file mode 100644 (file)
index 4e1d325..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "macroprocessor.h"
-
-MacroProcessor::MacroProcessor(std::map<std::string,Macro*> &macros) : macro_registry(macros)
-{
-}
-
-void MacroProcessor::beforeVisit(AST* cur, int depth)
-{
-}
-
-void MacroProcessor::afterVisit(AST* cur, int depth)
-{
-}
-
-void MacroProcessor::beforeChildren(AST* cur, int depth)
-{
-    // If we reached a syntax use then expand it
-    if (cur->type() == EXPAND)
-    {
-        //expandMacro(cur);
-    }
-}
-
-void MacroProcessor::afterChildren(AST* cur, int depth)
-{
-    // If we have a new syntax definition then register it
-    if (cur->type() == SYNTAX)
-    {
-        std::string name = (*(cur->children()->begin()))->text();
-        Macro* macro = new Macro();
-        macro->name( name );
-        macro_registry[ macro->name() ] = macro;
-    }
-}
-
-void MacroProcessor::beforeChild(AST* cur, int depth)
-{
-}
-
-void MacroProcessor::afterChild(AST* cur, int depth)
-{
-}
-