Class STRINGValueConverter
- java.lang.Object
-
- org.eclipse.xtext.conversion.impl.AbstractValueConverter<T>
-
- org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter<java.lang.String>
-
- org.eclipse.xtext.conversion.impl.STRINGValueConverter
-
- All Implemented Interfaces:
IValueConverter<java.lang.String>,IValueConverter.RuleSpecific
public class STRINGValueConverter extends AbstractLexerBasedConverter<java.lang.String>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSTRINGValueConverter.Implementation-
Nested classes/interfaces inherited from interface org.eclipse.xtext.conversion.IValueConverter
IValueConverter.RuleSpecific
-
-
Field Summary
-
Fields inherited from interface org.eclipse.xtext.conversion.IValueConverter
NO_OP_CONVERTER
-
-
Constructor Summary
Constructors Constructor Description STRINGValueConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringconvertFromString(java.lang.String literal, INode node)Converts a string literal (including leading and trailing single or double quote) to a semantic string value.protected STRINGValueConverter.ImplementationcreateConverter()protected java.lang.StringgetInvalidEscapeSequenceMessage()protected java.lang.StringgetStringNotClosedMessage()protected booleanisHexSequence(char[] in, int off, int chars)protected java.lang.StringtoEscapedString(java.lang.String value)java.lang.StringtoValue(java.lang.String string, INode node)Creates a value from the given input.-
Methods inherited from class org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter
assertTokens, assertTokens, assertValidValue, createTokenContentMismatchException, createTokenTypeMismatchException, getLexer, getLexerProvider, getRule, getRuleName, getRuleName, getTokenDefMap, getTokenDefProvider, getTokenSource, setLexerProvider, setRule, setTokenDefProvider, toString
-
-
-
-
Method Detail
-
toEscapedString
protected java.lang.String toEscapedString(java.lang.String value)
- Overrides:
toEscapedStringin classAbstractLexerBasedConverter<java.lang.String>
-
toValue
public java.lang.String toValue(java.lang.String string, INode node)Description copied from interface:IValueConverterCreates a value from the given input. The input is conformant to a data type or terminal rule.
The given
stringornodemay 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 nothidden.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 ValueConverterWithValueExceptionConverts 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 aValueConverterWithValueException.- Throws:
ValueConverterWithValueException- if the given string is syntactically invalid.- Since:
- 2.7
- See Also:
Strings.convertFromJavaString(String, boolean)
-
createConverter
protected STRINGValueConverter.Implementation createConverter()
- Since:
- 2.16
-
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
-
-