summaryrefslogtreecommitdiff
path: root/src/parsetree.h
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-10-06 10:50:30 -0400
committerAdrian Thurston <thurston@complang.org>2015-10-06 10:50:30 -0400
commit0088b7912eb1bbcf7034b005ef84e133f3d89aab (patch)
tree1b03a4ac4f897bb8e00dcf0992f1053b3ec666cc /src/parsetree.h
parentdc2a84cc6c730f991e5f7c41964f1a81a086aaae (diff)
downloadcolm-0088b7912eb1bbcf7034b005ef84e133f3d89aab.tar.gz
collect and emit reduction action items
Diffstat (limited to 'src/parsetree.h')
-rw-r--r--src/parsetree.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/parsetree.h b/src/parsetree.h
index 4e4fa8ac..9a7ddb4a 100644
--- a/src/parsetree.h
+++ b/src/parsetree.h
@@ -917,18 +917,33 @@ struct Namespace
typedef DList<Namespace> NamespaceList;
typedef BstSet< Namespace*, CmpOrd<Namespace*> > NamespaceSet;
+struct ReduceTextItem
+{
+ enum Type {
+ LhsRef,
+ RhsRef,
+ Txt
+ };
+
+ Type type;
+ String txt;
+
+ ReduceTextItem *prev, *next;
+};
+
+typedef DList<ReduceTextItem> ReduceTextItemList;
+
struct ReduceNonTerm
{
- ReduceNonTerm( const InputLoc &loc, TypeRef *nonTerm, const String &txt )
+ ReduceNonTerm( const InputLoc &loc, TypeRef *nonTerm )
:
loc(loc),
- nonTerm(nonTerm),
- txt(txt)
+ nonTerm(nonTerm)
{}
InputLoc loc;
TypeRef *nonTerm;
- String txt;
+ ReduceTextItemList itemList;
ReduceNonTerm *prev, *next;
};
@@ -936,17 +951,18 @@ struct ReduceNonTerm
struct ReduceAction
{
ReduceAction( const InputLoc &loc, TypeRef *nonTerm,
- const String &prod, const String &txt )
+ const String &prod )
:
loc(loc), nonTerm(nonTerm),
prod(prod),
- txt(txt), production(0)
+ production(0)
{}
InputLoc loc;
TypeRef *nonTerm;
String prod;
- String txt;
+ ReduceTextItemList itemList;
+
Production *production;