MCPcopy Create free account
hub / github.com/Genivia/RE-flex / write_main

Method write_main

src/reflex.cpp:3095–3121  ·  view source on GitHub ↗

Write main() to lex.yy.cpp

Source from the content-addressed store, hash-verified

3093
3094/// Write main() to lex.yy.cpp
3095void Reflex::write_main()
3096{
3097 if (!out->good())
3098 return;
3099 if (!options["main"].empty())
3100 {
3101 write_banner("SECTION 3: main");
3102 *out << "int main()\n{\n return ";
3103 if (options["bison"].empty())
3104 {
3105 if (!options["namespace"].empty())
3106 write_namespace_scope();
3107 if (!options["yyclass"].empty())
3108 *out << options["yyclass"];
3109 else if (!options["class"].empty())
3110 *out << options["class"];
3111 else
3112 *out << options["lexer"];
3113 *out << "()." << options["lex"] << "()";
3114 }
3115 else
3116 {
3117 *out << "yylex()";
3118 }
3119 *out << ";\n}\n";
3120 }
3121}
3122
3123/// Write regex string to lex.yy.cpp by escaping \ and ", prevent trigraphs, very long strings are represented by character arrays
3124void Reflex::write_regex(const std::string *condition, const std::string& regex)

Callers

nothing calls this directly

Calls 2

goodMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected