summaryrefslogtreecommitdiff
path: root/src/lmparse.kl
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2012-07-16 08:32:40 -0400
committerAdrian Thurston <thurston@complang.org>2012-07-16 08:32:40 -0400
commite4514d7b9dd8929f8976c3e746381ef9d4741005 (patch)
tree2f3e6c82535a071a3559e0453dd17f6ca06d96a5 /src/lmparse.kl
parent516b11d71d8bc5e8d05379d2e98a18e3a23d6461 (diff)
downloadcolm-e4514d7b9dd8929f8976c3e746381ef9d4741005.tar.gz
moved the send (also old << syntax) to LangTerm
The send belongs in the lang terms with the rest of the parsing, consing, matching, etc. Was in LangStmt only because there are some grammar issues to fix. The repl/accum/string definitions are a bit sloppy.
Diffstat (limited to 'src/lmparse.kl')
-rw-r--r--src/lmparse.kl38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/lmparse.kl b/src/lmparse.kl
index 07988dd7..4789bad1 100644
--- a/src/lmparse.kl
+++ b/src/lmparse.kl
@@ -1441,24 +1441,6 @@ statement: KW_Yield var_ref
final {
$$->stmt = LangStmt::cons( LangStmt::YieldType, $2->varRef );
};
-statement: var_ref TK_LtLt accumulate
- final {
- Namespace *nspace = namespaceStack.top();
- TokenRegion *region = regionStack.top();
- ParserText *parserText = ParserText::cons( $2->loc, nspace, region, replItemList );
- pd->parserTextList.append( parserText );
-
- $$->stmt = LangStmt::cons( LangStmt::SendType, $1->varRef, parserText );
- };
-statement: KW_Send var_ref accumulate
- final {
- Namespace *nspace = namespaceStack.top();
- TokenRegion *region = regionStack.top();
- ParserText *parserText = ParserText::cons( $1->loc, nspace, region, replItemList );
- pd->parserTextList.append( parserText );
-
- $$->stmt = LangStmt::cons( LangStmt::SendType, $2->varRef, parserText );
- };
nonterm opt_require_stmt uses statement;
@@ -1974,6 +1956,26 @@ code_factor: KW_ParseStop opt_capture type_ref '(' opt_code_expr_list ')'
}
};
+code_factor:
+ var_ref TK_LtLt accumulate
+ final {
+ Namespace *nspace = namespaceStack.top();
+ TokenRegion *region = regionStack.top();
+ ParserText *parserText = ParserText::cons( $2->loc, nspace, region, replItemList );
+ pd->parserTextList.append( parserText );
+
+ $$->expr = LangExpr::cons( LangTerm::cons( LangTerm::SendType, $1->varRef, parserText ) );
+ };
+code_factor:
+ KW_Send var_ref accumulate
+ final {
+ Namespace *nspace = namespaceStack.top();
+ TokenRegion *region = regionStack.top();
+ ParserText *parserText = ParserText::cons( $1->loc, nspace, region, replItemList );
+ pd->parserTextList.append( parserText );
+
+ $$->expr = LangExpr::cons( LangTerm::cons( LangTerm::SendType, $2->varRef, parserText ) );
+ };
code_factor: KW_TypeId '<' type_ref '>'
final {
$$->expr = LangExpr::cons( LangTerm::cons( $1->loc,