Exception: MilkTea::SemanticError
- Inherits:
-
StandardError
- Object
- StandardError
- MilkTea::SemanticError
- Defined in:
- lib/milk_tea/core/semantic_analyzer.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#suggestion ⇒ Object
readonly
Returns the value of attribute suggestion.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(msg = nil, line: nil, column: nil, length: nil, path: nil, suggestion: nil) ⇒ SemanticError
constructor
A new instance of SemanticError.
- #to_diagnostic(path: nil) ⇒ Object
Constructor Details
#initialize(msg = nil, line: nil, column: nil, length: nil, path: nil, suggestion: nil) ⇒ SemanticError
Returns a new instance of SemanticError.
24 25 26 27 28 29 30 31 |
# File 'lib/milk_tea/core/semantic_analyzer.rb', line 24 def initialize(msg = nil, line: nil, column: nil, length: nil, path: nil, suggestion: nil) super(msg) @line = line @column = column @length = length @path = path @suggestion = suggestion end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
22 23 24 |
# File 'lib/milk_tea/core/semantic_analyzer.rb', line 22 def column @column end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
22 23 24 |
# File 'lib/milk_tea/core/semantic_analyzer.rb', line 22 def length @length end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
22 23 24 |
# File 'lib/milk_tea/core/semantic_analyzer.rb', line 22 def line @line end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
22 23 24 |
# File 'lib/milk_tea/core/semantic_analyzer.rb', line 22 def path @path end |
#suggestion ⇒ Object (readonly)
Returns the value of attribute suggestion.
22 23 24 |
# File 'lib/milk_tea/core/semantic_analyzer.rb', line 22 def suggestion @suggestion end |
Instance Method Details
#code ⇒ Object
33 34 35 |
# File 'lib/milk_tea/core/semantic_analyzer.rb', line 33 def code "sema/error" end |
#to_diagnostic(path: nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/milk_tea/core/semantic_analyzer.rb', line 37 def to_diagnostic(path: nil) Diagnostic.new( path: @path || path, line: @line, column: @column, length: @length, code: "sema/error", message: , severity: :error, ) end |