Class ContentStatement

    • Constructor Detail

      • ContentStatement

        ContentStatement()
        Constructor for serialization.
      • ContentStatement

        public ContentStatement​(CompositeExpression content,
                                java.lang.String terminal,
                                Expression indentExpression,
                                ContentStatement.LineEndType lineEndType,
                                ILanguageElement parent)
                         throws VilException
        Creates a new content statement.
        Parameters:
        content - the content
        terminal - the limiting terminal (at start and end)
        indentExpression - an optional integer expression determining the additional indentation, e.g., in loops or recursions
        lineEndType - the line end type
        parent - the parent language element
        Throws:
        VilException - in case that the expression cannot be resolved or does not evaluate to an integer
    • Method Detail

      • needsLineEnd

        public boolean needsLineEnd​(boolean deflt)
        Returns whether a line end shall be emitted.
        Parameters:
        deflt - the value to be taken for ContentStatement.LineEndType.DEFAULT
        Returns:
        true if a line end shall be emitted, false else
      • getContent

        public CompositeExpression getContent()
        Returns the content.
        Returns:
        the content
      • getTerminal

        public java.lang.String getTerminal()
        Returns the terminal to encapsulate the content in the underlying template.
        Returns:
        the terminal
      • accept

        public java.lang.Object accept​(IVisitor visitor)
                                throws VilException
        Description copied from interface: ITemplateLangElement
        Accepts the visitor for visiting.
        Parameters:
        visitor - the visitor to be used
        Returns:
        the result of visiting this instance (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • isBlock

        public boolean isBlock()
        Description copied from interface: ITemplateElement
        Returns whether this element is a block (opposite is a single statement).
        Returns:
        true if it is a block, false else
      • getIndentExpression

        public Expression getIndentExpression()
        Returns the integer expression specifying the additional indentation.
        Returns:
        the indent expression (may be null)
      • endsWithContentStatement

        public boolean endsWithContentStatement()
        Description copied from interface: ITemplateElement
        Returns whether this element ends with a content statement.
        Returns:
        true for end with content statement, false else