本文整理汇总了C#中Mono.CSharp.Catch类的典型用法代码示例。如果您正苦于以下问题:C# Catch类的具体用法?C# Catch怎么用?C# Catch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Catch类属于Mono.CSharp命名空间,在下文中一共展示了Catch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ConvertCatch
CatchClause ConvertCatch(Catch ctch)
{
var result = new CatchClause();
var location = LocationsBag.GetLocations(ctch);
result.AddChild(new CSharpTokenNode(Convert(ctch.loc), CatchClause.CatchKeywordRole), CatchClause.CatchKeywordRole);
if (ctch.TypeExpression != null) {
if (location != null)
result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.LPar), Roles.LPar);
if (ctch.TypeExpression != null)
result.AddChild(ConvertToType(ctch.TypeExpression), Roles.Type);
if (ctch.Variable != null && !string.IsNullOrEmpty(ctch.Variable.Name))
result.AddChild(Identifier.Create(ctch.Variable.Name, Convert(ctch.Variable.Location)), Roles.Identifier);
if (location != null && location.Count > 1)
result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.RPar), Roles.RPar);
}
if (ctch.Block != null)
result.AddChild((BlockStatement)ctch.Block.Accept(this), Roles.Body);
return result;
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:23,代码来源:CSharpParser.cs
示例2: ConvertCatch
CatchClause ConvertCatch (Catch ctch)
{
CatchClause result = new CatchClause ();
var location = LocationsBag.GetLocations (ctch);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), "catch".Length), CatchClause.Roles.Keyword);
if (ctch.Type_expr != null) {
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), CatchClause.Roles.LPar);
result.AddChild ((INode)ctch.Type_expr.Accept (this), CatchClause.Roles.ReturnType);
if (!string.IsNullOrEmpty (ctch.Name))
result.AddChild (new Identifier (ctch.Name, Convert (location[1])), CatchClause.Roles.Identifier);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[2]), 1), CatchClause.Roles.RPar);
}
result.AddChild ((INode)ctch.Block.Accept (this), CatchClause.Roles.Body);
return result;
}
开发者ID:pgoron,项目名称:monodevelop,代码行数:23,代码来源:CSharpParser.cs
示例3: case_922
void case_922()
#line 6152 "cs-parser.jay"
{
if (yyToken == Token.CLOSE_PARENS) {
report.Error (1015, lexer.Location,
"A type that derives from `System.Exception', `object', or `string' expected");
} else {
Error_SyntaxError (yyToken);
}
yyVal = new Catch (null, GetLocation (yyVals[-2+yyTop]));
}
开发者ID:segaman,项目名称:NRefactory,代码行数:12,代码来源:cs-parser.cs
示例4: case_923
void case_923()
#line 6163 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
/* Required otherwise missing block could not be detected because*/
/* start_block is run early*/
var c = new Catch (null, GetLocation (yyVals[-5+yyTop]));
c.TypeExpression = (FullNamedExpression) yyVals[-3+yyTop];
if (yyVals[-2+yyTop] != null) {
var lt = (LocatedToken) yyVals[-2+yyTop];
c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
}
if (yyVals[-2+yyTop] != null) {
var lt = (LocatedToken) yyVals[-2+yyTop];
c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
}
lbag.AddLocation (c, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-1+yyTop]));
yyVal = c;
}
开发者ID:segaman,项目名称:NRefactory,代码行数:24,代码来源:cs-parser.cs
示例5: yyparse
//.........这里部分代码省略.........
case 899:
case_899();
break;
case 900:
case_900();
break;
case 901:
case_901();
break;
case 902:
case_902();
break;
case 903:
case_903();
break;
case 904:
case_904();
break;
case 905:
case_905();
break;
case 906:
case_906();
break;
case 907:
case_907();
break;
case 908:
case_908();
break;
case 911:
#line 6082 "cs-parser.jay"
{
yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List<Catch>) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false);
}
break;
case 912:
case_912();
break;
case 913:
case_913();
break;
case 914:
case_914();
break;
case 915:
case_915();
break;
case 916:
case_916();
break;
case 919:
#line 6131 "cs-parser.jay"
{
yyVal = new Catch ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 920:
case_920();
break;
case 921:
#line 6150 "cs-parser.jay"
{
yyVal = yyVals[-1+yyTop];
}
break;
开发者ID:segaman,项目名称:NRefactory,代码行数:67,代码来源:cs-parser.cs
示例6: case_920
void case_920()
#line 6133 "cs-parser.jay"
{
start_block (GetLocation (yyVals[-3+yyTop]));
var c = new Catch (current_block, GetLocation (yyVals[-4+yyTop]));
c.TypeExpression = (FullNamedExpression) yyVals[-2+yyTop];
if (yyVals[-1+yyTop] != null) {
var lt = (LocatedToken) yyVals[-1+yyTop];
c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
current_block.AddLocalName (c.Variable);
}
lbag.AddLocation (c, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop]));
yyVal = c;
}
开发者ID:segaman,项目名称:NRefactory,代码行数:16,代码来源:cs-parser.cs
示例7: yyparse
//.........这里部分代码省略.........
case 810:
case_810();
break;
case 817:
case_817();
break;
case 818:
case_818();
break;
case 819:
case_819();
break;
case 820:
case_820();
break;
case 821:
case_821();
break;
case 822:
case_822();
break;
case 823:
case_823();
break;
case 824:
case_824();
break;
case 825:
case_825();
break;
case 828:
#line 5266 "cs-parser.jay"
{
yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List<Catch>) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false);
}
break;
case 829:
case_829();
break;
case 830:
case_830();
break;
case 831:
case_831();
break;
case 832:
case_832();
break;
case 833:
case_833();
break;
case 836:
#line 5319 "cs-parser.jay"
{
yyVal = new Catch ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 837:
case_837();
break;
case 838:
#line 5338 "cs-parser.jay"
{
yyVal = yyVals[-1+yyTop];
}
break;
开发者ID:Ein,项目名称:monodevelop,代码行数:67,代码来源:cs-parser.cs
示例8: TryCatch
public TryCatch (Block block, List<Catch> catch_clauses, Location l, bool inside_try_finally)
{
this.Block = block;
this.Specific = catch_clauses;
this.inside_try_finally = inside_try_finally;
Catch c = catch_clauses [0];
if (c.IsGeneral) {
this.General = c;
catch_clauses.RemoveAt (0);
}
loc = l;
}
开发者ID:alisci01,项目名称:mono,代码行数:14,代码来源:statement.cs
示例9: case_935
void case_935()
#line 6221 "cs-parser.jay"
{
var c = new Catch ((ExplicitBlock) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]));
c.Filter = (CatchFilterExpression) yyVals[-1+yyTop];
yyVal = c;
}
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:7,代码来源:cs-parser.cs
示例10: yyparse
//.........这里部分代码省略.........
}
current_block.Toplevel.IsIterator = true;
yyVal = new Yield ((Expression) yyVals[-1+yyTop], lt.Location);
}
break;
case 797:
#line 5125 "cs-parser.jay"
{
Report.Error (1627, GetLocation (yyVals[-1+yyTop]), "Expression expected after yield return");
yyVal = null;
}
break;
case 798:
#line 5130 "cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop];
string s = lt.Value;
if (s != "yield"){
Report.Error (1003, lt.Location, "; expected");
yyVal = null;
}
if (RootContext.Version == LanguageVersion.ISO_1){
Report.FeatureIsNotAvailable (lt.Location, "yield statement");
yyVal = null;
}
current_block.Toplevel.IsIterator = true;
yyVal = new YieldBreak (lt.Location);
}
break;
case 801:
#line 5154 "cs-parser.jay"
{
yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List<Catch>) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false);
}
break;
case 802:
#line 5158 "cs-parser.jay"
{
yyVal = new TryFinally ((Statement) yyVals[-2+yyTop], (Block) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop]));
}
break;
case 803:
#line 5162 "cs-parser.jay"
{
yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List<Catch>) yyVals[-2+yyTop], GetLocation (yyVals[-4+yyTop]), true), (Block) yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop]));
}
break;
case 804:
#line 5166 "cs-parser.jay"
{
Report.Error (1524, GetLocation (yyVals[-2+yyTop]), "Expected catch or finally");
yyVal = null;
}
break;
case 805:
#line 5174 "cs-parser.jay"
{
var l = new List<Catch> (2);
l.Add ((Catch) yyVals[0+yyTop]);
yyVal = l;
}
break;
case 806:
#line 5181 "cs-parser.jay"
开发者ID:speier,项目名称:shake,代码行数:67,代码来源:cs-parser.cs
示例11: ConvertCatch
CatchClause ConvertCatch (Catch ctch)
{
CatchClause result = new CatchClause ();
var location = LocationsBag.GetLocations (ctch);
result.AddChild (new CSharpTokenNode (Convert (ctch.loc), "catch".Length), CatchClause.Roles.Keyword);
if (ctch.TypeExpression != null) {
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), CatchClause.Roles.LPar);
result.AddChild (ConvertToType (ctch.TypeExpression), CatchClause.Roles.Type);
if (ctch.Variable != null && !string.IsNullOrEmpty (ctch.Variable.Name))
result.AddChild (new Identifier (ctch.Variable.Name, Convert (ctch.Variable.Location)), CatchClause.Roles.Identifier);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), CatchClause.Roles.RPar);
}
result.AddChild ((BlockStatement)ctch.Block.Accept (this), CatchClause.Roles.Body);
return result;
}
开发者ID:madkat,项目名称:NRefactory,代码行数:21,代码来源:CSharpParser.cs
示例12: TryCatch
public TryCatch (Block block, ArrayList catch_clauses, Location l, bool inside_try_finally)
{
this.Block = block;
this.Specific = catch_clauses;
this.General = null;
this.inside_try_finally = inside_try_finally;
for (int i = 0; i < catch_clauses.Count; ++i) {
Catch c = (Catch) catch_clauses [i];
if (c.IsGeneral) {
if (i != catch_clauses.Count - 1)
Report.Error (1017, c.loc, "Try statement already has an empty catch block");
this.General = c;
catch_clauses.RemoveAt (i);
i--;
}
}
loc = l;
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:20,代码来源:statement.cs
示例13: yyparse
//.........这里部分代码省略.........
string s = lt.Value;
if (s != "yield"){
report.Error (1003, lt.Location, "; expected");
} else if (yyVals[-1+yyTop] == null) {
report.Error (1627, GetLocation (yyVals[0+yyTop]), "Expression expected after yield return");
} else if (lang_version == LanguageVersion.ISO_1){
FeatureIsNotAvailable (lt.Location, "iterators");
}
current_block.ParametersBlock.TopBlock.IsIterator = true;
yyVal = new Yield ((Expression) yyVals[-1+yyTop], lt.Location);
lbag.AddStatement (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
}
break;
case 857:
#line 5718 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop];
string s = lt.Value;
if (s != "yield"){
report.Error (1003, lt.Location, "; expected");
} else if (lang_version == LanguageVersion.ISO_1){
FeatureIsNotAvailable (lt.Location, "iterators");
}
current_block.ParametersBlock.TopBlock.IsIterator = true;
yyVal = new YieldBreak (lt.Location);
lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]), GetLocation (yyVals[0+yyTop]));
}
break;
case 860:
#line 5740 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List<Catch>) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false);
}
break;
case 861:
#line 5744 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new TryFinally ((Statement) yyVals[-2+yyTop], (Block) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop]));
lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
}
break;
case 862:
#line 5749 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new TryFinally (new TryCatch ((Block) yyVals[-3+yyTop], (List<Catch>) yyVals[-2+yyTop], GetLocation (yyVals[-4+yyTop]), true), (Block) yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop]));
lbag.AddStatement (yyVal, GetLocation (yyVals[-1+yyTop]));
}
break;
case 863:
#line 5754 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
report.Error (1524, GetLocation (yyVals[-2+yyTop]), "Expected catch or finally");
yyVal = null;
}
break;
case 864:
#line 5762 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var l = new List<Catch> (2);
l.Add ((Catch) yyVals[0+yyTop]);
yyVal = l;
}
break;
开发者ID:runefs,项目名称:Marvin,代码行数:67,代码来源:cs-parser.cs
示例14: case_841
void case_841()
#line 5334 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
if (yyToken == Token.CLOSE_PARENS) {
Report.Error (1015, lexer.Location,
"A type that derives from `System.Exception', `object', or `string' expected");
} else {
Error_SyntaxError (yyToken);
}
yyVal = new Catch (null, GetLocation (yyVals[-2+yyTop]));
}
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:12,代码来源:cs-parser.cs
示例15: case_839
void case_839()
#line 5315 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
start_block (GetLocation (yyVals[-3+yyTop]));
var c = new Catch (current_block, GetLocation (yyVals[-4+yyTop]));
c.TypeExpression = (FullNamedExpression) yyVals[-2+yyTop];
if (yyVals[-1+yyTop] != null) {
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
current_block.AddLocalName (c.Variable);
}
lbag.AddLocation (c, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop]));
yyVal = c;
}
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:16,代码来源:cs-parser.cs
注:本文中的Mono.CSharp.Catch类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论