summary refs log tree commit diff stats
ModeNameSize
-rw-r--r--.gitignore23log stats plain blame
-rw-r--r--CHANGELOG3916log stats plain blame
-rw-r--r--COPYING35147log stats plain blame
-rw-r--r--INSTALL616log stats plain blame
-rw-r--r--Makefile2545log stats plain blame
-rw-r--r--README2845log stats plain blame
d---------doc269log stats plain
-rwxr-xr-xranger.py1901log stats plain blame
d---------ranger367log stats plain
d---------scripts34log stats plain
-rwxr-xr-xsetup.py1516log stats plain blame
#336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
//: Support literal non-integers.
//: '3.14159:literal' is ugly, so we'll just say '3.14159' for non-integers.

:(scenarios load)
:(scenario noninteger_literal)
recipe main [
  1:number <- copy 3.14159
]
+parse:   ingredient: {name: "3.14159", properties: ["3.14159": "literal-number"]}

:(after "reagent::reagent(string s)")
  if (is_noninteger(s)) {
    name = s;
    types.push_back(0);
    properties.push_back(pair<string, vector<string> >(name, vector<string>()));
    properties.back().second.push_back("literal-number");
    set_value(to_double(s));
    return;
  }

:(code)
bool is_noninteger(const string& s) {
  return s.find_first_not_of("0123456789-.") == string::npos
      && s.find('.') != string::npos;
}

double to_double(string n) {
  char* end = NULL;
  // safe because string.c_str() is guaranteed to be null-terminated
  double result = strtod(n.c_str(), &end);
  assert(*end == '\0');
  return result;
}
bc798862e6b8b2dbd77328c8f99a2'>^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107