Todo
Move to com.ibm.icu.dev.somewhere. 2015-sep-03: This is used there, and also in CLDR and in UnicodeTools.
| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private String | |
| private String | |
| private Comparator | |
| private static final UnicodeRegex | |
| private static final Pattern | |
| private SymbolTable |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static List | Returns: filled listThe result of the appended lines. result, String The file to have an input stream. file, String if null, then UTF-8 encoding)Utility for loading lines from a file. |
| public static List | Returns: filled listThe result of the appended lines. result, InputStream The input stream. inputStream, String if null, then UTF-8 encoding)Utility for loading lines from a UTF8 file. |
| public UnicodeRegex | cloneAsThawed()
Implements com. |
| public static Pattern | |
| public static Pattern | |
| public String | Returns: PatternSeries of BNF lines. bnfLines)Compile a composed string from a set of BNF lines; see the List version for more information. |
| public String | Returns: PatternSeries of lines that represent a BNF expression. The lines contain
a series of statements that of the form x=y;. A statement can take
multiple lines, but there can't be multiple statements on a line.
A hash quotes to the end of the line. lines)Compile a composed string from a set of BNF lines, such as for composing a regex expression. |
| public static String | |
| public UnicodeRegex | |
| public String | |
| public String | |
| public String | |
| public SymbolTable | |
| private Map | |
| public boolean | isFrozen()
Implements com. |
| private int | |
| public void | |
| public void | |
| public void | |
| public UnicodeRegex | |
| public String | Returns: A processed Java regex pattern, suitable for input to Pattern.compile().A modified Java regex pattern, as in the input to
Pattern.compile(), except that all "character classes" are
processed as if they were UnicodeSet patterns. Example:
"abc[:bc=N:]. See UnicodeSet for the differences in syntax. regex)Implements com. |
| bnfCommentString | back to summary |
|---|---|
| private String bnfCommentString | |
| bnfLineSeparator | back to summary |
|---|---|
| private String bnfLineSeparator | |
| bnfVariableInfix | back to summary |
|---|---|
| private String bnfVariableInfix | |
| LongestFirst | back to summary |
|---|---|
| private Comparator<Object> LongestFirst | |
| STANDARD | back to summary |
|---|---|
| private static final UnicodeRegex STANDARD | |
| SUPP_ESCAPE | back to summary |
|---|---|
| private static final Pattern SUPP_ESCAPE | |
| symbolTable | back to summary |
|---|---|
| private SymbolTable symbolTable | |
| UnicodeRegex | back to summary |
|---|---|
| public UnicodeRegex() | |
| appendLines | back to summary |
|---|---|
| public static List Utility for loading lines from a file. | |
| appendLines | back to summary |
|---|---|
| public static List Utility for loading lines from a UTF8 file.
| |
| cloneAsThawed | back to summary |
|---|---|
| public UnicodeRegex cloneAsThawed() Implements com. Doc from com. Provides for the clone operation. Any clone is initially unfrozen.
| |
| compile | back to summary |
|---|---|
| public static Pattern compile(String regex) Compile a regex string, after processing by fix(...). | |
| compile | back to summary |
|---|---|
| public static Pattern compile(String regex, int options) Compile a regex string, after processing by fix(...). | |
| compileBnf | back to summary |
|---|---|
| public String compileBnf(String bnfLines) Compile a composed string from a set of BNF lines; see the List version for more information. | |
| compileBnf | back to summary |
|---|---|
| public String compileBnf(List<String> lines) Compile a composed string from a set of BNF lines, such as for composing a regex expression. The lines can be in any order, but there must not be any cycles. The result can be used as input for fix(). Example: uri = (?: (scheme) \\:)? (host) (?: \\? (query))? (?: \\u0023 (fragment))?; scheme = reserved+; host = // reserved+; query = [\\=reserved]+; fragment = reserved+; reserved = [[:ascii:][:alphabetic:]]; Caveats: at this point the parsing is simple; for example, # cannot be quoted (use \\u0023); you can set it to null to disable. The equality sign and a few others can be reset with setBnfX(). | |
| fix | back to summary |
|---|---|
| public static String fix(String regex) Convenience static function, using standard parameters. | |
| freeze | back to summary |
|---|---|
| public UnicodeRegex freeze() Implements com. Doc from com. Freezes the object.
| |
| getBnfCommentString | back to summary |
|---|---|
| public String getBnfCommentString() | |
| getBnfLineSeparator | back to summary |
|---|---|
| public String getBnfLineSeparator() | |
| getBnfVariableInfix | back to summary |
|---|---|
| public String getBnfVariableInfix() | |
| getSymbolTable | back to summary |
|---|---|
| public SymbolTable getSymbolTable() Set the symbol table for internal processing
| |
| getVariables | back to summary |
|---|---|
| private Map | |
| isFrozen | back to summary |
|---|---|
| public boolean isFrozen() Implements com. Doc from com. Determines whether the object has been frozen or not.
| |
| processSet | back to summary |
|---|---|
| private int processSet(String regex, int i, StringBuilder result, UnicodeSet temp, ParsePosition pos) | |
| setBnfCommentString | back to summary |
|---|---|
| public void setBnfCommentString(String bnfCommentString) | |
| setBnfLineSeparator | back to summary |
|---|---|
| public void setBnfLineSeparator(String bnfLineSeparator) | |
| setBnfVariableInfix | back to summary |
|---|---|
| public void setBnfVariableInfix(String bnfVariableInfix) | |
| setSymbolTable | back to summary |
|---|---|
| public UnicodeRegex setSymbolTable(SymbolTable symbolTable) Get the symbol table for internal processing
| |
| transform | back to summary |
|---|---|
| public String transform(String regex) Implements com. Adds full Unicode property support, with the latest version of Unicode, to Java Regex, bringing it up to Level 1 (see http://www.unicode.org/reports/tr18/). It does this by preprocessing the regex pattern string and interpreting the character classes (\p{...}, \P{...}, [...]) according to their syntax and meaning in UnicodeSet. With this utility, Java regex expressions can be updated to work with the latest version of Unicode, and with all Unicode properties. Note that the UnicodeSet syntax has not yet, however, been updated to be completely consistent with Java regex, so be careful of the differences. Not thread-safe; create a separate copy for different threads. In the future, we may extend this to support other regex packages.
| |