private static ExprKind GetKind(SyntaxToken operatorToken, BinaryPatternSyntax syntax) { return(operatorToken.Kind() switch { SyntaxKind.AndKeyword => ExprKind.AND_PATTERN, SyntaxKind.OrKeyword => ExprKind.OR_PATTERN, _ => throw new InternalError(syntax, $"Operator '{operatorToken.Kind()}' is not supported in binary patterns.") });
public static Doc Print(BinaryPatternSyntax node) { return(Doc.Concat( Node.Print(node.Left), Doc.Line, Token.PrintWithSuffix(node.OperatorToken, " "), Node.Print(node.Right) )); }
private Doc PrintBinaryPatternSyntax(BinaryPatternSyntax node) { return(Concat( this.Print(node.Left), SpaceIfNoPreviousComment, this.PrintSyntaxToken(node.OperatorToken, " "), this.Print(node.Right) )); }
public override void VisitBinaryPattern(BinaryPatternSyntax node) => base.VisitBinaryPattern(node);
public override void VisitBinaryPattern(BinaryPatternSyntax node) { Log(node, "Unsupported Syntax !"); }
public BinaryPattern(Context cx, BinaryPatternSyntax syntax, IExpressionParentEntity parent, int child) : base(new ExpressionInfo(cx, null, cx.CreateLocation(syntax.GetLocation()), GetKind(syntax.OperatorToken, syntax), parent, child, false, null)) { Pattern.Create(cx, syntax.Left, this, 0); Pattern.Create(cx, syntax.Right, this, 1); }