Exception: Flexr::Runtime::TokenTooLargeError

Inherits:
LexError
  • Object
show all
Defined in:
lib/flexr/runtime/errors.rb

Constant Summary collapse

CODE =
"FLEXR-E012"

Instance Attribute Summary collapse

Attributes inherited from LexError

#byte_pos, #filename, #line, #text

Attributes inherited from Error

#diagnostic

Instance Method Summary collapse

Constructor Details

#initialize(message = "token exceeds max_token_size", filename: nil, byte_pos: nil, line: nil, text: nil, rule: nil) ⇒ TokenTooLargeError

Returns a new instance of TokenTooLargeError.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/flexr/runtime/errors.rb', line 10

def initialize(message = "token exceeds max_token_size", filename: nil, byte_pos: nil, line: nil, text: nil,
               rule: nil)
  @code = CODE
  @rule = rule
  diagnostic = Diagnostics.error(
    CODE,
    message,
    help: "increase max_token_size or split the input token",
    note: rule.nil? ? nil : "rule #{rule} at byte #{byte_pos}"
  )
  super(message, filename: filename, byte_pos: byte_pos, line: line, text: text, diagnostic: diagnostic)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



8
9
10
# File 'lib/flexr/runtime/errors.rb', line 8

def code
  @code
end

#ruleObject (readonly)

Returns the value of attribute rule.



8
9
10
# File 'lib/flexr/runtime/errors.rb', line 8

def rule
  @rule
end