summaryrefslogtreecommitdiffstats
path: root/formats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-06-25 17:34:22 +0200
committerJan Pokorný <jpokorny@redhat.com>2015-07-02 23:43:38 +0200
commitcc8be165aafb1f7e136e2959e033824260b08074 (patch)
treea6f34bfbcd454930a14b3cb53f62fcd89a9c58b5 /formats
parente26543b9c5006269101fed5a9920971f52211729 (diff)
downloadclufter-cc8be165aafb1f7e136e2959e033824260b08074.tar.gz
clufter-cc8be165aafb1f7e136e2959e033824260b08074.tar.xz
clufter-cc8be165aafb1f7e136e2959e033824260b08074.zip
formats/simpleconfig: loosen desired notation a bit
Thanks to more tolerant "pretty-printer" and also with respect to what target structuring will be optimal for the parser. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'formats')
-rw-r--r--formats/simpleconfig.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/formats/simpleconfig.py b/formats/simpleconfig.py
index 5b8494e..3eae42a 100644
--- a/formats/simpleconfig.py
+++ b/formats/simpleconfig.py
@@ -16,11 +16,11 @@ class simpleconfig(SimpleFormat):
Internally ('struct'), it is structured liked this:
- SECTION ::= list-or-tuple(TAG, OPTIONS, SECTIONS)
- SECTIONS ::= list(SECTION) # must be list due to arragement
- OPTIONS ::= tuple(OPTION) # must be tuple (ditto)
- OPTION ::= list-or-tuple(TAG, VALUE)
- TAG ::= [^#@].* # due to arrangement
+ SECTION ::= tuple(TAG, OPTIONS, SECTIONS) # [] tolerated, but fixed width
+ SECTIONS ::= list-or-tuple(SECTION)
+ OPTIONS ::= list-or-tupletuple(OPTION)
+ OPTION ::= tuple(TAG, VALUE) # must be tuple due to inner arragement
+ TAG ::= .* # XXX and comment handling [^#@].*
VALUE ::= .*
where SECTIONS form logical subsections (arbitrarily nested)
@@ -28,17 +28,17 @@ class simpleconfig(SimpleFormat):
Example:
('corosync-ONLY-INTERNAL-TAG-NOT-EXTERNALIZED-ANYWAY',
- (),
- [['totem', (('version', '2'), ('cluster_name', 'aus-cluster')), None],
- ['nodelist',
- (),
- [['node', (('id', '1'), ('ring0_addr', 'lolek.example.com')), None],
- ['node', (('id', '2'), ('ring0_addr', 'bolek.example.com')), None]]],
- ['quorum',
- (('provider', 'corosync_votequorum'),
+ [],
+ [('totem', [('version', '2'), ('cluster_name', 'aus-cluster')], None),
+ ('nodelist',
+ [],
+ [('node', [('id', '1'), ('ring0_addr', 'lolek.example.com')], None),
+ ('node', [('id', '2'), ('ring0_addr', 'bolek.example.com')], None)]),
+ ('quorum',
+ [('provider', 'corosync_votequorum'),
('expected_votes', '1'),
- ('two_node', '1')),
- None]])
+ ('two_node', '1')],
+ None)])
"""
# NOTE yacc-based parser in fence-virt
native_protocol = STRUCT = Protocol('struct')