summaryrefslogtreecommitdiff
path: root/src/lmparse.kl
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2012-07-01 20:25:09 -0400
committerAdrian Thurston <thurston@complang.org>2012-07-01 20:25:09 -0400
commit024594868b14862744e990093ea061f20d48e55f (patch)
tree640718d4247a008ab43c6e21880e169b373f27a4 /src/lmparse.kl
parent247904a84430b8c9151fa6afb68f01b60afb92c9 (diff)
downloadcolm-024594868b14862744e990093ea061f20d48e55f.tar.gz
using static constructors for creating Expression
The advantage of static constructors is that we can use common constructors for initializing fields.
Diffstat (limited to 'src/lmparse.kl')
-rw-r--r--src/lmparse.kl12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lmparse.kl b/src/lmparse.kl
index 3ead7c98..8ef15a79 100644
--- a/src/lmparse.kl
+++ b/src/lmparse.kl
@@ -977,7 +977,7 @@ literal_item: opt_no_ignore TK_Literal opt_no_ignore
if ( ldel != 0 )
error( $2->loc ) << "literal already defined in this namespace" << endp;
else {
- Join *join = new Join( new Expression( new Term( new FactorWithAug(
+ Join *join = new Join( Expression::cons( new Term( new FactorWithAug(
new FactorWithRep( $2->loc, new FactorWithNeg( $2->loc, new Factor(
new Literal( $2->loc, $2->data,
Literal::LitString ) ) ) ) ) ) ) );
@@ -2091,29 +2091,29 @@ nonterm rl_expr
rl_expr:
rl_expr '|' rl_term_short final {
- $$->expression = new Expression( $1->expression,
+ $$->expression = Expression::cons( $1->expression,
$3->term, Expression::OrType );
};
rl_expr:
rl_expr '&' rl_term_short final {
- $$->expression = new Expression( $1->expression,
+ $$->expression = Expression::cons( $1->expression,
$3->term, Expression::IntersectType );
};
# This priority specification overrides the innermost parsing strategy which
# results ordered choice interpretation of the grammar.
rl_expr:
rl_expr '-' rl_term_short final {
- $$->expression = new Expression( $1->expression,
+ $$->expression = Expression::cons( $1->expression,
$3->term, Expression::SubtractType );
};
rl_expr:
rl_expr TK_DashDash rl_term_short final {
- $$->expression = new Expression( $1->expression,
+ $$->expression = Expression::cons( $1->expression,
$3->term, Expression::StrongSubtractType );
};
rl_expr:
rl_term_short final {
- $$->expression = new Expression( $1->term );
+ $$->expression = Expression::cons( $1->term );
};
nonterm rl_term_short