From bfb18b584290fef2599a7b15368fc9990c3ace85 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Mon, 3 Oct 2011 22:02:28 -0400 Subject: [PATCH] Identify nonterminals in the manual's grammar in an alternate way. Some output devices won't render .Va text differently from .Li text when displaying the man page. This unfortunately means that nonterminals look exactly the same as terminals in the grammar. Add brackets around nonterminals (which are otherwise unused in the grammar) so that it is readable on these devices, too. --- doc/man/cdecl99.1 | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/doc/man/cdecl99.1 b/doc/man/cdecl99.1 index e217c26..662858b 100644 --- a/doc/man/cdecl99.1 +++ b/doc/man/cdecl99.1 @@ -100,37 +100,38 @@ format is based on the one used in and is described by the following context-free grammar. This grammar is for illustrative purposes only: it is ambiguous and doesn't capture all the nuances of the C language. In this grammar, nonterminals are represented -.Va thusly , +.Va [ thusly ] , \[*e] represents the empty string, and both .Li | and successive \[->] under the same nonterminal indicate alternation. All other symbols are terminals. The nonterminals -.Va identifier , type-specifier , type-qualifier , storage-class-specifier +.Va [ identifier ] , [ type-specifier ] , +.Va [ type-qualifier ] , [ storage-class-specifier ] and -.Va function-specifier +.Va [ function-specifier ] are defined as in C. .Bl -column -offset indent ".Va english-decl" "" -.It Va english Ta \[->] Ta Li declare Va identifier Li as Va english-decl -.It Ta \[->] Ta Li type Va english-decl -.It Va english-decl Ta \[->] Ta Va sf-specs declarator -.It Va declarator Ta \[->] Ta Va qualifiers Li pointer to Va declarator -.It Ta \[->] Ta Li array Va size Li of Va declarator -.It Ta \[->] Ta Li function Va parameters Li returning Va declarator -.It Ta \[->] Ta Va tq-specs -.It Va qualifiers Ta \[->] Ta Va type-qualifier qualifiers | No \[*e] -.It Va tq-specs Ta \[->] Ta Va type-qualifier tq-specs -.It Ta \[->] Ta Va type-specifier tq-specs +.It Va english Ta \[->] Ta Li declare Va [ identifier ] Li as Va [ english-decl ] +.It Ta \[->] Ta Li type Va [ english-decl ] +.It Va english-decl Ta \[->] Ta Va [ sf-specs ] [ declarator ] +.It Va declarator Ta \[->] Ta Va [ qualifiers ] Li pointer to Va [ declarator ] +.It Ta \[->] Ta Li array Va [ size ] Li of Va [ declarator ] +.It Ta \[->] Ta Li function Va [ parameters ] Li returning Va [ declarator ] +.It Ta \[->] Ta Va [ tq-specs ] +.It Va qualifiers Ta \[->] Ta Va [ type-qualifier ] [ qualifiers ] | No \[*e] +.It Va tq-specs Ta \[->] Ta Va [ type-qualifier ] [ tq-specs ] +.It Ta \[->] Ta Va [ type-specifier ] [ tq-specs ] .It Ta \[->] Ta \[*e] -.It Va sf-specs Ta \[->] Ta Va storage-class-specifier sf-specs -.It Ta \[->] Ta Va function-specifier sf-specs +.It Va sf-specs Ta \[->] Ta Va [ storage-class-specifier ] [ sf-specs ] +.It Ta \[->] Ta Va [ function-specifier ] [ sf-specs ] .It Ta \[->] Ta \[*e] -.It Va size Ta \[->] Ta Va integer | Va identifier | Li * | No \[*e] -.It Va parameters Ta \[->] Ta Po Va param-list Pc -.It Ta \[->] Ta Po Va param-list Li , ... Pc +.It Va size Ta \[->] Ta Va [ integer ] | Va [ identifier ] | Li * | No \[*e] +.It Va parameters Ta \[->] Ta Po Va [ param-list ] Pc +.It Ta \[->] Ta Po Va [ param-list ] Li , ... Pc .It Ta \[->] Ta \[*e] -.It Va param-list Ta \[->] Ta Va parameter | Va parameter Li , Va param-list -.It Va parameter Ta \[->] Ta Va identifier Li as Va english-decl -.It Ta \[->] Ta Va english-decl +.It Va param-list Ta \[->] Ta Va [ parameter ] | Va [ parameter ] Li , Va [ param-list ] +.It Va parameter Ta \[->] Ta Va [ identifier ] Li as Va [ english-decl ] +.It Ta \[->] Ta Va [ english-decl ] .El .Sh RESOLVING AMBIGUITIES The C context-free grammar has many ambiguities regarding declarations. -- 2.43.2