[augeas-devel] [Augeas] #347: Repetition operator fails

Augeas trac at fedorahosted.org
Tue Jun 25 08:46:56 UTC 2013


#347: Repetition operator fails
---------------------+---------------------
 Reporter:  raphink  |       Owner:  lutter
     Type:  defect   |      Status:  new
 Priority:  major    |   Milestone:  next
Component:  Augeas   |     Version:  devel
 Keywords:           |  Blocked By:
 Blocking:           |
---------------------+---------------------
 The following lens fails to pass the tests:

 {{{
 module Mechanicalduck =

 let values =
      let allowed_semicolon = /[^\n ];/ | /;[^\n ]/
   in let no_semicolon = /[^\n;]/
   in let val_re = (no_semicolon | allowed_semicolon)*
   in let val = [ seq "val" . store val_re ]
   in let semicolon = Util.del_str " ; "
   in Build.opt_list val semicolon

 (* three simple values *)
 test values get "value1 ; value2 ; value3" =
   { "1" = "value1" }
   { "2" = "value2" }
   { "3" = "value3" }
 }}}

 with:

 {{{
 mechanicalduck.aug:46.0-49.20:exception thrown in test
 mechanicalduck.aug:46.5-.42:exception: Iterated lens matched less than it
 should
     Lens: /usr/share/augeas/lenses/dist/build.aug:59.43-.57:
     Error encountered at 1:16 (16 characters into string)
                <value1 ; value2 |=|; value3>

     Tree generated so far:
     /1 = "value1"
 /2 = "value2 "
 }}}

 The lens ctype which fails to parse is:

 {{{
 /([^\n;]|[^\n ];|;[^\n ])*( ; ([^\n;]|[^\n ];|;[^\n ])*)*/
 }}}

 Replacing the lens with:

 {{{
 let values =
      let allowed_semicolon = /[^\n ];/ | /;[^\n ]/
   in let no_semicolon = /[^\n;]/
   in let val_re = (no_semicolon | allowed_semicolon)*
   in let val = [ seq "val" . store val_re ]
   in let semicolon = Util.del_str " ; "
   in Build.list val semicolon | val
 }}}

 works, and the corresponding ctype is:

 {{{
 /([^\n;]|[^\n ];|;[^\n ])* ; ([^\n;]|[^\n ];|;[^\n ])*( ; ([^\n;]|[^\n
 ];|;[^\n ])*)*|([^\n;]|[^\n ];|;[^\n ])*/
 }}}

-- 
Ticket URL: <https://fedorahosted.org/augeas/ticket/347>
Augeas <http://augeas.net/>
a configuration API




More information about the augeas-devel mailing list