lib/formulae/parse/formula_peg.txt in rubyfromexcel-0.0.4 vs lib/formulae/parse/formula_peg.txt in rubyfromexcel-0.0.5
- old
+ new
@@ -7,31 +7,34 @@
string_join := thing (space `"&" space thing)+
arithmetic := thing (space operator space thing)+
comparison := thing space comparator space thing
comparator := '>=' | '<=' | '<>' | '>' | '<' | '='
string := `'"' /[^"]*/ `'"'
-any_reference = table_reference | local_table_reference | quoted_sheet_reference | sheet_reference | sheetless_reference
+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 := '+' | '-' | '/' | '*' | '^'
-table_reference := table_name `'[' (complex_structured_reference | simple_structured_reference) `']'
-local_table_reference := `'[' (complex_structured_reference | overly_structured_reference | simple_structured_reference) `']'
+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]+/
+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_.]+/
+named_reference := /[#a-zA-Z][\w_.!]+/
quoted_sheet_reference := single_quoted_string `'!' (sheetless_reference | named_reference)
sheet_reference := /[a-zA-Z0-9][\w_.]+/ `'!' (sheetless_reference | named_reference)
single_quoted_string = `"'" /[^']*/ `"'"
sheetless_reference = column_range | row_range | area | cell
column_range := column `':' column
row_range := row `':' row
area := reference `':' reference
cell := reference
row = /\$?\d+/
-column = /\$?[A-Z]+/
-reference = /\$?[A-Z]+\$?[0-9]+/
+column = /\$?[A-Za-z]{1,3}/
+reference = /\$?[A-Za-z]{1,3}\$?[0-9]+/
boolean = boolean_true | boolean_false
boolean_true := `'TRUE'
boolean_false := `'FALSE'
prefix := /[-+]/ thing
space = `/[ \n]*/