Class CharSupport
java.lang.Object
org.antlr.v4.misc.CharSupport
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]Given a char, we need to be able to show as an ANTLR literal.static final int[]When converting ANTLR char and string literals, here is the value set of escape chars. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringcapitalize(String s) static StringgetANTLRCharLiteralForChar(int c) Return a string representing the escaped char for code c.static intGiven char x or \\t or \\u1234 return the char value; Unnecessary escapes like '\{' yield -1.static intgetCharValueFromGrammarCharLiteral(String literal) Given a literal like (the 3 char sequence with single quotes) 'a', return the int value of 'a'.static StringgetIntervalSetEscapedString(IntervalSet intervalSet) static StringgetRangeEscapedString(int codePointStart, int codePointEnd) static StringgetStringFromGrammarStringLiteral(String literal) static intparseHexValue(String cstr, int startOff, int endOff)
-
Field Details
-
ANTLRLiteralEscapedCharValue
public static final int[] ANTLRLiteralEscapedCharValueWhen converting ANTLR char and string literals, here is the value set of escape chars. -
ANTLRLiteralCharValueEscape
Given a char, we need to be able to show as an ANTLR literal.
-
-
Constructor Details
-
CharSupport
public CharSupport()
-
-
Method Details
-
getANTLRCharLiteralForChar
Return a string representing the escaped char for code c. E.g., If c has value 0x100, you will get "\\u0100". ASCII gets the usual char (non-hex) representation. Non-ASCII characters are spit out as \\uXXXX or \\u{XXXXXX} escapes. -
getCharValueFromGrammarCharLiteral
Given a literal like (the 3 char sequence with single quotes) 'a', return the int value of 'a'. Convert escape sequences here also. Return -1 if not single char. -
getStringFromGrammarStringLiteral
-
getCharValueFromCharInGrammarLiteral
Given char x or \\t or \\u1234 return the char value; Unnecessary escapes like '\{' yield -1. -
parseHexValue
-
capitalize
-
getIntervalSetEscapedString
-
getRangeEscapedString
-