本文整理汇总了C#中Mono.CSharp.LabeledStatement类的典型用法代码示例。如果您正苦于以下问题:C# LabeledStatement类的具体用法?C# LabeledStatement怎么用?C# LabeledStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LabeledStatement类属于Mono.CSharp命名空间,在下文中一共展示了LabeledStatement类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override object Visit (LabeledStatement labeledStatement)
{
var result = new LabelStatement ();
result.AddChild (new Identifier (labeledStatement.Name, Convert (labeledStatement.loc)), LabelStatement.Roles.Identifier);
return result;
}
示例2: StartFlowBranching
public FlowBranchingLabeled StartFlowBranching (LabeledStatement stmt)
{
FlowBranchingLabeled branching = new FlowBranchingLabeled (CurrentBranching, stmt);
current_flow_branching = branching;
return branching;
}
示例3: case_783
void case_783()
#line 5255 "cs-parser.jay"
{
var lt = (LocatedToken) yyVals[-1+yyTop];
LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location);
lbag.AddLocation (labeled, GetLocation (yyVals[0+yyTop]));
current_block.AddLabel (labeled);
current_block.AddStatement (labeled);
}
示例4: Visit
public override object Visit(LabeledStatement labeledStatement)
{
var result = new LabelStatement();
result.AddChild(Identifier.Create(labeledStatement.Name, Convert(labeledStatement.loc)), Roles.Identifier);
var location = LocationsBag.GetLocations(labeledStatement);
if (location != null)
result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.Colon), Roles.Colon);
return result;
}
示例5: Visit
public virtual object Visit (LabeledStatement labeledStatement)
{
return null;
}
示例6: FlowBranchingLabeled
public FlowBranchingLabeled (FlowBranching parent, LabeledStatement stmt)
: base (parent, BranchingType.Labeled, SiblingType.Conditional, null, stmt.loc)
{
this.stmt = stmt;
CurrentUsageVector.MergeOrigins (stmt.JumpOrigins);
actual = CurrentUsageVector.Clone ();
// stand-in for backward jumps
CurrentUsageVector.ResetBarrier ();
}
示例7: AddLabel
public void AddLabel (string name, LabeledStatement label)
{
if (labels == null)
labels = new Dictionary<string, object> ();
object value;
if (!labels.TryGetValue (name, out value)) {
labels.Add (name, label);
return;
}
LabeledStatement existing = value as LabeledStatement;
List<LabeledStatement> existing_list;
if (existing != null) {
existing_list = new List<LabeledStatement> ();
existing_list.Add (existing);
labels[name] = existing_list;
} else {
existing_list = (List<LabeledStatement>) value;
}
//
// A collision checking between labels
//
for (int i = 0; i < existing_list.Count; ++i) {
existing = existing_list[i];
Block b = existing.Block;
// Collision at same level
if (label.Block == b) {
Report.SymbolRelatedToPreviousError (existing.loc, name);
Report.Error (140, label.loc, "The label `{0}' is a duplicate", name);
break;
}
// Collision with parent
b = label.Block;
while ((b = b.Parent) != null) {
if (existing.Block == b) {
Report.Error (158, label.loc,
"The label `{0}' shadows another label by the same name in a contained scope", name);
i = existing_list.Count;
break;
}
}
// Collision with with children
b = existing.Block;
while ((b = b.Parent) != null) {
if (label.Block == b) {
Report.Error (158, label.loc,
"The label `{0}' shadows another label by the same name in a contained scope", name);
i = existing_list.Count;
break;
}
}
}
existing_list.Add (label);
}
示例8: SetResolvedTarget
public void SetResolvedTarget (LabeledStatement label)
{
this.label = label;
label.AddReference ();
}
示例9: AddLabel
/// <summary>
/// Adds a label to the current block.
/// </summary>
///
/// <returns>
/// false if the name already exists in this block. true
/// otherwise.
/// </returns>
///
public bool AddLabel (LabeledStatement target)
{
if (switch_block != null)
return switch_block.AddLabel (target);
string name = target.Name;
Block cur = this;
while (cur != null) {
LabeledStatement s = cur.DoLookupLabel (name);
if (s != null) {
Toplevel.Report.SymbolRelatedToPreviousError (s.loc, s.Name);
Toplevel.Report.Error (140, target.loc, "The label `{0}' is a duplicate", name);
return false;
}
if (this == Explicit)
break;
cur = cur.Parent;
}
while (cur != null) {
if (cur.DoLookupLabel (name) != null) {
Error_158 (name, target.loc);
return false;
}
if (children != null) {
foreach (Block b in children) {
LabeledStatement s = b.DoLookupLabel (name);
if (s == null)
continue;
Toplevel.Report.SymbolRelatedToPreviousError (s.loc, s.Name);
Error_158 (name, target.loc);
return false;
}
}
cur = cur.Parent;
}
Toplevel.CheckError158 (name, target.loc);
if (labels == null)
labels = new Dictionary<string, LabeledStatement> ();
labels.Add (name, target);
return true;
}
示例10: case_728
void case_728()
#line 4643 "cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location);
current_block.AddLabel (labeled);
current_block.AddStatement (labeled);
}
示例11: yyparse
//.........这里部分代码省略.........
}
}
break;
case 689:
#line 4506 "cs-parser.jay"
{
current_block.AddStatement ((Statement) yyVals[0+yyTop]);
}
break;
case 718:
#line 4547 "cs-parser.jay"
{
Report.Error (1023, GetLocation (yyVals[0+yyTop]), "An embedded statement may not be a declaration or labeled statement");
yyVal = null;
}
break;
case 719:
#line 4552 "cs-parser.jay"
{
Report.Error (1023, GetLocation (yyVals[0+yyTop]), "An embedded statement may not be a declaration or labeled statement");
yyVal = null;
}
break;
case 720:
#line 4560 "cs-parser.jay"
{
yyVal = new EmptyStatement (GetLocation (yyVals[0+yyTop]));
}
break;
case 721:
#line 4567 "cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
LabeledStatement labeled = new LabeledStatement (lt.Value, lt.Location);
if (current_block.AddLabel (labeled))
current_block.AddStatement (labeled);
}
break;
case 723:
#line 4579 "cs-parser.jay"
{
if (yyVals[-1+yyTop] != null){
var de = (Tuple<FullNamedExpression, List<object>>) yyVals[-1+yyTop];
yyVal = declare_local_variables (de.Item1, de.Item2, de.Item1.Location);
}
}
break;
case 724:
#line 4587 "cs-parser.jay"
{
if (yyVals[-1+yyTop] != null){
var de = (Tuple<FullNamedExpression, List<object>>) yyVals[-1+yyTop];
yyVal = declare_local_constants (de.Item1, de.Item2);
}
}
break;
case 725:
#line 4604 "cs-parser.jay"
{
/* FIXME: Do something smart here regarding the composition of the type.*/
/* Ok, the above "primary_expression" is there to get rid of*/
/* both reduce/reduce and shift/reduces in the grammar, it should*/
/* really just be "type_name". If you use type_name, a reduce/reduce*/
示例12: case_733
void case_733()
{
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location);
lbag.AddLocation (labeled, GetLocation (yyVals[0+yyTop]));
current_block.AddLabel (labeled);
current_block.AddStatement (labeled);
}
示例13: yyparse
//.........这里部分代码省略.........
break;
case 750:
#line 5057 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
report.Error (1023, GetLocation (yyVals[0+yyTop]), "An embedded statement may not be a declaration or labeled statement");
yyVal = null;
}
break;
case 751:
#line 5062 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
report.Error (1023, GetLocation (yyVals[0+yyTop]), "An embedded statement may not be a declaration or labeled statement");
yyVal = null;
}
break;
case 752:
#line 5067 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = new EmptyStatement (GetLocation (yyVals[0+yyTop]));
}
break;
case 753:
#line 5075 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
/* Uses lexer.Location because semicolon location is not kept in quick mode*/
yyVal = new EmptyStatement (lexer.Location);
}
break;
case 754:
#line 5083 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location);
current_block.AddLabel (labeled);
current_block.AddStatement (labeled);
}
break;
case 757:
#line 5096 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
if (yyVals[-1+yyTop] is VarExpr)
yyVals[-1+yyTop] = new SimpleName ("var", ((VarExpr) yyVals[-1+yyTop]).Location);
yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]);
}
break;
case 758:
#line 5112 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
/* Ok, the above "primary_expression" is there to get rid of*/
/* both reduce/reduce and shift/reduces in the grammar, it should*/
/* really just be "type_name". If you use type_name, a reduce/reduce*/
/* creeps up. If you use namespace_or_type_name (which is all we need*/
/* really) two shift/reduces appear.*/
/* */
/* So the super-trick is that primary_expression*/
/* can only be either a SimpleName or a MemberAccess. */
/* The MemberAccess case arises when you have a fully qualified type-name like :*/
/* Foo.Bar.Blah i;*/
/* SimpleName is when you have*/
/* Blah i;*/
Expression expr = (Expression) yyVals[-1+yyTop];
示例14: case_728
void case_728()
#line 4623 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
LabeledStatement labeled = new LabeledStatement (lt.Value, current_block, lt.Location);
current_block.AddLabel (labeled);
current_block.AddStatement (labeled);
}