Lines Matching +full:- +full:- +full:version
8 * This class provides access to the current version of the ANTLR 4 runtime
9 * library as compile-time and runtime constants, along with methods for
10 * checking for matching version numbers and notifying listeners in the case
11 * where a version mismatch is detected.
13 * The runtime version information is provided by {@see RuntimeMetaData::VERSION} and
17 * The runtime version check is implemented by {@see RuntimeMetaData::checkVersion()}. Detailed
21 * Version strings x.y and x.y.z are considered "compatible" and no error
22 * would be generated. Likewise, version strings x.y-SNAPSHOT and x.y.z are
31 * A compile-time constant containing the current version of the ANTLR 4
34 * This compile-time constant value allows generated parsers and other
35 * libraries to include a literal reference to the version of the ANTLR 4
39 * Version numbers are assumed to have the form
40 * `major.minor.patch.evision-suffix`, with the individual components
43 * - major is a required non-negative integer, and is equal to
45 * - minor< is a required non-negative integer.
46 * - patch is an optional non-negative integer. When `patch` is omitted,
48 * - revision is an optional non-negative integer, and may only be included
51 * - suffix is an optional string. When `suffix` is omitted, the `-`
52 * (hyphen-minus) appearing before it is also omitted.
54 public const VERSION = '4.9.2'; define in Antlr\\Antlr4\\Runtime\\RuntimeMetaData
57 * Gets the currently executing version of the ANTLR 4 runtime library.
60 * {@see RuntimeMetaData::VERSION} field, as opposed to directly
61 * referencing the field as a compile-time constant.</p>
63 * @return string The currently executing version of the ANTLR 4 library
67 return self::VERSION;
71 * This method provides the ability to detect mismatches between the version
72 * of ANTLR 4 used to generate a parser, the version of the ANTLR runtime a
73 * parser was compiled against, and the version of the ANTLR runtime which
76 * The version check is designed to detect the following two specific
79 * The ANTLR Tool version used for code generation does not match the
80 * currently executing runtime version.
81 * The ANTLR Runtime version referenced at the time a parser was
82 * compiled does not match the currently executing runtime version.
85 * using two constants in each generated lexer and parser: a hard-coded
86 * constant indicating the version of the tool used to generate the parser
87 * and a reference to the compile-time constant {@link VERSION}. At
94 * version match and emits an error to stderr if a difference
99 * cases, the underlying version mismatch will not be reported here.
107 * *Additional note for target developers:* The version check
114 * @param string $generatingToolVersion The version of the tool used to
119 * @param string $compileTimeVersion The version of the runtime the parser
122 * to {@see RuntimeMetaData::VERSION}.
126 $runtimeConflictsWithGeneratingTool = $generatingToolVersion !== self::VERSION
127 …& self::getMajorMinorVersion($generatingToolVersion) !== self::getMajorMinorVersion(self::VERSION);
129 $runtimeConflictsWithCompileTimeTool = $compileTimeVersion !== self::VERSION
130 … && self::getMajorMinorVersion($compileTimeVersion) !== self::getMajorMinorVersion(self::VERSION);
135 'ANTLR Tool version %s used for code generation does not ' .
136 'match the current runtime version %s',
138 self::VERSION
147 'ANTLR Runtime version %s used for parser compilation does not ' .
148 'match the current runtime version %s',
150 self::VERSION
158 * Gets the major and minor version numbers from a version string. For
159 * details about the syntax of the input `version`.
162 * @param string $version The complete version string.
165 * only the major and minor components of the version string.
167 public static function getMajorMinorVersion(string $version) : string argument
169 $firstDot = \strpos($version, '.');
170 $referenceLength = \strlen($version);
174 $secondDot = \strpos($version, '.', $firstDot + 1);
177 $firstDash = \strpos($version, '-');
187 return \substr($version, 0, $referenceLength);