README in citrus-2.3.2 vs README in citrus-2.3.3

- old
+ new

@@ -204,19 +204,10 @@ tightly than the vertical bar. A full chart of operators and their respective levels of precedence is below. See [Choice](api/classes/Citrus/Choice.html) for more information. -## Grouping - -As is common in many programming languages, parentheses may be used to override -the normal binding order of operators. In the following example parentheses are -used to make the vertical bar between `'b'` and `'c'` bind tighter than the -space between `'a'` and `'b'`. - - 'a' ('b' | 'c') # match "a", then "b" or "c" - ## Labels Match objects may be referred to by a different name than the rule that originally generated them. Labels are added by placing the label and a colon immediately preceding any expression. @@ -297,11 +288,20 @@ {} | Extension (literal) | 4 : | Label | 3 e1 e2 | Sequence | 2 e1 | e2 | Ordered choice | 1 +## Grouping +As is common in many programming languages, parentheses may be used to override +the normal binding order of operators. In the following example parentheses are +used to make the vertical bar between `'b'` and `'c'` bind tighter than the +space between `'a'` and `'b'`. + + 'a' ('b' | 'c') # match "a", then "b" or "c" + + # Example Below is an example of a simple grammar that is able to parse strings of integers separated by any amount of white space and a `+` symbol. @@ -508,11 +508,11 @@ match = Addition.parse('23 + 12', :root => :additive) assert(match) assert_equal('23 + 12', match) assert_equal(35, match.value) end - + def test_number match = Addition.parse('23', :root => :number) assert(match) assert_equal('23', match) assert_equal(23, match.value) @@ -565,11 +565,31 @@ To install the [Vim](http://www.vim.org/) scripts, copy the files in `extras/vim` to a directory in Vim's [runtimepath](http://vimdoc.sourceforge.net/htmldoc/options.html#\'runtimepath\'). +# Examples + + +The project source directory contains several example scripts that demonstrate +how grammars are to be constructed and used. Each Citrus file in the examples +directory has an accompanying Ruby file with the same name that contains a suite +of tests for that particular file. + +The best way to run any of these examples is to pass the name of the Ruby file +directly to the Ruby interpreter on the command line, e.g.: + + $ ruby -Ilib examples/calc.rb + +This particular invocation uses the `-I` flag to ensure that you are using the +version of Citrus that was bundled with that particular example file (i.e. the +version that is contained in the `lib` directory). + + # Links + +Discussion around Citrus happens on the [citrus-users Google group](http://groups.google.com/group/citrus-users). The primary resource for all things to do with parsing expressions can be found on the original [Packrat and Parsing Expression Grammars page](http://pdos.csail.mit.edu/~baford/packrat) at MIT.