diff options
| author | Brice Figureau <brice-puppet@daysofwonder.com> | 2008-09-26 23:03:39 +0200 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2008-10-01 01:35:03 +1000 |
| commit | 4cf9710bd27fdb5f0720f4d8478ef940e7c4ba59 (patch) | |
| tree | e2db8d91c8e1d45bb9413899ff6566a712264b0a /test/data | |
| parent | cfa230a2d7b0c5e57cc0379785bd2025520f1c35 (diff) | |
| download | puppet-4cf9710bd27fdb5f0720f4d8478ef940e7c4ba59.tar.gz puppet-4cf9710bd27fdb5f0720f4d8478ef940e7c4ba59.tar.xz puppet-4cf9710bd27fdb5f0720f4d8478ef940e7c4ba59.zip | |
Add parser for arbitrary expressions
The expressions can be used in if 'test' and in the
right side of assignements.
The expressions can contain any number of sub-expressions
combined by either arithmetic operators, comparison operators,
or boolean operators.
Random Usage Examples:
$result = ((( $two + 2) / $one) + 4 * 5.45) - (6 << 7) + (0x800 + -9)
or
if ($a < 10) and ($a + 10 != 200) {
...
}
Diffstat (limited to 'test/data')
| -rw-r--r-- | test/data/snippets/arithmetic_expression.pp | 8 | ||||
| -rw-r--r-- | test/data/snippets/ifexpression.rb | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/test/data/snippets/arithmetic_expression.pp b/test/data/snippets/arithmetic_expression.pp new file mode 100644 index 000000000..aae98a4db --- /dev/null +++ b/test/data/snippets/arithmetic_expression.pp @@ -0,0 +1,8 @@ + +$one = 1.30 +$two = 2.034e-2 + +$result = ((( $two + 2) / $one) + 4 * 5.45) - (6 << 7) + (0x800 + -9) + + +notice("result is $result == 1295.87692307692")
\ No newline at end of file diff --git a/test/data/snippets/ifexpression.rb b/test/data/snippets/ifexpression.rb new file mode 100644 index 000000000..eea3b855b --- /dev/null +++ b/test/data/snippets/ifexpression.rb @@ -0,0 +1,6 @@ +$one = 1 +$two = 2 + +if ($one < $two) and (($two < 3) or ($two == 2)) { + notice("True!") +} |
