@SuppressWarnings("CheckReturnValue")
public static class AtomContext extends ParserRuleContext {
public FstringContext fstring() {
return getRuleContext(FstringContext.class,0);
}
public StringContext string() {
return getRuleContext(StringContext.class,0);
}
public NumberContext number() {
return getRuleContext(NumberContext.class,0);
}
public NilContext nil() {
return getRuleContext(NilContext.class,0);
}
public LogicContext logic() {
return getRuleContext(LogicContext.class,0);
}
public AtomContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_atom; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof NuttParserListener ) ((NuttParserListener)listener).enterAtom(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof NuttParserListener ) ((NuttParserListener)listener).exitAtom(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof NuttParserVisitor ) return ((NuttParserVisitor<? extends T>)visitor).visitAtom(this);
else return visitor.visitChildren(this);
}
}
Is it possible to provide common interface or abstract class that would describe content (unnamed subrules) of such rule when (I think only) it has only references to other parser rules? It is very boring to check every subrule if it is null, it would be wonderful if I could just use pattern matching and its "default" branch.
For example, I have this rule.
And generated class is:
Is it possible to provide common interface or abstract class that would describe content (unnamed subrules) of such rule when (I think only) it has only references to other parser rules? It is very boring to check every subrule if it is null, it would be wonderful if I could just use pattern matching and its "default" branch.