Class BuildlangWriter

    • Constructor Detail

      • BuildlangWriter

        public BuildlangWriter​(java.io.Writer out)
        Creates a build language writer.
        Parameters:
        out - the writer to write the elements to
    • Method Detail

      • printString

        private void printString​(java.lang.String string)
        Prints a string in quotes.
        Parameters:
        string - the string to be printed
      • visitRuleCallExpression

        public java.lang.Object visitRuleCallExpression​(RuleCallExpression ex)
                                                 throws VilException
        Description copied from interface: IVisitor
        Visits a rule call expression.
        Specified by:
        visitRuleCallExpression in interface IVisitor
        Parameters:
        ex - the expression
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • getScriptElementName

        protected java.lang.String getScriptElementName()
        Returns the language element name for a "script". [extensibility]
        Returns:
        the language element name ("vilScript")
      • printScriptHeader

        protected void printScriptHeader​(Script script)
                                  throws VilException
        Prints the header of script. [extensibility]
        Parameters:
        script - the script to be printed
        Throws:
        VilException - in case that printing the script header fails
        See Also:
        getScriptElementName()
      • hasContainedElements

        protected boolean hasContainedElements​(Script script)
        Returns whether script has contained elements. [extensibility]
        Parameters:
        script - the script to consider
        Returns:
        true if script has contained elements, false if script is empty
      • printScriptContentsBeforeRules

        protected void printScriptContentsBeforeRules​(Script script)
                                               throws VilException
        Prints the script contents before rules. [extensibility]
        Parameters:
        script - the script to be printed
        Throws:
        VilException - in case that printing the script contents fails
      • visitScript

        public java.lang.Object visitScript​(Script script)
                                     throws VilException
        Description copied from interface: IVisitor
        Visits a script.
        Specified by:
        visitScript in interface IVisitor
        Parameters:
        script - the project instance
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • printImports

        private void printImports​(Script script)
                           throws VilException
        Prints the imports of script.
        Parameters:
        script - the script the versions shall be printed for
        Throws:
        VilException - in case of problems while printing the version restrictions
      • printVtlRestrictions

        private void printVtlRestrictions​(Script script)
                                   throws VilException
        Prints the VTL restrictions.
        Parameters:
        script - the script the versions shall be printed for
        Throws:
        VilException - in case of problems while printing the version restrictions
      • visitLoadProperties

        public java.lang.Object visitLoadProperties​(LoadProperties properties)
                                             throws VilException
        Description copied from interface: IVisitor
        Visits a load properties directive.
        Specified by:
        visitLoadProperties in interface IVisitor
        Parameters:
        properties - the load properties representation
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitRule

        public java.lang.Object visitRule​(VtlRule rule)
                                   throws VilException
        Description copied from interface: IVisitor
        Visits a VTL mapping rule.
        Specified by:
        visitRule in interface IVisitor
        Parameters:
        rule - the rule
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitRule

        public java.lang.Object visitRule​(Rule rule)
                                   throws VilException
        Description copied from interface: IVisitor
        Visits a rule.
        Specified by:
        visitRule in interface IVisitor
        Parameters:
        rule - the rule
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • printRuleConditions

        protected void printRuleConditions​(Rule rule,
                                           Rule.Side side)
                                    throws VilException
        Prints the rule conditions on the specified side.
        Parameters:
        rule - the rule to print the conditions for
        side - the side (LHS = postconditions, RHS = preconditions)
        Throws:
        VilException - in case that visiting fails
      • printBlockContents

        protected void printBlockContents​(IRuleBlock block)
                                   throws VilException
        Prints the actual block contents.
        Parameters:
        block - the block to be printed
        Throws:
        VilException - in case of visiting problems
      • visitJoinExpression

        public java.lang.Object visitJoinExpression​(JoinExpression ex)
                                             throws VilException
        Description copied from interface: IVisitor
        Visits a join expression.
        Specified by:
        visitJoinExpression in interface IVisitor
        Parameters:
        ex - the join expression
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitJoinVariableDeclaration

        public java.lang.Object visitJoinVariableDeclaration​(JoinVariableDeclaration decl)
                                                      throws VilException
        Description copied from interface: IVisitor
        Visits a join variable declaration.
        Specified by:
        visitJoinVariableDeclaration in interface IVisitor
        Parameters:
        decl - the declaration
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitMapExpression

        public java.lang.Object visitMapExpression​(MapExpression map)
                                            throws VilException
        Description copied from interface: IVisitor
        Visits a map expression.
        Specified by:
        visitMapExpression in interface IVisitor
        Parameters:
        map - the expression to be visited
        Returns:
        the result of visiting the given expression (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitLoop

        private java.lang.Object visitLoop​(IEnumeratingLoop loop)
                                    throws VilException
        Visits a loop.
        Parameters:
        loop - the loop to be visited
        Returns:
        null
        Throws:
        VilException - in case of visiting problems
      • visitInstantiateExpression

        public java.lang.Object visitInstantiateExpression​(InstantiateExpression inst)
                                                    throws VilException
        Description copied from interface: IVisitor
        Visits an instantiate expression.
        Specified by:
        visitInstantiateExpression in interface IVisitor
        Parameters:
        inst - the instantiation expression
        Returns:
        the result of visiting the given expression (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitWhileStatement

        public java.lang.Object visitWhileStatement​(WhileStatement stmt)
                                             throws VilException
        Description copied from interface: IVisitor
        Visits a while statement.
        Specified by:
        visitWhileStatement in interface IVisitor
        Parameters:
        stmt - the statement to be visited
        Returns:
        the result of visiting the given expression (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitForStatement

        public java.lang.Object visitForStatement​(ForStatement stmt)
                                           throws VilException
        Description copied from interface: IVisitor
        Visits a for statement.
        Specified by:
        visitForStatement in interface IVisitor
        Parameters:
        stmt - the statement to be visited
        Returns:
        the result of visiting the given expression (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)