Exception: Ruby::Rego::ParserError
- Defined in:
- lib/ruby/rego/errors.rb
Overview
Error raised during parsing.
Instance Attribute Summary collapse
-
#column ⇒ Integer
readonly
-
#context ⇒ String?
readonly
-
#line ⇒ Integer
readonly
Attributes inherited from Error
Class Method Summary collapse
-
.from_position(message, position:, context: nil) ⇒ ParserError
Build an error from a position hash or location.
Instance Method Summary collapse
-
#initialize(message, location:, context: nil) ⇒ ParserError
constructor
Create a parser error.
Methods inherited from Error
Constructor Details
#initialize(message, location:, context: nil) ⇒ ParserError
Create a parser error.
95 96 97 98 99 100 101 |
# File 'lib/ruby/rego/errors.rb', line 95 def initialize(, location:, context: nil) @line = location.line @column = location.column @context = context composed = context ? "#{} (context: #{context})" : super(composed, location: location) end |
Instance Attribute Details
#column ⇒ Integer (readonly)
85 86 87 |
# File 'lib/ruby/rego/errors.rb', line 85 def column @column end |
#context ⇒ String? (readonly)
88 89 90 |
# File 'lib/ruby/rego/errors.rb', line 88 def context @context end |
#line ⇒ Integer (readonly)
82 83 84 |
# File 'lib/ruby/rego/errors.rb', line 82 def line @line end |
Class Method Details
.from_position(message, position:, context: nil) ⇒ ParserError
Build an error from a position hash or location.
109 110 111 112 |
# File 'lib/ruby/rego/errors.rb', line 109 def self.from_position(, position:, context: nil) location = Location.from(position) new(, location: location, context: context) end |