diff options
author | Adrian Thurston <thurston@complang.org> | 2015-10-04 23:16:46 -0400 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2015-10-04 23:16:46 -0400 |
commit | 13d7c884e2a855418d68b8e45041b8ab4a20a85c (patch) | |
tree | eccbfb13e83812b01858317938f972913c7b7bf1 /src/parser.cc | |
parent | 6fb0cdffbafb135edaec7d927e5e508997c1d826 (diff) | |
download | colm-13d7c884e2a855418d68b8e45041b8ab4a20a85c.tar.gz |
load reduction actions and generate a commit containing them
Diffstat (limited to 'src/parser.cc')
-rw-r--r-- | src/parser.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/parser.cc b/src/parser.cc index d1bead20..22348e06 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -261,6 +261,21 @@ Namespace *BaseParser::createNamespace( const InputLoc &loc, const String &name return nspace; } +Reduction *BaseParser::createReduction( const InputLoc loc, const String &name ) +{ + Namespace *parent = namespaceStack.top(); + Reduction *reduction = parent->findReduction( name ); + + if ( reduction == 0 ) { + reduction = new Reduction( loc, name ); + parent->reductions.append( reduction ); + } + + reductionStack.push( reduction ); + + return reduction; +} + LexJoin *BaseParser::literalJoin( const InputLoc &loc, const String &data ) { Literal *literal = Literal::cons( loc, data, Literal::LitString ); |