コード例 #1
0
        private static ConditionInstruction enterConditionAST(ConditionAST conditionAst)
        {
            ConditionInstruction condition = createConditionInstruction(conditionAst);

            condition.CompareInstruction = new CompareInstruction()
            {
                Left      = enterOperand(conditionAst.Left),
                Right     = enterOperand(conditionAst.Right),
                Operation = conditionAst.CompareOperator,
            };

            condition.TargetHitCount = conditionAst.HitCount;

            return(condition);
        }
コード例 #2
0
        private ConditionAST parseCondition()
        {
            var startIndex = _index;

            ConditionAST condition = parseCompare();

            if (condition != null)
            {
                var token = peekToken();
                if (token == '.' || token == '(')
                {
                    parseHitCount(condition);
                }
            }

            return(condition);
        }
コード例 #3
0
        private void parseHitCount(ConditionAST condition)
        {
            // Eat ( or .
            _ = eatToken();

            condition.HitCount = Convert.ToInt32(parseNumber());

            var peek = peekToken();

            if (peek == '.' || peek == ')')
            {
                // Eat ) or .
                _ = eatToken();
            }
            else
            {
                throw new ParserException($"Invalid hit count token at column {_index}");
            }
        }