Class StringParser
java.lang.Object
com.inductiveautomation.ignition.common.expressions.parsing.StringParser
- All Implemented Interfaces:
Parser
A parser that handles string interpolation, supporting literal text mixed with bound paths (e.g.,
"{path/to/tag}").
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumprotected static class -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStringParser(Class<? extends AbstractExpression> exprType) This constructor specifies what type of expression should be created. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddPart(List<StringParser.StringOrPath> parts, StringParser.StringOrPath newPart) static StringParserReturns a parser that expects to parse sql queries for referencesstatic StringParserReturns a parser who creates expressions that simply toString sub-expressions, adjusting the values for the locale.static StringParserReturns a parser who creates an expression that is the toString of all of the sub-expressions, but with no consideration of the locale.parse(String expr, ExpressionParseContext binder) Parse the given string into anExpression.protected StringParser.StringOrPath[]parseQueryWithBoundPaths(String query) protected StringParser.StringOrPath[]protected static StringParser.StringOrPath[]protected StringParser.StringOrPath[]Chops up a query, returning the string segments and path segments separatelyvoidpreventToStringSingleExpression(boolean prevent) If set to true and the parsed expression only contains one expression.voidsetAllowsReferenceEscape(boolean escapeReference) If true, allows item reference syntax, such as "{blah}" to be escaped with "\", to avoid expansion.voidsetEscapeStrategy(StringParser.EscapeStrategy strategy)
-
Field Details
-
ESCAPE
- See Also:
-
OPEN_DELIM
- See Also:
-
CLOSE_DELIM
- See Also:
-
-
Constructor Details
-
StringParser
public StringParser() -
StringParser
This constructor specifies what type of expression should be created. Different expressions will behave differently.
-
-
Method Details
-
newStandardParser_Localized
Returns a parser who creates expressions that simply toString sub-expressions, adjusting the values for the locale. -
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
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.NONETrue, usesStringParser.EscapeStrategy.REFERENCE -
setEscapeStrategy
-
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
Description copied from interface:ParserParse the given string into anExpression.- Specified by:
parsein interfaceParser- Parameters:
expr- the expression string to parsebinder- theExpressionParseContextto use during parsing- Returns:
- the parsed
Expression - Throws:
Exception- if the expression cannot be parsed
-
addPart
-
parseQueryWithBoundPaths
- Throws:
Exception
-
parseQueryWithBoundPathsEscapedCharacters
-
parseQueryWithEscapedBoundPaths
protected StringParser.StringOrPath[] parseQueryWithEscapedBoundPaths(String query) throws Exception Chops up a query, returning the string segments and path segments separately- Throws:
Exception
-
parseQueryWithBoundPathsNoEscape
protected static StringParser.StringOrPath[] parseQueryWithBoundPathsNoEscape(String query) throws Exception - Throws:
Exception
-