Class: RDF::Turtle::Reader::SyntaxError

Inherits:
ReaderError
  • Object
show all
Defined in:
lib/rdf/turtle/reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, **options) ⇒ SyntaxError

Initializes a new syntax error instance.

Parameters:

  • message (String, #to_s)
  • options (Hash{Symbol => Object})

Options Hash (**options):

  • :production (Symbol) — default: nil
  • :token (String) — default: nil
  • :lineno (Integer) — default: nil


697
698
699
700
701
702
# File 'lib/rdf/turtle/reader.rb', line 697

def initialize(message, **options)
  @production = options[:production]
  @token      = options[:token]
  @lineno     = options[:lineno] || (@token.lineno if @token.respond_to?(:lineno))
  super(message.to_s)
end

Instance Attribute Details

#linenoInteger (readonly)

The line number where the error occurred.

Returns:

  • (Integer)


687
688
689
# File 'lib/rdf/turtle/reader.rb', line 687

def lineno
  @lineno
end

#productionSymbol (readonly)

The current production.

Returns:

  • (Symbol)


675
676
677
# File 'lib/rdf/turtle/reader.rb', line 675

def production
  @production
end

#tokenString (readonly)

The invalid token which triggered the error.

Returns:

  • (String)


681
682
683
# File 'lib/rdf/turtle/reader.rb', line 681

def token
  @token
end