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/parsetree.h | |
parent | 6fb0cdffbafb135edaec7d927e5e508997c1d826 (diff) | |
download | colm-13d7c884e2a855418d68b8e45041b8ab4a20a85c.tar.gz |
load reduction actions and generate a commit containing them
Diffstat (limited to 'src/parsetree.h')
-rw-r--r-- | src/parsetree.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/parsetree.h b/src/parsetree.h index 3de830cb..b7e4e637 100644 --- a/src/parsetree.h +++ b/src/parsetree.h @@ -67,6 +67,8 @@ struct NameScope; struct IterCall; struct TemplateType; struct ObjectMethod; +struct Reduction; +struct Production; /* @@ -729,6 +731,7 @@ typedef DList<TokenRegion> RegionList; typedef DList<RegionImpl> RegionImplList; typedef Vector<Namespace*> NamespaceVect; +typedef Vector<Reduction*> ReductionVect; /* Generics have runtime-representations, so we must track them as unique * types. This gives the runtimes some idea of what is contained in the @@ -872,6 +875,7 @@ struct Namespace /* tree_t traversal. */ Namespace *findNamespace( const String &name ); + Reduction *findReduction( const String &name ); InputLoc loc; String name; @@ -901,6 +905,8 @@ struct Namespace Namespace *parentNamespace; NamespaceVect childNamespaces; + ReductionVect reductions; + NameScope *rootScope; Namespace *next, *prev; @@ -911,6 +917,39 @@ struct Namespace typedef DList<Namespace> NamespaceList; typedef BstSet< Namespace*, CmpOrd<Namespace*> > NamespaceSet; +struct ReduceAction +{ + ReduceAction( const InputLoc &loc, TypeRef *nonterm, + const String &prod, const String &txt ) + : + loc(loc), nonterm(nonterm), prod(prod), + txt(txt), production(0) + {} + + InputLoc loc; + TypeRef *nonterm; + String prod; + String txt; + + Production *production; + + ReduceAction *prev, *next; +}; + +typedef DList<ReduceAction> ReduceActionList; + +struct Reduction +{ + Reduction( const InputLoc &loc, String name ) + : loc(loc), name(name) {} + + InputLoc loc; + String name; + int id; + + ReduceActionList reduceActions; +}; + /* * LexJoin */ |