Package de.monticore.siunit.siunits
Class SIUnitsMill
- java.lang.Object
-
- de.monticore.siunit.siunits.SIUnitsMill
-
- Direct Known Subclasses:
SIUnitsMillForSIUnitLiterals
,SIUnitsMillForSIUnitTypes4Computing
,SIUnitsMillForSIUnitTypes4Math
public class SIUnitsMill extends java.lang.Object
The mill is a factory for builders and other commonly used functions, such as parsers or visitors. The mill was introduced to ensure compositionality of languages, while retaining reusability of functions developed for sublanguages. Only one mill instance exists, even though in composed languages it is available under several static signatures.
-
-
Field Summary
Fields Modifier and Type Field Description protected SIUnitsFullPrettyPrinter
fullPrettyPrinter
protected static SIUnitsMill
mill
protected ISIUnitsGlobalScope
sIUnitsGlobalScope
protected ISIUnitsTypeDispatcher
typeDispatcher
-
Constructor Summary
Constructors Modifier Constructor Description protected
SIUnitsMill()
-
Method Summary
-
-
-
Field Detail
-
mill
protected static SIUnitsMill mill
-
fullPrettyPrinter
protected SIUnitsFullPrettyPrinter fullPrettyPrinter
-
typeDispatcher
protected ISIUnitsTypeDispatcher typeDispatcher
-
sIUnitsGlobalScope
protected ISIUnitsGlobalScope sIUnitsGlobalScope
-
-
Method Detail
-
getMill
public static SIUnitsMill getMill()
-
init
public static void init()
Initializes a languages Mill. This will also initialize the Mills of all languages it depends on. This ensures that all objects of this mill, such as builders, traversers, scopes, ..., deliver the element of the correct language.
-
sIUnitBuilder
public static ASTSIUnitBuilder sIUnitBuilder()
-
_sIUnitBuilder
protected ASTSIUnitBuilder _sIUnitBuilder()
-
sIUnitPrimitiveBuilder
public static ASTSIUnitPrimitiveBuilder sIUnitPrimitiveBuilder()
-
_sIUnitPrimitiveBuilder
protected ASTSIUnitPrimitiveBuilder _sIUnitPrimitiveBuilder()
-
sIUnitWithPrefixBuilder
public static ASTSIUnitWithPrefixBuilder sIUnitWithPrefixBuilder()
-
_sIUnitWithPrefixBuilder
protected ASTSIUnitWithPrefixBuilder _sIUnitWithPrefixBuilder()
-
sIUnitWithoutPrefixBuilder
public static ASTSIUnitWithoutPrefixBuilder sIUnitWithoutPrefixBuilder()
-
_sIUnitWithoutPrefixBuilder
protected ASTSIUnitWithoutPrefixBuilder _sIUnitWithoutPrefixBuilder()
-
celsiusFahrenheitBuilder
public static ASTCelsiusFahrenheitBuilder celsiusFahrenheitBuilder()
-
_celsiusFahrenheitBuilder
protected ASTCelsiusFahrenheitBuilder _celsiusFahrenheitBuilder()
-
sIUnitDimensionlessBuilder
public static ASTSIUnitDimensionlessBuilder sIUnitDimensionlessBuilder()
-
_sIUnitDimensionlessBuilder
protected ASTSIUnitDimensionlessBuilder _sIUnitDimensionlessBuilder()
-
sIUnitKindGroupWithExponentBuilder
public static ASTSIUnitKindGroupWithExponentBuilder sIUnitKindGroupWithExponentBuilder()
-
_sIUnitKindGroupWithExponentBuilder
protected ASTSIUnitKindGroupWithExponentBuilder _sIUnitKindGroupWithExponentBuilder()
-
sIUnitGroupPrimitiveBuilder
public static ASTSIUnitGroupPrimitiveBuilder sIUnitGroupPrimitiveBuilder()
-
_sIUnitGroupPrimitiveBuilder
protected ASTSIUnitGroupPrimitiveBuilder _sIUnitGroupPrimitiveBuilder()
-
prettyPrint
public static java.lang.String prettyPrint(de.monticore.ast.ASTNode node, boolean printComments)
Uses the composed pretty printer to print an ASTNode of this language- Parameters:
node
- The ASTNode to be printedprintComments
- Whether comments should be printed- Returns:
- The pretty printer output
-
_prettyPrint
protected java.lang.String _prettyPrint(de.monticore.ast.ASTNode node, boolean printComments)
-
typeDispatcher
public static ISIUnitsTypeDispatcher typeDispatcher()
-
_typeDispatcher
protected ISIUnitsTypeDispatcher _typeDispatcher()
-
traverser
public static SIUnitsTraverser traverser()
A traverser is the conceptual entry point for every action within the visitor infrastructure. Visitors may be added, which contain the implementations for the visit and endVisit methods. Handlers may be added to modify the default traversal strategy. Each traverser retains their traversed elements to avoid duplicate traversal, possibly requiringITraverser.clearTraversedElements()
to be called in case of re-useinheritanceTraverser()
should be preferred over normal traverser, as they further enable language composition.- Returns:
- a new instance of this language's traverser
-
_traverser
protected SIUnitsTraverser _traverser()
-
inheritanceTraverser
public static SIUnitsTraverser inheritanceTraverser()
A traverser is the conceptual entry point for every action within the visitor infrastructure. Visitors may be added, which contain the implementations for the visit and endVisit methods. Handlers may be added to modify the default traversal strategy. Each traverser retains their traversed elements to avoid duplicate traversal, possibly requiringITraverser.clearTraversedElements()
to be called in case of re-use Inheritance Traverser should be preferred over default ones, as they further enable language composition.- Returns:
- a new instance of this language's inheritance traverser
-
_inheritanceTraverser
protected SIUnitsTraverser _inheritanceTraverser()
-
globalScope
public static ISIUnitsGlobalScope globalScope()
-
_globalScope
protected ISIUnitsGlobalScope _globalScope()
-
artifactScope
public static ISIUnitsArtifactScope artifactScope()
-
_artifactScope
protected ISIUnitsArtifactScope _artifactScope()
-
parser
public static SIUnitsParser parser()
Returns a new instance of this language's parser. Respects grammar composition by means of the Mill pattern.- Returns:
- a new instance of this language's parser
-
_parser
protected SIUnitsParser _parser()
-
scope
public static ISIUnitsScope scope()
-
_scope
protected ISIUnitsScope _scope()
-
scopesGenitor
public static SIUnitsScopesGenitor scopesGenitor()
Returns a new ScopeGenitor. ScopeGenitors are responsible for creating the scope structure of artifacts of only this language and linking it with the AST nodes. Note: ScopeGenitors do NOT delegate to elements of composed languages which is why you are most likely looking forscopesGenitorDelegator()
.- Returns:
- a new instance of this language's scope genitor
-
_scopesGenitor
protected SIUnitsScopesGenitor _scopesGenitor()
-
scopesGenitorDelegator
public static SIUnitsScopesGenitorDelegator scopesGenitorDelegator()
Returns a new ScopeGenitorDelegator. Delegates to the ScopeGenitors of composed languages, used for instantiating symbol tables in the context of language composition See the delegators #createFromAST method.- Returns:
- a new instance of this language's scope genitor delegator
-
_scopesGenitorDelegator
protected SIUnitsScopesGenitorDelegator _scopesGenitorDelegator()
-
nullLiteralBuilder
public static ASTNullLiteralBuilder nullLiteralBuilder()
-
booleanLiteralBuilder
public static ASTBooleanLiteralBuilder booleanLiteralBuilder()
-
charLiteralBuilder
public static ASTCharLiteralBuilder charLiteralBuilder()
-
stringLiteralBuilder
public static ASTStringLiteralBuilder stringLiteralBuilder()
-
natLiteralBuilder
public static ASTNatLiteralBuilder natLiteralBuilder()
-
signedNatLiteralBuilder
public static ASTSignedNatLiteralBuilder signedNatLiteralBuilder()
-
basicLongLiteralBuilder
public static ASTBasicLongLiteralBuilder basicLongLiteralBuilder()
-
signedBasicLongLiteralBuilder
public static ASTSignedBasicLongLiteralBuilder signedBasicLongLiteralBuilder()
-
basicFloatLiteralBuilder
public static ASTBasicFloatLiteralBuilder basicFloatLiteralBuilder()
-
signedBasicFloatLiteralBuilder
public static ASTSignedBasicFloatLiteralBuilder signedBasicFloatLiteralBuilder()
-
basicDoubleLiteralBuilder
public static ASTBasicDoubleLiteralBuilder basicDoubleLiteralBuilder()
-
signedBasicDoubleLiteralBuilder
public static ASTSignedBasicDoubleLiteralBuilder signedBasicDoubleLiteralBuilder()
-
initMe
public static void initMe(SIUnitsMill a)
-
reset
public static void reset()
-
-