本文整理汇总了C#中GotoStatement类的典型用法代码示例。如果您正苦于以下问题:C# GotoStatement类的具体用法?C# GotoStatement怎么用?C# GotoStatement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GotoStatement类属于命名空间,在下文中一共展示了GotoStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddLabel
internal void AddLabel(SimpleName label) {
this.labelIndex[label.Name.UniqueKey] = this.cases.Count;
GotoStatement gotoStatement = new GotoStatement(label, SourceDummy.SourceLocation);
List<Statement> statements = new List<Statement>(1);
statements.Add(gotoStatement);
this.cases.Add(new SwitchCase(new CompileTimeConstant(this.cases.Count, label.SourceLocation), statements, SourceDummy.SourceLocation));
}
示例2: Visit
public void Visit(GotoStatement gotoStatement)
{
}
示例3: AcceptGoto
public void AcceptGoto(GotoStatement stmt)
{
Check(stmt);
}
示例4: Visit
public override object Visit (GotoDefault gotoDefault)
{
var result = new GotoStatement (GotoType.CaseDefault);
result.AddChild (new CSharpTokenNode (Convert (gotoDefault.loc), "goto".Length), GotoStatement.Roles.Keyword);
var location = LocationsBag.GetLocations (gotoDefault);
if (location != null) {
result.AddChild (new CSharpTokenNode (Convert (location[0]), "default".Length), GotoStatement.DefaultKeywordRole);
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), GotoStatement.Roles.Semicolon);
}
return result;
}
示例5: VisitGotoStatement
public virtual void VisitGotoStatement (GotoStatement gotoStatement)
{
VisitChildren (gotoStatement);
}
示例6: CSharpGrammar
//.........这里部分代码省略.........
{
Keyword = (AstToken) node.Children[0].Result,
Semicolon = (AstToken) node.Children[1].Result
});
var returnStatement = new GrammarDefinition("ReturnStatement",
rule: ToElement(RETURN)
+ expressionOptional
+ ToElement(SEMICOLON),
createNode: node =>
{
var result = new ReturnStatement();
result.ReturnKeyword = (AstToken) node.Children[0].Result;
if (node.Children[1].HasChildren)
result.Value = (Expression) node.Children[1].Result;
result.AddChild(AstNodeTitles.Semicolon, node.Children[2].Result);
return result;
});
var throwStatement = new GrammarDefinition("ThrowStatement",
rule: ToElement(THROW)
+ expressionOptional
+ ToElement(SEMICOLON),
createNode: node =>
{
var result = new ThrowStatement();
result.ThrowKeyword = (AstToken) node.Children[0].Result;
if (node.Children[1].HasChildren)
result.Expression = (Expression) node.Children[1].Result;
result.AddChild(AstNodeTitles.Semicolon, node.Children[2].Result);
return result;
});
var gotoStatement = new GrammarDefinition("GotoStatement",
rule: ToElement(GOTO)
+ identifierInsideBody
+ ToElement(SEMICOLON),
// TODO: goto case and goto default statements.
createNode: node =>
{
var result = new GotoStatement();
result.GotoKeyword = (AstToken) node.Children[0].Result;
result.LabelIdentifier = (Identifier) node.Children[1].Result;
result.AddChild(AstNodeTitles.Semicolon, node.Children[2].Result);
return result;
});
var jumpStatement = new GrammarDefinition("JumpStatement",
rule: breakStatement
| continueStatement
| gotoStatement
| returnStatement
| throwStatement);
var yieldStatement = new GrammarDefinition("YieldStatement",
rule: ToElement(YIELD)
+ ToElement(RETURN)
+ expression
+ ToElement(SEMICOLON),
createNode: node => new YieldStatement()
{
YieldKeyword = (AstToken) node.Children[0].Result,
ReturnKeyword = (AstToken) node.Children[1].Result,
Value = (Expression) node.Children[2].Result
});
示例7: VisitGotoStatement
public void VisitGotoStatement(GotoStatement gotoStatement)
{
StartNode(gotoStatement);
WriteKeyword(GotoStatement.GotoKeywordRole);
WriteIdentifier(gotoStatement.GetChildByRole(Roles.Identifier));
Semicolon();
EndNode(gotoStatement);
}
示例8: Visit
public override object Visit (Goto gotoStatement)
{
var result = new GotoStatement ();
var location = LocationsBag.GetLocations (gotoStatement);
result.AddChild (new CSharpTokenNode (Convert (gotoStatement.loc), "goto".Length), GotoStatement.Roles.Keyword);
var loc = location != null ? Convert (location [0]) : AstLocation.Empty;
result.AddChild (Identifier.Create (gotoStatement.Target, loc), GotoStatement.Roles.Identifier);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location [1]), 1), GotoStatement.Roles.Semicolon);
return result;
}
示例9: VisitGotoStatement
public override void VisitGotoStatement(GotoStatement gotoStatement) {
new GotoBlock(this, gotoStatement).Emit();
}
示例10: ParseGoto
private Statement ParseGoto(TokenSet followers)
//^ requires this.currentToken == Token.Goto;
//^ ensures followers[this.currentToken] || this.currentToken == Token.EndOfFile;
{
SourceLocationBuilder slb = new SourceLocationBuilder(this.scanner.SourceLocationOfLastScannedToken);
this.GetNextToken();
Statement result;
switch (this.currentToken) {
case Token.Case:
this.GetNextToken();
Expression caseLabel = this.ParseExpression(followers|Token.Semicolon);
slb.UpdateToSpan(caseLabel.SourceLocation);
result = new GotoSwitchCaseStatement(caseLabel, slb);
break;
case Token.Default:
slb.UpdateToSpan(this.scanner.SourceLocationOfLastScannedToken);
result = new GotoSwitchCaseStatement(null, slb);
this.GetNextToken();
break;
default:
result = new GotoStatement(this.ParseSimpleName(followers), slb);
break;
}
this.SkipSemiColon(followers);
return result;
}
示例11: AcceptGoto
public void AcceptGoto(GotoStatement stmt)
{
IsEmpty = false;
}
示例12: Statement
//.........这里部分代码省略.........
LastParsedObject = s;
if (laKind == (Identifier))
{
Step();
s.Identifier = t.Value;
}
Expect(Semicolon);
s.EndLocation = t.EndLocation;
return s;
}
#endregion
#region Return
else if (laKind == (Return))
{
Step();
var s = new ReturnStatement() { Location = t.Location, Parent = Parent };
LastParsedObject = s;
if (laKind != (Semicolon))
s.ReturnExpression = Expression(Scope);
Expect(Semicolon);
s.EndLocation = t.EndLocation;
return s;
}
#endregion
#region Goto
else if (laKind == (Goto))
{
Step();
var s = new GotoStatement() { Location = t.Location, Parent = Parent };
LastParsedObject = s;
if (laKind == (Identifier))
{
Step();
s.StmtType = GotoStatement.GotoStmtType.Identifier;
s.LabelIdentifier = t.Value;
}
else if (laKind == Default)
{
Step();
s.StmtType = GotoStatement.GotoStmtType.Default;
}
else if (laKind == (Case))
{
Step();
s.StmtType = GotoStatement.GotoStmtType.Case;
if (laKind != (Semicolon))
s.CaseExpression = Expression(Scope);
}
Expect(Semicolon);
s.EndLocation = t.EndLocation;
return s;
}
#endregion
#region WithStatement
else if (laKind == (With))
{
示例13: Visit
public override void Visit(GotoStatement s)
{
if(s.StmtType == GotoStatement.GotoStmtType.Identifier &&
s.LabelIdentifierHash == DTokens.IncompleteIdHash) {
prv = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, s, MemberFilter.Labels);
scopedStatement = s;
halt = true;
}
else
base.Visit (s);
}
示例14: GotoStatement
void GotoStatement(
#line 3119 "VBNET.ATG"
out GotoStatement goToStatement) {
#line 3121 "VBNET.ATG"
string label = String.Empty;
Expect(119);
LabelName(
#line 3124 "VBNET.ATG"
out label);
#line 3126 "VBNET.ATG"
goToStatement = new GotoStatement(label);
}
示例15: Process_Goto_Statement
private void Process_Goto_Statement(StringBuilder sb, GotoStatement statement)
{
sb.Append("goto ");
if (statement.Identifier != null)
{
sb.Append(statement.Identifier.Text).Append(";");
}
else if (statement.Expression == null)
{
sb.Append("default;");
}
else
{
sb.Append("case ").Append(FormatExpression(statement.Expression)).Append(";");
}
}