/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk

« back to all changes in this revision

Viewing changes to src/libvqdr/function/function_token.vala

  • Committer: Gustav Hartvigsson
  • Date: 2022-05-30 18:46:35 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20220530184635-d8k8pofyyifu017d
Woops.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
using Gee;
2
2
 
3
3
using VQDR.Expression;
4
 
using Vee;
 
4
using Utils;
5
5
 
6
6
namespace VQDR.Expression {
7
7
  public abstract class FunctionToken : Token {
18
18
    // We only store the type, as that is what is important.
19
19
    private static Gee.HashMap<string, Type?> _allowed_functions;
20
20
    
21
 
    // +1 so that I can still use int64.MIN_VALUE.
22
 
    protected const int64 UNDEFINED = int64.MIN + 1; 
 
21
    protected const long UNDEFINED = long.MIN + 1; //+1 so that I can still use Long.MIN_VALUE.
23
22
    /** Right arrow */
24
23
    protected const string CH_RARR = "\u2192";
25
24
    /** Left arrow */
73
72
    /** Truncated output: equal */
74
73
    protected const string SYM_TRUNK_PART_EQUAL = CH_EQUAL; //"="
75
74
    /** Truncated output: begin */
76
 
    protected const string SYM_TRUNK_BEGIN = SYM_BEGIN
77
 
                                           + SYM_TRUNK_PART_ELLIPSIS
78
 
                                           + SYM_TRUNK_PART_EQUAL; //"[...="
 
75
    protected const string SYM_TRUNK_BEGIN = SYM_BEGIN + SYM_TRUNK_PART_ELLIPSIS + SYM_TRUNK_PART_EQUAL; //"[...="
79
76
    /** Truncated output: end */
80
77
    protected const string SYM_TRUNK_END = SYM_END; //"]"
81
78
    
85
82
    
86
83
    
87
84
    /**
88
 
     * Initialise the right function token by it's name.
 
85
     * Ititialise the right functon token by it's name.
89
86
     * 
90
87
     * @param token Token of the Function.
91
88
     * @param position Token position.
92
89
     * @return An instance representing the function, or @c null if not found.
93
90
     */
94
 
    public static FunctionToken? init_token (string token, int32 position) {
 
91
    public static FunctionToken? init_token (string token, int position) {
95
92
      
96
93
      if (_allowed_functions == null) {
97
 
        // Initialise the HashMap if it is not created.
 
94
        // Intialise the HashMap if it is not created.
98
95
        _allowed_functions = new Gee.HashMap<string, Type?> ();
99
96
        
100
97
        Entry[] entries = {
147
144
    }
148
145
    
149
146
    protected FastNumber get_optional_child_raw_result (Context instance,
150
 
                                                  int32 index,
151
 
                                                  int64 default_result)
 
147
                                                  int index,
 
148
                                                  long default_result)
152
149
                                                  throws GLib.Error {
153
150
     Token? tmp_roll = get_child (index);
154
151