Package epydoc :: Package markup :: Class ParseError
[hide private]
[frames] | no frames]

Class ParseError

source code


The base class for errors generated while parsing docstrings.

Instance Methods [hide private]
 
__init__(self, descr, linenum=None, is_fatal=1) source code
boolean
is_fatal(self)
Returns: true if this is a fatal error.
source code
int or None
linenum(self)
Returns: The line number on which the error occured (including any offset).
source code
None
set_linenum_offset(self, offset)
Set the line number offset for this error.
source code
 
descr(self) source code
string
__str__(self)
Return a string representation of this ParseError.
source code
string
__repr__(self)
Return the formal representation of this ParseError.
source code
int
__cmp__(self, other)
Compare two ParseErrors, based on their line number.
source code

Inherited from exceptions.Exception: __getitem__

Instance Variables [hide private]
string _descr
A description of the error.
boolean _fatal
True if this is a fatal error.
int _linenum
The line on which the error occured within the docstring.
int _offset
The line number where the docstring begins.
Method Details [hide private]

__init__(self, descr, linenum=None, is_fatal=1)
(Constructor)

source code 
Parameters:
  • descr (string) - A description of the error.
  • linenum (int) - The line on which the error occured within the docstring. The linenum of the first line is 0.
  • is_fatal (boolean) - True if this is a fatal error.
Overrides: exceptions.Exception.__init__

is_fatal(self)

source code 
Returns: boolean
true if this is a fatal error. If an error is fatal, then epydoc should ignore the output of the parser, and parse the docstring as plaintext.

linenum(self)

source code 
Returns: int or None
The line number on which the error occured (including any offset). If the line number is unknown, then return None.

set_linenum_offset(self, offset)

source code 

Set the line number offset for this error. This offset is the line number where the docstring begins. This offset is added to _linenum when displaying the line number of the error.

Parameters:
  • offset (int) - The new line number offset.
Returns: None

__str__(self)
(Informal representation operator)

source code 

Return a string representation of this ParseError. This multi-line string contains a description of the error, and specifies where it occured.

Returns: string
the informal representation of this ParseError.
Overrides: exceptions.Exception.__str__

__repr__(self)
(Representation operator)

source code 

Return the formal representation of this ParseError. ParseErrors have formal representations of the form:

  <ParseError on line 12>
Returns: string
the formal representation of this ParseError.

__cmp__(self, other)
(Comparison operator)

source code 

Compare two ParseErrors, based on their line number.

  • Return -1 if self.linenum<other.linenum
  • Return +1 if self.linenum>other.linenum
  • Return 0 if self.linenum==other.linenum.

The return value is undefined if other is not a ParseError.

Returns: int

Instance Variable Details [hide private]

_linenum

The line on which the error occured within the docstring. The linenum of the first line is 0.
Type:
int

_offset

The line number where the docstring begins. This offset is added to _linenum when displaying the line number of the error. Default value: 1.
Type:
int