Class: Silicon::Routing::SyntaxErrorInterpreter
- Inherits:
-
Object
- Object
- Silicon::Routing::SyntaxErrorInterpreter
- Defined in:
- lib/silicon/routing/syntax_error_interpreter.rb
Instance Method Summary collapse
-
#initialize(syntax_parser) ⇒ SyntaxErrorInterpreter
constructor
A new instance of SyntaxErrorInterpreter.
- #interpret ⇒ Object
Constructor Details
#initialize(syntax_parser) ⇒ SyntaxErrorInterpreter
Returns a new instance of SyntaxErrorInterpreter.
6 7 8 |
# File 'lib/silicon/routing/syntax_error_interpreter.rb', line 6 def initialize(syntax_parser) @syntax_parser = syntax_parser end |
Instance Method Details
#interpret ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/silicon/routing/syntax_error_interpreter.rb', line 10 def interpret line_num = 1 (0..@syntax_parser.max_terminal_failure_index - 1).each {|i| line_num += 1 if @syntax_parser.input[i] == ';' } = "Syntax error in routes definition, line #{line_num}. Expected: " expected = [] @syntax_parser.terminal_failures.each do |f| item = f.expected_string .gsub('^', '<space>/<tab>') .gsub(';', '<new line>') expected << item end + expected.join(', ') + '.' end |