Class TextBlockLiteralExpr

    • Constructor Detail

      • TextBlockLiteralExpr

        public TextBlockLiteralExpr()
      • TextBlockLiteralExpr

        public TextBlockLiteralExpr​(java.lang.String value)
        Creates a text block literal expression from given string.
        Parameters:
        value - the value of the literal
      • TextBlockLiteralExpr

        public TextBlockLiteralExpr​(TokenRange tokenRange,
                                    java.lang.String value)
        This constructor is used by the parser and is considered private.
    • Method Detail

      • accept

        public <R,​A> R accept​(GenericVisitor<R,​A> v,
                                    A arg)
        Description copied from interface: Visitable
        Accept method for visitor support.
        Type Parameters:
        R - the type of the return value of the visitor
        A - the type the user argument passed to the visitor
        Parameters:
        v - the visitor implementation
        arg - the argument passed to the visitor (of type A)
        Returns:
        the result of the visit (of type R)
      • accept

        public <A> void accept​(VoidVisitor<A> v,
                               A arg)
        Description copied from interface: Visitable
        Accept method for visitor support.
        Type Parameters:
        A - the type the argument passed for the visitor
        Parameters:
        v - the visitor implementation
        arg - any value relevant for the visitor (of type A)
      • stripIndentOfLines

        public java.util.stream.Stream<java.lang.String> stripIndentOfLines()
        Most of the algorithm for stripIndent, stopping just before concatenating all the lines into a single string. Useful for tools.
      • stripIndent

        public java.lang.String stripIndent()
        Returns:
        The algorithm from String::stripIndent in JDK 13.
      • translateEscapes

        public java.lang.String translateEscapes()
        Returns:
        The algorithm from String::translateEscapes in JDK 13.
      • asString

        public java.lang.String asString()
        Returns:
        the final string value of this text block after all processing.
      • isLastLine

        private boolean isLastLine​(java.lang.String[] rawLines,
                                   java.lang.Integer lineNr)
        Returns:
        is the line with index lineNr the last line in rawLines?
      • emptyOrWhitespace

        private boolean emptyOrWhitespace​(java.lang.String rawLine)
        Returns:
        is this string empty or filled only with whitespace?
      • indentSize

        private int indentSize​(java.lang.String s)
        Returns:
        the amount of leading whitespaces.
      • trimTrailing

        private java.lang.String trimTrailing​(java.lang.String source)
        Can be replaced when moving to JDK 11