Class ObjectParser.SourceParser

java.lang.Object
org.bzdev.util.ObjectParser.SourceParser
All Implemented Interfaces:
ObjectParser<ObjectParser.Source>
Enclosing interface:
ObjectParser<T>

public static class ObjectParser.SourceParser extends Object implements ObjectParser<ObjectParser.Source>
Object parser that tags a string as being one that is likely to be an ESP expression or statement.

This class is used by ObjectNamerLauncher to distinguish strings that must be evaluated from strings that should not be evaluated. For example, when using ObjectNamerLauncher with YAML,


     - = 10 + 20
 
would be treated as an expression whose value is 30. By contrast,

     - !!str = 10 + 20
 
would be interpretted as the string "= 10 + 20". This is actually handled in two passes. During the first, sequences that could be ESP expressions or statements are replaced with objects whose type is ObjectParser.Source containing the expression in string form. In the second pass, each ObjectParser.Source object is evaluated as an ESP expression or statement. This prevents the second case, where "= 10 + 20" was meant to be a string, from being replaced with the value 30.