Class: FixtureFox::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/fixture_fox/token.rb

Direct Known Subclasses

AnchorToken, Directive, Empty, Ident, Reference, Value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, lineno, initial_indent, pos, litt) ⇒ Token

Returns a new instance of Token.



10
11
12
13
# File 'lib/fixture_fox/token.rb', line 10

def initialize(file, lineno, initial_indent, pos, litt)
  @file, @lineno, @initial_indent, @pos, @litt = file, lineno, initial_indent, pos, litt
  @value = @litt
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



3
4
5
# File 'lib/fixture_fox/token.rb', line 3

def file
  @file
end

#initial_indentObject (readonly)

Returns the value of attribute initial_indent.



5
6
7
# File 'lib/fixture_fox/token.rb', line 5

def initial_indent
  @initial_indent
end

#linenoObject (readonly)

Returns the value of attribute lineno.



4
5
6
# File 'lib/fixture_fox/token.rb', line 4

def lineno
  @lineno
end

#littObject (readonly)

Returns the value of attribute litt.



7
8
9
# File 'lib/fixture_fox/token.rb', line 7

def litt
  @litt
end

#posObject (readonly)

Returns the value of attribute pos.



6
7
8
# File 'lib/fixture_fox/token.rb', line 6

def pos
  @pos
end

#valueObject (readonly)

Returns the value of attribute value.



8
9
10
# File 'lib/fixture_fox/token.rb', line 8

def value
  @value
end

Instance Method Details

#==(s) ⇒ Object



15
# File 'lib/fixture_fox/token.rb', line 15

def ==(s) @litt == s end

#error(msg) ⇒ Object

Raises:



18
19
20
# File 'lib/fixture_fox/token.rb', line 18

def error(msg)
  raise ParseError.new(file, lineno, initial_indent + pos, msg)
end

#to_sObject



16
# File 'lib/fixture_fox/token.rb', line 16

def to_s() @litt end