Class: Jkf::Parser::Base
- Inherits:
-
Object
- Object
- Jkf::Parser::Base
- Defined in:
- lib/jkf/parser/base.rb
Overview
Base of Parser
Instance Method Summary collapse
-
#parse(input) ⇒ Hash
start parse.
Instance Method Details
#parse(input) ⇒ Hash
start parse
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/jkf/parser/base.rb', line 12 def parse(input) @scanner = StringScanner.new(input.dup) @reported_pos = 0 @max_fail_pos = 0 @result = parse_root if success? && @scanner.eos? @result else record_failure(type: 'end', description: 'end of input') if failed? && @scanner.pos < input.size raise ParseError end end |