1
namespace VQDR.Expression {
3
public abstract class ValueToken : Token {
4
protected ValueToken (int position) {
9
public static ValueToken? init_constant_token (long val, int position) {
10
//return new ConstantValueToken (val, position);
14
public static ValueToken? init_variable_token (string name, int position) {
15
//return new VariableValueToken (name, position);
19
public static long parse_raw_value (string str) {
21
int i_of_dot = str.index_of_char ('.');
24
// Get the decimal value from the string, if such a thing exists.
25
if ((str.length - 1 > i_of_dot)) {
26
ret_val = long.parse ((str + "000").substring (i_of_dot + 1));
30
// Normalise the digits.
31
while (ret_val > Token.VALUES_PRECISION_FACTOR) {
32
ret_val = ret_val / 10;
36
ret_val = ret_val + (long.parse ("0" + str.substring (0, i_of_dot)) * Token.VALUES_PRECISION_FACTOR);
38
ret_val = long.parse (str) * Token.VALUES_PRECISION_FACTOR;