Commit 63849faf authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Recover from unfinished do-while loops.

parent 1d2fa45a
......@@ -594,6 +594,7 @@ AST *Parser::parse(int startToken)
T_SEMICOLON, T_COMMA, T_COLON,
T_NUMBER, T_TYPE_NAME, T_IDENTIFIER,
T_LEFT_BRACE, T_LEFT_PAREN, T_LEFT_BRACKET,
T_WHILE,
0
};
......
......@@ -173,6 +173,7 @@ AST *Parser::parse(int startToken)
T_SEMICOLON, T_COMMA, T_COLON,
T_NUMBER, T_TYPE_NAME, T_IDENTIFIER,
T_LEFT_BRACE, T_LEFT_PAREN, T_LEFT_BRACKET,
T_WHILE,
0
};
......@@ -213,137 +214,137 @@ AST *Parser::parse(int startToken)
return 0;
}
#line 640 "./glsl.g"
#line 641 "./glsl.g"
void Parser::reduce(int ruleno)
{
switch(ruleno) {
#line 649 "./glsl.g"
#line 650 "./glsl.g"
case 0: {
ast(1) = makeAstNode<IdentifierExpressionAST>(string(1));
} break;
#line 656 "./glsl.g"
#line 657 "./glsl.g"
case 1: {
ast(1) = makeAstNode<LiteralExpressionAST>(string(1));
} break;
#line 663 "./glsl.g"
#line 664 "./glsl.g"
case 2: {
ast(1) = makeAstNode<LiteralExpressionAST>(_engine->identifier("true", 4));
} break;
#line 670 "./glsl.g"
#line 671 "./glsl.g"
case 3: {
ast(1) = makeAstNode<LiteralExpressionAST>(_engine->identifier("false", 5));
} break;
#line 677 "./glsl.g"
#line 678 "./glsl.g"
case 4: {
// nothing to do.
} break;
#line 684 "./glsl.g"
#line 685 "./glsl.g"
case 5: {
ast(1) = ast(2);
} break;
#line 691 "./glsl.g"
#line 692 "./glsl.g"
case 6: {
// nothing to do.
} break;
#line 698 "./glsl.g"
#line 699 "./glsl.g"
case 7: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_ArrayAccess, expression(1), expression(3));
} break;
#line 705 "./glsl.g"
#line 706 "./glsl.g"
case 8: {
// nothing to do.
} break;
#line 712 "./glsl.g"
#line 713 "./glsl.g"
case 9: {
ast(1) = makeAstNode<MemberAccessExpressionAST>(expression(1), string(3));
} break;
#line 719 "./glsl.g"
#line 720 "./glsl.g"
case 10: {
ast(1) = makeAstNode<UnaryExpressionAST>(AST::Kind_PostIncrement, expression(1));
} break;
#line 726 "./glsl.g"
#line 727 "./glsl.g"
case 11: {
ast(1) = makeAstNode<UnaryExpressionAST>(AST::Kind_PostDecrement, expression(1));
} break;
#line 733 "./glsl.g"
#line 734 "./glsl.g"
case 12: {
// nothing to do.
} break;
#line 740 "./glsl.g"
#line 741 "./glsl.g"
case 13: {
// nothing to do.
} break;
#line 747 "./glsl.g"
#line 748 "./glsl.g"
case 14: {
ast(1) = makeAstNode<FunctionCallExpressionAST>
(sym(1).function.id, sym(1).function.arguments);
} break;
#line 755 "./glsl.g"
#line 756 "./glsl.g"
case 15: {
ast(1) = makeAstNode<FunctionCallExpressionAST>
(expression(1), sym(3).function.id, sym(3).function.arguments);
} break;
#line 763 "./glsl.g"
#line 764 "./glsl.g"
case 16: {
// nothing to do.
} break;
#line 770 "./glsl.g"
#line 771 "./glsl.g"
case 17: {
// nothing to do.
} break;
#line 777 "./glsl.g"
#line 778 "./glsl.g"
case 18: {
sym(1).function.id = sym(1).function_identifier;
sym(1).function.arguments = 0;
} break;
#line 785 "./glsl.g"
#line 786 "./glsl.g"
case 19: {
sym(1).function.id = sym(1).function_identifier;
sym(1).function.arguments = 0;
} break;
#line 793 "./glsl.g"
#line 794 "./glsl.g"
case 20: {
sym(1).function.id = sym(1).function_identifier;
......@@ -351,7 +352,7 @@ case 20: {
makeAstNode< List<ExpressionAST *> >(expression(2));
} break;
#line 802 "./glsl.g"
#line 803 "./glsl.g"
case 21: {
sym(1).function.arguments =
......@@ -359,379 +360,379 @@ case 21: {
(sym(1).function.arguments, expression(3));
} break;
#line 811 "./glsl.g"
#line 812 "./glsl.g"
case 22: {
// nothing to do.
} break;
#line 818 "./glsl.g"
#line 819 "./glsl.g"
case 23: {
ast(1) = makeAstNode<FunctionIdentifierAST>(type(1));
} break;
#line 825 "./glsl.g"
#line 826 "./glsl.g"
case 24: {
ast(1) = makeAstNode<FunctionIdentifierAST>(string(1));
} break;
#line 832 "./glsl.g"
#line 833 "./glsl.g"
case 25: {
// nothing to do.
} break;
#line 839 "./glsl.g"
#line 840 "./glsl.g"
case 26: {
ast(1) = makeAstNode<UnaryExpressionAST>(AST::Kind_PreIncrement, expression(2));
} break;
#line 846 "./glsl.g"
#line 847 "./glsl.g"
case 27: {
ast(1) = makeAstNode<UnaryExpressionAST>(AST::Kind_PreDecrement, expression(2));
} break;
#line 853 "./glsl.g"
#line 854 "./glsl.g"
case 28: {
ast(1) = makeAstNode<UnaryExpressionAST>(sym(1).kind, expression(2));
} break;
#line 860 "./glsl.g"
#line 861 "./glsl.g"
case 29: {
sym(1).kind = AST::Kind_UnaryPlus;
} break;
#line 867 "./glsl.g"
#line 868 "./glsl.g"
case 30: {
sym(1).kind = AST::Kind_UnaryMinus;
} break;
#line 874 "./glsl.g"
#line 875 "./glsl.g"
case 31: {
sym(1).kind = AST::Kind_LogicalNot;
} break;
#line 881 "./glsl.g"
#line 882 "./glsl.g"
case 32: {
sym(1).kind = AST::Kind_BitwiseNot;
} break;
#line 888 "./glsl.g"
#line 889 "./glsl.g"
case 33: {
// nothing to do.
} break;
#line 895 "./glsl.g"
#line 896 "./glsl.g"
case 34: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_Multiply, expression(1), expression(3));
} break;
#line 902 "./glsl.g"
#line 903 "./glsl.g"
case 35: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_Divide, expression(1), expression(3));
} break;
#line 909 "./glsl.g"
#line 910 "./glsl.g"
case 36: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_Modulus, expression(1), expression(3));
} break;
#line 916 "./glsl.g"
#line 917 "./glsl.g"
case 37: {
// nothing to do.
} break;
#line 923 "./glsl.g"
#line 924 "./glsl.g"
case 38: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_Plus, expression(1), expression(3));
} break;
#line 930 "./glsl.g"
#line 931 "./glsl.g"
case 39: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_Minus, expression(1), expression(3));
} break;
#line 937 "./glsl.g"
#line 938 "./glsl.g"
case 40: {
// nothing to do.
} break;
#line 944 "./glsl.g"
#line 945 "./glsl.g"
case 41: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_ShiftLeft, expression(1), expression(3));
} break;
#line 951 "./glsl.g"
#line 952 "./glsl.g"
case 42: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_ShiftRight, expression(1), expression(3));
} break;
#line 958 "./glsl.g"
#line 959 "./glsl.g"
case 43: {
// nothing to do.
} break;
#line 965 "./glsl.g"
#line 966 "./glsl.g"
case 44: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_LessThan, expression(1), expression(3));
} break;
#line 972 "./glsl.g"
#line 973 "./glsl.g"
case 45: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_GreaterThan, expression(1), expression(3));
} break;
#line 979 "./glsl.g"
#line 980 "./glsl.g"
case 46: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_LessEqual, expression(1), expression(3));
} break;
#line 986 "./glsl.g"
#line 987 "./glsl.g"
case 47: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_GreaterEqual, expression(1), expression(3));
} break;
#line 993 "./glsl.g"
#line 994 "./glsl.g"
case 48: {
// nothing to do.
} break;
#line 1000 "./glsl.g"
#line 1001 "./glsl.g"
case 49: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_Equal, expression(1), expression(3));
} break;
#line 1007 "./glsl.g"
#line 1008 "./glsl.g"
case 50: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_NotEqual, expression(1), expression(3));
} break;
#line 1014 "./glsl.g"
#line 1015 "./glsl.g"
case 51: {
// nothing to do.
} break;
#line 1021 "./glsl.g"
#line 1022 "./glsl.g"
case 52: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_BitwiseAnd, expression(1), expression(3));
} break;
#line 1028 "./glsl.g"
#line 1029 "./glsl.g"
case 53: {
// nothing to do.
} break;
#line 1035 "./glsl.g"
#line 1036 "./glsl.g"
case 54: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_BitwiseXor, expression(1), expression(3));
} break;
#line 1042 "./glsl.g"
#line 1043 "./glsl.g"
case 55: {
// nothing to do.
} break;
#line 1049 "./glsl.g"
#line 1050 "./glsl.g"
case 56: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_BitwiseOr, expression(1), expression(3));
} break;
#line 1056 "./glsl.g"
#line 1057 "./glsl.g"
case 57: {
// nothing to do.
} break;
#line 1063 "./glsl.g"
#line 1064 "./glsl.g"
case 58: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_LogicalAnd, expression(1), expression(3));
} break;
#line 1070 "./glsl.g"
#line 1071 "./glsl.g"
case 59: {
// nothing to do.
} break;
#line 1077 "./glsl.g"
#line 1078 "./glsl.g"
case 60: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_LogicalXor, expression(1), expression(3));
} break;
#line 1084 "./glsl.g"
#line 1085 "./glsl.g"
case 61: {
// nothing to do.
} break;
#line 1091 "./glsl.g"
#line 1092 "./glsl.g"
case 62: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_LogicalOr, expression(1), expression(3));
} break;
#line 1098 "./glsl.g"
#line 1099 "./glsl.g"
case 63: {
// nothing to do.
} break;
#line 1105 "./glsl.g"
#line 1106 "./glsl.g"
case 64: {
ast(1) = makeAstNode<TernaryExpressionAST>(AST::Kind_Conditional, expression(1), expression(3), expression(5));
} break;
#line 1112 "./glsl.g"
#line 1113 "./glsl.g"
case 65: {
// nothing to do.
} break;
#line 1119 "./glsl.g"
#line 1120 "./glsl.g"
case 66: {
ast(1) = makeAstNode<AssignmentExpressionAST>(sym(2).kind, expression(1), expression(3));
} break;
#line 1126 "./glsl.g"
#line 1127 "./glsl.g"
case 67: {
sym(1).kind = AST::Kind_Assign;
} break;
#line 1133 "./glsl.g"
#line 1134 "./glsl.g"
case 68: {
sym(1).kind = AST::Kind_AssignMultiply;
} break;
#line 1140 "./glsl.g"
#line 1141 "./glsl.g"
case 69: {
sym(1).kind = AST::Kind_AssignDivide;
} break;
#line 1147 "./glsl.g"
#line 1148 "./glsl.g"
case 70: {
sym(1).kind = AST::Kind_AssignModulus;
} break;
#line 1154 "./glsl.g"
#line 1155 "./glsl.g"
case 71: {
sym(1).kind = AST::Kind_AssignPlus;
} break;
#line 1161 "./glsl.g"
#line 1162 "./glsl.g"
case 72: {
sym(1).kind = AST::Kind_AssignMinus;
} break;
#line 1168 "./glsl.g"
#line 1169 "./glsl.g"
case 73: {
sym(1).kind = AST::Kind_AssignShiftLeft;
} break;
#line 1175 "./glsl.g"
#line 1176 "./glsl.g"
case 74: {
sym(1).kind = AST::Kind_AssignShiftRight;
} break;
#line 1182 "./glsl.g"
#line 1183 "./glsl.g"
case 75: {
sym(1).kind = AST::Kind_AssignAnd;
} break;
#line 1189 "./glsl.g"
#line 1190 "./glsl.g"
case 76: {
sym(1).kind = AST::Kind_AssignXor;
} break;
#line 1196 "./glsl.g"
#line 1197 "./glsl.g"
case 77: {
sym(1).kind = AST::Kind_AssignOr;
} break;
#line 1203 "./glsl.g"
#line 1204 "./glsl.g"
case 78: {
// nothing to do.
} break;
#line 1210 "./glsl.g"
#line 1211 "./glsl.g"
case 79: {
ast(1) = makeAstNode<BinaryExpressionAST>(AST::Kind_Comma, expression(1), expression(3));
} break;
#line 1217 "./glsl.g"
#line 1218 "./glsl.g"
case 80: {
// nothing to do.
} break;
#line 1224 "./glsl.g"
#line 1225 "./glsl.g"
case 81: {
// nothing to do.
} break;
#line 1231 "./glsl.g"
#line 1232 "./glsl.g"
case 82: {
ast(1) = makeAstNode<InitDeclarationAST>(sym(1).declaration_list);
} break;
#line 1238 "./glsl.g"
#line 1239 "./glsl.g"
case 83: {
ast(1) = makeAstNode<PrecisionDeclarationAST>(sym(2).precision, type(3));
} break;
#line 1245 "./glsl.g"
#line 1246 "./glsl.g"
case 84: {
if (sym(1).type_qualifier.qualifier != QualifiedTypeAST::Struct) {
......@@ -741,7 +742,7 @@ case 84: {
ast(1) = makeAstNode<TypeDeclarationAST>(type);
} break;
#line 1256 "./glsl.g"
#line 1257 "./glsl.g"
case 85: {