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