Beispiel #1
0
 public TokenAttribute(string value, OperatorType unaryOp, AstUnaryType unaryType, AstUnaryType unaryPostfix = 0)
 {
     Value         = value;
     UnaryOperator = unaryOp;
     UnaryType     = unaryType;
     UnaryPostfix  = unaryPostfix;
 }
Beispiel #2
0
 public TokenAttribute(string value, Precedence prec, AstUnaryType unary, AstBinaryType binary)
 {
     Value      = value;
     Precedence = prec;
     UnaryType  = unary;
     BinaryType = binary;
 }
Beispiel #3
0
 public TokenAttribute(string value, Precedence prec, OperatorType unaryOp, OperatorType binOp, AstUnaryType unary, AstBinaryType binary)
 {
     Value          = value;
     Precedence     = prec;
     UnaryType      = unary;
     BinaryType     = binary;
     UnaryOperator  = unaryOp;
     BinaryOperator = binOp;
 }
Beispiel #4
0
        public static string ToSymbol(this AstUnaryType op)
        {
            switch (op)
            {
            case AstUnaryType.DecreasePrefix: return("$prefix--");

            case AstUnaryType.DecreasePostfix: return("$postfix--");

            case AstUnaryType.IncreasePrefix: return("$prefix++");

            case AstUnaryType.IncreasePostfix: return("$postfix++");

            case AstUnaryType.Negate: return("-");

            case AstUnaryType.LogNot: return("!");

            case AstUnaryType.BitwiseNot: return("~");

            default: throw new Exception("invalid unop: " + op);
            }
        }
Beispiel #5
0
 public AstUnary ReadUnary(AstUnaryType type)
 {
     return(new AstUnary(
                ReadSource(), type,
                ReadExpression()));
 }
Beispiel #6
0
 public AstUnary(Source src, AstUnaryType type, AstExpression operand)
     : base(src)
 {
     Type    = type;
     Operand = operand;
 }
Beispiel #7
0
 public TokenAttribute(string value, AstUnaryType unaryType)
 {
     Value     = value;
     UnaryType = unaryType;
 }
Beispiel #8
0
 public TokenAttribute(string value, AstUnaryType unaryType, AstStatementModifier statementModifier)
 {
     Value             = value;
     UnaryType         = unaryType;
     StatementModifier = statementModifier;
 }