Exception: MOF::Helper::ParserError

Inherits:
Error
  • Object
show all
Defined in:
lib/mof/helper.rb

Instance Attribute Summary collapse

Attributes inherited from Error

#lineno, #msg, #name

Instance Method Summary collapse

Constructor Details

#initialize(name, lineno, line, token, token_value, stack) ⇒ ParserError

Returns a new instance of ParserError.



116
117
118
119
# File 'lib/mof/helper.rb', line 116

def initialize name, lineno, line, token, token_value, stack
  @token,@token_value,@stack = token, token_value, stack
  super name,lineno,line,""
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



115
116
117
# File 'lib/mof/helper.rb', line 115

def line
  @line
end

#stackObject (readonly)

Returns the value of attribute stack.



115
116
117
# File 'lib/mof/helper.rb', line 115

def stack
  @stack
end

#tokenObject (readonly)

Returns the value of attribute token.



115
116
117
# File 'lib/mof/helper.rb', line 115

def token
  @token
end

#token_valueObject (readonly)

Returns the value of attribute token_value.



115
116
117
# File 'lib/mof/helper.rb', line 115

def token_value
  @token_value
end

Instance Method Details

#to_sObject



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/mof/helper.rb', line 120

def to_s
  ret = "#{super}\tnear token #{@token_value.inspect}\n"
  ret << "\tStack [#{@stack.size}]:\n"
  idx = stack.size-1
  (1..12).each do |i|
	s = stack[idx]
	c = s.class
	case s
	when String, NilClass
	  s = s.inspect
	else
	  s = s.to_s
	end
	if s.size > 80
	  ret << "[#{i}:#{c}]\t#{s[0,80]}..."
	else
	  ret << "[#{i}:#{c}]\t#{s}"
	end
	ret << "\n"
	idx -= 1
	break if idx < 0
  end
  ret
end