Exception: Citrus::SyntaxError

Inherits:
ScriptError
  • Object
show all
Defined in:
lib/citrus/exceptions.rb

Instance Method Summary collapse

Constructor Details

#initializeSyntaxError

Returns a new instance of SyntaxError.



3
4
5
6
7
8
9
10
# File 'lib/citrus/exceptions.rb', line 3

def initialize
  line = $parser.failure_line
  col = $parser.failure_column
  str = $parser.input.lines.to_a[line-1]
  str = str.slice(col-1, str.length).delete($/)
  str = "file end" if str.empty?
  super("Unexpected #{str} at #{line}:#{col}.")
end