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
Instance Method Summary collapse
Instance Method Details
#compile(string, options = {}) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/walrus/parser.rb', line 35 def compile string, = {} @@compiler ||= Compiler.new parsed = [] catch :AndPredicateSuccess do # catch here because empty files throw parsed = parse string, end @@compiler.compile parsed, end |
#parse(string, options = {}) ⇒ Object
31 32 33 |
# File 'lib/walrus/parser.rb', line 31 def parse string, = {} Grammar.new.parse string, end |