"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/codegen.h" between
ragel-7.0.0.9.tar.gz and ragel-7.0.0.10.tar.gz

About:

codegen.h  (ragel-7.0.0.9):codegen.h  (ragel-7.0.0.10)
/* /*
* Copyright 2001-2014 Adrian Thurston <thurston@complang.org> * Copyright 2001-2014 Adrian Thurston <thurston@colm.net>
*/
/* This file is part of Ragel.
* *
* Ragel is free software; you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to
* the Free Software Foundation; either version 2 of the License, or * deal in the Software without restriction, including without limitation the
* (at your option) any later version. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* *
* Ragel is distributed in the hope that it will be useful, * The above copyright notice and this permission notice shall be included in al
* but WITHOUT ANY WARRANTY; without even the implied warranty of l
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * copies or substantial portions of the Software.
* GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with Ragel; if not, write to the Free Software * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
#ifndef _C_CODEGEN_H #ifndef _C_CODEGEN_H
#define _C_CODEGEN_H #define _C_CODEGEN_H
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
#include "common.h" #include "common.h"
#include "gendata.h" #include "gendata.h"
skipping to change at line 158 skipping to change at line 159
string KEY( Key key ); string KEY( Key key );
string LDIR_PATH( char *path ); string LDIR_PATH( char *path );
void ACTION( ostream &ret, GenAction *action, IlOpts opts ); void ACTION( ostream &ret, GenAction *action, IlOpts opts );
void NFA_CONDITION( ostream &ret, GenAction *condition, bool last ); void NFA_CONDITION( ostream &ret, GenAction *condition, bool last );
void CONDITION( ostream &ret, GenAction *condition ); void CONDITION( ostream &ret, GenAction *condition );
string ALPH_TYPE(); string ALPH_TYPE();
bool isAlphTypeSigned(); bool isAlphTypeSigned();
long long tableData; long long tableData;
RagelBackend backend;
bool stringTables; bool stringTables;
BackendFeature backendFeature;
virtual string GET_KEY(); virtual string GET_KEY();
string P(); string P();
string PE(); string PE();
string vEOF(); string vEOF();
string ACCESS(); string ACCESS();
string vCS(); string vCS();
string STACK(); string STACK();
skipping to change at line 189 skipping to change at line 188
string FIRST_FINAL() { return DATA_PREFIX() + "first_final"; } string FIRST_FINAL() { return DATA_PREFIX() + "first_final"; }
string CAST( string type ); string CAST( string type );
string ARR_TYPE( const TableArray &ta ) string ARR_TYPE( const TableArray &ta )
{ return ta.type; } { return ta.type; }
string ARR_REF( const TableArray &ta ) string ARR_REF( const TableArray &ta )
{ return ta.ref(); } { return ta.ref(); }
void INLINE_EXPR( ostream &ret, GenInlineList *inlineList );
void INLINE_BLOCK( ostream &ret, GenInlineExpr *inlineExpr );
void INLINE_PLAIN( ostream &ret, GenInlineExpr *inlineExpr );
void EOF_CHECK( ostream &ret );
void INLINE_LIST( ostream &ret, GenInlineList *inlineList, void INLINE_LIST( ostream &ret, GenInlineList *inlineList,
int targState, bool inFinish, bool csForced ); int targState, bool inFinish, bool csForced );
virtual void GOTO( ostream &ret, int gotoDest, bool inFinish ) = 0; virtual void GOTO( ostream &ret, int gotoDest, bool inFinish ) = 0;
virtual void CALL( ostream &ret, int callDest, int targState, bool inFini sh ) = 0; virtual void CALL( ostream &ret, int callDest, int targState, bool inFini sh ) = 0;
virtual void NCALL( ostream &ret, int callDest, int targState, bool inFin ish ) = 0; virtual void NCALL( ostream &ret, int callDest, int targState, bool inFin ish ) = 0;
virtual void NEXT( ostream &ret, int nextDest, bool inFinish ) = 0; virtual void NEXT( ostream &ret, int nextDest, bool inFinish ) = 0;
virtual void GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinis h ) = 0; virtual void GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinis h ) = 0;
virtual void NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinis h ) = 0; virtual void NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinis h ) = 0;
virtual void CALL_EXPR( ostream &ret, GenInlineItem *ilItem, virtual void CALL_EXPR( ostream &ret, GenInlineItem *ilItem,
int targState, bool inFinish ) = 0; int targState, bool inFinish ) = 0;
skipping to change at line 240 skipping to change at line 245
bool outLabelUsed; bool outLabelUsed;
bool testEofUsed; bool testEofUsed;
bool againLabelUsed; bool againLabelUsed;
bool useIndicies; bool useIndicies;
bool matchCondLabelUsed; bool matchCondLabelUsed;
void VALUE( string type, string name, string value ); void VALUE( string type, string name, string value );
string ACCESS_OPER() string ACCESS_OPER()
{ return backend == Direct ? "" : " -> "; } { return ""; }
string OPEN_HOST_EXPR() string OPEN_HOST_EXPR()
{ return backend == Direct ? "(" : "host( \"-\", 1 ) ={"; } { return "("; }
string OPEN_HOST_EXPR( string fileName, int line ) string OPEN_HOST_EXPR( string fileName, int line )
{ { return "("; }
return backend == Direct ? "(" : "host( \"" + fileName + "\", " +
STR(line) + " ) ={";
}
string CLOSE_HOST_EXPR() string CLOSE_HOST_EXPR()
{ return backend == Direct ? ")" : "}="; } { return ")"; }
string OPEN_HOST_BLOCK( string fileName, int line ) string OPEN_HOST_BLOCK( string fileName, int line )
{ {
if ( backend == Direct ) { if ( lineDirectives )
if ( lineDirectives ) return "{\n#line " + STR(line) + " \"" + fileName + "\"\n
return "{\n#line " + STR(line) + " \"" + fileName ";
+ "\"\n"; else
else return "{\n";
return "{\n";
}
else {
return "host( \"" + fileName + "\", " + STR(line) + " ) $
{";
}
} }
string OPEN_HOST_BLOCK( GenInlineExpr *inlineExpr ) string OPEN_HOST_BLOCK( GenInlineExpr *inlineExpr )
{ {
return OPEN_HOST_BLOCK( inlineExpr->loc.fileName, inlineExpr->loc .line ); return OPEN_HOST_BLOCK( inlineExpr->loc.fileName, inlineExpr->loc .line );
} }
string CLOSE_HOST_BLOCK() string CLOSE_HOST_BLOCK()
{ return backend == Direct ? "}" : "}$"; } { return "}"; }
string OPEN_HOST_PLAIN() string OPEN_HOST_PLAIN()
{ return backend == Direct ? "" : "host( \"-\", 1 ) @{"; } { return ""; }
string CLOSE_HOST_PLAIN() string CLOSE_HOST_PLAIN()
{ return backend == Direct ? "" : "}@"; } { return ""; }
string OPEN_GEN_EXPR() string OPEN_GEN_EXPR()
{ return backend == Direct ? "(" : "={"; } { return "("; }
string CLOSE_GEN_EXPR() string CLOSE_GEN_EXPR()
{ return backend == Direct ? ")" : "}="; } { return ")"; }
string OPEN_GEN_BLOCK() string OPEN_GEN_BLOCK()
{ return backend == Direct ? "{" : "${"; } { return "{"; }
string CLOSE_GEN_BLOCK() string CLOSE_GEN_BLOCK()
{ return backend == Direct ? "}" : "}$"; } { return "}"; }
string OPEN_GEN_PLAIN() string OPEN_GEN_PLAIN()
{ return backend == Direct ? "" : "@{"; } { return ""; }
string CLOSE_GEN_PLAIN() string CLOSE_GEN_PLAIN()
{ return backend == Direct ? "" : "}@"; } { return ""; }
string UINT() string UINT()
{ return backend == Direct ? "unsigned int" : "uint"; } { return "unsigned int"; }
string INDEX( string type, string name ) string INDEX( string type, string name )
{ {
if ( backend == Direct ) return "const " + type + " *" + name;
return "const " + type + " *" + name;
else
return "index " + type + " " + name;
} }
string ENTRY() string ENTRY()
{ {
if ( backend == Direct ) return "";
return "";
else
return "entry";
} }
string LABEL( string name ) string LABEL( string name )
{ {
if ( backend == Direct ) return name + ": ";
return name + ": ";
else
return "label " + name;
} }
string OFFSET( string arr, string off ) string OFFSET( string arr, string off )
{ {
if ( backend == Direct ) return "( " + arr + " + (" + off + "))";
return "( " + arr + " + (" + off + "))";
else
return "offset( " + arr + ", " + off + " )";
} }
string TRUE() string TRUE()
{ {
if ( backend == Direct ) return "1";
return "1";
else
return "TRUE";
} }
string DEREF( string arr, string off ) string DEREF( string arr, string off )
{ {
if ( backend == Direct ) return "(*( " + off + "))";
return "(*( " + off + "))";
else
return "deref( " + arr + ", " + off + " )";
} }
string CASE( string val ) string CASE( string val )
{ {
if ( backend == Direct ) return "case " + val + ": ";
return "case " + val + ": ";
else
return "case " + val;
} }
string DEFAULT() string DEFAULT()
{ {
if ( backend == Direct ) return "default:";
return "default:";
else
return "default";
} }
string CEND( ) string CEND( )
{ {
if ( backend == Direct ) return " break; ";
return " break; ";
else
return " ";
} }
string FALLTHROUGH() string FALLTHROUGH()
{ {
if ( backend == Direct ) return " ";
return " ";
else
return "fallthrough;";
} }
string NIL() string NIL()
{ {
if ( backend == Direct ) return "0";
return "0";
else
return "nil";
} }
string EXPORT( string type, string name, string value ) string EXPORT( string type, string name, string value )
{ {
if ( backend == Direct ) return "#define " + name + " " + value;
return "#define " + name + " " + value;
else
return "export " + type + " " + name + " " + value + ";";
} }
public: public:
virtual void writeExports(); virtual void writeExports();
}; };
#endif #endif
 End of changes. 34 change blocks. 
93 lines changed or deleted 54 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS