Top Fields Constructors Methods
org.antlr.v4.misc

public Class CharSupport

extends Object
Class Inheritance
Imports
org.antlr.v4.runtime.Lexer, org.antlr.v4.runtime.misc.Interval, .IntervalSet, java.util.Iterator

Field Summary

Modifier and TypeField and Description
public static final String[]
ANTLRLiteralCharValueEscape

Given a char, we need to be able to show as an ANTLR literal.

public static final int[]
ANTLRLiteralEscapedCharValue

When converting ANTLR char and string literals, here is the value set of escape chars.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String
public static String
getANTLRCharLiteralForChar(int c)

Return a string representing the escaped char for code c.

public static int
getCharValueFromCharInGrammarLiteral(String cstr)

Given char x or \\t or \\u1234 return the char value; Unnecessary escapes like '\{' yield -1.

public static int
getCharValueFromGrammarCharLiteral(String literal)

Given a literal like (the 3 char sequence with single quotes) 'a', return the int value of 'a'.

public static String
public static String
getRangeEscapedString(int codePointStart, int codePointEnd)

public static String
public static int
parseHexValue(String cstr, int startOff, int endOff)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ANTLRLiteralCharValueEscapeback to summary
public static final String[] ANTLRLiteralCharValueEscape

Given a char, we need to be able to show as an ANTLR literal.

ANTLRLiteralEscapedCharValueback to summary
public static final int[] ANTLRLiteralEscapedCharValue

When converting ANTLR char and string literals, here is the value set of escape chars.

Constructor Detail

CharSupportback to summary
public CharSupport()

Method Detail

capitalizeback to summary
public static String capitalize(String s)
getANTLRCharLiteralForCharback to summary
public static 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.

getCharValueFromCharInGrammarLiteralback to summary
public static int getCharValueFromCharInGrammarLiteral(String cstr)

Given char x or \\t or \\u1234 return the char value; Unnecessary escapes like '\{' yield -1.

getCharValueFromGrammarCharLiteralback to summary
public static int getCharValueFromGrammarCharLiteral(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.

getIntervalSetEscapedStringback to summary
public static String getIntervalSetEscapedString(IntervalSet intervalSet)
getRangeEscapedStringback to summary
public static String getRangeEscapedString(int codePointStart, int codePointEnd)
getStringFromGrammarStringLiteralback to summary
public static String getStringFromGrammarStringLiteral(String literal)
parseHexValueback to summary
public static int parseHexValue(String cstr, int startOff, int endOff)