Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
bingbingbingbing
mono
提交
63af9c84
M
mono
项目概览
bingbingbingbing
/
mono
与 Fork 源项目一致
从无法访问的项目Fork
通知
35
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mono
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
63af9c84
编写于
9月 13, 2010
作者:
M
Marek Safar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Better error reporting for missing identifiers.
上级
fbbffbcd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
21 deletion
+37
-21
mcs/errors/cs1001-3.cs
mcs/errors/cs1001-3.cs
+1
-1
mcs/errors/cs1001-4.cs
mcs/errors/cs1001-4.cs
+9
-0
mcs/errors/cs1001.cs
mcs/errors/cs1001.cs
+1
-1
mcs/errors/cs1041.cs
mcs/errors/cs1041.cs
+1
-1
mcs/mcs/cs-parser.jay
mcs/mcs/cs-parser.jay
+25
-18
未找到文件。
mcs/errors/
gcs1525
-3.cs
→
mcs/errors/
cs1001
-3.cs
浏览文件 @
63af9c84
// CS1
525: Unexpected symbol `)', expecting `identifier'
// CS1
001: Unexpected symbol `)', expecting identifier
// Line: 8
class
C
...
...
mcs/errors/
gcs1041
.cs
→
mcs/errors/
cs1001-4
.cs
浏览文件 @
63af9c84
// CS1001:
Identifier expected
// CS1001:
Unexpected symbol `)', expecting identifier
// Line: 6
class
B
<
T
>
...
...
@@ -6,4 +6,4 @@ class B<T>
T
Foo
(
T
)
{
}
}
\ No newline at end of file
}
mcs/errors/cs10
41-2
.cs
→
mcs/errors/cs10
01
.cs
浏览文件 @
63af9c84
//
cs1001: Identifier expected
//
CS1001: Unexpected symbol `)', expecting identifier
// Line: 6
class
T
{
...
...
mcs/errors/cs1
525-18
.cs
→
mcs/errors/cs1
041
.cs
浏览文件 @
63af9c84
// CS1
525: Unexpected symbol `foreach', expecting `identifier'
// CS1
041: Identifier expected, `foreach' is a keyword
// Line: 11
public
partial
class
Log
...
...
mcs/mcs/cs-parser.jay
浏览文件 @
63af9c84
...
...
@@ -443,8 +443,9 @@ using_alias_directive
var lt = (Tokenizer.LocatedToken) $2;
current_namespace.AddUsingAlias (lt.Value, (MemberName) $4, GetLocation ($1));
}
| USING error {
CheckIdentifierToken (yyToken, GetLocation ($2));
| USING error
{
Error_SyntaxError (yyToken);
$$ = null;
}
;
...
...
@@ -951,8 +952,9 @@ struct_declaration
lbag.AppendToMember (current_class, GetLocation ($13));
$$ = pop_current_class ();
}
| opt_attributes opt_modifiers opt_partial STRUCT error {
CheckIdentifierToken (yyToken, GetLocation ($5));
| opt_attributes opt_modifiers opt_partial STRUCT error
{
Error_SyntaxError (yyToken);
}
;
...
...
@@ -1517,8 +1519,8 @@ fixed_parameter
parameter_type
error
{
Error_SyntaxError (yyToken);
Location l = GetLocation ($4);
CheckIdentifierToken (yyToken, l);
$$ = new Parameter ((FullNamedExpression) $3, "NeedSomeGeneratorHere", (Parameter.Modifier) $2, (Attributes) $1, l);
}
| opt_attributes
...
...
@@ -1643,7 +1645,7 @@ parameter_array
}
| opt_attributes params_modifier type error
{
CheckIdentifierToken (yyToken, GetLocation ($4)
);
Error_SyntaxError (yyToken
);
$$ = null;
}
;
...
...
@@ -1921,8 +1923,9 @@ interface_declaration
lbag.AppendToMember (current_class, GetLocation ($11), GetLocation ($13));
$$ = pop_current_class ();
}
| opt_attributes opt_modifiers opt_partial INTERFACE error {
CheckIdentifierToken (yyToken, GetLocation ($5));
| opt_attributes opt_modifiers opt_partial INTERFACE error
{
Error_SyntaxError (yyToken);
}
;
...
...
@@ -6202,11 +6205,6 @@ void CheckToken (int error, int yyToken, string msg, Location loc)
Report.Error (error, loc, msg);
}
void CheckIdentifierToken (int yyToken, Location loc)
{
CheckToken (1041, yyToken, "Identifier expected", loc);
}
string ConsumeStoredComment ()
{
string s = tmpComment;
...
...
@@ -6310,7 +6308,6 @@ public NamespaceEntry CurrentNamespace {
}
}
void Error_SyntaxError (int token)
{
Error_SyntaxError (0, token, "Unexpected symbol");
...
...
@@ -6320,18 +6317,28 @@ void Error_SyntaxError (int error_code, int token, string msg)
{
string symbol = GetSymbolName (token);
string expecting = GetExpecting ();
var loc = lexer.Location - symbol.Length;
if (error_code == 0) {
if (expecting == "`)'")
if (expecting == "`identifier'") {
if (token > Token.FIRST_KEYWORD && token < Token.LAST_KEYWORD) {
Report.Error (1041, loc, "Identifier expected, `{0}' is a keyword", symbol);
return;
}
error_code = 1001;
expecting = "identifier";
} else if (expecting == "`)'") {
error_code = 1026;
else
} else {
error_code = 1525;
}
}
if (string.IsNullOrEmpty (expecting))
Report.Error (error_code, l
exer.Location
, "{1} `{0}'", symbol, msg);
Report.Error (error_code, l
oc
, "{1} `{0}'", symbol, msg);
else
Report.Error (error_code, l
exer.Location
, "{2} `{0}', expecting {1}", symbol, expecting, msg);
Report.Error (error_code, l
oc
, "{2} `{0}', expecting {1}", symbol, expecting, msg);
}
string GetExpecting ()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录