Class: Walrus::Parser
- Inherits:
-
Object
- Object
- Walrus::Parser
- Defined in:
- lib/walrus/parser.rb
Overview
The parser is currently quite slow, although perfectly usable. The quickest route to optimizing it may be to replace it with a C parser inside a Ruby extension, possibly generated using Ragel: www.cs.queensu.ca/~thurston/ragel/
Instance Method Summary collapse
Instance Method Details
#compile(string, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/walrus/parser.rb', line 29 def compile(string, = {}) @@compiler ||= Compiler.new parsed = [] catch :AndPredicateSuccess do # catch here because an empty file will throw parsed = parse string, end @@compiler.compile parsed, end |
#parse(string, options = {}) ⇒ Object
25 26 27 |
# File 'lib/walrus/parser.rb', line 25 def parse(string, = {}) @@grammar.parse(string, ) end |