Class STRINGValueConverter

    • Constructor Detail

      • STRINGValueConverter

        public STRINGValueConverter()
    • Method Detail

      • toValue

        public java.lang.String toValue​(java.lang.String string,
                                        INode node)
        Description copied from interface: IValueConverter

        Creates a value from the given input. The input is conformant to a data type or terminal rule.

        The given string or node may be null but not both of them.

        Parameters:
        string - the string that was inferred from the node. Usually the node's text but may be reduced to the parts of the node that are not hidden.
        node - the parsed node including hidden parts.
        Returns:
        the new value or null.
      • convertFromString

        protected java.lang.String convertFromString​(java.lang.String literal,
                                                     INode node)
                                              throws ValueConverterWithValueException
        Converts a string literal (including leading and trailing single or double quote) to a semantic string value. Recovers from invalid escape sequences and announces the first problem with a ValueConverterWithValueException.
        Throws:
        ValueConverterWithValueException - if the given string is syntactically invalid.
        Since:
        2.7
        See Also:
        Strings.convertFromJavaString(String, boolean)
      • getInvalidEscapeSequenceMessage

        protected java.lang.String getInvalidEscapeSequenceMessage()
        Since:
        2.7
      • getStringNotClosedMessage

        protected java.lang.String getStringNotClosedMessage()
        Since:
        2.7
      • isHexSequence

        protected boolean isHexSequence​(char[] in,
                                        int off,
                                        int chars)
        Since:
        2.7