[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] [Augeas] #253: Match oddities in recursive lens



#253: Match oddities in recursive lens
---------------------+---------------------
 Reporter:  raphink  |       Owner:  lutter
     Type:  defect   |      Status:  new
 Priority:  major    |   Milestone:  next
Component:  Augeas   |     Version:  devel
 Keywords:           |  Blocked By:
 Blocking:           |
---------------------+---------------------
 As I was making graphviz.aug, I noticed a weird behavior with recursive
 lenses.

 Using `graphviz.aug` as of 810b8b65bfaf68bc83dfa871adeb9b3b48fc4eb9, we
 have:

 {{{
 (* View: subgraph
      Recursive mode doesn't work in the put direction
      so this is resctricted to two levels for now.
      TODO: See why recursive mode won't work. *)
 let subgraph = block "subgraph" (subgraph_nonrec | entry)

 (* View: graph
      The top-level graph
      Use <subgraph_nonrec> for debug *)
 let graph = block /(di)?graph/ (subgraph | entry) . Util.eol
 }}}

 which works, but only supports two levels of recursion for `subgraph`s
 (beware, this non-recursive lens requires about 6GB of RAM to typecheck).
 To turn on recursion, set `subgraph` to:

 {{{
 let rec subgraph = block "subgraph" (subgraph | entry)
 }}}

 Now, the typechecking fails with:

 {{{
 Syntax error in lens definition
 graphviz.aug:117.0-.77:Failed to compile lns
 graphviz.aug:117.10-.77:exception: ambiguous tree concatenation
       First regexp: /({ /#comment/ = /[^\001-\004\t\n
 ][^\001-\004\n]*[^\001-\004\t\n ]|[^\001-\004\t\n ]/ } | { })*{
 /(di)?graph/ = /"[^\001-\004"]*"|[.0-9A-Z_a-z]+/ }/
       Second regexp: /({ /#comment/ = /[^\001-\004\t\n
 ][^\001-\004\n]*[^\001-\004\t\n ]|[^\001-\004\t\n ]/ } | { })*/
       ' { "#comment" = "AA" }' can be split into
       '|=| { "#comment" = "AA" }'

      and
       ' { "#comment" = "AA" }|=|'

     First lens: graphviz.aug:117.10-.46:
     Second lens: graphviz.aug:117.49-.77:
 }}}

 This is a first hint into the issue. If we remove the `(Util.comment |
 Util.empty)*` at the end of the `graph` definition such that we get:

 {{{
 let lns = (Util.comment | Util.empty)* . graph
 }}}

 then typechecking passes, but `test_graphviz.aug` returns:

 {{{
 tests/test_graphviz.aug:45.0-52.0:exception thrown in test
 tests/test_graphviz.aug:45.5-46.36:exception: Failed to match
     ({ /#comment/ = /[^\001-\004\t\n ][^\001-\004\n]*[^\001-\004\t\n
 ]|[^\001-\004\t\n ]/ } | { })*{ /(di)?graph/ = /"[^\001-\004"]*"|[.0-9A-
 Z_a-z]+/ }
   with tree
     { "graph" = "A" }
     Lens: ./graphviz.aug:117.10-.46:
     Error encountered at path

 Syntax error in lens definition
 Failed to load tests/test_graphviz.aug
 }}}

 which seems like a similar error to the one involving `Util.comment`
 above.

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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]