1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

some csharp parser fixes

This commit is contained in:
Kevin Glynn 2011-03-11 11:10:11 +01:00
parent 77ea92d5d6
commit 409084a283

View File

@ -48,6 +48,7 @@ tokens {
APPLY; APPLY;
ARGS; ARGS;
NEW; NEW;
NEWARRAY;
STATIC_CONSTRUCTOR; STATIC_CONSTRUCTOR;
RETURN = 'return'; RETURN = 'return';
@ -257,10 +258,12 @@ public primary_expression:
| primary_expression_start primary_expression_part* | primary_expression_start primary_expression_part*
| 'new' ( (object_creation_expression ('.'|'->'|'[')) => | 'new' ( (object_creation_expression ('.'|'->'|'[')) =>
object_creation_expression primary_expression_part+ // new Foo(arg, arg).Member object_creation_expression primary_expression_part+ // new Foo(arg, arg).Member
// try the simple one first, this has no argS and no expressions // (try the simple one first, this has no argS and no expressions
// symantically could be object creation // symantically could be object creation)
| (delegate_creation_expression) => delegate_creation_expression// new FooDelegate (MyFunction) // keving: try object_creation_expression first, it could be new type ( xx ) {}
| object_creation_expression // can also match delegate_creation, will have to distinguish in NetMaker.g
| (object_creation_expression) => object_creation_expression
| delegate_creation_expression // new FooDelegate (MyFunction)
| anonymous_object_creation_expression) // new {int X, string Y} | anonymous_object_creation_expression) // new {int X, string Y}
| sizeof_expression // sizeof (struct) | sizeof_expression // sizeof (struct)
| checked_expression // checked (... | checked_expression // checked (...
@ -407,7 +410,7 @@ public element_initializer:
public object_initializer: public object_initializer:
member_initializer_list? ','? '}' ; member_initializer_list? ','? '}' ;
public member_initializer_list: public member_initializer_list:
member_initializer (',' member_initializer) ; member_initializer (',' member_initializer)* ;
public member_initializer: public member_initializer:
identifier '=' initializer_value ; identifier '=' initializer_value ;
public initializer_value: public initializer_value:
@ -753,7 +756,7 @@ public get_accessor_declaration:
public set_accessor_declaration: public set_accessor_declaration:
accessor_modifier? 'set' accessor_body ; accessor_modifier? 'set' accessor_body ;
public accessor_modifier: public accessor_modifier:
'public' | 'protected' | 'private' | 'internal' ; 'protected' 'internal'? | 'private' | 'internal' 'protected'?;
public accessor_body: public accessor_body:
block ; block ;