fixed keywords with question marks

This commit is contained in:
Justin Meza 2013-02-26 21:35:54 -05:00
parent 78b8308da1
commit e58ece8ef7
2 changed files with 16 additions and 2 deletions

View File

@ -2897,6 +2897,13 @@ StmtNode *parseIfThenElseStmtNode(Token ***tokenp)
goto parseIfThenElseStmtNodeAbort;
}
/* Remove the question mark from the token stream */
status = acceptToken(&tokens, TT_QUESTION);
if (!status) {
parser_error_expected_token(TT_QUESTION, tokens);
goto parseIfThenElseStmtNodeAbort;
}
/* The if keyword must appear on its own line */
if (!acceptToken(&tokens, TT_NEWLINE)) {
parser_error(PR_EXPECTED_END_OF_EXPRESSION, tokens);
@ -3050,6 +3057,13 @@ StmtNode *parseSwitchStmtNode(Token ***tokenp)
goto parseSwitchStmtNodeAbort;
}
/* Remove the question mark from the token stream */
status = acceptToken(&tokens, TT_QUESTION);
if (!status) {
parser_error_expected_token(TT_QUESTION, tokens);
goto parseSwitchStmtNodeAbort;
}
/* The switch keyword must appear on its own line */
status = acceptToken(&tokens, TT_NEWLINE);
if (!status) {

View File

@ -158,12 +158,12 @@ static const char *keywords[] = {
"SMOOSH", /* TT_SMOOSH */
"!", /* TT_BANG */
"GIMMEH", /* TT_GIMMEH */
"O RLY?", /* TT_ORLY */
"O RLY", /* TT_ORLY */
"YA RLY", /* TT_YARLY */
"MEBBE", /* TT_MEBBE */
"NO WAI", /* TT_NOWAI */
"OIC", /* TT_OIC */
"WTF?", /* TT_WTF */
"WTF", /* TT_WTF */
"OMG", /* TT_OMG */
"OMGWTF", /* TT_OMGWTF */
"GTFO", /* TT_GTFO */