Class: Parser::Marker

Inherits:
Object show all
Defined in:
lib/carat/parser.rb,
lib/carat/parser-old.rb

Overview

Token Marker

This is the superclas of Token, UnitToken and RawToken

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, match, parent) ⇒ Marker

Returns a new instance of Marker.



138
139
140
# File 'lib/carat/parser.rb', line 138

def initialize
  @content = []
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



299
300
301
# File 'lib/carat/parser-old.rb', line 299

def body
  @body
end

#contentObject

Returns the value of attribute content.



136
137
138
# File 'lib/carat/parser.rb', line 136

def content
  @content
end

#inner_rangeObject

Returns the value of attribute inner_range.



137
138
139
# File 'lib/carat/parser.rb', line 137

def inner_range
  @inner_range
end

#keyObject (readonly)

Returns the value of attribute key.



299
300
301
# File 'lib/carat/parser-old.rb', line 299

def key
  @key
end

#matchObject

Returns the value of attribute match.



136
137
138
# File 'lib/carat/parser.rb', line 136

def match
  @match
end

#outer_rangeObject

Returns the value of attribute outer_range.



137
138
139
# File 'lib/carat/parser.rb', line 137

def outer_range
  @outer_range
end

#parentObject

Returns the value of attribute parent.



136
137
138
# File 'lib/carat/parser.rb', line 136

def parent
  @parent
end

#tokenObject

Returns the value of attribute token.



136
137
138
# File 'lib/carat/parser.rb', line 136

def token
  @token
end

Instance Method Details

#<<(content) ⇒ Object

array-like methods



142
# File 'lib/carat/parser.rb', line 142

def <<( content ) ; @content << content ; end

#each(&blk) ⇒ Object



146
# File 'lib/carat/parser.rb', line 146

def each(&blk) ; @content.each(&blk) ; end

#empty?Boolean

Returns:

  • (Boolean)


144
# File 'lib/carat/parser.rb', line 144

def empty? ; @content.empty? ; end

#lastObject



143
# File 'lib/carat/parser.rb', line 143

def last ; @content.empty? ? @content : @content.last ; end

#popObject



145
# File 'lib/carat/parser.rb', line 145

def pop ; @content.pop ; end