/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk
64 by Gustav Hartvigsson
[General] Major refactoring. Utils -> Vee nenaming.
1
using Vee;
1 by Gustav Hartvigsson
* Initial code - far from done
2
3
namespace VQDR.Expression {
4
  public abstract class OperatorToken : Token {
5
    
52.1.3 by Gustav Hartvigsson
int -> int32
6
    protected OperatorToken (int32 position) {
1 by Gustav Hartvigsson
* Initial code - far from done
7
      base (position);
8
    }
9
    
10
    public static OperatorToken? init_token (string name,
52.1.3 by Gustav Hartvigsson
int -> int32
11
                                             int32 position)
1 by Gustav Hartvigsson
* Initial code - far from done
12
                                             throws ParseError {
13
      switch (name) {
14
        case "+": 
11 by Gustav Hartvigsson
* FastNumber:
15
          return new AddOperatorToken (position);
1 by Gustav Hartvigsson
* Initial code - far from done
16
        case "-":
11 by Gustav Hartvigsson
* FastNumber:
17
          return new SubtractOperatorToken (position);
1 by Gustav Hartvigsson
* Initial code - far from done
18
        case "*":
11 by Gustav Hartvigsson
* FastNumber:
19
          return new MultiplyOperatorToken (position);
1 by Gustav Hartvigsson
* Initial code - far from done
20
        case "/":
11 by Gustav Hartvigsson
* FastNumber:
21
          return new DivideOperatorToken (position);
1 by Gustav Hartvigsson
* Initial code - far from done
22
        case "d":
23
        case "w":
24
        case "t":
23 by Gustav Hartvigsson
* Added DiceOperatiorToken
25
          return new DiceOperatorToken (position);
26
        default:
27
          break;
1 by Gustav Hartvigsson
* Initial code - far from done
28
      }
29
      throw new ParseError.INVALID_CHARECTER (@"Could not decode $name," +
30
                                              " it is not a valid operation.");
31
    }
32
    
33
  }
34
}