Exception: CodeModels::ParsingError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/codemodels/parser.rb

Direct Known Subclasses

UnknownNodeType

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node, msg, line = nil, column = nil) ⇒ ParsingError

Returns a new instance of ParsingError.



51
52
53
54
55
56
57
58
# File 'lib/codemodels/parser.rb', line 51

def initialize(node,msg,line=nil,column=nil)
	super("Parsing error: #{msg}")
	@node = node
	@msg = msg
	@line = line
	@column = column
	raise "If column is specified also line should be" if line==nil and column!=nil
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



49
50
51
# File 'lib/codemodels/parser.rb', line 49

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



48
49
50
# File 'lib/codemodels/parser.rb', line 48

def line
  @line
end

#nodeObject (readonly)

Returns the value of attribute node.



47
48
49
# File 'lib/codemodels/parser.rb', line 47

def node
  @node
end

Instance Method Details

#to_sObject



60
61
62
63
64
65
66
67
68
# File 'lib/codemodels/parser.rb', line 60

def to_s
	if @line and @column
		"Parsing error: #{@msg}, node: #{node}, line: #{@line}, column: #{column}"
	elsif @line
	"Parsing error: #{@msg}, node: #{node}, line: #{@line}"
else
	"Parsing error: #{@msg}, node: #{node}"
end
end