[augeas-devel] Debug help on sphinx lense

Andrew Colin Kissa andrew at topdog.za.net
Thu Nov 20 19:21:33 UTC 2014


Hi All,

I have written a lense to parse the sphinx search configuration file sphinx.conf

I am able to successfully parse and work with the file but augparse keeps giving
me errors am trying to write the tests but cannot move forward due to the augparse
errors.

I have tried debugging but have not been able to resolve the "ambiguous concatenation"
issue. I would appreciate some help.

The lense is attached below.

module Sphinx =
  autoload xfm

(************************************************************************
* Group: USEFUL PRIMITIVES
*************************************************************************)

let eol = Util.eol

let sep = Sep.space

let empty = Util.empty

let indent = Util.indent

let comment = Util.comment

let eq = del /[ \t]*=/ " ="

let any = Rx.no_spaces - Rx.cl

let value = any . (Rx.space . any)*

let cont_value = (any|Rx.cl) . (Rx.space . any . (Rx.cl)?)*

let block_names = /searchd|indexer/

let blocks_with_opts = /source|index/

let keys = Rx.word

let quote = Quote.do_dquote_opt

(************************************************************************
 * Group: Entry
 *************************************************************************)

let entry = [ indent . key keys . eq . (Sep.opt_space . store value)? . eol ]

let cont_entry = [ indent . key keys . eq . (Sep.space . store cont_value) . eol ]

let sphinx_block (ent:lens) (comment:lens) =
    let indent = del Rx.opt_space "\t"
    in del Build.block_ldelim_newlines_re Build.block_ldelim_newlines_default
    . ((ent | comment) . (Util.empty | ent | comment)*)?
    . del Build.block_rdelim_newlines_re Build.block_rdelim_newlines_default

let blockn = [ indent . key blocks_with_opts . sep . quote (store Rx.space_in) . sphinx_block (entry|cont_entry) comment . eol ]
let block = [ indent . key block_names . sphinx_block (entry|cont_entry) comment . eol ]

(************************************************************************
 * Group: filter and lens
 *************************************************************************)

let lns = (comment|empty|block|blockn)*

let filter = incl "/etc/sphinx/*.conf"

let xfm = transform lns filter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20141120/a23788b9/attachment.sig>


More information about the augeas-devel mailing list