RuntimeMetaData

This class provides access to the current version of the ANTLR 4 runtime library as compile-time and runtime constants, along with methods for checking for matching version numbers and notifying listeners in the case where a version mismatch is detected.

<p> The runtime version information is provided by {@link #VERSION} and {@link #getRuntimeVersion()}. Detailed information about these values is provided in the documentation for each member.</p>

<p> The runtime version check is implemented by {@link #checkVersion}. Detailed information about incorporating this call into user code, as well as its use in generated code, is provided in the documentation for the method.</p>

<p> Version strings x.y and x.y.z are considered "compatible" and no error would be generated. Likewise, version strings x.y-SNAPSHOT and x.y.z are considered "compatible" because the major and minor components x.y are the same in each.</p>

<p> To trap any error messages issued by this code, use System.setErr() in your main() startup code. </p>

Members

Static functions

checkVersion
void checkVersion(string generatingToolVersion, string compileTimeVersion)

This method provides the ability to detect mismatches between the version of ANTLR 4 used to generate a parser, the version of the ANTLR runtime a parser was compiled against, and the version of the ANTLR runtime which is currently executing.

getMajorMinorVersion
string getMajorMinorVersion(string antlr_version)

Gets the major and minor version numbers from a version string. For details about the syntax of the input {@code version}. E.g., from x.y.z return x.y.

Static variables

VERSION
string VERSION;

A compile-time constant containing the current version of the ANTLR 4 runtime library.

Meta