lib/formulae/parse/formula_peg.txt in rubyfromexcel-0.0.7 vs lib/formulae/parse/formula_peg.txt in rubyfromexcel-0.0.9
- old
+ new
@@ -1,24 +1,24 @@
formula := space? expression+
-expression = string_join | arithmetic | comparison | thing
+expression = string_join | comparison | arithmetic | thing
thing = function | brackets | any_reference | string | percentage | number | boolean | prefix | named_reference
argument = expression | null
function := /[A-Z]+/ `'(' space argument? (space `',' space argument)* space `')'
brackets := `'(' space expression+ space `')'
string_join := thing (space `"&" space thing)+
arithmetic := thing (space operator space thing)+
-comparison := thing space comparator space thing
+comparison := (arithmetic | thing) space comparator space (arithmetic | thing)
comparator := '>=' | '<=' | '<>' | '>' | '<' | '='
string := `'"' /[^"]*/ `'"'
any_reference = external_reference | any_internal_reference
any_internal_reference = table_reference | local_table_reference | quoted_sheet_reference | sheet_reference | sheetless_reference
percentage := /[-+]?[0-9]+\.?[0-9]*/ `'%'
number := /[-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?/
operator := '+' | '-' | '/' | '*' | '^'
external_reference := /\[\d+\]!?/ any_internal_reference
table_reference := table_name `'[' (range_structured_reference | complex_structured_reference | simple_structured_reference) `']'
local_table_reference := `'[' (range_structured_reference | complex_structured_reference | overly_structured_reference | simple_structured_reference) `']'
-table_name = /[.a-zA-Z0-9]+/
+table_name = /[.a-zA-Z0-9_]+/
range_structured_reference = /\[[^\u005d]*\],\[[^\u005d]*\]:\[[^\u005d]*\]/
complex_structured_reference = /\[[^\u005d]*\],\[[^\u005d]*\]/
overly_structured_reference = `'[' simple_structured_reference `']'
simple_structured_reference = /[^\u005d]*/
named_reference := /[#a-zA-Z][\w_.!]+/