Class MessageMatcher
- java.lang.Object
-
- com.squarespace.cldrengine.message.MessageMatcher
-
public class MessageMatcher extends java.lang.Object
Matches against a substring defined by the [start, end) range argument. When a match occurs it updates the range's start pointer. This allows a single matcher instance to be used to match positions recursively. For example, while the outer block is being parsed at [0, 74] the inner block at [24, 73] can be recursively parsed using the same matcher, with the corresponding parse positions maintained in a range object within each stack frame. "{gender, select, female {guests plural one {her guest} other {her guests}}"
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MessageMatcher.State
-
Constructor Summary
Constructors Constructor Description MessageMatcher(java.util.Collection<java.lang.String> formatters, java.lang.String raw)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.Object>
arguments(MessageMatcher.State r)
char
character(MessageMatcher.State r)
boolean
complete(MessageMatcher.State r)
void
debug(java.lang.String msg, MessageMatcher.State r)
java.lang.String
formatter(MessageMatcher.State r)
java.lang.String
identifier(MessageMatcher.State r)
protected java.lang.String
match(java.util.regex.Matcher matcher, MessageMatcher.State r)
Attempt to match the pattern at the given starting location.java.util.List<java.lang.String>
options(MessageMatcher.State r)
java.lang.String
pluralChoice(MessageMatcher.State r)
int
pluralOffset(MessageMatcher.State r)
boolean
spaces(MessageMatcher.State r)
-
-
-
Method Detail
-
debug
public void debug(java.lang.String msg, MessageMatcher.State r)
-
character
public char character(MessageMatcher.State r)
-
complete
public boolean complete(MessageMatcher.State r)
-
spaces
public boolean spaces(MessageMatcher.State r)
-
arguments
public java.util.List<java.lang.Object> arguments(MessageMatcher.State r)
-
identifier
public java.lang.String identifier(MessageMatcher.State r)
-
options
public java.util.List<java.lang.String> options(MessageMatcher.State r)
-
formatter
public java.lang.String formatter(MessageMatcher.State r)
-
pluralChoice
public java.lang.String pluralChoice(MessageMatcher.State r)
-
pluralOffset
public int pluralOffset(MessageMatcher.State r)
-
match
protected java.lang.String match(java.util.regex.Matcher matcher, MessageMatcher.State r)
Attempt to match the pattern at the given starting location. If a match is found, move the start pointer and return the string. Otherwise return undefined.
-
-