Java 类org.antlr.v4.runtime.misc.IntegerStack 实例源码

项目:linden    文件:BQLCompiler.java   
private static TerminalNode getStartNode(ParseTree tree) {
  if (tree instanceof TerminalNode) {
    return (TerminalNode) tree;
  }

  Deque<ParseTree> workList = new ArrayDeque<ParseTree>();
  IntegerStack workIndexStack = new IntegerStack();
  workList.push(tree);
  workIndexStack.push(0);
  while (!workList.isEmpty()) {
    ParseTree currentTree = workList.peek();
    int currentIndex = workIndexStack.peek();
    if (currentIndex == currentTree.getChildCount()) {
      workList.pop();
      workIndexStack.pop();
      continue;
    }

    // move work list to next child
    workIndexStack.push(workIndexStack.pop() + 1);

    // process the current child
    ParseTree child = currentTree.getChild(currentIndex);
    if (child instanceof TerminalNode) {
      return (TerminalNode) child;
    }

    workList.push(child);
    workIndexStack.push(0);
  }

  return null;
}
项目:goworks    文件:SimpleLexerState.java   
private SimpleLexerState(int mode, @NullAllowed IntegerStack modeStack) {
    this.mode = mode;
    if (modeStack == null || modeStack.isEmpty()) {
        this.modeStack = EMPTY_MODE_STACK;
    } else {
        this.modeStack = new IntegerStack(modeStack);
    }
}
项目:goworks    文件:SimpleLexerState.java   
private static SimpleLexerState create(int mode, @NullAllowed IntegerStack modeStack) {
    if (mode == Lexer.DEFAULT_MODE && (modeStack == null || modeStack.isEmpty())) {
        return INITIAL;
    }

    return new SimpleLexerState(mode, modeStack);
}
项目:antlrworks2    文件:SimpleLexerState.java   
private SimpleLexerState(int mode, @NullAllowed IntegerStack modeStack) {
    this.mode = mode;
    if (modeStack == null || modeStack.isEmpty()) {
        this.modeStack = EMPTY_MODE_STACK;
    } else {
        this.modeStack = new IntegerStack(modeStack);
    }
}
项目:antlrworks2    文件:SimpleLexerState.java   
private static SimpleLexerState create(int mode, @NullAllowed IntegerStack modeStack) {
    if (mode == Lexer.DEFAULT_MODE && (modeStack == null || modeStack.isEmpty())) {
        return INITIAL;
    }

    return new SimpleLexerState(mode, modeStack);
}
项目:netbeans-editorconfig-editor    文件:ECLexer.java   
public LexerState(int mode, IntegerStack stack) {
    Mode = mode;
    Stack = new IntegerStack(stack);
}
项目:goworks    文件:SimpleLexerState.java   
public IntegerStack getModeStack() {
    return modeStack;
}
项目:editorconfig-netbeans    文件:ECLexer.java   
public LexerState(int mode, IntegerStack stack) {
  Mode = mode;
  Stack = new IntegerStack(stack);
}
项目:intellij-plugin-v4    文件:ANTLRv4LexerState.java   
public ANTLRv4LexerState(int mode, IntegerStack modeStack, int currentRuleType) {
    super(mode, modeStack);
    this.currentRuleType = currentRuleType;
}
项目:antlrworks2    文件:SimpleLexerState.java   
public IntegerStack getModeStack() {
    return modeStack;
}
项目:protobuf-netbeans-plugin    文件:AntlrLexerState.java   
/**
 * @effects Makes this be a new AntlrLexerState s with s.mode = mode and
 *          s.modeStack = modeStack if modeStack != null, else
 *          s.modeStack = nil
 */
public AntlrLexerState(int mode, IntegerStack modeStack) {
    this.mode = mode;
    this.modeStack = modeStack != null ? modeStack.toArray() : null;
}
项目:jetbrains    文件:ANTLRLexerState.java   
/**
 * Constructs a new instance of {@link ANTLRLexerState}
 * containing the mode and mode stack information for an ANTLR
 * lexer.
 *
 * @param mode The current lexer mode, {@link Lexer#_mode}.
 * @param modeStack The lexer mode stack, {@link Lexer#_modeStack}, or {@code null} .
 */
public ANTLRLexerState(int mode, @Nullable IntegerStack modeStack) {
    this.mode = mode;
    this.modeStack = modeStack != null ? modeStack.toArray() : null;
}
项目:intellij-plugin-v4    文件:ANTLRLexerState.java   
/**
 * Constructs a new instance of {@link ANTLRLexerState} containing the mode and mode stack information for an ANTLR
 * lexer.
 *
 * @param mode The current lexer mode, {@link Lexer#_mode}.
 * @param modeStack The lexer mode stack, {@link Lexer#_modeStack}, or {@code null} .
 */
public ANTLRLexerState(int mode, @Nullable IntegerStack modeStack) {
    this.mode = mode;
    this.modeStack = modeStack != null ? modeStack.toArray() : null;
}