Class StringParser
- java.lang.Object
-
- com.inductiveautomation.ignition.common.expressions.parsing.StringParser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StringParser.EscapeStrategy
protected static class
StringParser.StringOrPath
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLOSE_DELIM
static java.lang.String
ESCAPE
static java.lang.String
OPEN_DELIM
-
Constructor Summary
Constructors Modifier Constructor Description StringParser()
protected
StringParser(java.lang.Class<? extends AbstractExpression> exprType)
This constructor specifies what type of expression should be created.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addPart(java.util.List<StringParser.StringOrPath> parts, StringParser.StringOrPath newPart)
StringParser.EscapeStrategy
getAllowsReferenceEscape()
static StringParser
newQueryParser()
Returns a parser that expects to parse sql queries for referencesstatic StringParser
newStandardParser_Localized()
Returns a parser who creates expressions that simply toString sub-expressions, adjusting the values for the locale.static StringParser
newStandardParser_NonLocalized()
Returns a parser who creates an expression that is the toString of all of the sub-expressions, but with no consideration of the locale.Expression
parse(java.lang.String expr, ExpressionParseContext binder)
protected StringParser.StringOrPath[]
parseQueryWithBoundPaths(java.lang.String query)
protected StringParser.StringOrPath[]
parseQueryWithBoundPathsEscapedCharacters(java.lang.String query)
protected static StringParser.StringOrPath[]
parseQueryWithBoundPathsNoEscape(java.lang.String query)
protected StringParser.StringOrPath[]
parseQueryWithEscapedBoundPaths(java.lang.String query)
Chops up a query, returning the string segments and path segments separatelyvoid
preventToStringSingleExpression(boolean prevent)
If set to true and the parsed expression only contains one expression.void
setAllowsReferenceEscape(boolean escapeReference)
If true, allows item reference syntax, such as "{blah}" to be escaped with "\", to avoid expansion.void
setEscapeStrategy(StringParser.EscapeStrategy strategy)
-
-
-
Field Detail
-
ESCAPE
public static final java.lang.String ESCAPE
- See Also:
- Constant Field Values
-
OPEN_DELIM
public static final java.lang.String OPEN_DELIM
- See Also:
- Constant Field Values
-
CLOSE_DELIM
public static final java.lang.String CLOSE_DELIM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StringParser
public StringParser()
-
StringParser
protected StringParser(java.lang.Class<? extends AbstractExpression> exprType)
This constructor specifies what type of expression should be created. Different expressions will behave differently.
-
-
Method Detail
-
newStandardParser_Localized
public static StringParser newStandardParser_Localized()
Returns a parser who creates expressions that simply toString sub-expressions, adjusting the values for the locale.
-
newStandardParser_NonLocalized
public static StringParser newStandardParser_NonLocalized()
Returns a parser who creates an expression that is the toString of all of the sub-expressions, but with no consideration of the locale.
-
newQueryParser
public static StringParser newQueryParser()
Returns a parser that expects to parse sql queries for references
-
setAllowsReferenceEscape
public void setAllowsReferenceEscape(boolean escapeReference)
If true, allows item reference syntax, such as "{blah}" to be escaped with "\", to avoid expansion. False, usesStringParser.EscapeStrategy.NONE
True, usesStringParser.EscapeStrategy.REFERENCE
-
setEscapeStrategy
public void setEscapeStrategy(StringParser.EscapeStrategy strategy)
-
getAllowsReferenceEscape
public StringParser.EscapeStrategy getAllowsReferenceEscape()
-
preventToStringSingleExpression
public void preventToStringSingleExpression(boolean prevent)
If set to true and the parsed expression only contains one expression. The direct result of that expression will not be wrapped with a toString expression.
-
parse
public Expression parse(java.lang.String expr, ExpressionParseContext binder) throws java.lang.Exception
-
addPart
protected void addPart(java.util.List<StringParser.StringOrPath> parts, StringParser.StringOrPath newPart)
-
parseQueryWithBoundPaths
protected StringParser.StringOrPath[] parseQueryWithBoundPaths(java.lang.String query) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseQueryWithBoundPathsEscapedCharacters
protected StringParser.StringOrPath[] parseQueryWithBoundPathsEscapedCharacters(java.lang.String query)
-
parseQueryWithEscapedBoundPaths
protected StringParser.StringOrPath[] parseQueryWithEscapedBoundPaths(java.lang.String query) throws java.lang.Exception
Chops up a query, returning the string segments and path segments separately- Throws:
java.lang.Exception
-
parseQueryWithBoundPathsNoEscape
protected static StringParser.StringOrPath[] parseQueryWithBoundPathsNoEscape(java.lang.String query) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-