Class TextDfnGenerator
java.lang.Object
org.ek9lang.compiler.phase7.AbstractDfnGenerator
org.ek9lang.compiler.phase7.TextDfnGenerator
- All Implemented Interfaces:
Function<EK9Parser.TextDeclarationContext, IRConstruct>
final class TextDfnGenerator
extends AbstractDfnGenerator
implements Function<EK9Parser.TextDeclarationContext, IRConstruct>
Creates the appropriate IR Construct for a text declaration.
Text constructs are EK9's first-class internationalization (i18n) system that provides:
- Compile-time validation of translation completeness
- Type-safe parameters for text templates
- String interpolation within text bodies
- Runtime locale selection
Deals with the following ANTLR grammar:
textDeclaration
: identifier AS? NL+ INDENT NL* (directive? textBodyDeclaration NL+)+ DEDENT
;
textBodyDeclaration
: identifier (LPAREN RPAREN)? NL+ INDENT NL* argumentParam? directive? stringLit NL+ DEDENT
;
Text body methods have an implicit String return type. The stringLit IS the return value.
This is different from regular methods where you declare <- rtn as String.
-
Field Summary
Fields inherited from class AbstractDfnGenerator
generators, notImplicitSuper, operationDfnGenerator, stackContext, voidStr -
Constructor Summary
ConstructorsConstructorDescriptionTextDfnGenerator(IRGenerationContext stackContext) Constructor using stack context - the single source of state. -
Method Summary
Methods inherited from class AbstractDfnGenerator
createDebugInfoCreator, createInitOperation, createInstanceInitOperation, getParsedModule, newPerConstructContext, newSyntheticInitOperation, processAsMethodOrOperator, processPropertiesForInstanceInit, processSyntheticConstructor
-
Constructor Details
-
TextDfnGenerator
TextDfnGenerator(IRGenerationContext stackContext) Constructor using stack context - the single source of state.
-
-
Method Details
-
apply
- Specified by:
applyin interfaceFunction<EK9Parser.TextDeclarationContext, IRConstruct>
-