Class: SportDb::Parser
- Inherits:
-
Object
- Object
- SportDb::Parser
- Defined in:
- lib/sportdb/parser.rb
Instance Method Summary collapse
-
#parse(lines, debug: false) ⇒ Object
convience helper - ignore errors by default.
- #parse_with_errors(lines, debug: false) ⇒ Object
-
#tokenize(lines, debug: false) ⇒ Object
convience helper - ignore errors by default.
-
#tokenize_with_errors(lines, debug: false) ⇒ Object
“default” lexer & parser (wraps RaccMatchParser).
Instance Method Details
#parse(lines, debug: false) ⇒ Object
convience helper - ignore errors by default
104 105 106 107 |
# File 'lib/sportdb/parser.rb', line 104 def parse( lines, debug: false ) tree, _ = parse_with_errors( lines, debug: debug ) tree end |
#parse_with_errors(lines, debug: false) ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/sportdb/parser.rb', line 95 def parse_with_errors( lines, debug: false ) ## todo/check - if lines needs to chack for array of lines and such ## or handled by tokenizer??? parser = RaccMatchParser.new( lines ) tree, errors = parser.parse_with_errors [tree, errors] end |
#tokenize(lines, debug: false) ⇒ Object
convience helper - ignore errors by default
89 90 91 92 |
# File 'lib/sportdb/parser.rb', line 89 def tokenize( lines, debug: false ) tokens, _ = tokenize_with_errors( lines, debug: debug ) tokens end |