File: create_doc.leg

package info (click to toggle)
flint 2.4.4-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,904 kB
  • ctags: 13,326
  • sloc: ansic: 208,848; cpp: 11,358; sh: 564; makefile: 250
file content (49 lines) | stat: -rw-r--r-- 1,516 bytes parent folder | download | duplicates (4)
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
# Minimal grammar for our documentation files. To compile, run
# > leg create_doc.leg -o create_doc_gen.c

start = group*

group = comments groupopening comments (EOL|function|subgroupopening)*


groupopening = stars blankline sectiontitle blankline content stars
subgroupopening = pluses blankline? subsectiontitle blankline? content pluses

sectiontitle = "    " < linecontent > EOL     {
    fprintf(out, "\\section{%.*s}\n", yyleng, yytext);}

subsectiontitle = "    " < linecontent > EOL     {
    fprintf(out, "\\subsection{%.*s}\n", yyleng, yytext);}

function = (macroheader|functionheader) functionfooter? EOL*

functionheader = < funcnametype '(' funcargs ')' modifiers? ';'?
                      > whitespace? EOL {printfuncheader(yytext, yyleng);}

macroheader = < 'macro' whitespace linecontent > EOL    {
    printfuncheader(yytext, yyleng);}

funcnametype = !('*'|'+') ('operator()' | (! '(' .))*
funcargs = (! ')' .)*
modifiers = whitespace? ("const" | "(macro)")

functionfooter = content


content = < (contentline | blankline)* >       {
    fprintf(out, "%.*s", yyleng, yytext);}

contentline = "    " linecontent EOL

linecontent = (! EOL .) *

comments = (whitespace | EOL | comment)*

comment = '/*' (! "*/" .)* '*/'

blankline = whitespace? EOL

stars = "*******************************************************************************" EOL
pluses = "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" EOL
EOL = ('\r\n' | '\n' | '\r')
whitespace = (' ' | '\t')+