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); }
private ConditionAST parseCondition() { var startIndex = _index; ConditionAST condition = parseCompare(); if (condition != null) { var token = peekToken(); if (token == '.' || token == '(') { parseHitCount(condition); } } return(condition); }
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}"); } }