Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
29d9f099
Commit
29d9f099
authored
Jul 24, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 24, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added "Expected '('" error.
parent
98223b96
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
14 deletions
+35
-14
jscript_En.rc
dlls/jscript/jscript_En.rc
+1
-0
parser.y
dlls/jscript/parser.y
+26
-14
resource.h
dlls/jscript/resource.h
+1
-0
api.js
dlls/jscript/tests/api.js
+7
-0
No files found.
dlls/jscript/jscript_En.rc
View file @
29d9f099
...
...
@@ -27,6 +27,7 @@ STRINGTABLE DISCARDABLE
IDS_NO_PROPERTY "Object doesn't support this property or method"
IDS_ARG_NOT_OPT "Argument not optional"
IDS_SYNTAX_ERROR "Syntax error"
IDS_LBRACKET "Expected '('"
IDS_NOT_FUNC "Function expected"
IDS_NOT_DATE "'[object]' is not a date object"
IDS_NOT_NUM "Number expected"
...
...
dlls/jscript/parser.y
View file @
29d9f099
...
...
@@ -25,6 +25,7 @@
#define YYPARSE_PARAM ctx
static int parser_error(const char*);
static void set_error(parser_ctx_t*,UINT);
static BOOL allow_auto_semicolon(parser_ctx_t*);
static void program_parsed(parser_ctx_t*,source_elements_t*);
static source_elements_t *function_body_parsed(parser_ctx_t*,source_elements_t*);
...
...
@@ -266,7 +267,7 @@ SourceElements
/* ECMA-262 3rd Edition 13 */
FunctionExpression
: KFunction Identifier_opt
'('
FormalParameterList_opt ')' '{' FunctionBody '}'
: KFunction Identifier_opt
left_bracket
FormalParameterList_opt ')' '{' FunctionBody '}'
{ $$ = new_function_expression(ctx, $2, $4, $7, $1, $8-$1+1); }
KFunction
...
...
@@ -379,24 +380,24 @@ ExpressionStatement
/* ECMA-262 3rd Edition 12.5 */
IfStatement
: kIF
'('
Expression ')' Statement kELSE Statement
: kIF
left_bracket
Expression ')' Statement kELSE Statement
{ $$ = new_if_statement(ctx, $3, $5, $7); }
| kIF
'('
Expression ')' Statement %prec LOWER_THAN_ELSE
| kIF
left_bracket
Expression ')' Statement %prec LOWER_THAN_ELSE
{ $$ = new_if_statement(ctx, $3, $5, NULL); }
/* ECMA-262 3rd Edition 12.6 */
IterationStatement
: kDO Statement kWHILE
'('
Expression ')' semicolon_opt
: kDO Statement kWHILE
left_bracket
Expression ')' semicolon_opt
{ $$ = new_while_statement(ctx, TRUE, $5, $2); }
| kWHILE
'('
Expression ')' Statement
| kWHILE
left_bracket
Expression ')' Statement
{ $$ = new_while_statement(ctx, FALSE, $3, $5); }
| kFOR
'('
ExpressionNoIn_opt ';' Expression_opt ';' Expression_opt ')' Statement
| kFOR
left_bracket
ExpressionNoIn_opt ';' Expression_opt ';' Expression_opt ')' Statement
{ $$ = new_for_statement(ctx, NULL, $3, $5, $7, $9); }
| kFOR
'('
kVAR VariableDeclarationListNoIn ';' Expression_opt ';' Expression_opt ')' Statement
| kFOR
left_bracket
kVAR VariableDeclarationListNoIn ';' Expression_opt ';' Expression_opt ')' Statement
{ $$ = new_for_statement(ctx, $4, NULL, $6, $8, $10); }
| kFOR
'('
LeftHandSideExpression kIN Expression ')' Statement
| kFOR
left_bracket
LeftHandSideExpression kIN Expression ')' Statement
{ $$ = new_forin_statement(ctx, NULL, $3, $5, $7); }
| kFOR
'('
kVAR VariableDeclarationNoIn kIN Expression ')' Statement
| kFOR
left_bracket
kVAR VariableDeclarationNoIn kIN Expression ')' Statement
{ $$ = new_forin_statement(ctx, $4, NULL, $6, $8); }
/* ECMA-262 3rd Edition 12.7 */
...
...
@@ -416,7 +417,7 @@ ReturnStatement
/* ECMA-262 3rd Edition 12.10 */
WithStatement
: kWITH
'('
Expression ')' Statement
: kWITH
left_bracket
Expression ')' Statement
{ $$ = new_with_statement(ctx, $3, $5); }
/* ECMA-262 3rd Edition 12.12 */
...
...
@@ -426,8 +427,8 @@ LabelledStatement
/* ECMA-262 3rd Edition 12.11 */
SwitchStatement
: kSWITCH
'('
Expression ')' CaseBlock
{ $$ = new_switch_statement(ctx, $3, $5); }
: kSWITCH
left_bracket
Expression ')' CaseBlock
{ $$ = new_switch_statement(ctx, $3, $5); }
/* ECMA-262 3rd Edition 12.11 */
CaseBlock
...
...
@@ -471,8 +472,8 @@ TryStatement
/* ECMA-262 3rd Edition 12.14 */
Catch
: kCATCH
'('
tIdentifier ')' Block
{ $$ = new_catch_block(ctx, $3, $5); }
: kCATCH
left_bracket
tIdentifier ')' Block
{ $$ = new_catch_block(ctx, $3, $5); }
/* ECMA-262 3rd Edition 12.14 */
Finally
...
...
@@ -493,6 +494,7 @@ Expression
ExpressionNoIn_opt
: /* empty */ { $$ = NULL; }
| ExpressionNoIn { $$ = $1; }
| error { set_error(ctx, IDS_SYNTAX_ERROR); YYABORT; }
/* ECMA-262 3rd Edition 11.14 */
ExpressionNoIn
...
...
@@ -796,6 +798,10 @@ semicolon_opt
: ';'
| error { if(!allow_auto_semicolon(ctx)) {YYABORT;} }
left_bracket
: '('
| error { set_error(ctx, IDS_LBRACKET); YYABORT; }
%%
static BOOL allow_auto_semicolon(parser_ctx_t *ctx)
...
...
@@ -1434,6 +1440,12 @@ static int parser_error(const char *str)
return 0;
}
static void set_error(parser_ctx_t *ctx, UINT error)
{
ctx->hres = JSCRIPT_ERROR|error;
}
static expression_t *new_identifier_expression(parser_ctx_t *ctx, const WCHAR *identifier)
{
identifier_expression_t *ret = parser_alloc(ctx, sizeof(identifier_expression_t));
...
...
dlls/jscript/resource.h
View file @
29d9f099
...
...
@@ -23,6 +23,7 @@
#define IDS_NO_PROPERTY 0x01B6
#define IDS_ARG_NOT_OPT 0x01c1
#define IDS_SYNTAX_ERROR 0x03EA
#define IDS_LBRACKET 0x03ED
#define IDS_NOT_FUNC 0x138A
#define IDS_NOT_DATE 0x138E
#define IDS_NOT_NUM 0x1389
...
...
dlls/jscript/tests/api.js
View file @
29d9f099
...
...
@@ -1318,5 +1318,12 @@ exception_test(function() {arr.toString = Function.prototype.toString; arr.toStr
exception_test
(
function
()
{
date
();},
"TypeError"
,
-
2146823286
);
exception_test
(
function
()
{
arr
();},
"TypeError"
,
-
2146823286
);
exception_test
(
function
()
{
eval
(
"for(i=0;) {}"
);},
"SyntaxError"
,
-
2146827286
);
exception_test
(
function
()
{
eval
(
"function {};"
);},
"SyntaxError"
,
-
2146827283
);
exception_test
(
function
()
{
eval
(
"if"
);},
"SyntaxError"
,
-
2146827283
);
exception_test
(
function
()
{
eval
(
"do i=0; while"
);},
"SyntaxError"
,
-
2146827283
);
exception_test
(
function
()
{
eval
(
"while"
);},
"SyntaxError"
,
-
2146827283
);
exception_test
(
function
()
{
eval
(
"for"
);},
"SyntaxError"
,
-
2146827283
);
exception_test
(
function
()
{
eval
(
"with"
);},
"SyntaxError"
,
-
2146827283
);
exception_test
(
function
()
{
eval
(
"switch"
);},
"SyntaxError"
,
-
2146827283
);
reportSuccess
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment