12
private struct Entry {
11
18
// We only store the type, as that is what is important.
12
19
private static Gee.HashMap<string, Type?> _allowed_functions;
14
protected const long UNDEFINED = long.MIN + 1; //+1 so that I can still use Long.MIN_VALUE.
21
// +1 so that I can still use int64.MIN_VALUE.
22
protected const int64 UNDEFINED = int64.MIN + 1;
16
24
protected const string CH_RARR = "\u2192";
65
73
/** Truncated output: equal */
66
74
protected const string SYM_TRUNK_PART_EQUAL = CH_EQUAL; //"="
67
75
/** Truncated output: begin */
68
protected const string SYM_TRUNK_BEGIN = SYM_BEGIN + SYM_TRUNK_PART_ELLIPSIS + SYM_TRUNK_PART_EQUAL; //"[...="
76
protected const string SYM_TRUNK_BEGIN = SYM_BEGIN
77
+ SYM_TRUNK_PART_ELLIPSIS
78
+ SYM_TRUNK_PART_EQUAL; //"[...="
69
79
/** Truncated output: end */
70
80
protected const string SYM_TRUNK_END = SYM_END; //"]"
73
_allowed_functions = new Gee.HashMap<string, Type?> ();
74
this.priority = PRIO_FUNCTION;
83
this.priority = Prio.FUNCTION;
78
* Ititialise the right functon token by it's name.
88
* Initialise the right function token by it's name.
80
90
* @param token Token of the Function.
81
91
* @param position Token position.
82
92
* @return An instance representing the function, or @c null if not found.
84
public static FunctionToken? init_token (string token, int position) {
85
FunctionToken? retval = null;
94
public static FunctionToken? init_token (string token, int32 position) {
96
if (_allowed_functions == null) {
97
// Initialise the HashMap if it is not created.
98
_allowed_functions = new Gee.HashMap<string, Type?> ();
101
{"round_up", typeof (RoundUpFunctionToken)},
102
{"round_down", typeof (RoundDownFunctionToken)},
103
{"roll_and_keep", typeof (RollAndKeepFunctionToken)},
107
foreach (Entry e in entries) {
108
_allowed_functions.@set (e.key, e.val);
87
113
// We get the token type.
88
114
Type? t = _allowed_functions.@get (token.down ());
91
117
// Construct a new instance of the token.
92
retval = (FunctionToken) GLib.Object.@new (t, null, null);
118
return (FunctionToken) GLib.Object.@new (t, null, null);