When the visitor is used by a parser, this is called to parse a move
        in standard algebraic notation.

        You can override the default implementation to work around specific
        quirks of your input format.
515467
def parse_san(self, board: chess.Board, san: str) -> chess.Move:
        
        # Replace zeros with correct castling notation.
        if san == "0-0":
            san = "O-O"
        elif san == "0-0-0":
            san = "O-O-O"

        return board.parse_san(san)
377730
@Override
    public void visitCode(Code obj) {
        if (!Values.STATIC_INITIALIZER.equals(getMethodName())) {
            state = State.SEEN_NOTHING;
            super.visitCode(obj);
        }
    }
546778
@Override
    public void sawOpcode(int seen) {
        try {
            stack.precomputation(this);

            switch (seen) {
                case Const.IRETURN: {
                    processIntegerReturn();
                }
                break;

                case Const.GOTO:
                case Const.GOTO_W: {
                    if (stack.getStackDepth() > 0) {
                        throw new StopOpcodeParsingException();
                    }
                    if (furthestBranchTarget < getBranchTarget()) {
                        furthestBranchTarget = getBranchTarget();
                    }
                }
                break;

                case Const.IFEQ:
                case Const.IFNE:
                case Const.IFLT:
                case Const.IFGE:
                case Const.IFGT:
                case Const.IFLE:
                case Const.IF_ICMPEQ:
                case Const.IF_ICMPNE:
                case Const.IF_ICMPLT:
                case Const.IF_ICMPGE:
                case Const.IF_ICMPGT:
                case Const.IF_ICMPLE:
                case Const.IF_ACMPEQ:
                case Const.IF_ACMPNE:
                case Const.IFNULL:
                case Const.IFNONNULL: {
                    if (furthestBranchTarget < getBranchTarget()) {
                        furthestBranchTarget = getBranchTarget();
                    }
                }
                break;

                case Const.LOOKUPSWITCH:
                case Const.TABLESWITCH: {
                    int defTarget = getDefaultSwitchOffset() + getPC();
                    if (furthestBranchTarget > defTarget) {
                        furthestBranchTarget = defTarget;
                    }
                }
                break;

                case Const.ATHROW: {
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item item = stack.getStackItem(0);
                        String exSig = item.getSignature();
                        if ("Ljava/lang/UnsupportedOperationException;".equals(exSig)) {
                            throw new StopOpcodeParsingException();
                        }
                    }
                }
                break;

                /*
                 * these three opcodes are here because findbugs proper is broken, it sometimes
                 * doesn't push this constant on the stack, because of bad branch handling
                 */
                case Const.ICONST_0:
                    if (getNextOpcode() == Const.IRETURN) {
                        sawConstant = Integer.valueOf(0);
                    }
                break;

                case Const.ICONST_M1:
                    if (getNextOpcode() == Const.IRETURN) {
                        sawConstant = Integer.valueOf(-1);
                    }
                break;

                case Const.ICONST_1:
                    if (getNextOpcode() == Const.IRETURN) {
                        sawConstant = Integer.valueOf(1);
                    }
                break;

                default:
                break;

            }
        } finally {
            stack.sawOpcode(this, seen);
        }
    }
1120282
private final ParseTreeNode parse() throws ParserException {
	try {
	    createActionStack();
	    return LRTokenStreamConverter.convert(getTokenStream(), getGrammar(), actionStack);
	} catch (GrammarException e) {
	    logger.error(e.getMessage(), e);
	    throw new ParserException(e.getMessage());
	}
    }
638445
function transformString(code, visitorsPost, visitorsPre) {
//         StatCollector.resumeTimer("parse");
//        console.time("parse")
//        var newAst = esprima.parse(code, {loc:true, range:true});
        var newAst = acorn.parse(code, {locations: true, ecmaVersion: 6 });
//        console.timeEnd("parse")
//        StatCollector.suspendTimer("parse");
//        StatCollector.resumeTimer("transform");
//        console.time("transform")
        addScopes(newAst);
        var len = visitorsPost.length;
        for (var i = 0; i < len; i++) {
            newAst = astUtil.transformAst(newAst, visitorsPost[i], visitorsPre[i], astUtil.CONTEXT.RHS);
        }
//        console.timeEnd("transform")
//        StatCollector.suspendTimer("transform");
//        console.log(JSON.stringify(newAst,null,"  "));
        return newAst;
    }
674142
def parse_moves
      s0 = @current_pos
      s1 = parse_firstboard
      if s1 != :failed
        s2 = []
        s3 = parse_move
        while s3 != :failed
          s2 << s3
          s3 = parse_move
        end
        parse_comments
        @reported_pos = s0
        s0 = s2.unshift(s1)
      else
        @current_pos = s0
        s0 = :failed
      end
      s0
    end
387445
function parseReturnStatement() {
        var token, argument = null;

        expectKeyword('return');

        if (!inFunctionBody) {
            throwErrorTolerant({}, Messages.IllegalReturn);
        }

        // 'return' followed by a space and an identifier is very common.
        if (source[index] === ' ') {
            if (isIdentifierStart(source[index + 1])) {
                argument = parseExpression();
                consumeSemicolon();
                return {
                    type: Syntax.ReturnStatement,
                    argument: argument
                };
            }
        }

        if (peekLineTerminator()) {
            return {
                type: Syntax.ReturnStatement,
                argument: null
            };
        }

        if (!match(';')) {
            token = lookahead();
            if (!match('}') && token.type !== Token.EOF) {
                argument = parseExpression();
            }
        }

        consumeSemicolon();

        return {
            type: Syntax.ReturnStatement,
            argument: argument
        };
    }
948167
function(obj, visitor, context, traversalStrategy) {
      traversalStrategy = traversalStrategy || this._traversalStrategy;
      walkImpl(obj, traversalStrategy, null, visitor, context);
    }
146430
@Override
    public void sawOpcode(int seen) {
        int pc = 0;
        try {
            stack.precomputation(this);

            switch (state) {
                case SAW_NOTHING:
                    pc = sawOpcodeAfterNothing(seen);
                break;

                case SAW_CTOR:
                    if ((seen == Const.POP) || (seen == Const.RETURN)) {
                        bugReporter.reportBug(new BugInstance(this, BugType.SEC_SIDE_EFFECT_CONSTRUCTOR.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                                .addSourceLine(this));
                    }
                    state = State.SAW_NOTHING;
                break;
            }
        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if ((pc != 0) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                item.setUserValue(Integer.valueOf(pc));
            }
        }
    }
31899
def parse_special_move
      s0 = @current_pos
      s1 = match_str("%")
      if s1 != :failed
        s3 = match_regexp(/^[\-+_A-Z]/)
        if s3 != :failed
          s2 = []
          while s3 != :failed
            s2 << s3
            s3 = match_regexp(/^[\-+_A-Z]/)
          end
        else
          s2 = :failed
        end
        if s2 != :failed
          if parse_nl != :failed
            @reported_pos = s0
            s0 = { "special" => s2.join }
          else
            @current_pos = s0
            s0 = :failed
          end
        else
          @current_pos = s0
          s0 = :failed
        end
      else
        @current_pos = s0
        s0 = :failed
      end
      s0
    end
1078953
@Override
    public void visitInsn(int inst) {
        processPendingExceptionHandlerEntry(-1);

        // List of opcodes taken from visitInsn documentation
        if (waitingForSuper) {
            // Visit the instruction
            super.visitInsn(inst);

            switch (inst) {
                case NOP:
                    break;
                // One slot constants
                case ACONST_NULL:
                case ICONST_M1:
                case ICONST_0:
                case ICONST_1:
                case ICONST_2:
                case ICONST_3:
                case ICONST_4:
                case ICONST_5:
                case FCONST_0:
                case FCONST_1:
                case FCONST_2:
                    push(OTHER, 1);
                    break;
                // Two slot constants
                case DCONST_0:
                case DCONST_1:
                case LCONST_0:
                case LCONST_1:
                    push(OTHER, 2);
                    break;
                // One slot array load
                case IALOAD:
                case FALOAD:
                case AALOAD:
                case BALOAD:
                case CALOAD:
                case SALOAD:
                    pop(1); // pop(2); push(OTHER, 1);
                    break;
                // Two slot array load
                case DALOAD:
                case LALOAD:
                    // pop(2); push(OTHER, 2);
                    break;
                // One slot array store
                case IASTORE:
                case FASTORE:
                case AASTORE:
                case BASTORE:
                case CASTORE:
                case SASTORE:
                    pop(3);
                    break;
                // Two slot array store
                case DASTORE:
                case LASTORE:
                    pop(4);
                    break;
                // Basic pop instructions
                case POP:
                    pop(1);
                    break;
                case POP2:
                    pop(2);
                    break;
                // Stack manipulation instructions
                case DUP: {
                    Object top = currentStack.get(currentStack.size() - 1);
                    push(top, 1);
                    break;
                }
                case DUP_X1: {
                    Object top = currentStack.get(currentStack.size() - 1);
                    int addPosition = currentStack.size() - 2;
                    currentStack.add(addPosition, top);
                    break;
                }
                case DUP_X2: {
                    Object top = currentStack.get(currentStack.size() - 1);
                    int addPosition = currentStack.size() - 3;
                    currentStack.add(addPosition, top);
                    break;
                }
                case DUP2: {
                    int position = currentStack.size() - 2;
                    currentStack.add(currentStack.get(position));
                    currentStack.add(currentStack.get(position + 1));
                    break;
                }
                case DUP2_X1: {
                    int addPosition = currentStack.size() - 3;
                    currentStack.add(addPosition, currentStack.get(currentStack.size() - 1));
                    currentStack.add(addPosition, currentStack.get(currentStack.size() - 2));
                    break;
                }
                case DUP2_X2: {
                    int addPosition = currentStack.size() - 4;
                    currentStack.add(addPosition, currentStack.get(currentStack.size() - 1));
                    currentStack.add(addPosition, currentStack.get(currentStack.size() - 2));
                    break;
                }
                case SWAP: {
                    Object o = currentStack.remove(currentStack.size() - 2);
                    currentStack.add(o);
                    break;
                }
                // One slot arithmetic and logical instructions
                case IADD:
                case FADD:
                case ISUB:
                case FSUB:
                case IMUL:
                case FMUL:
                case IDIV:
                case FDIV:
                case IREM:
                case FREM:
                case INEG:
                case FNEG:
                case ISHL:
                case ISHR:
                case IUSHR:
                case IAND:
                case IOR:
                case IXOR:
                    pop(1);
                    break;
                // Two slot arithmetic and logical instructions
                case DADD:
                case LADD:
                case DSUB:
                case LSUB:
                case DMUL:
                case LMUL:
                case DDIV:
                case LDIV:
                case DREM:
                case LREM:
                case DNEG:
                case LNEG:
                case LSHL:
                case LSHR:
                case LUSHR:
                case LAND:
                case LOR:
                case LXOR:
                    pop(2);
                    break;
                // One slot to two slot conversions
                case I2D:
                case I2L:
                case F2D:
                case F2L:
                    push(OTHER, 1);
                    break;
                // One slot to one slot conversions
                case F2I:
                case I2B:
                case I2C:
                case I2F:
                case I2S:
                    break;
                // Two slot to one slot conversions
                case D2F:
                case D2I:
                case L2I:
                case L2F:
                    pop(1);
                    break;
                // Two slot to two slot conversions
                case L2D:
                case D2L:
                    break;
                // Two slot compare
                case DCMPL:
                case DCMPG:
                case LCMP:
                    pop(3);
                    break;
                // One slot compare
                case FCMPL:
                case FCMPG:
                    pop(1);
                    break;
                // One slot return
                case IRETURN:
                case FRETURN:
                case ARETURN:
                    pop(1);
                    break;
                // Two slot return
                case DRETURN:
                case LRETURN:
                    pop(2);
                    break;
                // Zero slot return
                case RETURN:
                    break;
                // Get array length
                case ARRAYLENGTH:
                    break;
                // Throw an exception
                case ATHROW:
                    pop(1);
                    break;
                // Enter or leave a monitor
                case MONITORENTER:
                case MONITOREXIT:
                    pop(1);
                    break;
                default:
            }
        } else {
            // Handle return and throw instructions
            switch (inst) {
                case RETURN:
                case ARETURN:
                case DRETURN:
                case FRETURN:
                case IRETURN:
                case LRETURN:
                    if (onMethodReturn()) {
                        visitFrameAfterMethodReturnCallback();
                    }
                    break;
                case ATHROW:
                    if (onThrowInstruction()) {
                        visitFrameAfterOnThrowCallback();
                    }
                    break;
            }
            super.visitInsn(inst);
        }
    }
837613
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "SF_SWITCH_FALLTHROUGH", justification = "This fall-through is deliberate and documented")
    @Override
    public void sawOpcode(int seen) {
        int reg = -1;
        SPPUserValue userValue = null;
        try {
            stack.precomputation(this);

            checkTrimLocations();

            if (isBranchByteCode(seen)) {
                Integer branchTarget = Integer.valueOf(getBranchTarget());
                BitSet branchInsSet = branchTargets.get(branchTarget);
                if (branchInsSet == null) {
                    branchInsSet = new BitSet();
                    branchTargets.put(branchTarget, branchInsSet);
                }
                branchInsSet.set(getPC());
            }
            // not an else if, because some of the opcodes in the previous
            // branch also matter here.
            if ((seen == Const.IFEQ) || (seen == Const.IFLE) || (seen == Const.IFNE)) {
                checkForEmptyStringAndNullChecks(seen);
            }
            // see above, several opcodes hit multiple branches.
            if ((seen == Const.IFEQ) || (seen == Const.IFNE) || (seen == Const.IFGT)) {
                checkSizeEquals0();
            }

            if (seen == Const.IFEQ) {
                checkNullAndInstanceOf();
            }

            switch (seen) {
                case Const.IFNE:
                    checkNotEqualsStringBuilderLength();
                break;
                case Const.IFEQ:
                    checkEqualsStringBufferLength();
                break;
                case Const.IRETURN: {
                    if (lastIfEqWasBoolean) {
                        checkForUselessTernaryReturn();
                    }
                }
                // $FALL-THROUGH$
                case Const.LRETURN:
                case Const.DRETURN:
                case Const.FRETURN:
                case Const.ARETURN:
                    trimLocations.clear();
                break;
                case Const.LDC2_W:
                    checkApproximationsOfMathConstants();
                break;
                case Const.DCMPL:
                    checkCompareToNaNDouble();
                break;
                case Const.FCMPL:
                    checkCompareToNaNFloat();
                break;
                case Const.ICONST_0:
                case Const.ICONST_1:
                case Const.ICONST_2:
                case Const.ICONST_3:
                    userValue = sawIntConst();
                break;
                case Const.CALOAD:
                    checkImproperToCharArrayUse();
                break;
                case Const.INVOKESTATIC:
                    userValue = sawInvokeStatic();
                break;
                case Const.INVOKEVIRTUAL:
                    userValue = sawInvokeVirtual();
                break;
                case Const.INVOKESPECIAL:
                    sawInvokeSpecial();
                break;
                case Const.INVOKEINTERFACE:
                    userValue = sawInvokeInterface();
                break;

                case Const.IF_ICMPEQ:
                case Const.IF_ICMPGE:
                case Const.IF_ICMPGT:
                case Const.IF_ICMPLE:
                case Const.IF_ICMPLT:
                case Const.IF_ICMPNE:
                    if (stack.getStackDepth() >= 2) {
                        OpcodeStack.Item first = stack.getStackItem(1);
                        OpcodeStack.Item second = stack.getStackItem(0);
                        SPPUserValue uv = (SPPUserValue) first.getUserValue();
                        Integer c = null;
                        if ((uv != null) && (uv.getMethod() == SPPMethod.COMPARETO)) {
                            c = (Integer) second.getConstant();
                        } else {
                            uv = (SPPUserValue) second.getUserValue();
                            if ((uv != null) && (uv.getMethod() == SPPMethod.COMPARETO)) {
                                c = (Integer) first.getConstant();
                            }
                        }
                        if ((uv != null) && (uv.getMethod() == SPPMethod.COMPARETO) && ((c == null) || (c.intValue() != 0))) {
                            bugReporter.reportBug(new BugInstance(this, BugType.SPP_USE_ZERO_WITH_COMPARATOR.name(), NORMAL_PRIORITY).addClass(this)
                                    .addMethod(this).addSourceLine(this));
                        }
                    }
                break;

                default:
                    if (OpcodeUtils.isALoad(seen)) {
                        sawLoad(seen);
                    } else if (OpcodeUtils.isAStore(seen)) {
                        reg = RegisterUtils.getAStoreReg(this, seen);
                        checkTrimDupStore();
                        checkStutterdAssignment(seen, reg);
                        checkImmutableUsageOfStringBuilder(reg);
                    }
            }

        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if ((stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                if (userValue != null) {
                    item.setUserValue(userValue);
                } else {
                    SPPUserValue uv = (SPPUserValue) item.getUserValue();
                    if ((((uv != null) && (uv.getMethod() == SPPMethod.ITERATOR)) && (seen == Const.GETFIELD)) || (seen == Const.ALOAD)
                            || ((seen >= Const.ALOAD_0) && (seen <= Const.ALOAD_3))) {
                        item.setUserValue(null);
                    }
                }
            }

            lastOpcode = seen;
            lastReg = reg;
            System.arraycopy(lastPCs, 1, lastPCs, 0, 3);
            lastPCs[3] = getPC();
        }
    }
611336
@Override
    public void sawOpcode(int seen) {
        switch (state) {
            case SAW_NOTHING:
                if (seen == Const.CHECKCAST) {
                    castClass = getClassConstantOperand();
                    state = State.SAW_CHECKCAST;
                } else if (seen == Const.INVOKEINTERFACE) {
                    // enhanced for loops add an incorrect checkcast instruction, so
                    // ignore checkcasts after iterator.next()
                    String clsName = getClassConstantOperand();
                    String methodName = getNameConstantOperand();
                    if ("java/util/Iterator".equals(clsName) && "next".equals(methodName)) {
                        state = State.SAW_NEXT;
                    }
                }
            break;

            case SAW_CHECKCAST:
                if (OpcodeUtils.isAStore(seen)) {
                    int reg = RegisterUtils.getAStoreReg(this, seen);
                    LocalVariable lv = lvt.getLocalVariable(reg, getNextPC());
                    if (lv != null) {
                        String sig = lv.getSignature();
                        if (sig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
                            sig = SignatureUtils.trimSignature(sig);
                        }
                        if (!sig.equals(castClass)) {
                            bugReporter.reportBug(new BugInstance(this, BugType.OC_OVERZEALOUS_CASTING.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                                    .addSourceLine(this));
                        }
                    }
                } else if (seen == Const.PUTFIELD) {
                    FieldAnnotation f = FieldAnnotation.fromReferencedField(this);
                    String sig = f.getFieldSignature();
                    if (sig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
                        sig = SignatureUtils.trimSignature(sig);
                    }
                    // if the signature is Object, the field might be genericized, so ignore
                    if (!Values.SLASHED_JAVA_LANG_OBJECT.equals(sig) && !sig.equals(castClass)) {
                        bugReporter.reportBug(new BugInstance(this, BugType.OC_OVERZEALOUS_CASTING.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                                .addSourceLine(this));
                    }
                }
                state = State.SAW_NOTHING;
            break;

            case SAW_NEXT:
            default:
                state = State.SAW_NOTHING;
            break;
        }
    }
1165918
@Override
    public void sawOpcode(int seen) {
        boolean srcField = false;
        try {
            stack.precomputation(this);

            switch (seen) {
                case Const.ALOAD_0:
                    srcField = true;
                break;

                case Const.DUP:
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item item = stack.getStackItem(0);
                        if (item.getUserValue() != null) {
                            srcField = true;
                        }
                    }
                break;

                case Const.GETFIELD:
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item item = stack.getStackItem(0);
                        if (item.getRegisterNumber() == 0) {
                            srcField = true;
                        }
                    }
                break;

                case Const.PUTFIELD:
                    if (stack.getStackDepth() >= 2) {
                        OpcodeStack.Item item = stack.getStackItem(1);
                        if ((item.getRegisterNumber() == 0) || (item.getUserValue() != null)) {
                            bugReporter.reportBug(new BugInstance(this, BugType.SCA_SUSPICIOUS_CLONE_ALGORITHM.name(), NORMAL_PRIORITY).addClass(this)
                                    .addMethod(this).addSourceLine(this));
                        }
                    }

                break;

                case Const.INVOKEINTERFACE:
                case Const.INVOKEVIRTUAL:
                    String sig = getSigConstantOperand();
                    int numArgs = SignatureUtils.getNumParameters(sig);
                    if (stack.getStackDepth() > numArgs) {
                        OpcodeStack.Item item = stack.getStackItem(numArgs);
                        if ((item.getRegisterNumber() == 0) || (item.getUserValue() != null)) {
                            String name = getNameConstantOperand();
                            Integer priority = changingMethods.get(name);
                            if (priority != null) {
                                bugReporter.reportBug(new BugInstance(this, BugType.SCA_SUSPICIOUS_CLONE_ALGORITHM.name(), priority.intValue()).addClass(this)
                                        .addMethod(this).addSourceLine(this));
                            }
                        }
                    }
                break;

                default:
                break;
            }
        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if (srcField && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                item.setUserValue(Boolean.TRUE);
            }
        }
    }
1294844
Expr unary() {
		Tok tok = peek();
		switch (tok.sym) {
		case NOT:
			move();
			return new Logic(tok.sym, unary(), location);
		case ADD:
		case SUB:
			move();
			return new Unary(tok.sym, unary(), location).toConstIfPossible();
		case INC:
		case DEC:
			move();
			return new IncDec(tok.sym, false, incDec(), location);
		default:
			return incDec();
		}
	}
879537
def parse_move
      s0 = @current_pos
      s1 = parse_line
      if s1 != :failed
        s2 = []
        s3 = parse_comment
        while s3 != :failed
          s2 << s3
          s3 = parse_comment
        end
        parse_pointer
        @reported_pos = s0
        s0 = transform_move(s1, s2)
      else
        @current_pos = s0
        s0 = :failed
      end
      s0
    end
126464
@Override
    protected <R, C> R accept(AstVisitor<R, C> visitor, C context)
    {
        return visitor.visitExpression(this, context);
    }