summaryrefslogtreecommitdiff
path: root/src/piraha/Grammar.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/piraha/Grammar.cc')
-rw-r--r--src/piraha/Grammar.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/piraha/Grammar.cc b/src/piraha/Grammar.cc
index 9592e7c2..5a516358 100644
--- a/src/piraha/Grammar.cc
+++ b/src/piraha/Grammar.cc
@@ -6,18 +6,18 @@ extern smart_ptr<Pattern> compile(smart_ptr<Group> g,bool ignCase,smart_ptr<Gram
smart_ptr<Grammar> pegGrammar = AutoGrammar::reparserGenerator();
-void Grammar::compile(std::string name,smart_ptr<Group> g) {
- default_rule = name;
- smart_ptr<Pattern> p = piraha::compile(g,false,this);
- patterns.put(name,p);
+void compile(smart_ptr<Grammar> thisg,std::string name,smart_ptr<Group> g) {
+ thisg->default_rule = name;
+ smart_ptr<Pattern> p = piraha::compile(g,false,thisg);
+ thisg->patterns.put(name,p);
}
-void Grammar::compile(std::string name,std::string pattern) {
- default_rule = name;
+void compile(smart_ptr<Grammar> thisg,std::string name,std::string pattern) {
+ thisg->default_rule = name;
smart_ptr<Matcher> m = new Matcher(pegGrammar,"pattern",pattern.c_str());
smart_ptr<Group> g = m.dup<Group>();
if(m->matches()) {
- smart_ptr<Pattern> p = piraha::compile(g,false,this);
- patterns.put(name,p);
+ smart_ptr<Pattern> p = piraha::compile(g,false,thisg);
+ thisg->patterns.put(name,p);
} else {
std::cout << "Could not compile(" << name << "," << pattern << ")" << std::endl;
std::cout << "pos = " << m->pos << std::endl;