io.deephaven.lang.generated.ScopedNode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-open-api-lang-parser Show documentation
Show all versions of deephaven-open-api-lang-parser Show documentation
The 'open-api-lang-parser' project
/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 7.0 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=Chunker,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package io.deephaven.lang.generated;
import io.deephaven.lang.api.HasScope;
import io.deephaven.lang.api.IsScope;
import java.util.ArrayList;
import java.util.List;
/**
* An ast node which can have scope nodes.
* item.mthd()[array.access].field = blah()
*
* item, mthd(), [], .field, etc are all scoped nodes,
* as they have preceding tokens which qualify their type.
*
* Anything that can come after a . is a ScopedNode.
* Anything that can come before is an IsScope.
*
*/
public class ScopedNode extends SimpleNode implements HasScope {
private List scope;
public ScopedNode(int i) {
super(i);
}
public ScopedNode(Chunker p, int i) {
super(p, i);
}
@Override
public void setScope(List scope) {
this.scope = scope;
if (scope != null && !scope.isEmpty()) {
scope.get(scope.size() - 1).setScopeTarget(this);
}
}
@Override
public final List getScope() {
if (scope == null) {
scope = new ArrayList<>();
}
return scope;
}
}