inclSectionTarg(inclSectionTarg),
includeDepth(includeDepth),
line(1), column(1), lastnl(0),
- parser(0), active(false),
+ parser(0), ignoreSection(false),
parserExistsError(false),
whitespaceOn(true)
{}
void startSection();
void endSection();
void do_scan();
- bool parserExists();
+ bool active();
ostream &scan_error();
char *fileName;
/* Set by machine statements, these persist from section to section
* allowing for unnamed sections. */
Parser *parser;
- bool active;
+ bool ignoreSection;
IncludeStack includeStack;
/* This is set if ragel has already emitted an error stating that
%% write init;
}
-bool Scanner::parserExists()
+bool Scanner::active()
{
- if ( parser != 0 )
- return true;
+ if ( ignoreSection )
+ return false;
- if ( ! parserExistsError ) {
+ if ( parser == 0 && ! parserExistsError ) {
scan_error() << "there is no previous specification name" << endl;
parserExistsError = true;
}
- return false;
+
+ if ( parser == 0 )
+ return false;
+
+ return true;
}
ostream &Scanner::scan_error()
char *machine = word;
if ( inclSectionTarg == 0 ) {
- active = true;
+ ignoreSection = false;
ParserDictEl *pdEl = parserDict.find( machine );
if ( pdEl == 0 ) {
}
else if ( strcmp( inclSectionTarg, machine ) == 0 ) {
/* found include target */
- active = true;
+ ignoreSection = false;
parser = inclToParser;
}
else {
/* ignoring section */
- active = false;
+ ignoreSection = true;
parser = 0;
}
}
action handle_include
{
- if ( parserExists() && active ) {
+ if ( active() ) {
char *inclSectionName = word;
char *inclFileName = 0;
action write_command
{
- parserExists();
- if ( active && machineSpec == 0 && machineName == 0 ) {
+ if ( active() && machineSpec == 0 && machineName == 0 ) {
output << "<write"
" def_name=\"" << parser->sectionName << "\""
" line=\"" << line << "\""
action write_arg
{
- if ( active && machineSpec == 0 && machineName == 0 )
+ if ( active() && machineSpec == 0 && machineName == 0 )
output << "<arg>" << tokdata << "</arg>";
}
action write_close
{
- if ( active && machineSpec == 0 && machineName == 0 )
+ if ( active() && machineSpec == 0 && machineName == 0 )
output << "</write>\n";
}
action handle_token
{
/* Send the token off to the parser. */
- if ( parserExists() && active ) {
+ if ( active() ) {
InputLoc loc;
#if 0
}%%
/* Close off the section with the parser. */
- if ( parserExists() && active ) {
+ if ( active() ) {
InputLoc loc;
loc.fileName = fileName;
loc.line = line;