summaryrefslogtreecommitdiffstats
path: root/tcllib/modules/doctools/docidx_lang_syntax.man
blob: cdf7b0c51e4fe38e97d4d143386806a52148d27d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin docidx_lang_syntax n 1.0]
[see_also docidx_intro]
[see_also docidx_lang_cmdref]
[see_also docidx_lang_faq]
[see_also docidx_lang_intro]
[keywords {docidx commands}]
[keywords {docidx language}]
[keywords {docidx markup}]
[keywords {docidx syntax}]
[keywords markup]
[keywords {semantic markup}]
[copyright {2007-2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>}]
[moddesc   {Documentation tools}]
[titledesc {docidx language syntax}]
[category  {Documentation tools}]
[description]
[para]

This document contains the formal specification of the syntax of the
docidx markup language, version 1 in Backus-Naur-Form. This document
is intended to be a reference, complementing the
[term {docidx language command reference}].

A beginner should read the much more informally written
[term {docidx language introduction}] first before trying to
understand either this document or the command reference.

[section Fundamentals]

In the broadest terms possible the [term {docidx markup language}] is
like SGML and similar languages. A document written in this language
consists primarily of markup commands, with text embedded into it at
some places.

[para]

Each markup command is a just Tcl command surrounded by a matching
pair of [const [lb]] and [const [rb]]. Which commands are available,
and their arguments, i.e. syntax is specified in the
[term {docidx language command reference}].

[para]

In this document we specify first the lexeme, and then the syntax,
i.e. how we can mix text and markup commands with each other.

[section {Lexical definitions}]

In the syntax rules listed in the next section

[list_begin enumerated]
[enum]
<TEXT> stands for all text except markup commands.

[enum]
Any XXX stands for the markup command [lb]xxx[rb] including its
arguments. Each markup command is a Tcl command surrounded by a
matching pair of [const [lb]] and [const [rb]]. Inside of these
delimiters the usual rules for a Tcl command apply with regard to word
quotation, nested commands, continuation lines, etc.

[enum]
<WHITE> stands for all text consisting only of spaces, newlines,
tabulators and the [cmd comment] markup command.
[list_end]

[section Syntax]

The rules listed here specify only the syntax of docidx documents. The
lexical level of the language was covered in the previous section.

[para]

Regarding the syntax of the (E)BNF itself

[list_begin enumerated]
[enum]
The construct { X } stands for zero or more occurrences of X.
[enum]
The construct [lb] X [rb] stands for zero or one occurrence of X.
[list_end]

The syntax:

[example {
index     = defs
            INDEX_BEGIN
            [ contents ]
            INDEX_END
            { <WHITE> }

defs      = { INCLUDE | VSET | <WHITE> }
contents  = keyword { keyword }

keyword   = defs KEY ref { ref }
ref       = MANPAGE | URL | defs
}]

At last a rule we were unable to capture in the EBNF syntax, as it is
about the arguments of the markup commands, something which is not
modeled here.

[list_begin enumerated]
[enum]

The arguments of all markup commands have to be plain text, and/or text
markup commands, i.e. one of

[list_begin enumerated]
[enum][cmd lb],
[enum][cmd rb], or
[enum][cmd vset] (1-argument form).
[list_end]

[list_end]

[vset CATEGORY doctools]
[include ../doctools2base/include/feedback.inc]
[manpage_end]