Exception: Language::Parser::Interuption
- Inherits:
-
StandardError
- Object
- StandardError
- Language::Parser::Interuption
show all
- Defined in:
- lib/language/parser/interuption.rb
Instance Method Summary
collapse
Constructor Details
#initialize(parser, atom = Atom.new) ⇒ Interuption
Returns a new instance of Interuption.
4
5
6
7
|
# File 'lib/language/parser/interuption.rb', line 4
def initialize(parser, atom = Atom.new)
@parser = parser
@atom = atom
end
|
Instance Method Details
#column_index ⇒ Object
23
24
25
|
# File 'lib/language/parser/interuption.rb', line 23
def column_index
cursor - input.lines[...line_index].map(&:size).sum
end
|
#line ⇒ Object
13
14
15
16
17
|
# File 'lib/language/parser/interuption.rb', line 13
def line
l = input.lines[line_index]
l += "\n" if l[-1] != "\n"
l
end
|
#line_index ⇒ Object
19
20
21
|
# File 'lib/language/parser/interuption.rb', line 19
def line_index
input[...cursor].count("\n")
end
|
#message ⇒ Object
9
10
11
|
# File 'lib/language/parser/interuption.rb', line 9
def message
"\n#{line}#{" " * column_index}^\n"
end
|