Exemple #1
0
 public TokenAttribute(string value, OperatorType unaryOp, AstUnaryType unaryType, AstUnaryType unaryPostfix = 0)
 {
     Value         = value;
     UnaryOperator = unaryOp;
     UnaryType     = unaryType;
     UnaryPostfix  = unaryPostfix;
 }
Exemple #2
0
 public TokenAttribute(string value, Precedence prec, AstUnaryType unary, AstBinaryType binary)
 {
     Value      = value;
     Precedence = prec;
     UnaryType  = unary;
     BinaryType = binary;
 }
Exemple #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;
 }
Exemple #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);
            }
        }
Exemple #5
0
 public AstUnary ReadUnary(AstUnaryType type)
 {
     return(new AstUnary(
                ReadSource(), type,
                ReadExpression()));
 }
Exemple #6
0
 public AstUnary(Source src, AstUnaryType type, AstExpression operand)
     : base(src)
 {
     Type    = type;
     Operand = operand;
 }
Exemple #7
0
 public TokenAttribute(string value, AstUnaryType unaryType)
 {
     Value     = value;
     UnaryType = unaryType;
 }
Exemple #8
0
 public TokenAttribute(string value, AstUnaryType unaryType, AstStatementModifier statementModifier)
 {
     Value             = value;
     UnaryType         = unaryType;
     StatementModifier = statementModifier;
 }