{
ret.type( TERM );
}
- cout << terminator_string << " " << escaped << " " << ret.type() << " " << ret.text() << "|"<< endl;
return ret;
}
#include "dlparser.h"
#include "exception.h"
#include "common.h"
-#include "macroprocessor.h"
+#include "expprocessor.h"
using namespace std;
}
}
- // 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;
--- /dev/null
+#include "expprocessor.h"
+
+ExpProcessor::ExpProcessor(std::map<std::string,Macro*> ¯os) : 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)
+{
+}
+
-#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);
+++ /dev/null
-#include "macroprocessor.h"
-
-MacroProcessor::MacroProcessor(std::map<std::string,Macro*> ¯os) : 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)
-{
-}
-