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

BQLCompiler.java 文件源码 项目:linden 阅读 25 收藏 0 点赞 0 评论 0
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;
}
SimpleLexerState.java 文件源码 项目:goworks 阅读 26 收藏 0 点赞 0 评论 0
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);
    }
}
SimpleLexerState.java 文件源码 项目:goworks 阅读 30 收藏 0 点赞 0 评论 0
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);
}
SimpleLexerState.java 文件源码 项目:antlrworks2 阅读 25 收藏 0 点赞 0 评论 0
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);
    }
}
SimpleLexerState.java 文件源码 项目:antlrworks2 阅读 22 收藏 0 点赞 0 评论 0
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);
}
ECLexer.java 文件源码 项目:netbeans-editorconfig-editor 阅读 19 收藏 0 点赞 0 评论 0
public LexerState(int mode, IntegerStack stack) {
    Mode = mode;
    Stack = new IntegerStack(stack);
}
SimpleLexerState.java 文件源码 项目:goworks 阅读 22 收藏 0 点赞 0 评论 0
public IntegerStack getModeStack() {
    return modeStack;
}
ECLexer.java 文件源码 项目:editorconfig-netbeans 阅读 20 收藏 0 点赞 0 评论 0
public LexerState(int mode, IntegerStack stack) {
  Mode = mode;
  Stack = new IntegerStack(stack);
}
ANTLRv4LexerState.java 文件源码 项目:intellij-plugin-v4 阅读 20 收藏 0 点赞 0 评论 0
public ANTLRv4LexerState(int mode, IntegerStack modeStack, int currentRuleType) {
    super(mode, modeStack);
    this.currentRuleType = currentRuleType;
}
SimpleLexerState.java 文件源码 项目:antlrworks2 阅读 20 收藏 0 点赞 0 评论 0
public IntegerStack getModeStack() {
    return modeStack;
}
AntlrLexerState.java 文件源码 项目:protobuf-netbeans-plugin 阅读 22 收藏 0 点赞 0 评论 0
/**
 * @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;
}
ANTLRLexerState.java 文件源码 项目:jetbrains 阅读 22 收藏 0 点赞 0 评论 0
/**
 * 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;
}
ANTLRLexerState.java 文件源码 项目:intellij-plugin-v4 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 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;
}


问题


面经


文章

微信
公众号

扫码关注公众号