forked from jasder/antlr
track different types of StructDecl elements so Go can do setters/getters.
This commit is contained in:
parent
8b8094c044
commit
75794a588b
|
@ -57,6 +57,16 @@ public class StructDecl extends Decl {
|
|||
@ModelElement public List<OutputModelObject> interfaces;
|
||||
@ModelElement public List<OutputModelObject> extensionMembers;
|
||||
|
||||
// Track these separately; Go target needs to generate getters/setters
|
||||
// Do not make them templates; we only need the Decl object not the ST
|
||||
// built from it. Avoids adding args to StructDecl template
|
||||
public OrderedHashSet<Decl> tokenDecls = new OrderedHashSet<Decl>();
|
||||
public OrderedHashSet<Decl> tokenTypeDecls = new OrderedHashSet<Decl>();
|
||||
public OrderedHashSet<Decl> tokenListDecls = new OrderedHashSet<Decl>();
|
||||
public OrderedHashSet<Decl> ruleContextDecls = new OrderedHashSet<Decl>();
|
||||
public OrderedHashSet<Decl> ruleContextListDecls = new OrderedHashSet<Decl>();
|
||||
public OrderedHashSet<Decl> attributeDecls = new OrderedHashSet<Decl>();
|
||||
|
||||
public StructDecl(OutputModelFactory factory, Rule r) {
|
||||
super(factory, factory.getGenerator().getTarget().getRuleFunctionContextStructName(r));
|
||||
addDispatchMethods(r);
|
||||
|
@ -80,8 +90,29 @@ public class StructDecl extends Decl {
|
|||
|
||||
public void addDecl(Decl d) {
|
||||
d.ctx = this;
|
||||
|
||||
if ( d instanceof ContextGetterDecl ) getters.add(d);
|
||||
else attrs.add(d);
|
||||
|
||||
// add to specific "lists"
|
||||
if ( d instanceof TokenTypeDecl ) {
|
||||
tokenTypeDecls.add(d);
|
||||
}
|
||||
else if ( d instanceof TokenListDecl ) {
|
||||
tokenListDecls.add(d);
|
||||
}
|
||||
else if ( d instanceof TokenDecl ) {
|
||||
tokenDecls.add(d);
|
||||
}
|
||||
else if ( d instanceof RuleContextListDecl ) {
|
||||
ruleContextListDecls.add(d);
|
||||
}
|
||||
else if ( d instanceof RuleContextDecl ) {
|
||||
ruleContextDecls.add(d);
|
||||
}
|
||||
else if ( d instanceof AttributeDecl ) {
|
||||
attributeDecls.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
public void addDecl(Attribute a) {
|
||||
|
|
Loading…
Reference in New Issue