Class PackageProperties
java.lang.Object
org.ek9lang.compiler.support.PackageProperties
THE rule for what a 'defines package' block may hold (E06260): which property NAMES a package defines, and the
SHAPE each one's value must have.
- A single literal of one kind: 'version' a Version, 'description' and 'license' a String, 'publicAccess' and the 'applyStandard...' flags a Boolean.
- A List of String literals: 'tags', 'includeFiles', 'excludeFiles', 'capabilities'.
- A Dict of (String, String) literals: 'deps', 'devDeps', 'excludeDeps'.
Any other name is unusable - there is no 'name' property, the module name IS the package name. A package property is metadata read before compilation, so being any primary is not enough - "yes" is a primary, and read as a Boolean it was silently false.
Shared by the CLI's package pre-pass (Ek9SourceVisitor) and the in-process
pipeline (phase 1's PackagePropertyOrError), so the LSP, MCP tools and the CLI cannot disagree about what
a package may hold - they report the same message at the same place. Use this - do not re-derive the property
names or shapes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanTrue if a package defines a property of this name.static booleanisOfRequiredKind(String property, EK9Parser.AssignmentExpressionContext ive) True if the property is one a package defines and the assignment has the shape it requires.names()Every property name a package defines, in alphabetical order.problemWith(String property, EK9Parser.AssignmentExpressionContext ive) What is wrong with this package property, if anything - the text both doors report (afterIn '<module>' package:) as E06260.static org.antlr.v4.runtime.TokenreportAt(EK9Parser.VariableDeclarationContext variableDeclaration) Where a package property's problem is reported: its value, or its name when the value is not an expression.requiredLiteralType(String property) The fully qualified literal type a package property must be given, if it is a single-literal property.
-
Method Details
-
names
-
isKnown
True if a package defines a property of this name. -
requiredLiteralType
-
isOfRequiredKind
True if the property is one a package defines and the assignment has the shape it requires. -
problemWith
public static Optional<String> problemWith(String property, EK9Parser.AssignmentExpressionContext ive) What is wrong with this package property, if anything - the text both doors report (afterIn '<module>' package:) as E06260. Empty when the property is known and of the required shape. -
reportAt
public static org.antlr.v4.runtime.Token reportAt(EK9Parser.VariableDeclarationContext variableDeclaration) Where a package property's problem is reported: its value, or its name when the value is not an expression.
-