[Rpm-maint] RFC - EBNF for rpmrc
Paul Nasrat
pnasrat at redhat.com
Thu May 3 09:43:59 UTC 2007
The attached is an attempt to document the current rpmrc syntax. The
reasons behind this is mainly to familiarise myself with grammars,
lexers and parsers so I can then attempt to write a grammar for
specfiles.
Comments welcome.
Paul
-------------- next part --------------
(*
* EBNF for RPM rpmrc files
*
* Copyright (C) 2007 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions of
* the GNU General Public License v.2. This program is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY expressed or
* implied, including the implied warranties of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA. Any Red Hat trademarks that are incorporated in the source code or
* documentation are not subject to the GNU General Public License and may
* only be used or replicated with the express permission of Red Hat, Inc.
*
* Red Hat Author(s): Paul Nasrat
*
*)
(* The rpmrc file *)
rpmrc = parts+ ;
parts = macrofiles | include | optflags | machine_canon | machine_compat | machine_translate | comments ;
comments = '#' string ;
string = {.+} ;
(* RPMRC options *)
macrofiles = 'macrofiles' ':' search-path ;
include = 'include' ':' path ;
(* key string - NB not key: *)
optflags = 'optflags' ':' string ;
(* Machine options *)
machine_keys = os | arch | buildos | buildarch ;
os = 'os' ;
arch = 'arch' ;
buildos = 'buildos' ;
buildarch = 'buildarch' ;
(* key: short_name num *)
machine_canon = machine_keys ['_'] canon string;
canon = 'canon' ;
(* key: compat list *)
machine_compat = machine_keys ['_'] compat string;
compat = 'compat' ;
(* key: default *)
machine_translate = machine_keys ['_'] translate string;
translate = 'translate';
(* Path EBNF derived from http://www.boost.org/libs/filesystem/doc/path.htm#Grammar *)
search-path = path { path-seperator path } ;
path = [root] [relative-path] ;
root = [root-name] [root-directory] ;
root-directory = separator ;
relative-path = path-element { separator path-element } [separator] ;
path-element = filename | parent-directory | directory-placeholder ;
filename = char { char } ;
directory-placeholder = "." ;
parent-directory = ".." ;
separator = '/' ;
path-seperator = ":" ;
(* Can include globs *)
char = .-seperator ;
More information about the Rpm-maint
mailing list