Commit Diff


commit - d632b3b70d9b6e226557e450243d0efd5e39105a
commit + 6fdc24670880d6e8e15741e7a8b212b9474d6b6d
blob - 56420c89d5fdd54c9f1cbb6811d56afea7b8674a
blob + cee8dced6dbc99befa37810c07d052d3656a1ceb
--- ini_n.c
+++ ini_n.c
@@ -29,18 +29,23 @@
  *
  * converted to be compatible with our combinators:
  *
- *	inifile	= sects empties wss tail
- *	sects	= {header entries}
- *	tail	= [eof wss eol anys]
+ *	inifile	= sects empties wss otail
+ *	sect	= header entries
+ *	tail	= eof wss eol anys
+ *	sects	= {sect}
+ *	otail	= [tail]
  *
  *	header	= empties bra sname ket eol
- *	entries	= {empties key eq value eol}
- *	empties	= {wss comment nl}
+ *	entry	= empties key eq value eol
+ *	empty	= wss ocmnt nl
+ *	entries	= {entry}
+ *	empties	= {empty}
  *
  *	eol	= nl | end
  *	bra	= wss leftbr
  *	ket	= rightbr wss
- *	comment	= [semi lchars]
+ *	comment	= semi lchars
+ *	ocmnt	= [comment]
  *	sname	= {schar}+
  *	key	= {kchar}+
  *	value	= {lchar}+
@@ -66,9 +71,9 @@
  * note how right-hand sides have one of the following forms:
  *
  *  - a sequence of nonterminals (SEQ)
- *  - a sequence of nonterminals inside { } (MANY)
- *  - a sequence of nonterminals inside { }+ (MANY1)
- *  - a sequence of nonterminals inside [ ] (OPT)
+ *  - a single nonterminal inside { } (MANY)
+ *  - a single nonterminal inside { }+ (MANY1)
+ *  - a single nonterminal inside [ ] (OPT)
  *  - a choice of nonterminals (CHOICE)
  *  - a string of characters (STRING)
  *  - a single character (CHAR)
@@ -105,20 +110,23 @@ DEF_(rightbr,	CHAR(']'))
 DEF_(eol,	CHOICE(nl, end))
 DEF_(bra,	SEQ(wss, leftbr))
 DEF_(ket,	SEQ(rightbr, wss))
-DEF_(comment,	OPT(semi, lchars))
+DEF_(comment,	SEQ(semi, lchars))
+DEF (ocmnt,	OPT(comment))
 DEF_(sname,	MANY1(schar))
 DEF_(key,	MANY1(kchar))
 DEF_(value,	MANY1(lchar))
 
-DEF_(empty,	SEQ(wss, comment, nl))
+DEF_(empty,	SEQ(wss, ocmnt, nl))
 DEF_(empties,	MANY(empty))
 DEF_(header,	SEQ(empties, bra, sname, ket, eol))
 DEF_(entry,	SEQ(empties, key, eq, value, eol))
 DEF_(entries,	MANY(entry))
 
-DEF_(tail,	OPT(eof, wss, eol, anys))
-DEF_(sects,	MANY(header, entries))
-DEF_(inifile,	TRY(sects, empties, wss, tail))
+DEF_(tail,	SEQ(eof, wss, eol, anys))
+DEF (otail,	OPT(tail))
+DEF_(sect,	SEQ(header, entries))
+DEF_(sects,	MANY(sect))
+DEF_(inifile,	TRY(sects, empties, wss, otail))
 
 bool
 trace(void *ctx, void *env, const char *s, size_t len)