bin_PROGRAMS = re2c
win_BINARIES = $(WINBUILDDIR)/re2c.exe
-re2c_SOURCES = code.cc dfa.cc go_construct.cc go_destruct.cc go_emit.cc go_used_labels.cc main.cc parser.cc actions.cc scanner.re substr.cc range.cc \
+re2c_SOURCES = code.cc code_names.cc dfa.cc go_construct.cc go_destruct.cc go_emit.cc go_used_labels.cc \
+ main.cc parser.cc actions.cc scanner.re substr.cc range.cc \
translate.cc scanner.cc mbo_getopt.cc print.cc input.cc input_api.cc output.cc \
enc.cc utf8.cc utf8_range.cc utf8_regexp.cc utf16.cc utf16_range.cc utf16_regexp.cc range_suffix.cc \
basics.h code.h code_names.h dfa.h go.h enc.h indent.h input.h input_api.h free_list.h globals.h ins.h \
-/* Generated by re2c 0.14.1.dev on Mon Mar 2 13:32:16 2015*/
+/* Generated by re2c 0.14.1.dev on Fri Mar 27 16:37:18 2015*/
#include <stdlib.h>
#include <string.h>
#include <iostream>
}
++YYCURSOR;
{
- if (!ignore_eoc && !DFlag)
+ if (!(ignore_eoc || DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok) - 1);
// -1 so we don't write out the \0
{
ignore_cnt++;
}
- else if (!DFlag)
+ else if (!(DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
}
{
fatal("found standard 're2c' block while using -r flag");
}
- if (!DFlag)
+ if (!(DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(&cursor[-7]) - (const char*)(tok));
}
fatal("found 'use:re2c' block without -r flag");
}
reuse();
- if (!DFlag)
+ if (!(DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(&cursor[-11]) - (const char*)(tok));
}
if (yych != 'c') goto yy12;
++YYCURSOR;
{
- if (!DFlag)
+ if (!(DFlag || flag_skeleton))
{
out.insert_yymaxfill ();
}
{
tok = pos = cursor;
ignore_eoc = true;
- if (!DFlag)
+ if (!(DFlag || flag_skeleton))
{
out.insert_line_info ();
out << "\n";
ignore_eoc = false;
ignore_cnt = 0;
}
- else if (!DFlag)
+ else if (!(DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
}
ignore_eoc = false;
ignore_cnt = 0;
}
- else if (!DFlag)
+ else if (!(DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
}
--- /dev/null
+#include "code_names.h"
+#include "globals.h"
+
+namespace re2c
+{
+
+std::string& CodeNames::operator [] (const char * what)
+{
+ CodeNames::iterator it = find(std::string(what));
+
+ if (it == end() || flag_skeleton)
+ {
+ return insert(std::make_pair(std::string(what), std::string(what))).first->second;
+ }
+ else
+ {
+ return it->second;
+ }
+}
+
+} // end namespace re2c
std::string& operator [] (const char * what);
};
-inline std::string& CodeNames::operator [] (const char * what)
-{
- CodeNames::iterator it = find(std::string(what));
-
- if (it != end())
- {
- return it->second;
- }
- else
- {
- return insert(std::make_pair(std::string(what), std::string(what))).first->second;
- }
-}
-
} // end namespace re2c
#endif
extern bool rFlag;
extern bool sFlag;
extern bool tFlag;
+extern bool flag_skeleton;
extern bool bNoGenerationDate;
extern bool bUsedYYMarker;
bool rFlag = false;
bool sFlag = false;
bool tFlag = false;
+bool flag_skeleton = false;
bool bNoGenerationDate = false;
bool bUsedYYBitmap = false;
mbo_opt_struct(12, 0, "case-inverted"),
mbo_opt_struct(13, 1, "encoding-policy"),
mbo_opt_struct(14, 1, "input"),
+ mbo_opt_struct(15, 0, "skeleton"),
mbo_opt_struct('-', 0, NULL) /* end of args */
};
"\n"
"--input i Specify re2c input API.\n"
" i can be one of the following: default, custom.\n"
+ "\n"
+ "--skeleton Instead of embedding re2c-generated code into C/C++ source,\n"
+ " generate a self-contained program for the same DFA.\n"
+ " Most useful for correctness and performance testing.\n"
;
}
return 1;
}
break;
+
+ case 15:
+ flag_skeleton = true;
+ break;
}
}
return 2;
}
- if (DFlag && (bFlag || dFlag || sFlag))
+ if (DFlag && (bFlag || dFlag || sFlag || flag_skeleton))
{
- std::cerr << "re2c: error: Cannot combine -D with -b, -d or -s switches\n";
+ std::cerr << "re2c: error: Cannot combine -D with -b, -d, -s or --skeleton switches\n";
return 2;
}
{
fatal("found standard 're2c' block while using -r flag");
}
- if (!DFlag)
+ if (!(DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(&cursor[-7]) - (const char*)(tok));
}
fatal("found 'use:re2c' block without -r flag");
}
reuse();
- if (!DFlag)
+ if (!(DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(&cursor[-11]) - (const char*)(tok));
}
RETURN(Reuse);
}
"/*!max:re2c" {
- if (!DFlag)
+ if (!(DFlag || flag_skeleton))
{
out.insert_yymaxfill ();
}
"/*!types:re2c" {
tok = pos = cursor;
ignore_eoc = true;
- if (!DFlag)
+ if (!(DFlag || flag_skeleton))
{
out.insert_line_info ();
out << "\n";
ignore_eoc = false;
ignore_cnt = 0;
}
- else if (!DFlag)
+ else if (!(DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
}
ignore_eoc = false;
ignore_cnt = 0;
}
- else if (!DFlag)
+ else if (!(DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
}
{
ignore_cnt++;
}
- else if (!DFlag)
+ else if (!(DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
}
goto echo;
}
zero {
- if (!ignore_eoc && !DFlag)
+ if (!(ignore_eoc || DFlag || flag_skeleton))
{
out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok) - 1);
// -1 so we don't write out the \0