All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.deephaven.lang.generated.ScopedNode Maven / Gradle / Ivy

There is a newer version: 0.36.1
Show newest version
/* 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;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy