Exception: Bade::Parser::SyntaxError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/bade/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, file, line, lineno, column) ⇒ SyntaxError

Returns a new instance of SyntaxError.



15
16
17
18
19
20
21
# File 'lib/bade/parser.rb', line 15

def initialize(error, file, line, lineno, column)
  @error = error
  @file = file || '(__TEMPLATE__)'
  @line = line.to_s
  @lineno = lineno
  @column = column
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



13
14
15
# File 'lib/bade/parser.rb', line 13

def column
  @column
end

#errorObject (readonly)

Returns the value of attribute error.



13
14
15
# File 'lib/bade/parser.rb', line 13

def error
  @error
end

#fileObject (readonly)

Returns the value of attribute file.



13
14
15
# File 'lib/bade/parser.rb', line 13

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line.



13
14
15
# File 'lib/bade/parser.rb', line 13

def line
  @line
end

#linenoObject (readonly)

Returns the value of attribute lineno.



13
14
15
# File 'lib/bade/parser.rb', line 13

def lineno
  @lineno
end

Instance Method Details

#to_sObject



23
24
25
26
27
28
29
30
31
# File 'lib/bade/parser.rb', line 23

def to_s
  line = @line.lstrip
  column = @column + line.size - @line.size
  %{#{error}
  #{file}, Line #{lineno}, Column #{@column}
  #{line}
  #{' ' * column}^
}
end