예제 #1
0
 private ExpressionOperationKind ConvertUnaryToOperationKind(TextSpan span)
 {
     switch (span.Text)
     {
         case "<":
             return ExpressionOperationKind.LowByte;
         case ">":
             return ExpressionOperationKind.HighByte;
         case "-":
             return ExpressionOperationKind.UnaryMinus;
         case ".NOT":
             return ExpressionOperationKind.LogicalNot;
         case ".DEF":
             return ExpressionOperationKind.Def;
         case ".REF":
             return ExpressionOperationKind.Ref;
         default:
             throw new InvalidOperationException();
     }
 }
예제 #2
0
 private ExpressionOperationKind ConvertToOperationKind(TextSpan span)
 {
     switch (span.Text)
     {
         case "=":
             return ExpressionOperationKind.Equal;
         case "<>":
             return ExpressionOperationKind.NotEqual;
         case "<":
             return ExpressionOperationKind.SmallerThan;
         case ">":
             return ExpressionOperationKind.GreaterThan;
         case "<=":
             return ExpressionOperationKind.SmallerThanOrEqual;
         case ">=":
             return ExpressionOperationKind.GreaterThanOrEqual;
         case "+":
             return ExpressionOperationKind.Add;
         case "-":
             return ExpressionOperationKind.Sub;
         case "*":
             return ExpressionOperationKind.Mult;
         case "/":
             return ExpressionOperationKind.Div;
         case "&":
             return ExpressionOperationKind.BitwiseAnd;
         case "!":
             return ExpressionOperationKind.BitwiseOr;
         case "^":
             return ExpressionOperationKind.BitwiseXor;
         case ".AND":
             return ExpressionOperationKind.LogicalAnd;
         case ".OR":
             return ExpressionOperationKind.LogicalOr;
         default:
             throw new InvalidOperationException();
     }
 }
 private string FormatResult(string label, TextSpan span)
 {
     return FormatResult(label, span.Text.Trim());
 }
예제 #4
0
 private void EmitTerminal(SyntaxNodeKind nodeKind, TextSpan span)
 {
     handler.EndNode(new ParserContext(nodeKind, span));
 }