Package org.antlr.v4.misc
Class CharSupport
- java.lang.Object
-
- org.antlr.v4.misc.CharSupport
-
public class CharSupport extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]ANTLRLiteralCharValueEscapeGiven a char, we need to be able to show as an ANTLR literal.static int[]ANTLRLiteralEscapedCharValueWhen converting ANTLR char and string literals, here is the value set of escape chars.
-
Constructor Summary
Constructors Constructor Description CharSupport()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringcapitalize(java.lang.String s)static java.lang.StringgetANTLRCharLiteralForChar(int c)Return a string representing the escaped char for code c.static intgetCharValueFromCharInGrammarLiteral(java.lang.String cstr)Given char x or \\t or \\u1234 return the char value; Unnecessary escapes like '\{' yield -1.static intgetCharValueFromGrammarCharLiteral(java.lang.String literal)Given a literal like (the 3 char sequence with single quotes) 'a', return the int value of 'a'.static java.lang.StringgetIntervalSetEscapedString(IntervalSet intervalSet)static java.lang.StringgetRangeEscapedString(int codePointStart, int codePointEnd)static java.lang.StringgetStringFromGrammarStringLiteral(java.lang.String literal)static intparseHexValue(java.lang.String cstr, int startOff, int endOff)
-
-
-
Field Detail
-
ANTLRLiteralEscapedCharValue
public static final int[] ANTLRLiteralEscapedCharValue
When converting ANTLR char and string literals, here is the value set of escape chars.
-
ANTLRLiteralCharValueEscape
public static final java.lang.String[] ANTLRLiteralCharValueEscape
Given a char, we need to be able to show as an ANTLR literal.
-
-
Method Detail
-
getANTLRCharLiteralForChar
public static java.lang.String getANTLRCharLiteralForChar(int c)
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
public static int getCharValueFromGrammarCharLiteral(java.lang.String literal)
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
public static java.lang.String getStringFromGrammarStringLiteral(java.lang.String literal)
-
getCharValueFromCharInGrammarLiteral
public static int getCharValueFromCharInGrammarLiteral(java.lang.String cstr)
Given char x or \\t or \\u1234 return the char value; Unnecessary escapes like '\{' yield -1.
-
parseHexValue
public static int parseHexValue(java.lang.String cstr, int startOff, int endOff)
-
capitalize
public static java.lang.String capitalize(java.lang.String s)
-
getIntervalSetEscapedString
public static java.lang.String getIntervalSetEscapedString(IntervalSet intervalSet)
-
getRangeEscapedString
public static java.lang.String getRangeEscapedString(int codePointStart, int codePointEnd)
-
-