/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk
1 by Gustav Hartvigsson
* Initial code - far from done
1
using VQDR.Common;
2
3
namespace VQDR.Expression {
4
  public abstract class OperatorToken : Token {
5
    
6
    protected OperatorToken (int position) {
7
      base (position);
8
    }
9
    
10
    public static OperatorToken? init_token (string name,
11
                                             int position)
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":
25
          //return new DiceOperatiorToken (position);
26
        break;
27
      }
28
      throw new ParseError.INVALID_CHARECTER (@"Could not decode $name," +
29
                                              " it is not a valid operation.");
30
    }
31
    
32
  }
33
}