Exemple #1
0
 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.")
     });
Exemple #2
0
 public static Doc Print(BinaryPatternSyntax node)
 {
     return(Doc.Concat(
                Node.Print(node.Left),
                Doc.Line,
                Token.PrintWithSuffix(node.OperatorToken, " "),
                Node.Print(node.Right)
                ));
 }
Exemple #3
0
 private Doc PrintBinaryPatternSyntax(BinaryPatternSyntax node)
 {
     return(Concat(
                this.Print(node.Left),
                SpaceIfNoPreviousComment,
                this.PrintSyntaxToken(node.OperatorToken, " "),
                this.Print(node.Right)
                ));
 }
Exemple #4
0
 public override void VisitBinaryPattern(BinaryPatternSyntax node) => base.VisitBinaryPattern(node);
 public override void VisitBinaryPattern(BinaryPatternSyntax node)
 {
     Log(node, "Unsupported Syntax !");
 }
Exemple #6
0
 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);
 }