EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: msi again
From: Andrew Johnson <[email protected]>
To: [email protected]
Date: Mon, 23 Aug 2010 16:44:56 -0500
Hi Ben,

On Monday 23 August 2010 07:27:03 Benjamin Franksen wrote:
> Sorry for replying to myself, but I found that the restriction that global
> substitution sets must precede file substitution sets is too, well,
> restrictive. In fact, I found a place where we use the /dev/null trick
> twice in two separate locations in the same substitution files.
>
> I have attached a new version of msi.c that allows mixing file and global
> sections. The semantics is that definitions inside a global section are
> valid from the point of definition to the rest of the file, except where
> overwritten by other global definitions or shadowed by local ones (in file
> sections).

Without actually delving into your msi.c code, I'd like to agree on a formal 
grammar for the substitutions file.  The dbLoadTemplate code currently 
implements some extra features that are not documented, which I eventually 
want to remove.  I'm adding a warning message if someone uses them, and will 
delete them from the 3.15 tree.

Having looked through the Yacc grammar for dbLoadTemplate I should point out 
that it doesn't currently support empty patterns or substitutions.  With the 
addition of the global variables I think it makes sense to allow this:
  file xyz {}
but I don't see why you'd need to be able to write either of these as well:
  file xyz {{}}
  file xyz { pattern {} {} }

Here's what I think the syntax should look like with "global" added, expressed 
in EBNF:


substitution-file ::= ( global-definitions* template-substitutions+ )+

global-definitions ::= 'global' '{' variable-definitions '}'
variable-definitions ::= variable-definition ( ',' variable-definition )*
variable-definition ::= variable-name '=' value

template-substitutions ::= 'file' file-name '{' substitutions? '}'
substitutions ::= variable-substitutions | pattern-substitutions
variable-substitutions ::= '{' variable-definitions '}'

pattern-substitutions ::= 'pattern' '{' pattern-names '}' pattern-definitions
pattern-names ::= variable-name ( ',' variable-name )*
pattern-definitions ::= ( '{' pattern-values '}' )+
pattern-values ::= value ( ',' value )*

variable-name ::= variable-name-char+
file-name ::= file-name-char+ | double-quoted-string | single-quoted-string
value ::= value-char+ | double-quoted-string | single-quoted-string

double-quoted-string ::= '"' (double-quoted-char | escaped-char)* '"'
single-quoted-string ::= "'" (single-quoted-char | escaped-char)* "'"
double-quoted-char ::= [^"\]
single-quoted-char ::= [^'\]
escaped-char ::= '\' .

Currently dbLoadTemplate_lex.l defines the remaining terminals to be
  variable-name-char ::= value-char
  file-name-char ::= value-char
  value-char ::= [a-zA-Z0-9_+:./\<>;[] | '-' | ']'

I would prefer something like these instead
  variable-name-char ::= [a-zA-Z0-9_]
  file-name-char ::= [a-zA-Z0-9_+:./\] | '-'
  value-char ::= [a-zA-Z0-9_+:./\<>;[] | '-' | ']'
but such a change might break existing substitutions files.

- Andrew
-- 
The best FOSS code is written to be read by other humans -- Harald Welte


Replies:
Re: msi again Benjamin Franksen
References:
msi again Benjamin Franksen
Re: msi again Benjamin Franksen
Re: msi again Benjamin Franksen

Navigate by Date:
Prev: Re: edm meter Andrew Johnson
Next: GNU make 3.82 problem Allison, Stephanie
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: msi again Benjamin Franksen
Next: Re: msi again Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·