syntax region rlCodeCurly matchgroup=NONE start="{" end="}" contained contains=@inlineItems
syntax region rlCodeSemi matchgroup=Type start="\<alphtype\>" start="\<getkey\>" start="\<access\>" start="\<variable\>" matchgroup=NONE end=";" contained contains=@inlineItems
-syntax region rlWrite matchgroup=Type start="\<write\>" matchgroup=NONE end=";" contained contains=rlWriteKeywords,rlWriteOptions
+syntax region rlWrite matchgroup=Type start="\<write\>" matchgroup=NONE end="[;)]" contained contains=rlWriteKeywords,rlWriteOptions
-syntax keyword rlWriteKeywords init data exec exports contained
+syntax keyword rlWriteKeywords init data exec exports start error first_final contained
syntax keyword rlWriteOptions noerror nofinal noprefix noend nocs contained
"
}
}
+void FsmCodeGen::writeStart()
+{
+ out << START_STATE_ID();
+}
+
+void FsmCodeGen::writeFirstFinal()
+{
+ out << FIRST_FINAL_STATE();
+}
+
+void FsmCodeGen::writeError()
+{
+ out << ERROR_STATE();
+}
/*
* Language specific, but style independent code generators functions.
virtual void finishRagelDef();
virtual void writeInit();
+ virtual void writeStart();
+ virtual void writeFirstFinal();
+ virtual void writeError();
protected:
string FSM_NAME();
}
}
+
+void CSharpFsmCodeGen::writeStart()
+{
+ out << START_STATE_ID();
+}
+
+void CSharpFsmCodeGen::writeFirstFinal()
+{
+ out << FIRST_FINAL_STATE();
+}
+
+void CSharpFsmCodeGen::writeError()
+{
+ out << ERROR_STATE();
+}
+
/*
* C# Specific
*/
virtual void finishRagelDef();
virtual void writeInit();
+ virtual void writeStart();
+ virtual void writeFirstFinal();
+ virtual void writeError();
protected:
string FSM_NAME();
setValueLimits();
}
+void CodeGenData::write_option_error( InputLoc &loc, char *arg )
+{
+ source_warning(loc) << "unrecognized write option \"" << arg << "\"" << endl;
+}
+
void CodeGenData::writeStatement( InputLoc &loc, int nargs, char **args )
{
/* FIXME: This should be moved to the virtual functions in the code
noPrefix = true;
else if ( strcmp( args[i], "nofinal" ) == 0 )
noFinal = true;
- else {
- source_warning(loc) << "unrecognized write option \"" <<
- args[i] << "\"" << endl;
- }
+ else
+ write_option_error( loc, args[i] );
}
writeData();
}
for ( int i = 1; i < nargs; i++ ) {
if ( strcmp( args[i], "nocs" ) == 0 )
noCS = true;
- else {
- source_warning(loc) << "unrecognized write option \"" <<
- args[i] << "\"" << endl;
- }
+ else
+ write_option_error( loc, args[i] );
}
writeInit();
}
for ( int i = 1; i < nargs; i++ ) {
if ( strcmp( args[i], "noend" ) == 0 )
noEnd = true;
- else {
- source_warning(loc) << "unrecognized write option \"" <<
- args[i] << "\"" << endl;
- }
+ else
+ write_option_error( loc, args[i] );
}
writeExec();
}
else if ( strcmp( args[0], "exports" ) == 0 ) {
- for ( int i = 1; i < nargs; i++ ) {
- source_warning(loc) << "unrecognized write option \"" <<
- args[i] << "\"" << endl;
- }
+ for ( int i = 1; i < nargs; i++ )
+ write_option_error( loc, args[i] );
writeExports();
}
+ else if ( strcmp( args[0], "start" ) == 0 ) {
+ for ( int i = 1; i < nargs; i++ )
+ write_option_error( loc, args[i] );
+ writeStart();
+ }
+ else if ( strcmp( args[0], "first_final" ) == 0 ) {
+ for ( int i = 1; i < nargs; i++ )
+ write_option_error( loc, args[i] );
+ writeFirstFinal();
+ }
+ else if ( strcmp( args[0], "error" ) == 0 ) {
+ for ( int i = 1; i < nargs; i++ )
+ write_option_error( loc, args[i] );
+ writeError();
+ }
else {
/* EMIT An error here. */
source_error(loc) << "unrecognized write command \"" <<
virtual void writeInit() {};
virtual void writeExec() {};
virtual void writeExports() {};
+ virtual void writeStart() {};
+ virtual void writeFirstFinal() {};
+ virtual void writeError() {};
/* This can also be overwridden to modify the processing of write
* statements. */
ostream &source_warning( const InputLoc &loc );
ostream &source_error( const InputLoc &loc );
+ void write_option_error( InputLoc &loc, char *arg );
};
#endif
}
}
+void JavaTabCodeGen::writeStart()
+{
+ out << START_STATE_ID();
+}
+
+void JavaTabCodeGen::writeFirstFinal()
+{
+ out << FIRST_FINAL_STATE();
+}
+
+void JavaTabCodeGen::writeError()
+{
+ out << ERROR_STATE();
+}
+
void JavaTabCodeGen::writeData()
{
/* If there are any transtion functions then output the array. If there
virtual void writeData();
virtual void writeInit();
virtual void writeExports();
+ virtual void writeStart();
+ virtual void writeFirstFinal();
+ virtual void writeError();
virtual void finishRagelDef();
void NEXT( ostream &ret, int nextDest, bool inFinish );
}
}
+void RubyCodeGen::writeStart()
+{
+ out << START_STATE_ID();
+}
+
+void RubyCodeGen::writeFirstFinal()
+{
+ out << FIRST_FINAL_STATE();
+}
+
+void RubyCodeGen::writeError()
+{
+ out << ERROR_STATE();
+}
+
+
/*
* Local Variables:
* mode: c++
protected:
virtual void writeExports();
virtual void writeInit();
+ virtual void writeStart();
+ virtual void writeFirstFinal();
+ virtual void writeError();
/* Determine if we should use indicies. */
virtual void calcIndexSize();
[ -z "$*" ] && set -- *.rl
-config=../common/config.h
+config=../ragel/config.h
ragel=../ragel/ragel
cxx_compiler=`sed '/^#define CXX/s/#define CXX *//p;d' $config`