Syntax errors

Module name: blackbird.error

This module contains the class BlackbirdErrorListener, which inherits the standard ANTLR4 error listener, and overrides the default syntaxError method.

This custom listener enables us to:

  1. Remove the extraneous Python traceback, which we generally do not want users to see.
  2. Replace some common ANTLR error messages, which can be a bit obfuscating, with ones that are more informative.

Note that we do not try and replace all error messages, just the more common ones that the user is likely to come across.

Summary

NoTraceBack(msg) A generic exception with no traceback provided
BlackbirdSyntaxError(msg) Blackbird syntax error exception
BlackbirdErrorListener Custom error listener for Blackbird

Code details

exception NoTraceBack(msg)[source]

A generic exception with no traceback provided

__init__(msg)[source]

Method executed when the exception is called.

Parameters:msg (str) – message to be printed in the traceback
__weakref__

list of weak references to the object (if defined)

exception BlackbirdSyntaxError(msg)[source]

Blackbird syntax error exception

class BlackbirdErrorListener[source]

Custom error listener for Blackbird