Trying to show a problem with the Treetop Documentation at http://cjheath.github.io/treetop/pitfalls_and_advanced_techniques.html
Say I want to parse a diabolical wiki syntax in which the following interpretations apply.
** *hello* ** --> <strong><em>hello</em></strong> * **hello** * --> <em><strong>hello</strong></em> rule strong '**' (em / !'*' . / '\*')+ '**' end rule em '**' (strong / !'*' . / '\*')+ '**' end
Emphasized text is allowed within strong text by virtue of em being the first alternative. Since em will only successfully parse if a matching * is found, it is permitted, but other than that, no * characters are allowed unless they are escaped.
It gives me the following error.
$ rake
Expected one of **, \* at line 1, column 4 (byte 4) after **
1
4
rake aborted!
Exception: Parse error at offset: 0
/Users/spundun/Documents/code_samples/treetop_nested_non_unique_delimiters/parser.rb:24:in `parse'
/Users/spundun/Documents/code_samples/treetop_nested_non_unique_delimiters/Rakefile:6:in `block in <top (required)>'
/Users/spundun/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/Users/spundun/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => default => test
(See full trace by running task with --trace)
$
Thanks, applied. Sorry it took a while to get to it.