Record Class GrammarCatalogEntry
java.lang.Object
java.lang.Record
name.jurgenei.gradle.antlr.catalog.GrammarCatalogEntry
public record GrammarCatalogEntry(String name, String runtimeGrammar, String parser, String lexer, String startRule)
extends Record
Immutable grammar entry loaded from a catalog file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.lexer()Returns the lexer coordinate from the catalog entry.name()Returns the catalog grammar name.parser()Returns the parser coordinate from the catalog entry.resolveLexerPath(Path baseDirectory) Resolves lexer coordinate to a local path when applicable.resolveLexerUri(Path baseDirectory) Resolves lexer coordinate to a URI.resolveParserPath(Path baseDirectory) Resolves parser coordinate to a local path when applicable.resolveParserUri(Path baseDirectory) Resolves parser coordinate to a URI.Resolves effective runtime grammar key.Returns the optional runtime grammar alias.Returns the parser start rule configured for this entry.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
GrammarCatalogEntry
public GrammarCatalogEntry(String name, String runtimeGrammar, String parser, String lexer, String startRule) Creates an immutable grammar catalog entry.- Parameters:
name- catalog grammar name.runtimeGrammar- optional runtime grammar key used by legacy converter mode.parser- parser coordinate (path or class name depending on task configuration).lexer- lexer coordinate (path or class name depending on task configuration).startRule- parser entry rule name.
-
-
Method Details
-
name
Returns the catalog grammar name.- Returns:
- catalog grammar name.
-
runtimeGrammar
Returns the optional runtime grammar alias.- Returns:
- optional runtime grammar key.
-
parser
Returns the parser coordinate from the catalog entry.- Returns:
- parser coordinate value.
-
lexer
Returns the lexer coordinate from the catalog entry.- Returns:
- lexer coordinate value.
-
startRule
Returns the parser start rule configured for this entry.- Returns:
- parser entry rule name.
-
resolveRuntimeGrammar
Resolves effective runtime grammar key.- Returns:
runtimeGrammarwhen provided, otherwisename.
-
resolveParserPath
Resolves parser coordinate to a local path when applicable.- Parameters:
baseDirectory- base directory used for relative coordinates.- Returns:
- local parser path, or
nullfor non-file URIs.
-
resolveLexerPath
Resolves lexer coordinate to a local path when applicable.- Parameters:
baseDirectory- base directory used for relative coordinates.- Returns:
- local lexer path, or
nullfor non-file URIs.
-
resolveParserUri
Resolves parser coordinate to a URI.- Parameters:
baseDirectory- base directory used for relative coordinates.- Returns:
- parser URI.
-
resolveLexerUri
Resolves lexer coordinate to a URI.- Parameters:
baseDirectory- base directory used for relative coordinates.- Returns:
- lexer URI.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).
-