Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

True and false as tokens

  • Loading branch information...
commit 278982a7c8df344399781fb08591d0c1a09f230c 1 parent a67db7f
Tomas Doran authored
Showing with 15 additions and 1 deletion.
  1. +4 −0 lib/Pegex/Puppet/Data.pm
  2. +5 −1 share/puppet.pgx
  3. +6 −0 t/basic.t
4 lib/Pegex/Puppet/Data.pm
View
@@ -2,10 +2,14 @@ package Pegex::Puppet::Data;
use Pegex::Mo;
extends 'Pegex::Receiver';
+use boolean;
+
sub got_resource_name { @{pop()}; }
sub got_resource_term { @{pop()}; }
sub got_set_of_resource_terms { @{pop()}; }
sub got_resource_definition { my ($name, $data) = @{pop()}; return ([$name, {@$data}]) }
+sub got_true { &boolean::true }
+sub got_false { &boolean::false }
1;
6 share/puppet.pgx
View
@@ -34,9 +34,13 @@ resource_term: <resource_term_name> <fat_comma> <resource_term_value>
resource_term_name: <bare_word>
-resource_term_value: <bare_word> | <quoted_string>
+resource_term_value: <true> | <false> | <bare_word> | <quoted_string>
fat_comma: /~=<RANGLE>~/
wspace: /(?:<EOL>~)*/
+true: /true/
+
+false: /false/
+
6 t/basic.t
View
@@ -4,6 +4,7 @@ use Test::More 0.88;
use Test::Differences;
use Pegex::Puppet;
+use boolean;
my @data = (
[q{file {
@@ -12,6 +13,11 @@ my @data = (
}
} => [['file', [['foo', {foo => 'bar'}]]]]],
[q{file {
+ foo:
+ foo => true
+}
+} => [['file', [['foo', {foo => &boolean::true}]]]]],
+[q{file {
"/tmp/foo":
ensure => exists
}
Please sign in to comment.
Something went wrong with that request. Please try again.