public varNode var() { var token = lexer.GetToken(); if (token.Id == 0) { var text = ""; var arg0 = L_BRACKET(); text += arg0.Text; var arg1 = or(); text += arg1.Text; var arg2 = R_BRACKET(); text += arg2.Text; var result = new varNode(text, arg0, arg1, arg2); result.L_BRACKET = arg0; result.or = arg1; result.R_BRACKET = arg2; token = lexer.GetToken(); if (token.Id != -1 && token.Id != 4 && token.Id != 3 && token.Id != 2 && token.Id != 1) { throw new ParserException("Got unxpected token from lexer"); } return(result); } if (token.Id == 6) { var text = ""; var arg0 = VAR(); text += arg0.Text; var result = new varNode(text, arg0); result.VAR = arg0; token = lexer.GetToken(); if (token.Id != -1 && token.Id != 4 && token.Id != 3 && token.Id != 2 && token.Id != 1) { throw new ParserException("Got unxpected token from lexer"); } return(result); } throw new ParserException("Got unxpected token from lexer"); //return null }
public varNode var() { var token = lexer.GetToken(); if (token.Id == 4) { var text = ""; var arg0 = LETS(); text += arg0.Text; var arg1 = NAME(); text += arg1.Text; var arg2 = COLON(); text += arg2.Text; var arg3 = type(); text += arg3.Text; var arg4 = SET(); text += arg4.Text; var arg5 = expr(); text += arg5.Text; var result = new varNode(text, null, arg0, arg1, arg2, arg3, arg4, arg5); result.LETS = arg0; result.NAME = arg1; result.COLON = arg2; result.type = arg3; result.SET = arg4; result.expr = arg5; result.res = result.type.res + Space + result.NAME.Text + Is + result.expr.res; token = lexer.GetToken(); if (token.Id != -1 && token.Id != 3 && token.Id != 4 && token.Id != 5 && token.Id != 0 && token.Id != 31 && token.Id != 17 && token.Id != 18 && token.Id != 19 && token.Id != 20 && token.Id != 21 && token.Id != 22 && token.Id != 23 && token.Id != 24 && token.Id != 25 && token.Id != 26 && token.Id != 7 && token.Id != 8 && token.Id != 10 && token.Id != 13 && token.Id != 29 && token.Id != 15) { throw new ParserException("Got unxpected token from lexer"); } return(result); } throw new ParserException("Got unxpected token from lexer"); //return null }