David Lutterkort 3c1bf4
From 075f8d35497fb36d9193e5364c055049c66fa5eb Mon Sep 17 00:00:00 2001
David Lutterkort 3c1bf4
From: Lubomir Rintel <lubo.rintel@gooddata.com>
David Lutterkort 3c1bf4
Date: Mon, 9 Jan 2012 18:52:11 +0100
David Lutterkort 3c1bf4
Subject: [PATCH 1/2] Allow JSON number literals to be followed by whitespace
David Lutterkort 3c1bf4
David Lutterkort 3c1bf4
Add a test case.
David Lutterkort 3c1bf4
David Lutterkort 3c1bf4
Fixes https://fedorahosted.org/augeas/ticket/247
David Lutterkort 3c1bf4
---
David Lutterkort 3c1bf4
 AUTHORS                    |    1 +
David Lutterkort 3c1bf4
 lenses/json.aug            |    2 +-
David Lutterkort 3c1bf4
 lenses/tests/test_json.aug |    3 +++
David Lutterkort 3c1bf4
 3 files changed, 5 insertions(+), 1 deletions(-)
David Lutterkort 3c1bf4
David Lutterkort 3c1bf4
diff --git a/AUTHORS b/AUTHORS
David Lutterkort 3c1bf4
index df63f95..e7870f2 100644
David Lutterkort 3c1bf4
--- a/AUTHORS
David Lutterkort 3c1bf4
+++ b/AUTHORS
David Lutterkort 3c1bf4
@@ -44,6 +44,7 @@ Contributions by:
David Lutterkort 3c1bf4
   Bill Pemberton              <wfp5p@virginia.edu>
David Lutterkort 3c1bf4
   Alan Pevec                  <apevec@redhat.com>
David Lutterkort 3c1bf4
   Robin Lee Powell            <rlpowell@digitalkingdom.org>
David Lutterkort 3c1bf4
+  Lubomir Rintel              <lubo.rintel@gooddata.com>
David Lutterkort 3c1bf4
   Roman Rakus                 <rrakus@redhat.com>
David Lutterkort 3c1bf4
   Satoru SATOH                <satoru.satoh@gmail.com>
David Lutterkort 3c1bf4
   Nicolas Valcárcel Scerpella <nvalcarcel@ubuntu.com>
David Lutterkort 3c1bf4
diff --git a/lenses/json.aug b/lenses/json.aug
David Lutterkort 3c1bf4
index c22ad90..6ceab09 100644
David Lutterkort 3c1bf4
--- a/lenses/json.aug
David Lutterkort 3c1bf4
+++ b/lenses/json.aug
David Lutterkort 3c1bf4
@@ -29,7 +29,7 @@ let str_store =
David Lutterkort 3c1bf4
   let q =  del "\"" "\"" in
David Lutterkort 3c1bf4
   q . store /[^"]*/ . q . ws             (* " Emacs, relax *)
David Lutterkort 3c1bf4
 
David Lutterkort 3c1bf4
-let number = [ label "number" . store /-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?/ ]
David Lutterkort 3c1bf4
+let number = [ label "number" . store /-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?/ . ws ]
David Lutterkort 3c1bf4
 let str = [ label "string" . str_store ]
David Lutterkort 3c1bf4
 
David Lutterkort 3c1bf4
 let const (r:regexp) = [ label "const" . store r . ws ]
David Lutterkort 3c1bf4
diff --git a/lenses/tests/test_json.aug b/lenses/tests/test_json.aug
David Lutterkort 3c1bf4
index 0bcd25d..d8b7fa8 100644
David Lutterkort 3c1bf4
--- a/lenses/tests/test_json.aug
David Lutterkort 3c1bf4
+++ b/lenses/tests/test_json.aug
David Lutterkort 3c1bf4
@@ -8,6 +8,9 @@ test lns get "true" = { "const" = "true" }
David Lutterkort 3c1bf4
 
David Lutterkort 3c1bf4
 test lns get "3.141" = { "number" = "3.141" }
David Lutterkort 3c1bf4
 
David Lutterkort 3c1bf4
+test lns get "{ \"key\" : 666 }" =
David Lutterkort 3c1bf4
+  { "dict" { "entry" = "key" { "number" = "666" } } }
David Lutterkort 3c1bf4
+
David Lutterkort 3c1bf4
 test lns get "[true, 0, \"yo\"]" =
David Lutterkort 3c1bf4
   { "array" { "const" = "true" } { "number" = "0" } { "string" = "yo" } }
David Lutterkort 3c1bf4
 
David Lutterkort 3c1bf4
-- 
David Lutterkort 3c1bf4
1.7.7.5
David Lutterkort 3c1bf4