[ntp:hackers] Cool new stuff

Frank Kardel kardel at ntp.org
Fri Jul 21 22:41:32 UTC 2006


Hal Murray wrote:

>>1. peerstats, loopstats, cryptostats, sysstats, clockstats and
>>rawstats are now reserved words and may not be used as filenames in
>>the configuration file. Hence, a configuration command such as:
>>    
>>
>
>  
>
>>filegen peerstats file peerstats enable
>>    
>>
>
>  
>
>>won't work and will give a syntax error. Instead, use something like:
>>    
>>
>
>  
>
sorry, but here is room for improvement :-)

>>filegen peerstats file peer_stats enable
>>    
>>
>
>That seems pretty ugly to me.  A lot of scripts have those filenames wired in.
>
>How hard is it to add something like quotes around the filename to get past 
>the keyword checking?
>
>
>  
>
Usually this is handled in the syntax to expect a string token. The 
tokenizer
(flex) could pick up the string (including spaces and escape syntax 
handling).
and the parser just fetches that value. There are countless examples how to
pick up a string token in a flex/bison or lex/yacc environment. That 
should solve
your problem here.

I expect the syntax to have more string valued tokens in the future (e.g.
device pathnames, init strings). So this basic functionality should be 
there.

Also for the stats keyword I would rather see a lexical token from the 
stats class
which is dynamically configured at daemon startup time. This avoids to 
pre-define
all stats classes fixed in the syntax.  This way  the dynamic 
registration of stats
collectors is still possible without affecting the syntax. Think of it 
as a pre-registered
list of allowed words at the place after the filegen keyword.
(e. g. FILEGEN COLLECTOR FILE STRING ACTION, COLLECTOR being one of the
register collector names, STRING being a quoted string holding the file 
name, ACTION
being one of the action keywords, the rest are constant tokens)

I would need to look at your grammar to give you more tips there.

Frank


More information about the hackers mailing list