class Bindgen::ConfigReader::ConditionEvaluator
- Bindgen::ConfigReader::ConditionEvaluator
- Reference
- Object
Overview
Implements the condition evaluation logic of Parser.
See Parsers documentation for a description of the syntax.
You can sub-class this and pass an instance into a Parser if you want
to augment its feature-set.
Defined in:
bindgen/config_reader/condition_evaluator.crConstant Summary
-
RX =
/^(?:els)?if(?: +|_)(.+?)(?: +|_)(is|isnt|matches|newer_or|older_or)(?: +|_)(.*)$/ -
Regular expression for conditionals. Matches:
[els]if VARIABLE (is|matches) VALUE. Instead of a space, an underscore may be used instead.
Constructors
Instance Method Summary
-
#conditional?(text : String) : Bool
Returns
trueif the text looks like a condition. -
#evaluate(condition_text : String, state : ConditionState) : Tuple(Bool, ConditionState)
Evaluates condition_text.
-
#read_verb(text : String) : Verb | Nil
Reads the conditional verb from text, if any.
-
#variables : Hash(String, String)
Accessible variables
Constructor Detail
Instance Method Detail
def conditional?(text : String) : Bool
#
Returns true if the text looks like a condition. This is
used to feed all keys in a mapping into.
Evaluates condition_text.
Reads the conditional verb from text, if any.