Skip to content

Latest commit

 

History

History
18 lines (10 loc) · 659 Bytes

How_to_fix_parsing_errors.md

File metadata and controls

18 lines (10 loc) · 659 Bytes

Parsing excel formulae

The parser that this project uses to turn excel formulae into abstract syntax trees is given in src/excel/formula_peg.txt. This is turned into the ruby code in formula_peg.rb using the command:

cd src/excel
text-peg2ruby-peg formula_peg.txt formula_peg.rb

The form of the grammar is given in the docs relating to the rubypeg gem, available from https://github.com/tamc/rubypeg

Testing the parser

Tests can be added to spec/test_data/formulae_to_ast.txt

In that file, each line contains an excel formula, followed by the ast into which it should be converted.

The tests are run by:

rspec spec/excel/formula_peg_spec.rb