Exception: VerilogTools::ParseError
- Inherits:
-
StandardError
- Object
- StandardError
- VerilogTools::ParseError
- Defined in:
- lib/HDLRuby/verilog_parser.rb
Overview
The class describing parse errors.
Instance Method Summary collapse
-
#initialize(msg, line, lpos, cpos, filename) ⇒ ParseError
constructor
Create a new parse error with message +msg+, faulty line text +line_text+, line number +lpos+, column +cpos+, and possibly file name +filename+.
-
#make_message ⇒ Object
Generate the error message.
Constructor Details
#initialize(msg, line, lpos, cpos, filename) ⇒ ParseError
Create a new parse error with message +msg+, faulty line text +line_text+, line number +lpos+, column +cpos+, and possibly file name +filename+.
99 100 101 102 103 104 105 106 |
# File 'lib/HDLRuby/verilog_parser.rb', line 99 def initialize(msg,line,lpos,cpos,filename) @msg = msg.to_s @line = line.to_s.gsub(/\t/," ") @lpos = lpos.to_i @cpos = cpos.to_i @filename = filename.to_s if filename super(self.) end |
Instance Method Details
#make_message ⇒ Object
Generate the error message. NOTE: if you want to translate the error message, please redefine the function.
111 112 113 114 115 116 117 118 119 |
# File 'lib/HDLRuby/verilog_parser.rb', line 111 def if @filename then head = "Parse error in file '#{@filename}' " else head = "Parse error " end return head + "line #{@lpos}: " + @msg + ".\n" + "#{@line}\n" + ("-" * (@cpos)) + "^" end |