private ExpressionNode ParseSimpleExpression(SymTable symTable) { if (Current.SubType == CharConstant) { var tmp = Current; Next(); return(new ConstNode(null, tmp.Value, tmp.Line, tmp.Position) { Type = TypeSymbol.CharTypeSymbol }); } var t = ParseTerm(symTable); var c = Current; while (AddOps.Contains(c.SubType)) { Next(); var temp = ParseTerm(symTable); if ( t.Type is ArrayTypeSymbol || t.Type is RecordTypeSymbol || temp.Type is ArrayTypeSymbol || temp.Type is RecordTypeSymbol ) { throw new ParserException("Incompatible types", c.Line, c.Position); } (t, temp) = SelectType(t, temp); t = new BinOpNode(new List <Node> { t, temp }, c.SubType, c.Line, c.Position) { Type = t.Type }; c = Current; } return(t); }
/// <summary> /// Adds the add operation between the child i and i+1. /// </summary> public void AppendAddOperation(AddOps operation) { m_operations.Add(operation); }