public static IsLabelStmt ( LNode _n, Pedantics p = Pedantics.Lax ) : bool | ||
_n | LNode | |
p | Pedantics | |
Résultat | bool |
public SPResult AutoPrintLabelStmt() { if (!EcsValidators.IsLabelStmt(_n, Pedantics)) { return(SPResult.Fail); } _out.Indent(PrinterIndentHint.Label); G.Verify(0 == PrintAttrs(AttrStyle.AllowWordAttrs)); if (_name == S.Label) { if (_n.Args[0].Name == S.Default) { _out.Write("default"); } else { PrintExpr(_n.Args[0], StartStmt); } } else if (_name == S.Case) { _out.Write("case"); _out.Space(); bool first = true; foreach (var arg in _n.Args) { if (first) { first = false; } else { WriteThenSpace(',', SpaceOpt.AfterComma); } PrintExpr(arg, StartExpr, Ambiguity.AllowUnassignedVarDecl); } } _out.Write(':'); _out.Dedent(PrinterIndentHint.Label); return(SPResult.NeedSuffixTrivia); }
public SPResult AutoPrintLabelStmt(Ambiguity flags) { if (!EcsValidators.IsLabelStmt(_n, Pedantics)) { return(SPResult.Fail); } _out.BeginLabel(); G.Verify(0 == PrintAttrs(StartStmt, AttrStyle.AllowWordAttrs, flags)); if (_n.Name == S.Label) { if (_n.Args[0].Name == S.Default) { _out.Write("default", true); } else { PrintExpr(_n.Args[0], StartStmt); } } else if (_n.Name == S.Case) { _out.Write("case", true); _out.Space(); bool first = true; foreach (var arg in _n.Args) { if (first) { first = false; } else { WriteThenSpace(',', SpaceOpt.AfterComma); } PrintExpr(arg, StartStmt); } } _out.Write(':', true); return(SPResult.NeedSuffixTrivia); }