flooph 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flooph.rb +9 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f718ff84dd25dade90072186cde278b586f39657
|
4
|
+
data.tar.gz: 689471893e0b67601c5a7041c81ac89c109e17dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a67d8d7e1b85e23d0a0fb066a64e7e5d051c2ee5eb39e19fcadf5f331580d7aac034ec8d3e252a69f77cf73af3313e8529cb561bfa79435e1cb929499f781acf
|
7
|
+
data.tar.gz: b959cabe0b642938216d70c474a787f4cab09ee1932e45e3521bbb12391ccde69667995e9a9312eb6d144fd8c6144c680370152b5e80ad408e5fb09456abc4eb
|
data/lib/flooph.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'parslet'
|
2
2
|
|
3
3
|
class Flooph < Parslet::Parser
|
4
|
-
VERSION = '0.1.
|
4
|
+
VERSION = '0.1.3'
|
5
5
|
|
6
6
|
# The current values used when evaluating templates and conditionals.
|
7
7
|
# Can also be updated by user input using #update_variables.
|
@@ -61,13 +61,13 @@ class Flooph < Parslet::Parser
|
|
61
61
|
# cats = 42 # variable `cats` equals 42
|
62
62
|
# cats>0 & dogs>0 # if both variables are numbers greater than zero
|
63
63
|
#
|
64
|
-
# * Numeric and string comparisons, using
|
64
|
+
# * Numeric and string comparisons, using any of `< > = == ≤ <= ≥ >= ≠ !=`
|
65
65
|
# * Non-present variables or invalid comparisons always result in false
|
66
66
|
# * Variable presence/truthiness using just name (isDead) or with optional trailing question mark (isDead?).
|
67
|
-
# * Boolean composition
|
68
|
-
# *
|
69
|
-
# *
|
70
|
-
# *
|
67
|
+
# * Boolean composition, e.g. `a | b & c & (d | !e) || !(f && g)`
|
68
|
+
# * `!foo` means "not foo", inverting the meaning
|
69
|
+
# * `&` has higher precedence than `|`
|
70
|
+
# * `|` is the same as `||`; `&` is the same as `&&`
|
71
71
|
#
|
72
72
|
# @param vars [Hash] variable values to use for this and future evaluations.
|
73
73
|
# If omitted, existing variable values will be used.
|
@@ -179,6 +179,9 @@ class Flooph < Parslet::Parser
|
|
179
179
|
rule(:var) { match['a-zA-Z'] >> match('\w').repeat }
|
180
180
|
rule(:sp) { match[' \t'].repeat }
|
181
181
|
|
182
|
+
# Workaround parslet bug that requires a root for inspection
|
183
|
+
root :mkup
|
184
|
+
|
182
185
|
class Transform < Parslet::Transform
|
183
186
|
rule(proz:simple(:s)){ s.to_s }
|
184
187
|
rule(test:simple(:test), out:simple(:out), elifs:subtree(:elifs), else:subtree(:elseout)) do
|