src
Main Page
Namespaces
Classes
Files
File List
File Members
main.cc
Go to the documentation of this file.
1
#include "
src/util/c99_stdint.h
"
2
#include <string>
3
4
#include "
src/codegen/output.h
"
5
#include "
src/conf/msg.h
"
6
#include "
src/conf/opt.h
"
7
#include "
src/conf/warn.h
"
8
#include "
src/globals.h
"
9
#include "
src/parse/input.h
"
10
#include "
src/parse/parser.h
"
11
#include "
src/parse/scanner.h
"
12
13
namespace
re2c
14
{
15
16
bool
bUsedYYBitmap
=
false
;
17
bool
bWroteGetState
=
false
;
18
bool
bWroteCondCheck
=
false
;
19
uint32_t
last_fill_index
= 0;
20
std::string
yySetupRule
=
""
;
21
22
}
// end namespace re2c
23
24
using namespace
re2c
;
25
26
int
main
(
int
,
char
*argv[])
27
{
28
switch
(
parse_opts
(argv,
opts
))
29
{
30
case
OK
:
break
;
31
case
EXIT_OK
:
return
0;
32
case
EXIT_FAIL
:
return
1;
33
}
34
35
// set up the source stream
36
re2c::Input
input (
opts
.
source_file
);
37
if
(!input.
open
())
38
{
39
error
(
"cannot open source file: %s"
,
opts
.
source_file
);
40
return
1;
41
}
42
43
// set up the output streams
44
re2c::Output
output (
opts
.
output_file
,
opts
->
header_file
);
45
if
(!output.
source
.
open
())
46
{
47
error
(
"cannot open output file: %s"
,
opts
.
output_file
);
48
return
1;
49
}
50
if
(
opts
->
tFlag
&& !output.
header
.
open
())
51
{
52
error
(
"cannot open header file: %s"
,
opts
->
header_file
);
53
return
1;
54
}
55
56
Scanner
scanner (input, output.
source
);
57
parse
(scanner, output);
58
59
return
warn
.
error
() ? 1 : 0;
60
}
re2c::bWroteGetState
bool bWroteGetState
Definition:
main.cc:17
re2c::Input::open
bool open()
Definition:
input.cc:10
re2c::opt_t::tFlag
bool tFlag
Definition:
opt.h:118
re2c::Scanner
Definition:
scanner.h:52
output.h
input.h
re2c::error
void error(const char *fmt,...)
Definition:
msg.cc:10
re2c::parse
void parse(Scanner &, Output &)
re2c::warn
Warn warn
Definition:
warn.cc:11
re2c::Opt::output_file
const char * output_file
Definition:
opt.h:154
opt.h
re2c::Output::source
OutputFile source
Definition:
output.h:136
globals.h
re2c::bWroteCondCheck
bool bWroteCondCheck
Definition:
main.cc:18
parser.h
re2c::opt_t::header_file
const char * header_file
Definition:
opt.h:118
re2c::HeaderFile::open
bool open()
Definition:
output.cc:347
re2c::yySetupRule
std::string yySetupRule
Definition:
main.cc:20
re2c::bUsedYYBitmap
bool bUsedYYBitmap
Definition:
main.cc:16
re2c::Output::header
HeaderFile header
Definition:
output.h:137
msg.h
re2c::Output
Definition:
output.h:134
re2c::OK
Definition:
opt.h:209
re2c::Input
Definition:
input.h:11
re2c::OutputFile::open
bool open()
Definition:
output.cc:65
re2c::EXIT_FAIL
Definition:
opt.h:211
re2c::opts
Opt opts
Definition:
opt.cc:7
warn.h
scanner.h
c99_stdint.h
re2c::last_fill_index
uint32_t last_fill_index
Definition:
main.cc:19
re2c::EXIT_OK
Definition:
opt.h:210
main
int main(int, char *argv[])
Definition:
main.cc:26
re2c::Warn::error
bool error() const
Definition:
warn.cc:34
re2c
Definition:
bitmap.cc:10
re2c::parse_opts
parse_opts_t parse_opts(char **argv, Opt &opts)
re2c::Opt::source_file
const char * source_file
Definition:
opt.h:153
Generated by
1.8.10