Exception: Bade::Parser::SyntaxError
- Defined in:
- lib/bade/parser.rb
Overview
Error representing syntax error in specific file, line and column
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
Instance Method Summary collapse
-
#initialize(error, file, line, lineno, column) ⇒ SyntaxError
constructor
A new instance of SyntaxError.
- #to_s ⇒ Object
Constructor Details
#initialize(error, file, line, lineno, column) ⇒ SyntaxError
Returns a new instance of SyntaxError.
19 20 21 22 23 24 25 26 27 |
# File 'lib/bade/parser.rb', line 19 def initialize(error, file, line, lineno, column) super(error) @error = error @file = file || '(__TEMPLATE__)' @line = line.to_s @lineno = lineno @column = column end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
17 18 19 |
# File 'lib/bade/parser.rb', line 17 def column @column end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
17 18 19 |
# File 'lib/bade/parser.rb', line 17 def error @error end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
17 18 19 |
# File 'lib/bade/parser.rb', line 17 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
17 18 19 |
# File 'lib/bade/parser.rb', line 17 def line @line end |
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
17 18 19 |
# File 'lib/bade/parser.rb', line 17 def lineno @lineno end |
Instance Method Details
#to_s ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bade/parser.rb', line 29 def to_s line = @line.lstrip column = @column + line.size - @line.size <<~MSG #{error} #{file}, Line #{lineno}, Column #{@column} #{line} #{' ' * column}^ MSG end |