@ -54,7 +54,7 @@ namespace Mono.CSharp
/// </summary>
/// </summary>
Block current_block;
Block current_block;
BlockVariableDeclaration current_variable;
BlockVariable current_variable;
Delegate current_delegate;
Delegate current_delegate;
@ -426,7 +426,7 @@ extern_alias_directives
extern_alias_directive
extern_alias_directive
: EXTERN_ALIAS IDENTIFIER IDENTIFIER SEMICOLON
: EXTERN_ALIAS IDENTIFIER IDENTIFIER SEMICOLON
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
string s = lt.Value;
string s = lt.Value;
if (s != "alias") {
if (s != "alias") {
syntax_error (lt.Location, "`alias' expected");
syntax_error (lt.Location, "`alias' expected");
@ -434,7 +434,7 @@ extern_alias_directive
if (lang_version == LanguageVersion.ISO_1)
if (lang_version == LanguageVersion.ISO_1)
FeatureIsNotAvailable (lt.Location, "external alias");
FeatureIsNotAvailable (lt.Location, "external alias");
lt = (Tokenizer. LocatedToken) $3;
lt = (LocatedToken) $3;
if (lt.Value == QualifiedAliasMember.GlobalAlias) {
if (lt.Value == QualifiedAliasMember.GlobalAlias) {
RootNamespace.Error_GlobalNamespaceRedefined (report, lt.Location);
RootNamespace.Error_GlobalNamespaceRedefined (report, lt.Location);
}
}
@ -474,7 +474,7 @@ using_namespace
}
}
| USING IDENTIFIER ASSIGN namespace_or_type_expr SEMICOLON
| USING IDENTIFIER ASSIGN namespace_or_type_expr SEMICOLON
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
if (lang_version != LanguageVersion.ISO_1 && lt.Value == "global") {
if (lang_version != LanguageVersion.ISO_1 && lt.Value == "global") {
report.Warning (440, 2, lt.Location,
report.Warning (440, 2, lt.Location,
"An alias named `global' will not be used when resolving `global::'. The global namespace will be used instead");
"An alias named `global' will not be used when resolving `global::'. The global namespace will be used instead");
@ -563,15 +563,14 @@ opt_semicolon_error
namespace_name
namespace_name
: IDENTIFIER
: IDENTIFIER
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = new MemberName (lt.Value, lt.Location);
$$ = new MemberName (lt.Value, lt.Location);
}
}
| namespace_name DOT IDENTIFIER
| namespace_name DOT IDENTIFIER
{
{
var lt = (Tokenizer.LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new MemberName ((MemberName) $1, lt.Value, lt.Location) {
$$ = new MemberName ((MemberName) $1, lt.Value, lt.Location);
DotLocation = GetLocation ($2)
lbag.AddLocation ($$, GetLocation ($2));
};
}
}
| error
| error
{
{
@ -747,7 +746,7 @@ attribute_section_cont
{
{
Error_SyntaxError (yyToken);
Error_SyntaxError (yyToken);
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
var tne = new SimpleName (lt.Value, null, lt.Location);
var tne = new SimpleName (lt.Value, null, lt.Location);
$$ = new List<Attribute> () {
$$ = new List<Attribute> () {
@ -764,7 +763,7 @@ attribute_section_cont
attribute_target
attribute_target
: IDENTIFIER
: IDENTIFIER
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = CheckAttributeTarget (lt.Value, lt.Location);
$$ = CheckAttributeTarget (lt.Value, lt.Location);
savedCloseLocation = GetLocation ($1);
savedCloseLocation = GetLocation ($1);
}
}
@ -894,14 +893,14 @@ named_attribute_argument
expression
expression
{
{
--lexer.parsing_block;
--lexer.parsing_block;
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4);
$$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4);
lbag.AddLocation ($$, GetLocation($2));
lbag.AddLocation ($$, GetLocation($2));
}
}
;
;
named_argument
named_argument
: identifier_inside_body COLON opt_named_modifier expression
: identifier_inside_body COLON opt_named_modifier expression_or_error
{
{
if (lang_version <= LanguageVersion.V_3)
if (lang_version <= LanguageVersion.V_3)
FeatureIsNotAvailable (GetLocation ($1), "named argument");
FeatureIsNotAvailable (GetLocation ($1), "named argument");
@ -909,7 +908,7 @@ named_argument
// Avoid boxing in common case (no modifier)
// Avoid boxing in common case (no modifier)
var arg_mod = $3 == null ? Argument.AType.None : (Argument.AType) $3;
var arg_mod = $3 == null ? Argument.AType.None : (Argument.AType) $3;
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4, arg_mod);
$$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4, arg_mod);
lbag.AddLocation ($$, GetLocation($2));
lbag.AddLocation ($$, GetLocation($2));
}
}
@ -1023,7 +1022,7 @@ constant_declaration
opt_modifiers
opt_modifiers
CONST type IDENTIFIER
CONST type IDENTIFIER
{
{
var lt = (Tokenizer. LocatedToken) $5;
var lt = (LocatedToken) $5;
var mod = (Modifiers) $2;
var mod = (Modifiers) $2;
current_field = new Const (current_type, (FullNamedExpression) $4, mod, new MemberName (lt.Value, lt.Location), (Attributes) $1);
current_field = new Const (current_type, (FullNamedExpression) $4, mod, new MemberName (lt.Value, lt.Location), (Attributes) $1);
current_type.AddMember (current_field);
current_type.AddMember (current_field);
@ -1074,7 +1073,7 @@ constant_declarators
constant_declarator
constant_declarator
: COMMA IDENTIFIER constant_initializer
: COMMA IDENTIFIER constant_initializer
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (ConstInitializer) $3);
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (ConstInitializer) $3);
lbag.AddLocation ($$, GetLocation ($1));
lbag.AddLocation ($$, GetLocation ($1));
}
}
@ -1114,7 +1113,7 @@ field_declaration
if (type.Type != null && type.Type.Kind == MemberKind.Void)
if (type.Type != null && type.Type.Kind == MemberKind.Void)
report.Error (670, GetLocation ($3), "Fields cannot have void type");
report.Error (670, GetLocation ($3), "Fields cannot have void type");
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
current_field = new Field (current_type, type, (Modifiers) $2, new MemberName (lt.Value, lt.Location), (Attributes) $1);
current_field = new Field (current_type, type, (Modifiers) $2, new MemberName (lt.Value, lt.Location), (Attributes) $1);
current_type.AddField (current_field);
current_type.AddField (current_field);
$$ = current_field;
$$ = current_field;
@ -1139,7 +1138,7 @@ field_declaration
if (lang_version < LanguageVersion.ISO_2)
if (lang_version < LanguageVersion.ISO_2)
FeatureIsNotAvailable (GetLocation ($3), "fixed size buffers");
FeatureIsNotAvailable (GetLocation ($3), "fixed size buffers");
var lt = (Tokenizer. LocatedToken) $5;
var lt = (LocatedToken) $5;
current_field = new FixedField (current_type, (FullNamedExpression) $4, (Modifiers) $2,
current_field = new FixedField (current_type, (FullNamedExpression) $4, (Modifiers) $2,
new MemberName (lt.Value, lt.Location), (Attributes) $1);
new MemberName (lt.Value, lt.Location), (Attributes) $1);
@ -1203,7 +1202,7 @@ field_declarators
field_declarator
field_declarator
: COMMA IDENTIFIER
: COMMA IDENTIFIER
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null);
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null);
lbag.AddLocation ($$, GetLocation ($1));
lbag.AddLocation ($$, GetLocation ($1));
}
}
@ -1214,7 +1213,7 @@ field_declarator
variable_initializer
variable_initializer
{
{
--lexer.parsing_block;
--lexer.parsing_block;
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) $5);
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) $5);
lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3));
lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3));
}
}
@ -1239,7 +1238,7 @@ fixed_field_declarators
fixed_field_declarator
fixed_field_declarator
: COMMA IDENTIFIER fixed_field_size
: COMMA IDENTIFIER fixed_field_size
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (ConstInitializer) $3);
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (ConstInitializer) $3);
lbag.AddLocation ($$, GetLocation ($1));
lbag.AddLocation ($$, GetLocation ($1));
}
}
@ -1383,8 +1382,10 @@ method_header
current_type.AddMember (method);
current_type.AddMember (method);
if ($11 != null)
async_block = (method.ModFlags & Modifiers.ASYNC) != 0;
method.SetConstraints ((List<Constraints>) $11);
if ($12 != null)
method.SetConstraints ((List<Constraints>) $12);
if (doc_support)
if (doc_support)
method.DocComment = Lexer.consume_doc_comment ();
method.DocComment = Lexer.consume_doc_comment ();
@ -1561,7 +1562,7 @@ fixed_parameter
parameter_type
parameter_type
identifier_inside_body
identifier_inside_body
{
{
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
$$ = new Parameter ((FullNamedExpression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location);
$$ = new Parameter ((FullNamedExpression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location);
lbag.AddLocation ($$, parameterModifierLocation);
lbag.AddLocation ($$, parameterModifierLocation);
}
}
@ -1570,7 +1571,7 @@ fixed_parameter
parameter_type
parameter_type
identifier_inside_body OPEN_BRACKET CLOSE_BRACKET
identifier_inside_body OPEN_BRACKET CLOSE_BRACKET
{
{
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
report.Error (1552, lt.Location, "Array type specifier, [], must appear before parameter name");
report.Error (1552, lt.Location, "Array type specifier, [], must appear before parameter name");
$$ = new Parameter ((FullNamedExpression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location);
$$ = new Parameter ((FullNamedExpression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location);
lbag.AddLocation ($$, parameterModifierLocation);
lbag.AddLocation ($$, parameterModifierLocation);
@ -1629,7 +1630,7 @@ fixed_parameter
if ((valid_param_mod & ParameterModifierType.DefaultValue) == 0)
if ((valid_param_mod & ParameterModifierType.DefaultValue) == 0)
report.Error (1065, GetLocation ($5), "Optional parameter is not valid in this context");
report.Error (1065, GetLocation ($5), "Optional parameter is not valid in this context");
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
$$ = new Parameter ((FullNamedExpression) $3, lt.Value, mod, (Attributes) $1, lt.Location);
$$ = new Parameter ((FullNamedExpression) $3, lt.Value, mod, (Attributes) $1, lt.Location);
lbag.AddLocation ($$, parameterModifierLocation, GetLocation ($5)); // parameterModifierLocation should be ignored when mod == NONE
lbag.AddLocation ($$, parameterModifierLocation, GetLocation ($5)); // parameterModifierLocation should be ignored when mod == NONE
@ -1701,7 +1702,7 @@ parameter_modifier
parameter_array
parameter_array
: opt_attributes params_modifier type IDENTIFIER
: opt_attributes params_modifier type IDENTIFIER
{
{
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
$$ = new ParamsParameter ((FullNamedExpression) $3, lt.Value, (Attributes) $1, lt.Location);
$$ = new ParamsParameter ((FullNamedExpression) $3, lt.Value, (Attributes) $1, lt.Location);
lbag.AddLocation ($$, savedLocation);
lbag.AddLocation ($$, savedLocation);
}
}
@ -1709,7 +1710,7 @@ parameter_array
{
{
report.Error (1751, GetLocation ($2), "Cannot specify a default value for a parameter array");
report.Error (1751, GetLocation ($2), "Cannot specify a default value for a parameter array");
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
$$ = new ParamsParameter ((FullNamedExpression) $3, lt.Value, (Attributes) $1, lt.Location);
$$ = new ParamsParameter ((FullNamedExpression) $3, lt.Value, (Attributes) $1, lt.Location);
lbag.AddLocation ($$, savedLocation);
lbag.AddLocation ($$, savedLocation);
}
}
@ -2135,11 +2136,11 @@ operator_declarator
Operator.GetName (op));
Operator.GetName (op));
}
}
} else {
} else {
if (p_count > 2) {
if (p_count == 1) {
report.Error (1019, loc, "Overloadable unary operator expected");
} else if (p_count != 2) {
report.Error (1534, loc, "Overloaded binary operator `{0}' takes two parameters",
report.Error (1534, loc, "Overloaded binary operator `{0}' takes two parameters",
Operator.GetName (op));
Operator.GetName (op));
} else if (p_count != 2) {
report.Error (1019, loc, "Overloadable unary operator expected");
}
}
}
}
@ -2276,7 +2277,7 @@ constructor_declarator
valid_param_mod = 0;
valid_param_mod = 0;
current_local_parameters = (ParametersCompiled) $6;
current_local_parameters = (ParametersCompiled) $6;
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
var mods = (Modifiers) $2;
var mods = (Modifiers) $2;
var c = new Constructor (current_type, lt.Value, mods, (Attributes) $1, current_local_parameters, lt.Location);
var c = new Constructor (current_type, lt.Value, mods, (Attributes) $1, current_local_parameters, lt.Location);
@ -2373,7 +2374,7 @@ destructor_declaration
}
}
IDENTIFIER OPEN_PARENS CLOSE_PARENS method_body
IDENTIFIER OPEN_PARENS CLOSE_PARENS method_body
{
{
var lt = (Tokenizer. LocatedToken) $5;
var lt = (LocatedToken) $5;
if (lt.Value != current_container.MemberName.Name){
if (lt.Value != current_container.MemberName.Name){
report.Error (574, lt.Location, "Name of destructor must match name of class");
report.Error (574, lt.Location, "Name of destructor must match name of class");
} else if (current_container.Kind != MemberKind.Class){
} else if (current_container.Kind != MemberKind.Class){
@ -2496,7 +2497,7 @@ event_declarators
event_declarator
event_declarator
: COMMA IDENTIFIER
: COMMA IDENTIFIER
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null);
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null);
lbag.AddLocation ($$, GetLocation ($1));
lbag.AddLocation ($$, GetLocation ($1));
}
}
@ -2507,7 +2508,7 @@ event_declarator
event_variable_initializer
event_variable_initializer
{
{
--lexer.parsing_block;
--lexer.parsing_block;
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) $5);
$$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) $5);
lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3));
lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3));
}
}
@ -2729,7 +2730,7 @@ enum_member_declarations
enum_member_declaration
enum_member_declaration
: opt_attributes IDENTIFIER
: opt_attributes IDENTIFIER
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) $1);
var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) $1);
((Enum) current_type).AddEnumMember (em);
((Enum) current_type).AddEnumMember (em);
@ -2752,7 +2753,7 @@ enum_member_declaration
{
{
--lexer.parsing_block;
--lexer.parsing_block;
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) $1);
var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) $1);
em.Initializer = new ConstInitializer (em, (Expression) $5, GetLocation ($4));
em.Initializer = new ConstInitializer (em, (Expression) $5, GetLocation ($4));
((Enum) current_type).AddEnumMember (em);
((Enum) current_type).AddEnumMember (em);
@ -2766,7 +2767,7 @@ enum_member_declaration
{
{
Error_SyntaxError (yyToken);
Error_SyntaxError (yyToken);
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) $1);
var em = new EnumMember ((Enum) current_type, new MemberName (lt.Value, lt.Location), (Attributes) $1);
((Enum) current_type).AddEnumMember (em);
((Enum) current_type).AddEnumMember (em);
@ -2840,8 +2841,8 @@ namespace_or_type_expr
: member_name
: member_name
| qualified_alias_member IDENTIFIER opt_type_argument_list
| qualified_alias_member IDENTIFIER opt_type_argument_list
{
{
var lt1 = (Tokenizer. LocatedToken) $1;
var lt1 = (LocatedToken) $1;
var lt2 = (Tokenizer. LocatedToken) $2;
var lt2 = (LocatedToken) $2;
$$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) $3, lt1.Location);
$$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) $3, lt1.Location);
lbag.AddLocation ($$, savedLocation, GetLocation ($2));
lbag.AddLocation ($$, savedLocation, GetLocation ($2));
@ -2852,17 +2853,16 @@ member_name
: simple_name_expr
: simple_name_expr
| namespace_or_type_expr DOT IDENTIFIER opt_type_argument_list
| namespace_or_type_expr DOT IDENTIFIER opt_type_argument_list
{
{
var lt = (Tokenizer.LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location) {
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location);
DotLocation = GetLocation ($2)
lbag.AddLocation ($$, GetLocation ($2));
};
}
}
;
;
simple_name_expr
simple_name_expr
: IDENTIFIER opt_type_argument_list
: IDENTIFIER opt_type_argument_list
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = new SimpleName (lt.Value, (TypeArguments)$2, lt.Location);
$$ = new SimpleName (lt.Value, (TypeArguments)$2, lt.Location);
}
}
;
;
@ -2918,7 +2918,7 @@ type_declaration_name
opt_type_parameter_list
opt_type_parameter_list
{
{
lexer.parsing_generic_declaration = false;
lexer.parsing_generic_declaration = false;
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = new MemberName (lt.Value, (TypeParameters)$3, lt.Location);
$$ = new MemberName (lt.Value, (TypeParameters)$3, lt.Location);
}
}
;
;
@ -2938,7 +2938,7 @@ method_declaration_name
| explicit_interface IDENTIFIER opt_type_parameter_list
| explicit_interface IDENTIFIER opt_type_parameter_list
{
{
lexer.parsing_generic_declaration = false;
lexer.parsing_generic_declaration = false;
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new MemberName (lt.Value, (TypeParameters) $3, (ATypeNameExpression) $1, lt.Location);
$$ = new MemberName (lt.Value, (TypeParameters) $3, (ATypeNameExpression) $1, lt.Location);
}
}
;
;
@ -2959,21 +2959,21 @@ indexer_declaration_name
explicit_interface
explicit_interface
: IDENTIFIER opt_type_argument_list DOT
: IDENTIFIER opt_type_argument_list DOT
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = new SimpleName (lt.Value, (TypeArguments) $2, lt.Location);
$$ = new SimpleName (lt.Value, (TypeArguments) $2, lt.Location);
lbag.AddLocation ($$, GetLocation ($3));
lbag.AddLocation ($$, GetLocation ($3));
}
}
| qualified_alias_member IDENTIFIER opt_type_argument_list DOT
| qualified_alias_member IDENTIFIER opt_type_argument_list DOT
{
{
var lt1 = (Tokenizer. LocatedToken) $1;
var lt1 = (LocatedToken) $1;
var lt2 = (Tokenizer. LocatedToken) $2;
var lt2 = (LocatedToken) $2;
$$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) $3, lt1.Location);
$$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) $3, lt1.Location);
lbag.AddLocation ($$, savedLocation, GetLocation ($4));
lbag.AddLocation ($$, savedLocation, GetLocation ($4));
}
}
| explicit_interface IDENTIFIER opt_type_argument_list DOT
| explicit_interface IDENTIFIER opt_type_argument_list DOT
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new MemberAccess ((ATypeNameExpression) $1, lt.Value, (TypeArguments) $3, lt.Location);
$$ = new MemberAccess ((ATypeNameExpression) $1, lt.Value, (TypeArguments) $3, lt.Location);
lbag.AddLocation ($$, GetLocation ($4));
lbag.AddLocation ($$, GetLocation ($4));
}
}
@ -3014,7 +3014,7 @@ type_parameters
type_parameter
type_parameter
: opt_attributes opt_type_parameter_variance IDENTIFIER
: opt_attributes opt_type_parameter_variance IDENTIFIER
{
{
var lt = (Tokenizer. LocatedToken)$3;
var lt = (LocatedToken)$3;
var variance = (Variance) $2;
var variance = (Variance) $2;
$$ = new TypeParameter (new MemberName (lt.Value, lt.Location), (Attributes)$1, variance);
$$ = new TypeParameter (new MemberName (lt.Value, lt.Location), (Attributes)$1, variance);
if (variance != Variance.None)
if (variance != Variance.None)
@ -3202,11 +3202,11 @@ primary_expression
primary_expression_or_type
primary_expression_or_type
: IDENTIFIER opt_type_argument_list
: IDENTIFIER opt_type_argument_list
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = new SimpleName (lt.Value, (TypeArguments)$2, lt.Location);
$$ = new SimpleName (lt.Value, (TypeArguments)$2, lt.Location);
}
}
| IDENTIFIER GENERATE_COMPLETION {
| IDENTIFIER GENERATE_COMPLETION {
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = new CompletionSimpleName (MemberName.MakeName (lt.Value, null), lt.Location);
$$ = new CompletionSimpleName (MemberName.MakeName (lt.Value, null), lt.Location);
}
}
| member_access
| member_access
@ -3259,29 +3259,26 @@ parenthesized_expression
member_access
member_access
: primary_expression DOT identifier_inside_body opt_type_argument_list
: primary_expression DOT identifier_inside_body opt_type_argument_list
{
{
var lt = (Tokenizer.LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location) {
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location);
DotLocation = GetLocation ($2)
lbag.AddLocation ($$, GetLocation ($2));
};
}
}
| builtin_types DOT identifier_inside_body opt_type_argument_list
| builtin_types DOT identifier_inside_body opt_type_argument_list
{
{
var lt = (Tokenizer.LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location) {
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location);
DotLocation = GetLocation ($2)
lbag.AddLocation ($$, GetLocation ($2));
};
}
}
| BASE DOT identifier_inside_body opt_type_argument_list
| BASE DOT identifier_inside_body opt_type_argument_list
{
{
var lt = (Tokenizer.LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new MemberAccess (new BaseThis (GetLocation ($1)), lt.Value, (TypeArguments) $4, lt.Location) {
$$ = new MemberAccess (new BaseThis (GetLocation ($1)), lt.Value, (TypeArguments) $4, lt.Location);
DotLocation = GetLocation ($2)
lbag.AddLocation ($$, GetLocation ($2));
};
}
}
| qualified_alias_member identifier_inside_body opt_type_argument_list
| qualified_alias_member identifier_inside_body opt_type_argument_list
{
{
var lt1 = (Tokenizer. LocatedToken) $1;
var lt1 = (LocatedToken) $1;
var lt2 = (Tokenizer. LocatedToken) $2;
var lt2 = (LocatedToken) $2;
$$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) $3, lt1.Location);
$$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (TypeArguments) $3, lt1.Location);
lbag.AddLocation ($$, savedLocation, GetLocation ($2));
lbag.AddLocation ($$, savedLocation, GetLocation ($2));
@ -3290,7 +3287,7 @@ member_access
$$ = new CompletionMemberAccess ((Expression) $1, null,GetLocation ($3));
$$ = new CompletionMemberAccess ((Expression) $1, null,GetLocation ($3));
}
}
| primary_expression DOT IDENTIFIER GENERATE_COMPLETION {
| primary_expression DOT IDENTIFIER GENERATE_COMPLETION {
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new CompletionMemberAccess ((Expression) $1, lt.Value, lt.Location);
$$ = new CompletionMemberAccess ((Expression) $1, lt.Value, lt.Location);
}
}
| builtin_types DOT GENERATE_COMPLETION
| builtin_types DOT GENERATE_COMPLETION
@ -3298,7 +3295,7 @@ member_access
$$ = new CompletionMemberAccess ((Expression) $1, null, lexer.Location);
$$ = new CompletionMemberAccess ((Expression) $1, null, lexer.Location);
}
}
| builtin_types DOT IDENTIFIER GENERATE_COMPLETION {
| builtin_types DOT IDENTIFIER GENERATE_COMPLETION {
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new CompletionMemberAccess ((Expression) $1, lt.Value, lt.Location);
$$ = new CompletionMemberAccess ((Expression) $1, lt.Value, lt.Location);
}
}
;
;
@ -3378,13 +3375,13 @@ member_initializer_list
member_initializer
member_initializer
: IDENTIFIER ASSIGN initializer_value
: IDENTIFIER ASSIGN initializer_value
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = new ElementInitializer (lt.Value, (Expression)$3, lt.Location);
$$ = new ElementInitializer (lt.Value, (Expression)$3, lt.Location);
lbag.AddLocation ($$, GetLocation ($2));
lbag.AddLocation ($$, GetLocation ($2));
}
}
| AWAIT ASSIGN initializer_value
| AWAIT ASSIGN initializer_value
{
{
var lt = (Tokenizer. LocatedToken) Error_AwaitAsIdentifier ($1);
var lt = (LocatedToken) Error_AwaitAsIdentifier ($1);
$$ = new ElementInitializer (lt.Value, (Expression)$3, lt.Location);
$$ = new ElementInitializer (lt.Value, (Expression)$3, lt.Location);
lbag.AddLocation ($$, GetLocation ($2));
lbag.AddLocation ($$, GetLocation ($2));
}
}
@ -3722,13 +3719,13 @@ anonymous_type_parameters
anonymous_type_parameter
anonymous_type_parameter
: identifier_inside_body ASSIGN variable_initializer
: identifier_inside_body ASSIGN variable_initializer
{
{
var lt = (Tokenizer. LocatedToken)$1;
var lt = (LocatedToken)$1;
$$ = new AnonymousTypeParameter ((Expression)$3, lt.Value, lt.Location);
$$ = new AnonymousTypeParameter ((Expression)$3, lt.Value, lt.Location);
lbag.AddLocation ($$, GetLocation ($2));
lbag.AddLocation ($$, GetLocation ($2));
}
}
| identifier_inside_body
| identifier_inside_body
{
{
var lt = (Tokenizer. LocatedToken)$1;
var lt = (LocatedToken)$1;
$$ = new AnonymousTypeParameter (new SimpleName (lt.Value, lt.Location),
$$ = new AnonymousTypeParameter (new SimpleName (lt.Value, lt.Location),
lt.Value, lt.Location);
lt.Value, lt.Location);
}
}
@ -3857,15 +3854,17 @@ typeof_type_expression
unbound_type_name
unbound_type_name
: identifier_inside_body generic_dimension
: identifier_inside_body generic_dimension
{
{
var lt = (Tokenizer.LocatedToken) $1;
var lt = (LocatedToken) $1;
var sn = new SimpleName (lt.Value, (int) $2, lt.Location);
var sn = new SimpleName (lt.Value, (int) $2, lt.Location);
$$ = sn;
$$ = sn;
lbag.AddLocation (sn.TypeArguments, Lexer.GetGenericDimensionLocations ());
lbag.AddLocation (sn.TypeArguments, Lexer.GetGenericDimensionLocations ());
}
}
| qualified_alias_member identifier_inside_body generic_dimension
| qualified_alias_member identifier_inside_body generic_dimension
{
{
var lt1 = (Tokenizer.LocatedToken) $1;
var lt1 = (LocatedToken) $1;
var lt2 = (Tokenizer.LocatedToken) $2;
var lt2 = (LocatedToken) $2;
var qam = new QualifiedAliasMember (lt1.Value, lt2.Value, (int) $3, lt1.Location);
var qam = new QualifiedAliasMember (lt1.Value, lt2.Value, (int) $3, lt1.Location);
$$ = qam;
$$ = qam;
lbag.AddLocation (qam.TypeArguments, Lexer.GetGenericDimensionLocations ());
lbag.AddLocation (qam.TypeArguments, Lexer.GetGenericDimensionLocations ());
@ -3873,20 +3872,18 @@ unbound_type_name
}
}
| unbound_type_name DOT identifier_inside_body
| unbound_type_name DOT identifier_inside_body
{
{
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new MemberAccess ((Expression) $1, lt.Value, lt.Location) {
$$ = new MemberAccess ((Expression) $1, lt.Value, lt.Location);
DotLocation = GetLocation ($2)
lbag.AddLocation ($$, savedLocation, GetLocation ($2));
};
}
}
| unbound_type_name DOT identifier_inside_body generic_dimension
| unbound_type_name DOT identifier_inside_body generic_dimension
{
{
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
var ma = new MemberAccess ((Expression) $1, lt.Value, (int) $4, lt.Location) {
var ma = new MemberAccess ((Expression) $1, lt.Value, (int) $4, lt.Location);
DotLocation = GetLocation ($2)
};
$$ = ma;
$$ = ma;
lbag.AddLocation ($$, savedLocation, GetLocation ($2));
lbag.AddLocation (ma.TypeArguments, Lexer.GetGenericDimensionLocations ());
lbag.AddLocation (ma.TypeArguments, Lexer.GetGenericDimensionLocations ());
}
}
| namespace_or_type_expr DOT identifier_inside_body generic_dimension
| namespace_or_type_expr DOT identifier_inside_body generic_dimension
@ -3895,10 +3892,8 @@ unbound_type_name
if (tne.HasTypeArguments)
if (tne.HasTypeArguments)
Error_TypeExpected (GetLocation ($4));
Error_TypeExpected (GetLocation ($4));
var lt = (Tokenizer.LocatedToken) $3;
var lt = (LocatedToken) $3;
var ma = new MemberAccess (tne, lt.Value, (int) $4, lt.Location) {
var ma = new MemberAccess (tne, lt.Value, (int) $4, lt.Location);
DotLocation = GetLocation ($2)
};
$$ = ma;
$$ = ma;
lbag.AddLocation (ma.TypeArguments, Lexer.GetGenericDimensionLocations ());
lbag.AddLocation (ma.TypeArguments, Lexer.GetGenericDimensionLocations ());
}
}
@ -3917,7 +3912,7 @@ generic_dimension
qualified_alias_member
qualified_alias_member
: IDENTIFIER DOUBLE_COLON
: IDENTIFIER DOUBLE_COLON
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
if (lang_version == LanguageVersion.ISO_1)
if (lang_version == LanguageVersion.ISO_1)
FeatureIsNotAvailable (lt.Location, "namespace alias qualifier");
FeatureIsNotAvailable (lt.Location, "namespace alias qualifier");
savedLocation = GetLocation ($2);
savedLocation = GetLocation ($2);
@ -3971,7 +3966,7 @@ unchecked_expression
pointer_member_access
pointer_member_access
: primary_expression OP_PTR IDENTIFIER opt_type_argument_list
: primary_expression OP_PTR IDENTIFIER opt_type_argument_list
{
{
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new MemberAccess (new Indirection ((Expression) $1, GetLocation ($2)), lt.Value, (TypeArguments) $4, lt.Location);
$$ = new MemberAccess (new Indirection ((Expression) $1, GetLocation ($2)), lt.Value, (TypeArguments) $4, lt.Location);
}
}
;
;
@ -4570,24 +4565,24 @@ lambda_parameter_list
lambda_parameter
lambda_parameter
: parameter_modifier parameter_type identifier_inside_body
: parameter_modifier parameter_type identifier_inside_body
{
{
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new Parameter ((FullNamedExpression) $2, lt.Value, (Parameter.Modifier) $1, null, lt.Location);
$$ = new Parameter ((FullNamedExpression) $2, lt.Value, (Parameter.Modifier) $1, null, lt.Location);
}
}
| parameter_type identifier_inside_body
| parameter_type identifier_inside_body
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new Parameter ((FullNamedExpression) $1, lt.Value, Parameter.Modifier.NONE, null, lt.Location);
$$ = new Parameter ((FullNamedExpression) $1, lt.Value, Parameter.Modifier.NONE, null, lt.Location);
}
}
| IDENTIFIER
| IDENTIFIER
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
$$ = new ImplicitLambdaParameter (lt.Value, lt.Location);
$$ = new ImplicitLambdaParameter (lt.Value, lt.Location);
}
}
| AWAIT
| AWAIT
{
{
var lt = (Tokenizer. LocatedToken) Error_AwaitAsIdentifier ($1);
var lt = (LocatedToken) Error_AwaitAsIdentifier ($1);
$$ = new ImplicitLambdaParameter (lt.Value, lt.Location);
$$ = new ImplicitLambdaParameter (lt.Value, lt.Location);
}
}
;
;
@ -4637,7 +4632,7 @@ expression_or_error
lambda_expression
lambda_expression
: IDENTIFIER ARROW
: IDENTIFIER ARROW
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location);
Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location);
start_anonymous (true, new ParametersCompiled (p), false, lt.Location);
start_anonymous (true, new ParametersCompiled (p), false, lt.Location);
}
}
@ -4648,7 +4643,7 @@ lambda_expression
}
}
| AWAIT ARROW
| AWAIT ARROW
{
{
var lt = (Tokenizer. LocatedToken) Error_AwaitAsIdentifier ($1);
var lt = (LocatedToken) Error_AwaitAsIdentifier ($1);
Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location);
Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location);
start_anonymous (true, new ParametersCompiled (p), false, lt.Location);
start_anonymous (true, new ParametersCompiled (p), false, lt.Location);
}
}
@ -4659,7 +4654,7 @@ lambda_expression
}
}
| ASYNC identifier_inside_body ARROW
| ASYNC identifier_inside_body ARROW
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location);
Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location);
start_anonymous (true, new ParametersCompiled (p), true, lt.Location);
start_anonymous (true, new ParametersCompiled (p), true, lt.Location);
}
}
@ -4923,14 +4918,14 @@ opt_class_base
: /* empty */
: /* empty */
| COLON type_list
| COLON type_list
{
{
current_type.AddBasesForPart ((List<FullNamedExpression>) $2);
current_type.SetBaseTypes ((List<FullNamedExpression>) $2);
lbag.AppendToMember (current_type, GetLocation ($1));
lbag.AppendToMember (current_type, GetLocation ($1));
}
}
| COLON type_list error
| COLON type_list error
{
{
Error_SyntaxError (yyToken);
Error_SyntaxError (yyToken);
current_type.AddBasesForPart ((List<FullNamedExpression>) $2);
current_type.SetBaseTypes ((List<FullNamedExpression>) $2);
}
}
;
;
@ -4970,7 +4965,7 @@ type_parameter_constraints_clauses
type_parameter_constraints_clause
type_parameter_constraints_clause
: WHERE IDENTIFIER COLON type_parameter_constraints
: WHERE IDENTIFIER COLON type_parameter_constraints
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new Constraints (new SimpleMemberName (lt.Value, lt.Location), (List<FullNamedExpression>) $4, GetLocation ($1));
$$ = new Constraints (new SimpleMemberName (lt.Value, lt.Location), (List<FullNamedExpression>) $4, GetLocation ($1));
lbag.AddLocation ($$, GetLocation ($3));
lbag.AddLocation ($$, GetLocation ($3));
}
}
@ -4978,7 +4973,7 @@ type_parameter_constraints_clause
{
{
Error_SyntaxError (yyToken);
Error_SyntaxError (yyToken);
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new Constraints (new SimpleMemberName (lt.Value, lt.Location), null, GetLocation ($1));
$$ = new Constraints (new SimpleMemberName (lt.Value, lt.Location), null, GetLocation ($1));
}
}
;
;
@ -5160,7 +5155,7 @@ statement
| IDENTIFIER error
| IDENTIFIER error
{
{
Error_SyntaxError (yyToken);
Error_SyntaxError (yyToken);
var lt =(Tokenizer. LocatedToken) $1;
var lt =(LocatedToken) $1;
var sn = new SimpleName (lt.Value, lt.Location);
var sn = new SimpleName (lt.Value, lt.Location);
current_block.AddStatement(new StatementErrorExpression (sn));
current_block.AddStatement(new StatementErrorExpression (sn));
$$ = null;
$$ = null;
@ -5258,7 +5253,7 @@ empty_statement
labeled_statement
labeled_statement
: identifier_inside_body COLON
: identifier_inside_body COLON
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location);
LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location);
lbag.AddLocation (labeled, GetLocation ($2));
lbag.AddLocation (labeled, GetLocation ($2));
current_block.AddLabel (labeled);
current_block.AddLabel (labeled);
@ -5375,10 +5370,10 @@ identifier_inside_body
block_variable_declaration
block_variable_declaration
: variable_type identifier_inside_body
: variable_type identifier_inside_body
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var li = new LocalVariable (current_block, lt.Value, lt.Location);
var li = new LocalVariable (current_block, lt.Value, lt.Location);
current_block.AddLocalName (li);
current_block.AddLocalName (li);
current_variable = new BlockVariableDeclaration ((FullNamedExpression) $1, li);
current_variable = new BlockVariable ((FullNamedExpression) $1, li);
}
}
opt_local_variable_initializer opt_variable_declarators semicolon_or_handle_error_close_brace
opt_local_variable_initializer opt_variable_declarators semicolon_or_handle_error_close_brace
{
{
@ -5391,10 +5386,10 @@ block_variable_declaration
}
}
| CONST variable_type identifier_inside_body
| CONST variable_type identifier_inside_body
{
{
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location);
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location);
current_block.AddLocalName (li);
current_block.AddLocalName (li);
current_variable = new BlockConstantDeclaration ((FullNamedExpression) $2, li);
current_variable = new BlockConstant ((FullNamedExpression) $2, li);
}
}
const_variable_initializer opt_const_declarators SEMICOLON
const_variable_initializer opt_const_declarators SEMICOLON
{
{
@ -5461,18 +5456,18 @@ variable_declarators
variable_declarator
variable_declarator
: COMMA identifier_inside_body
: COMMA identifier_inside_body
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var li = new LocalVariable (current_variable.Variable, lt.Value, lt.Location);
var li = new LocalVariable (current_variable.Variable, lt.Value, lt.Location);
var d = new BlockVariableDeclaration.Declarat or (li, null);
var d = new BlockVariableDeclarator (li, null);
current_variable.AddDeclarator (d);
current_variable.AddDeclarator (d);
current_block.AddLocalName (li);
current_block.AddLocalName (li);
lbag.AddLocation (d, GetLocation ($1));
lbag.AddLocation (d, GetLocation ($1));
}
}
| COMMA identifier_inside_body ASSIGN block_variable_initializer
| COMMA identifier_inside_body ASSIGN block_variable_initializer
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var li = new LocalVariable (current_variable.Variable, lt.Value, lt.Location);
var li = new LocalVariable (current_variable.Variable, lt.Value, lt.Location);
var d = new BlockVariableDeclaration.Declarat or (li, (Expression) $4);
var d = new BlockVariableDeclarator (li, (Expression) $4);
current_variable.AddDeclarator (d);
current_variable.AddDeclarator (d);
current_block.AddLocalName (li);
current_block.AddLocalName (li);
lbag.AddLocation (d, GetLocation ($1), GetLocation ($3));
lbag.AddLocation (d, GetLocation ($1), GetLocation ($3));
@ -5504,9 +5499,9 @@ const_declarators
const_declarator
const_declarator
: COMMA identifier_inside_body ASSIGN constant_initializer_expr
: COMMA identifier_inside_body ASSIGN constant_initializer_expr
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location);
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.Constant, lt.Location);
var d = new BlockVariableDeclaration.Declarat or (li, (Expression) $4);
var d = new BlockVariableDeclarator (li, (Expression) $4);
current_variable.AddDeclarator (d);
current_variable.AddDeclarator (d);
current_block.AddLocalName (li);
current_block.AddLocalName (li);
lbag.AddLocation (d, GetLocation ($1), GetLocation ($3));
lbag.AddLocation (d, GetLocation ($1), GetLocation ($3));
@ -5557,7 +5552,6 @@ statement_expression
ExpressionStatement s = $1 as ExpressionStatement;
ExpressionStatement s = $1 as ExpressionStatement;
if (s == null) {
if (s == null) {
var expr = $1 as Expression;
var expr = $1 as Expression;
expr.Error_InvalidExpressionStatement (report);
$$ = new StatementErrorExpression (expr);
$$ = new StatementErrorExpression (expr);
} else {
} else {
$$ = new StatementExpression (s);
$$ = new StatementExpression (s);
@ -5822,10 +5816,10 @@ opt_for_initializer
for_initializer
for_initializer
: variable_type identifier_inside_body
: variable_type identifier_inside_body
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var li = new LocalVariable (current_block, lt.Value, lt.Location);
var li = new LocalVariable (current_block, lt.Value, lt.Location);
current_block.AddLocalName (li);
current_block.AddLocalName (li);
current_variable = new BlockVariableDeclaration ((FullNamedExpression) $1, li);
current_variable = new BlockVariable ((FullNamedExpression) $1, li);
}
}
opt_local_variable_initializer opt_variable_declarators
opt_local_variable_initializer opt_variable_declarators
{
{
@ -5891,7 +5885,7 @@ foreach_statement
start_block (GetLocation ($2));
start_block (GetLocation ($2));
current_block.IsCompilerGenerated = true;
current_block.IsCompilerGenerated = true;
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location);
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location);
current_block.AddLocalName (li);
current_block.AddLocalName (li);
@ -5905,7 +5899,8 @@ foreach_statement
{
{
start_block (GetLocation ($2));
start_block (GetLocation ($2));
current_block.IsCompilerGenerated = true;
current_block.IsCompilerGenerated = true;
var lt = (Tokenizer.LocatedToken) $4;
var lt = (LocatedToken) $4;
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location);
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location);
current_block.AddLocalName (li);
current_block.AddLocalName (li);
$$ = li;
$$ = li;
@ -5925,7 +5920,7 @@ foreach_statement
{
{
start_block (GetLocation ($2));
start_block (GetLocation ($2));
current_block.IsCompilerGenerated = true;
current_block.IsCompilerGenerated = true;
var lt = $4 as Tokenizer. LocatedToken;
var lt = $4 as LocatedToken;
var li = lt != null ? new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location) : null;
var li = lt != null ? new LocalVariable (current_block, lt.Value, LocalVariable.Flags.ForeachVariable | LocalVariable.Flags.Used, lt.Location) : null;
Foreach f = new Foreach ((Expression) $3, li, null, null, null, GetLocation ($1));
Foreach f = new Foreach ((Expression) $3, li, null, null, null, GetLocation ($1));
@ -5977,7 +5972,7 @@ continue_statement
goto_statement
goto_statement
: GOTO identifier_inside_body SEMICOLON
: GOTO identifier_inside_body SEMICOLON
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
$$ = new Goto (lt.Value, GetLocation ($1));
$$ = new Goto (lt.Value, GetLocation ($1));
lbag.AddStatement ($$, GetLocation ($2), GetLocation ($3));
lbag.AddStatement ($$, GetLocation ($2), GetLocation ($3));
}
}
@ -6027,7 +6022,7 @@ throw_statement
yield_statement
yield_statement
: identifier_inside_body RETURN opt_expression SEMICOLON
: identifier_inside_body RETURN opt_expression SEMICOLON
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
string s = lt.Value;
string s = lt.Value;
if (s != "yield"){
if (s != "yield"){
report.Error (1003, lt.Location, "; expected");
report.Error (1003, lt.Location, "; expected");
@ -6045,7 +6040,7 @@ yield_statement
{
{
Error_SyntaxError (yyToken);
Error_SyntaxError (yyToken);
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
string s = lt.Value;
string s = lt.Value;
if (s != "yield"){
if (s != "yield"){
report.Error (1003, lt.Location, "; expected");
report.Error (1003, lt.Location, "; expected");
@ -6061,7 +6056,7 @@ yield_statement
}
}
| identifier_inside_body BREAK SEMICOLON
| identifier_inside_body BREAK SEMICOLON
{
{
var lt = (Tokenizer. LocatedToken) $1;
var lt = (LocatedToken) $1;
string s = lt.Value;
string s = lt.Value;
if (s != "yield"){
if (s != "yield"){
report.Error (1003, lt.Location, "; expected");
report.Error (1003, lt.Location, "; expected");
@ -6069,7 +6064,7 @@ yield_statement
FeatureIsNotAvailable (lt.Location, "iterators");
FeatureIsNotAvailable (lt.Location, "iterators");
}
}
current_block.Explicit.RegisterIteratorYield () ;
current_block.ParametersBlock.TopBlock.IsIterator = true ;
$$ = new YieldBreak (lt.Location);
$$ = new YieldBreak (lt.Location);
lbag.AddStatement ($$, GetLocation ($2), GetLocation ($3));
lbag.AddStatement ($$, GetLocation ($2), GetLocation ($3));
}
}
@ -6141,7 +6136,7 @@ catch_clause
c.TypeExpression = (FullNamedExpression) $3;
c.TypeExpression = (FullNamedExpression) $3;
if ($4 != null) {
if ($4 != null) {
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
current_block.AddLocalName (c.Variable);
current_block.AddLocalName (c.Variable);
}
}
@ -6174,12 +6169,12 @@ catch_clause
c.TypeExpression = (FullNamedExpression) $3;
c.TypeExpression = (FullNamedExpression) $3;
if ($4 != null) {
if ($4 != null) {
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
}
}
if ($4 != null) {
if ($4 != null) {
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
}
}
@ -6237,7 +6232,7 @@ fixed_statement
start_block (GetLocation ($2));
start_block (GetLocation ($2));
current_block.IsCompilerGenerated = true;
current_block.IsCompilerGenerated = true;
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.FixedVariable | LocalVariable.Flags.Used, lt.Location);
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.FixedVariable | LocalVariable.Flags.Used, lt.Location);
current_block.AddLocalName (li);
current_block.AddLocalName (li);
current_variable = new Fixed.VariableDeclaration ((FullNamedExpression) $3, li);
current_variable = new Fixed.VariableDeclaration ((FullNamedExpression) $3, li);
@ -6265,7 +6260,7 @@ using_statement
start_block (GetLocation ($2));
start_block (GetLocation ($2));
current_block.IsCompilerGenerated = true;
current_block.IsCompilerGenerated = true;
var lt = (Tokenizer. LocatedToken) $4;
var lt = (LocatedToken) $4;
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.UsingVariable | LocalVariable.Flags.Used, lt.Location);
var li = new LocalVariable (current_block, lt.Value, LocalVariable.Flags.UsingVariable | LocalVariable.Flags.Used, lt.Location);
current_block.AddLocalName (li);
current_block.AddLocalName (li);
current_variable = new Using.VariableDeclaration ((FullNamedExpression) $3, li);
current_variable = new Using.VariableDeclaration ((FullNamedExpression) $3, li);
@ -6371,7 +6366,7 @@ first_from_clause
{
{
current_block = new Linq.QueryBlock (current_block, lexer.Location);
current_block = new Linq.QueryBlock (current_block, lexer.Location);
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var rv = new Linq.RangeVariable (lt.Value, lt.Location);
var rv = new Linq.RangeVariable (lt.Value, lt.Location);
var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$4, rv, GetLocation ($1));
var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$4, rv, GetLocation ($1));
lbag.AddLocation (start, GetLocation ($3));
lbag.AddLocation (start, GetLocation ($3));
@ -6381,7 +6376,7 @@ first_from_clause
{
{
current_block = new Linq.QueryBlock (current_block, lexer.Location);
current_block = new Linq.QueryBlock (current_block, lexer.Location);
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
var rv = new Linq.RangeVariable (lt.Value, lt.Location);
var rv = new Linq.RangeVariable (lt.Value, lt.Location);
var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$5, rv, GetLocation ($1)) {
var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$5, rv, GetLocation ($1)) {
IdentifierType = (FullNamedExpression)$2
IdentifierType = (FullNamedExpression)$2
@ -6396,7 +6391,7 @@ nested_from_clause
{
{
current_block = new Linq.QueryBlock (current_block, lexer.Location);
current_block = new Linq.QueryBlock (current_block, lexer.Location);
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var rv = new Linq.RangeVariable (lt.Value, lt.Location);
var rv = new Linq.RangeVariable (lt.Value, lt.Location);
var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$4, rv, GetLocation ($1));
var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$4, rv, GetLocation ($1));
lbag.AddLocation (start, GetLocation ($3));
lbag.AddLocation (start, GetLocation ($3));
@ -6406,7 +6401,7 @@ nested_from_clause
{
{
current_block = new Linq.QueryBlock (current_block, lexer.Location);
current_block = new Linq.QueryBlock (current_block, lexer.Location);
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
var rv = new Linq.RangeVariable (lt.Value, lt.Location);
var rv = new Linq.RangeVariable (lt.Value, lt.Location);
var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$5, rv, GetLocation ($1)) {
var start = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$5, rv, GetLocation ($1)) {
IdentifierType = (FullNamedExpression)$2
IdentifierType = (FullNamedExpression)$2
@ -6423,7 +6418,7 @@ from_clause
}
}
expression_or_error
expression_or_error
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
$$ = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)$5, GetLocation ($1));
$$ = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)$5, GetLocation ($1));
@ -6439,7 +6434,7 @@ from_clause
}
}
expression_or_error
expression_or_error
{
{
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
$$ = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)$6, GetLocation ($1)) {
$$ = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)$6, GetLocation ($1)) {
@ -6571,7 +6566,7 @@ let_clause
}
}
expression_or_error
expression_or_error
{
{
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
$$ = new Linq.Let ((Linq.QueryBlock) current_block, sn, (Expression)$5, GetLocation ($1));
$$ = new Linq.Let ((Linq.QueryBlock) current_block, sn, (Expression)$5, GetLocation ($1));
lbag.AddLocation ($$, GetLocation ($3));
lbag.AddLocation ($$, GetLocation ($3));
@ -6630,7 +6625,7 @@ join_clause
var outer_selector = linq_clause_blocks.Pop ();
var outer_selector = linq_clause_blocks.Pop ();
var block = linq_clause_blocks.Pop ();
var block = linq_clause_blocks.Pop ();
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
Linq.RangeVariable into;
Linq.RangeVariable into;
@ -6650,7 +6645,7 @@ join_clause
((Linq.QueryBlock)current_block).AddRangeVariable (sn);
((Linq.QueryBlock)current_block).AddRangeVariable (sn);
lt = (Tokenizer. LocatedToken) $12;
lt = (LocatedToken) $12;
into = new Linq.RangeVariable (lt.Value, lt.Location);
into = new Linq.RangeVariable (lt.Value, lt.Location);
$$ = new Linq.GroupJoin (block, sn, (Expression)$5, outer_selector, (Linq.QueryBlock) current_block, into, GetLocation ($1));
$$ = new Linq.GroupJoin (block, sn, (Expression)$5, outer_selector, (Linq.QueryBlock) current_block, into, GetLocation ($1));
@ -6692,7 +6687,7 @@ join_clause
var outer_selector = linq_clause_blocks.Pop ();
var outer_selector = linq_clause_blocks.Pop ();
var block = linq_clause_blocks.Pop ();
var block = linq_clause_blocks.Pop ();
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
var sn = new Linq.RangeVariable (lt.Value, lt.Location);
Linq.RangeVariable into;
Linq.RangeVariable into;
@ -6714,7 +6709,7 @@ join_clause
((Linq.QueryBlock)current_block).AddRangeVariable (sn);
((Linq.QueryBlock)current_block).AddRangeVariable (sn);
lt = (Tokenizer. LocatedToken) $13;
lt = (LocatedToken) $13;
into = new Linq.RangeVariable (lt.Value, lt.Location); // TODO:
into = new Linq.RangeVariable (lt.Value, lt.Location); // TODO:
$$ = new Linq.GroupJoin (block, sn, (Expression)$6, outer_selector, (Linq.QueryBlock) current_block, into, GetLocation ($1)) {
$$ = new Linq.GroupJoin (block, sn, (Expression)$6, outer_selector, (Linq.QueryBlock) current_block, into, GetLocation ($1)) {
@ -6840,7 +6835,7 @@ opt_query_continuation
query_body
query_body
{
{
var current_block = linq_clause_blocks.Pop ();
var current_block = linq_clause_blocks.Pop ();
var lt = (Tokenizer. LocatedToken) $2;
var lt = (LocatedToken) $2;
var rv = new Linq.RangeVariable (lt.Value, lt.Location);
var rv = new Linq.RangeVariable (lt.Value, lt.Location);
$$ = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, null, rv, GetLocation ($1)) {
$$ = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, null, rv, GetLocation ($1)) {
next = (Linq.AQueryClause)$4
next = (Linq.AQueryClause)$4
@ -6945,7 +6940,7 @@ doc_cref
{
{
module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)$1;
module.DocumentationBuilder.ParsedBuiltinType = (TypeExpression)$1;
module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)$4;
module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)$4;
var lt = (Tokenizer. LocatedToken) $3;
var lt = (LocatedToken) $3;
$$ = new MemberName (lt.Value);
$$ = new MemberName (lt.Value);
}
}
| doc_type_declaration_name DOT THIS
| doc_type_declaration_name DOT THIS
@ -7107,7 +7102,7 @@ object Error_AwaitAsIdentifier (object token)
{
{
if (async_block) {
if (async_block) {
report.Error (4003, GetLocation (token), "`await' cannot be used as an identifier within an async method or lambda expression");
report.Error (4003, GetLocation (token), "`await' cannot be used as an identifier within an async method or lambda expression");
return new Tokenizer. LocatedToken ("await", GetLocation (token));
return new LocatedToken ("await", GetLocation (token));
}
}
return token;
return token;
@ -7301,7 +7296,7 @@ void FeatureIsNotAvailable (Location loc, string feature)
Location GetLocation (object obj)
Location GetLocation (object obj)
{
{
var lt = obj as Tokenizer. LocatedToken;
var lt = obj as LocatedToken;
if (lt != null)
if (lt != null)
return lt.Location;
return lt.Location;
@ -7379,7 +7374,7 @@ AnonymousMethodExpression end_anonymous (ParametersBlock anon_block)
retval = current_anonymous_method;
retval = current_anonymous_method;
async_block = (bool) oob_stack.Pop ();
async_block = (bool) oob_stack.Pop ();
current_variable = (BlockVariableDeclaration ) oob_stack.Pop ();
current_variable = (BlockVariable) oob_stack.Pop ();
current_local_parameters = (ParametersCompiled) oob_stack.Pop ();
current_local_parameters = (ParametersCompiled) oob_stack.Pop ();
current_anonymous_method = (AnonymousMethodExpression) oob_stack.Pop ();
current_anonymous_method = (AnonymousMethodExpression) oob_stack.Pop ();
@ -7488,7 +7483,7 @@ string GetSymbolName (int token)
case Token.LITERAL:
case Token.LITERAL:
return ((Constant)lexer.Value).GetValue ().ToString ();
return ((Constant)lexer.Value).GetValue ().ToString ();
case Token.IDENTIFIER:
case Token.IDENTIFIER:
return ((Tokenizer. LocatedToken)lexer.Value).Value;
return ((LocatedToken)lexer.Value).Value;
case Token.BOOL:
case Token.BOOL:
return "bool";
return "bool";