Class: Rsec::ParseContext
- Inherits:
-
Object
- Object
- Rsec::ParseContext
- Defined in:
- lib/error.rb
Overview
expand error reporting of Rsec
Instance Method Summary collapse
Instance Method Details
#report_error(msg, source) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/error.rb', line 3 def report_error(msg, source) if pos <= @last_fail_pos line = line @last_fail_pos col = col @last_fail_pos line_text = line_text @last_fail_pos expect_tokens = Rsec::Fail.get_tokens @last_fail_mask expects = ", expect token [ #{expect_tokens.join ' | '} ]" else line = line pos col = col pos line_text = line_text pos expects = nil end msg = "#{msg}\nin #{source}:#{line} at #{col}#{expects}" Rsec::SyntaxError.new msg, line_text, line, col end |