public object MORE_ARRAY(ParseTreeNode actual, string name) { /* * MORE_ARRAY.Rule * = DATA_TYPE | RESERV_ARRAY + COR_IZQ + EXPLOGICA + PUNTO + PUNTO + EXPLOGICA + COR_DER + RESERV_OF + MORE_ARRAY; | ; */ if (actual.ChildNodes.Count == 1) { return(actual.ChildNodes[0].ChildNodes[0].Token.Text); } else { var row = actual.ChildNodes[0].Token.Location.Line; var col = actual.ChildNodes[0].Token.Location.Column; ExpressionAST expressionAST = new ExpressionAST(); var limit_inf = expressionAST.getExpresion(actual.ChildNodes[2]); var limit_sup = expressionAST.getExpresion(actual.ChildNodes[5]); var resultado = MORE_ARRAY(actual.ChildNodes[8], name); //Instruction exp = null; if (resultado is string) { return(new ArraysMultiple(name, limit_inf, limit_sup, resultado.ToString(), resultado.ToString(), null, row, col, 1)); } else { var exp = (ArraysMultiple)resultado; return(new ArraysMultiple(name, limit_inf, limit_sup, exp.DataType, exp.Auxiliar, exp, row, col, exp.Contador + 1)); } } }
public Instruction ARRAYs(ParseTreeNode actual, string name) { /* * ARRAY.Rule = * RESERV_ARRAY + COR_IZQ + EXPLOGICA + PUNTO + PUNTO + EXPLOGICA + COR_DER + RESERV_OF + MORE_ARRAY + PUNTO_COMA; */ ExpressionAST expressionAST = new ExpressionAST(); var limit_inf = expressionAST.getExpresion(actual.ChildNodes[2]); var limit_sup = expressionAST.getExpresion(actual.ChildNodes[5]); var row = actual.ChildNodes[0].Token.Location.Line; var col = actual.ChildNodes[0].Token.Location.Column; var resultado = MORE_ARRAY(actual.ChildNodes[8], name); if (resultado is string) { return(new Arrays(name, limit_inf, limit_sup, resultado.ToString(), row, col)); } else { var res = (ArraysMultiple)resultado; return(new ArraysMultiple(name, limit_inf, limit_sup, res.DataType, res.Auxiliar, res, row, col, res.Contador + 1)); } }
public IF IFTHEN(ParseTreeNode actual) { /* * IFTHEN.Rule * = RESERV_IF + EXPRESION + RESERV_THEN + IF_SENTENCE + ELIF; */ IF ifs = new IF(); ExpressionAST expressionAST = new ExpressionAST(); var row = actual.ChildNodes[0].Token.Location.Line; var col = actual.ChildNodes[0].Token.Location.Column; var LOGIC_EXPRESION = expressionAST.getExpresion(actual.ChildNodes[1]); var SENTENCES = IF_SENTENCE(actual.ChildNodes[3]); var ELSE = ELIF(actual.ChildNodes[4]); return(new IF(LOGIC_EXPRESION, SENTENCES, ELSE, row, col)); }