lib/fonte/parsers/number.treetop in fonte-0.1.0 vs lib/fonte/parsers/number.treetop in fonte-0.2.0
- old
+ new
@@ -1,10 +1,12 @@
module Fonte
module Parsers
grammar Number
+ include Word
+
rule number
- float / integer
+ coordinates / float / integer
end
rule float
(
# Scientific notation (eg 5e7, 2.2E-4)
@@ -32,9 +34,21 @@
) {
def value
Integer(text_value)
end
}
+ end
+
+ rule coordinates
+ x:coordinate SPACE y:coordinate SPACE z:coordinate {
+ def value
+ [x.value, y.value, z.value]
+ end
+ }
+ end
+
+ rule coordinate
+ float / integer
end
end
end
end