forked from Genivia/RE-flex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
man.sh
executable file
·81 lines (70 loc) · 2.24 KB
/
man.sh
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
#!/bin/sh
# Generates man page doc/man/reflex.1 from reflex -h
# Robert van Engelen, Genivia Inc. All rights reserved.
if [ "$#" = 1 ]
then
if [ -x bin/reflex ]
then
echo
echo "Creating reflex man page"
mkdir -p doc/man
echo '.TH REFLEX "1" "'`date '+%B %d, %Y'`'" "reflex '$1'" "User Commands"' > doc/man/reflex.1
cat >> doc/man/reflex.1 << 'END'
.SH NAME
\fBreflex\fR -- regex\-centric, fast and flexible lexical analyzer generator
.SH SYNOPSIS
.B reflex
[\fIOPTIONS\fR] [\fIFILE\fR]
.SH DESCRIPTION
Generates C++ source code programs that perform pattern\-matching on text.
\fIFILE\fR is a lexer specification source file, usually with extension .l.
Generates lex.yy.cpp unless option \fB-o\fR specifies otherwise.
.SH OPTIONS
END
bin/reflex -h \
| sed -e 's/\([^\\]\)\\/\1\\\\/g' \
| sed \
-e '/^$/ d' \
-e '/^Usage:/ d' \
-e 's/^ //' \
-e $'s/^ \(.*\)$/.TP\\\n \\1/' \
-e $'s/^ \(.*\)$/.PP\\\n.B \\1/' \
-e 's/\(--[-+0-9A-Za-z_]*\)/\\fB\1\\fR/g' \
-e 's/\([^-0-9A-Za-z_]\)\(-.\)/\1\\fB\2\\fR/g' \
-e 's/\[=\([-0-9A-Za-z_]*\)\]/[=\\fI\1\\fR]/g' \
-e 's/=\([-0-9A-Za-z_]*\)/=\\fI\1\\fR/g' \
| sed -e 's/-/\\-/g' >> doc/man/reflex.1
cat >> doc/man/reflex.1 << 'END'
.SH DEPENDENCIES
None, except when option \fB-m\fR specifies an external pattern\-matcher engine
such as pcre2 or boost that requires the corresponding library.
.SH "DOCUMENTATION"
The full documentation for \fBreflex\fR is maintained as a Doxygen\-generated
manual reflex/doc/html/index.html located in the source directory of the reflex
installation. Or visit:
.IP
https://www.genivia.com/doc/reflex/html/index.html
.PP
to browse the latest version of the reflex user guide.
.SH BUGS
REJECT is not functional and not available.
.PP
Report bugs at:
.IP
https://github.com/Genivia/RE-flex/issues
.SH LICENSE
\fBreflex\fR is released under the BSD\-3 license. All parts of the software
have reasonable copyright terms permitting free redistribution. This includes
the ability to reuse all or parts of the reflex source tree.
.SH "SEE ALSO"
lex(1), flex(1), flex++(1).
END
echo "reflex $1 manual page created and saved in doc/man/reflex.1"
else
echo "bin/reflex is needed but was not found: build reflex first"
exit 1
fi
else
echo "Usage: ./man.sh 1.v.v"
exit 1
fi