Exception: ANTLR3::CompileTask::GrammarFile::FormatError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/antlr3/task.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, file = nil) ⇒ FormatError

Returns a new instance of FormatError.


473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/antlr3/task.rb', line 473

def initialize( source, file = nil )
  @file = file
  @source = source
  message = ''
  if file.nil? # inline
    message << "bad inline grammar source:\n"
    message << ( "-" * 80 ) << "\n"
    message << @source
    message[ -1 ] == ?\n or message << "\n"
    message << ( "-" * 80 ) << "\n"
    message << "could not locate a grammar name and type declaration matching\n"
    message << "/^\s*(lexer|parser|tree)?\s*grammar\s*(\S+)\s*;/"
  else
    message << 'bad grammar source in file %p\n' % @file
    message << ( "-" * 80 ) << "\n"
    message << @source
    message[ -1 ] == ?\n or message << "\n"
    message << ( "-" * 80 ) << "\n"
    message << "could not locate a grammar name and type declaration matching\n"
    message << "/^\s*(lexer|parser|tree)?\s*grammar\s*(\S+)\s*;/"
  end
  super( message )
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file


467
468
469
# File 'lib/antlr3/task.rb', line 467

def file
  @file
end

#sourceObject (readonly)

Returns the value of attribute source


467
468
469
# File 'lib/antlr3/task.rb', line 467

def source
  @source
end

Class Method Details

.[](*args) ⇒ Object


469
470
471
# File 'lib/antlr3/task.rb', line 469

def self.[]( *args )
  new( *args )
end