Report.Error(1671, name.Location, "A namespace declaration cannot have modifiers or attributes");
}
- current_namespace = new NamespaceEntry (
+ current_namespace = new NamespaceEntry (compiler,
current_namespace, file, name.GetName ());
current_class = current_namespace.SlaveDeclSpace;
current_container = current_class.PartialContainer;
}
| error
{
- syntax_error (lexer.Location, "`.' expected");
+ Error_SyntaxError (yyToken);
$$ = new MemberName ("<invalid>", lexer.Location);
}
;
variable_initializer
: expression
| array_initializer
+ | error
+ {
+ // It has to be here for the parent to safely restore artificial block
+ Error_SyntaxError (yyToken);
+ $$ = null;
+ }
;
method_declaration
list.Add ((Expression) $3);
$$ = list;
}
- | error
- {
- Error_SyntaxError (yyToken);
- $$ = new List<Expression> ();
- }
;
typeof_expression
$$ = new Cast ((FullNamedExpression) $2, (Expression) $4, GetLocation ($1));
lbag.AddLocation ($$, GetLocation ($3));
}
- | OPEN_PARENS builtin_types CLOSE_PARENS prefixed_unary_expression
- {
- $$ = new Cast ((FullNamedExpression) $2, (Expression) $4, GetLocation ($1));
- lbag.AddLocation ($$, GetLocation ($3));
- }
;
//
Report.Error (1023, GetLocation ($1), "An embedded statement may not be a declaration or labeled statement");
$$ = null;
}
+ | error
+ {
+ Error_SyntaxError (yyToken);
+ $$ = new EmptyStatement (GetLocation ($1));
+ }
;
empty_statement
interactive_parsing
: EVAL_STATEMENT_PARSER EOF
- | EVAL_USING_DECLARATIONS_UNIT_PARSER using_directives
+ | EVAL_USING_DECLARATIONS_UNIT_PARSER using_directives opt_COMPLETE_COMPLETION
| EVAL_STATEMENT_PARSER {
Evaluator.LoadAliases (current_namespace);
this.file = file;
this.compiler = ctx;
- current_namespace = new NamespaceEntry (null, file, null);
+ current_namespace = new NamespaceEntry (ctx, null, file, null);
current_class = current_namespace.SlaveDeclSpace;
current_container = current_class.PartialContainer; // == RootContest.ToplevelTypes
oob_stack.Clear ();
void Error_SyntaxError (int error_code, int token, string msg)
{
+ // An error message has been reported by tokenizer
+ if (token == Token.ERROR)
+ return;
+
string symbol = GetSymbolName (token);
string expecting = GetExpecting ();
var loc = lexer.Location - symbol.Length;