Exception: Layo::SyntaxError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/layo/syntax_error.rb

Direct Known Subclasses

UnexpectedTokenError, UnknownTokenError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line, pos, msg) ⇒ SyntaxError

Returns a new instance of SyntaxError.



5
6
7
8
# File 'lib/layo/syntax_error.rb', line 5

def initialize(line, pos, msg)
  super(msg)
  @line, @pos = line, pos
end

Instance Attribute Details

#lineObject

Returns the value of attribute line.



3
4
5
# File 'lib/layo/syntax_error.rb', line 3

def line
  @line
end

#posObject

Returns the value of attribute pos.



3
4
5
# File 'lib/layo/syntax_error.rb', line 3

def pos
  @pos
end

Instance Method Details

#to_sObject



10
11
12
# File 'lib/layo/syntax_error.rb', line 10

def to_s
  super << " on line #{@line}, character #{@pos}"
end