Exception: CodeModels::ParsingError
- Inherits:
-
StandardError
- Object
- StandardError
- CodeModels::ParsingError
- Defined in:
- lib/codemodels/parser.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
-
#initialize(node, msg, line = nil, column = nil) ⇒ ParsingError
constructor
A new instance of ParsingError.
- #to_s ⇒ Object
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
#column ⇒ Object (readonly)
Returns the value of attribute column.
49 50 51 |
# File 'lib/codemodels/parser.rb', line 49 def column @column end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
48 49 50 |
# File 'lib/codemodels/parser.rb', line 48 def line @line end |
#node ⇒ Object (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_s ⇒ Object
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 |