Gentoo Archives: gentoo-pms

From: Walter <walter.stanish@×××××.com>
To: gentoo-pms@l.g.o
Subject: [gentoo-pms] [gentoo-pms-abnf] Generation of regex from ABNF!
Date: Mon, 23 Sep 2013 07:17:00
Message-Id: CACwuEiNj7VzLQ4L_KcBs8TH1e9omPNxRWPzUM7yv1-MmeT4DQw@mail.gmail.com
1 Hear ye, formalistic entity definition fans!
2
3 Aforementioned evil project to interpret the PMS docs and recast them
4 unofficially as a go-to formal grammar has advanced to its next stage of
5 world domination! (Complete no-show by the forecast army of worker-gnomes
6 notwithstanding.)
7
8 As of a few minutes ago, thanks to some quirky ruby, almost-correct*
9 regular expressions can now be generated for each of the various
10 identifiers, which could be used in any tools.
11
12 From a transparency/maintenance perspective it may be preferable to
13 generate these for any package-related tools since it means everyone is
14 sourcing their grammar - without error prone manual processes - from the
15 same single point of truth, removing an entire class of bugs.
16
17 Code @ https://github.com/globalcitizen/gentoo-pms-abnf
18 Related bug @ https://bugs.gentoo.org/show_bug.cgi?id=456892 (full of
19 unbelievers)
20
21 - Walter
22
23 * 'Almost correct' because entities like "a" are not officially allowed in
24 ABNF, but desirable in spec for readability and ease of editing. An
25 intermediate script is thus needed prior to regex generation to simply
26 convert strings in to escaped entities ('%xxx' IIRC) to get properly solid
27 output. Easy one but I'm otherwise disposed today.