Beispiel #1
0
    public bool ParsingImmVariable(Token tk, int index)
    {
        string s = lex.GetTokenString();
        int    i = 0;

        if (GetEquValue(s, ref i))
        {
            lex.Match(Token.Ident);
            opcode.Imm             = i;
            opcode.Register[index] = Addressing.imm;
            return(true);
        }
        else if (opcode.IsCanBackFillInst())
        {
            opcode.BackFillLabel = s;
            opcode.Imm           = DataIndex;
            opcode.LineNo        = lex.GetLineNo();
            opcode.RowNo         = lex.GetRowNo();
            lex.Match(Token.Ident);
            opcode.Register[index] = Addressing.backfill;
            return(true);
        }
        else
        {
            Error("unknown identifier: " + s);
            lex.SkipLine();
            return(false);
        }
    }