Re: [PATCH] Unknown cfg function

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Mon, 29 Jul 2013 16:19:52 -0600

On 07/29/2013 01:42 PM, Kinkie wrote:

>> After this patch, if I type parametres(foo) instead of parameters(foo),
>> will Squid think that I am defining a regular expression instead of
>> importing foo where my true regular expressions are stored?

> Guys, one question: I understand that everyone here is very
> distrusting of lex/yacc parser generators.

I believe your understanding is incorrect. While I would not recommend
lex/yacc for Squid, there is no reason to distrust "formal" parsers in
general -- they work much better than hand-written ones in most cases.
We even wrote a formal parser generator for protocol work some years
ago: www.hapy.org.

> in cases such as these a full parser would just be able
> to make sense from the context, instead of covering corner cases such
> as this one.

A formal parser needs a good grammar, which Squid configuration
currently lacks. While virtually anything can be forced into a formal
grammar (albeit not necessarily LALR), doing that for the current Squid
configuration file would be rather painful and mostly pointless.

For example, while you can force a specific acl type name to be
hard-coded into the grammar so that YACC switches to a special part of
the grammar tree to parse regular expressions, doing so would defeat the
purpose of introducing a formal grammar and formal parsers while _not_
solving the problem of supporting %macros and parameter imports.

A big part of the effort related to quoted strings project was to move
Squid closer to a good configuration grammar. Doing so is not possible
without screwing up some old configurations. Accommodating those is
where all the problems and debates start. Once we have a good grammar,
we can discuss whether it is a good idea to use a formal parser for it,
and which formal parser to use.

Cheers,

Alex.
Received on Mon Jul 29 2013 - 22:20:09 MDT

This archive was generated by hypermail 2.2.0 : Tue Jul 30 2013 - 12:00:50 MDT