[augeas-devel] Having trouble differentiating quoted vs unquoted string

Matthew Palmer matt at anchor.net.au
Fri Aug 14 08:18:13 UTC 2009


On Thu, Aug 13, 2009 at 06:36:47PM -0700, David Lutterkort wrote:
> On Thu, 2009-08-13 at 12:39 +1000, Matthew Palmer wrote:
> > That's ugly and prone to error, but I could talk my way into doing that if I
> > absolutely had to.  However, there are other SSH options that can be a
> > comma-separated list of value, which then need to be quoted (but not
> > necessarily, if you've only got one value to set that doesn't contain
> > spaces).  That one we can't trick with leaving the quotes in place...
> 
> Yeah, for those cases, you'll want raphink's way to strip quotes and
> commas and parse each value into a separate tree node.

That still has the "optionally unquoted" problem, as I understand it.

> > So, here's my "test" lens for the simple quoted/unquoted line scenario
> > (though using single quotes as the quoting character, to simplify the
> > escaping):
> > 
> > let unquoted_line = seq "count" . del /'?/ "" . store /[^' \t\n][^' \t\n]*/ . del /'?/ ""
> > 
> > let quoted_line = seq "count" . Util.del_str "'" . store /[^'\n]* [^'\n]*/ . Util.del_str "'"
> > 
> > let line = (unquoted_line|quoted_line) . Util.eol
> > 
> > let lns = line*
> > 
> > However, augparse tells me that this is overlapping, and that '' (exactly
> > that -- the single quotes there are augparse's, not mine) matches both. 
> > I've got an explicit and required space character in the middle there, so
> > how can that second regexp (in quoted_line) match the empty string?
> 
> That's again the issue that Augeas only looks at labels, not values in
> the tree -> file direction;

It seems that if you say this often enough, eventually it'll sink in -- for
some reason, every time you've said this in the past I've read it as "looks
at values" and assumed that it'll match how I "think" it'll match (based on
the value).  Sorry 'bout that.

Now that things are clearer in my head, I realise I'm far, far more screwed
than I previously realised.  I *have* to be able to distinguish between
quoted and unquoted strings, because the list of what "terminates" the
string is different if it's an unquoted string (comma, whitespace) or a
quoted string (quotes).

Any suggestions on how to proceed?  Right at the moment, I'm not even sure
how to parse a comma-separated list of options without making a mess of it. 
I guess I should go back to looking at how to do case-insensitive regexes
(damn my flex/bison skills are rusty).

- Matt




More information about the augeas-devel mailing list