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
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jkf/parser/base.rb', line 9 def parse(input) @input = input.clone @current_pos = 0 @reported_pos = 0 @cached_pos = 0 @cached_pos_details = { line: 1, column: 1, seenCR: false } @max_fail_pos = 0 @max_fail_expected = [] @silent_fails = 0 @result = parse_root if success? && @current_pos == @input.size return @result else fail(type: "end", description: "end of input") if failed? && @current_pos < input.size raise ParseError end end |