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

Class ParseError

Exception --+
            |
           ParseError

Known Subclasses:
ColorizingError, StructuringError, TokenizationError

The base class for errors generated while parsing docstrings.
Method Summary
  __init__(self, descr, linenum, is_fatal)
int __cmp__(self, other)
Compare two ParseErrors, based on their line number.
string __repr__(self)
Return the formal representation of this ParseError.
string __str__(self)
Return a string representation of this ParseError.
boolean is_fatal(self)
Return true if this is a fatal error.
int or None linenum(self)
Return the line number on which the error occured (including any offset).
None set_linenum_offset(self, offset)
Set the line number offset for this error.
Inherited from Exception: __getitem__

Instance Variable Summary
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

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

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

__cmp__(self, other)
(Comparison operator)

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

__repr__(self)
(Representation operator)

Return the formal representation of this ParseError. ParseErrors have formal representations of the form:
  <ParseError on line 12>
Returns:
the formal representation of this ParseError.
           (type=string)

__str__(self)
(Informal representation operator)

Return a string representation of this ParseError. This multi-line string contains a description of the error, and specifies where it occured.
Returns:
the informal representation of this ParseError.
           (type=string)
Overrides:
exceptions.Exception.__str__

is_fatal(self)

Returns:
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.
           (type=boolean)

linenum(self)

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

set_linenum_offset(self, offset)

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 - The new line number offset.
           (type=int)
Returns:
None

Instance Variable Details

_descr

A description of the error.
Type:
string

_fatal

True if this is a fatal error.
Type:
boolean

_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

Generated by Epydoc 2.1 on Sat Mar 20 17:46:13 2004 http://epydoc.sf.net