[augeas-devel] NASL lens entry

Tim Brigham timbrigham at gmail.com
Thu Jan 9 21:51:06 UTC 2014


I wanted to ask about how I'm handling one point in writing the lens for
parsing my NASL files.

I'm using two cases for my end of line, those that end with a semicolon
only and those that end with a closing parenthesis. e.g.

let cparen      = del /\)/ ")"
let semic       = Util.del_str ";"
let dquote      = Util.del_str "\""
let comma       = del /,/ ","
let colon       = del /:[ \t]*/ ": "
let eol         = del /[ \t]*\n/ "\n"
let del_opt_ws = del /[ \t]*/ ""
let equal       = del /[ \t]*=[ \t]*/ "="
let oparen      = del /\(/ "("

let cparen_entry (kw:string) = [ del_opt_ws .  key kw . oparen .
value_to_cparen . cparen . semic . eol   ]
let semic_entry (kw:string) = [  del_opt_ws . key kw  . equal .
 value_to_semic .  semic . eol ]

This works perfectly until I run into something where I have an embedded
closing parenthesis in a given line, e.g


* script_copyright("This script is Copyright (C) 2004 Michel Arboi");*


My thought is something like this should work to generalize it but I'm not
sure how to define value_to_something.

let refined_entry (kw:string) = [ del_opt_ws . key kw . ( oparen | equal )
. value_to_something . cparen{0,1} . semic . eol  ]

The (oparen|equal) comes back with
exception: overlapping lenses in tree union.put
    Example matched by both:
    First lens: lens/nasl.aug:24.14-.26:
    Second lens: lens/nasl.aug:23.13-.36:

Can you assist?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20140109/acd43c0e/attachment.htm>


More information about the augeas-devel mailing list