|
Static methods defined here:
- make_evaluate_error(message, statement=None, config=None, eliminate_tag=False)
- Make evaluate-error.
Report error information and return EvaluateError that is
Exception.
This method does not raise Exception. So caller should raise
Exception if it is needed.
Args:
message (str): Error message
statement (Statement or NoneType, optional): Statement
where error occurs. It is used to get location.
None is given when cause is not Statement.
config (Config or NoneType, optional): Configuration if
needed.
eliminate_tag (bool, optional): True if tag is not needed,
False otherwise.
The default is False
Returns:
EvaluateError: Exception for raising.
- make_lex_error(message, medium, line, column, config=None)
- Make lex-error.
Report error information and return LexError that is Exception.
This method does not raise Exception. So caller should raise
Exception if it is needed.
Args:
message (str): Error message
medium (str or NoneType): The object that has source code.
line (int): Line number of location where error occurs.
column (int): Column number of location where error occurs.
config (Config or NoneType, optional): Configuration if
needed.
Returns:
LexError: Exception for raising.
- make_parse_error(message, token=None, config=None)
- Make parse-error.
Report error information and return ParseError that is
Exception.
This method does not raise Exception. So caller should raise
Exception if it is needed.
Args:
message (str): Error message
token (Token or NoneType, optional): Token.
None is given when
cause is not Token.
config (Config or NoneType, optional): Configuration if
needed.
Returns:
ParseError: Exception for raising.
- report(tag, message, location=None, config=None, eliminate_tag=False)
- Report an error message.
Print an error message into stderr according as configuration.
Args:
tag (str): Tag, such as "Lexer", "Parser", or "Evaluator".
message (str): Main message of Error
location (Token or str or NoneType, optional): The location
of error
config (Config or NoneType, optional): Configuration if
needed.
eliminate_tag (bool, optional): True if tag is not needed,
False otherwise.
The default is False
Returns:
str: Error message
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- EvaluateError = <class 'vivjson.error.Error.EvaluateError'>
- Evaluate-error class of Runtime error
- LexError = <class 'vivjson.error.Error.LexError'>
- Lex-error class of Runtime error
- ParseError = <class 'vivjson.error.Error.ParseError'>
- Parse-error class of Runtime error
- TAG = 'Viv'
|