* deleted all references to ANTLR

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@26173 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2008-03-02 14:27:05 +00:00
parent 97cf898619
commit f49ba45b33
28 changed files with 1 additions and 8092 deletions

View file

@ -1,6 +1,7 @@
2008-03-02 David Wetzel <dave@turbocat.de>
GSWeb.framework/GSWHTTPIO.m
* optimized readDataLine
* deleted all references to ANTLR
2008-03-01 David Wetzel <dave@turbocat.de>
* GSWAdaptors/Apache2/mod_gsw.c

View file

@ -1,57 +0,0 @@
#ifndef INC_GSWHTMLAttrLexer_h_
#define INC_GSWHTMLAttrLexer_h_
/*
* ANTLR-generated file resulting from grammar htmltag.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.7.1; 1996,1997,1998,1999,2000
*/
#include "GSWeb.h"
#include "gsantlr/ANTLRCommon.h"
#include "gsantlr/ANTLRCommonToken.h"
#include "gsantlr/ANTLRCharBuffer.h"
#include "gsantlr/ANTLRBitSet.h"
#include "gsantlr/ANTLRCharScanner.h"
@interface GSWHTMLAttrLexer : ANTLRCharScanner
{
};
-(void) initLiterals;
-(BOOL)getCaseSensitiveLiterals;
-(id)initWithTextStream:(ANTLRDefTextInputStream)_in;
-(id)initWithCharBuffer:(ANTLRCharBuffer*)_buffer;
-(ANTLRDefToken) nextToken;
/*public: */-(void) mIDENTWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mLETTERWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mDIGITWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mASSIGNWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mWSWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mSTRINGWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mPOINTWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mINTWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mPCINTWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mHEXNUMWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mHEXINTWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mHEXDIGITWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mLCLETTERWithCreateToken:(BOOL)_createToken ;
@end
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrLexer___tokenSet_0_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrLexer___tokenSet_0;
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrLexer___tokenSet_1_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrLexer___tokenSet_1;
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrLexer___tokenSet_2_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrLexer___tokenSet_2;
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrLexer___tokenSet_3_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrLexer___tokenSet_3;
#endif /*INC_GSWHTMLAttrLexer_h_*/

View file

@ -1,676 +0,0 @@
/*
* ANTLR-generated file resulting from grammar htmltag.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.7.1; 1996,1997,1998,1999,2000
*/
#include "GSWeb.h"
#include "gsantlr/ANTLRCommon.h"
#include "gsantlr/ANTLRException.h"
#include "GSWHTMLAttrLexer.h"
#include "GSWHTMLAttrTokenTypes.h"
@implementation GSWHTMLAttrLexer
-(id)initWithTextStream:(ANTLRDefTextInputStream)_in
{
//LOGObjectFnStart();
self=[super initWithTextStream:_in];
[self setCaseSensitive:YES];
[self initLiterals];
//LOGObjectFnStop();
return self;
}
-(id)initWithCharBuffer:(ANTLRCharBuffer*)_buffer
{
//LOGObjectFnStart();
self=[super initWithCharBuffer:_buffer];
[self setCaseSensitive:YES];
[self initLiterals];
//LOGObjectFnStop();
return self;
}
-(void)initLiterals
{
//LOGObjectFnStart();
//LOGObjectFnStop();
}
-(BOOL)getCaseSensitiveLiterals
{
return YES;
}
-(ANTLRDefToken) nextToken
{
ANTLRDefToken theRetToken=nil;
BOOL end=NO;
//LOGObjectFnStart();
for (;!end;)
{
ANTLRDefToken theRetToken;
ANTLRTokenType _ttype = ANTLRToken_INVALID_TYPE;
[self resetText];
NS_DURING // for error handling
{
switch ( [self LA:1])
{
case ((unichar)('A')): case ((unichar)('B')): case ((unichar)('C')): case ((unichar)('D')):
case ((unichar)('E')): case ((unichar)('F')): case ((unichar)('G')): case ((unichar)('H')):
case ((unichar)('I')): case ((unichar)('J')): case ((unichar)('K')): case ((unichar)('L')):
case ((unichar)('M')): case ((unichar)('N')): case ((unichar)('O')): case ((unichar)('P')):
case ((unichar)('Q')): case ((unichar)('R')): case ((unichar)('S')): case ((unichar)('T')):
case ((unichar)('U')): case ((unichar)('V')): case ((unichar)('W')): case ((unichar)('X')):
case ((unichar)('Y')): case ((unichar)('Z')): case ((unichar)('_')): case ((unichar)('a')):
case ((unichar)('b')): case ((unichar)('c')): case ((unichar)('d')): case ((unichar)('e')):
case ((unichar)('f')): case ((unichar)('g')): case ((unichar)('h')): case ((unichar)('i')):
case ((unichar)('j')): case ((unichar)('k')): case ((unichar)('l')): case ((unichar)('m')):
case ((unichar)('n')): case ((unichar)('o')): case ((unichar)('p')): case ((unichar)('q')):
case ((unichar)('r')): case ((unichar)('s')): case ((unichar)('t')): case ((unichar)('u')):
case ((unichar)('v')): case ((unichar)('w')): case ((unichar)('x')): case ((unichar)('y')):
case ((unichar)('z')):
{
[self mIDENTWithCreateToken:YES];
theRetToken=_returnToken;
break;
}
case ((unichar)('=')):
{
[self mASSIGNWithCreateToken:YES];
theRetToken=_returnToken;
break;
}
case ((unichar)('\t')): case ((unichar)('\n')): case ((unichar)('\r')): case ((unichar)(' ')):
{
[self mWSWithCreateToken:YES];
theRetToken=_returnToken;
break;
}
case ((unichar)('"')): case ((unichar)('\'')):
{
[self mSTRINGWithCreateToken:YES];
theRetToken=_returnToken;
break;
}
case ((unichar)('.')):
{
[self mPOINTWithCreateToken:YES];
theRetToken=_returnToken;
break;
}
case ((unichar)('#')):
{
[self mHEXNUMWithCreateToken:YES];
theRetToken=_returnToken;
break;
}
default:
if ((([self LA:1] >= ((unichar)('0')) && [self LA:1] <= ((unichar)('9')))) && ([GSWHTMLAttrLexer___tokenSet_0 isMember:[self LA:2]]))
{
[self mPCINTWithCreateToken:YES];
theRetToken=_returnToken;
}
else if ((([self LA:1] >= ((unichar)('0')) && [self LA:1] <= ((unichar)('9')))))
{
[self mINTWithCreateToken:YES];
theRetToken=_returnToken;
}
else
{
if ([self LA:1]!=ANTLR_EOF_CHAR) [ANTLRScannerException raiseWithReason:[NSString stringWithFormat:@"no viable alt for char: %@",[ANTLRCharScanner charName:[self LA:1]]] line:[self line]];
[self setReturnToken:[self makeToken:ANTLRToken_EOF_TYPE]];
}
}
_ttype = [_returnToken tokenType];
_ttype = [self testLiteralsTable:_ttype];
if ( _ttype!=ANTLRToken_SKIP )
{
[_returnToken setTokenType:_ttype];
end=YES;
}
}
NS_HANDLER
{
[self consume];
[self reportErrorWithException:localException];
}
NS_ENDHANDLER;
}
//LOGObjectFnStop();
return _returnToken;
}
-(void) mIDENTWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_IDENT;
int _saveIndex;
//LOGObjectFnStart();
{
switch ( [self LA:1])
{
case ((unichar)('A')): case ((unichar)('B')): case ((unichar)('C')): case ((unichar)('D')):
case ((unichar)('E')): case ((unichar)('F')): case ((unichar)('G')): case ((unichar)('H')):
case ((unichar)('I')): case ((unichar)('J')): case ((unichar)('K')): case ((unichar)('L')):
case ((unichar)('M')): case ((unichar)('N')): case ((unichar)('O')): case ((unichar)('P')):
case ((unichar)('Q')): case ((unichar)('R')): case ((unichar)('S')): case ((unichar)('T')):
case ((unichar)('U')): case ((unichar)('V')): case ((unichar)('W')): case ((unichar)('X')):
case ((unichar)('Y')): case ((unichar)('Z')): case ((unichar)('a')): case ((unichar)('b')):
case ((unichar)('c')): case ((unichar)('d')): case ((unichar)('e')): case ((unichar)('f')):
case ((unichar)('g')): case ((unichar)('h')): case ((unichar)('i')): case ((unichar)('j')):
case ((unichar)('k')): case ((unichar)('l')): case ((unichar)('m')): case ((unichar)('n')):
case ((unichar)('o')): case ((unichar)('p')): case ((unichar)('q')): case ((unichar)('r')):
case ((unichar)('s')): case ((unichar)('t')): case ((unichar)('u')): case ((unichar)('v')):
case ((unichar)('w')): case ((unichar)('x')): case ((unichar)('y')): case ((unichar)('z')):
{
[self mLETTERWithCreateToken:NO];
break;
}
case ((unichar)('_')):
{
[self matchCharacter:'_'];
break;
}
default:
{
[ANTLRScannerException raiseWithReason:[NSString stringWithFormat:@"no viable alt for char: %@",[ANTLRCharScanner charName:[self LA:1]]] line:[self line]];
}
}
}
{
do
{
switch ( [self LA:1])
{
case ((unichar)('A')): case ((unichar)('B')): case ((unichar)('C')): case ((unichar)('D')):
case ((unichar)('E')): case ((unichar)('F')): case ((unichar)('G')): case ((unichar)('H')):
case ((unichar)('I')): case ((unichar)('J')): case ((unichar)('K')): case ((unichar)('L')):
case ((unichar)('M')): case ((unichar)('N')): case ((unichar)('O')): case ((unichar)('P')):
case ((unichar)('Q')): case ((unichar)('R')): case ((unichar)('S')): case ((unichar)('T')):
case ((unichar)('U')): case ((unichar)('V')): case ((unichar)('W')): case ((unichar)('X')):
case ((unichar)('Y')): case ((unichar)('Z')): case ((unichar)('a')): case ((unichar)('b')):
case ((unichar)('c')): case ((unichar)('d')): case ((unichar)('e')): case ((unichar)('f')):
case ((unichar)('g')): case ((unichar)('h')): case ((unichar)('i')): case ((unichar)('j')):
case ((unichar)('k')): case ((unichar)('l')): case ((unichar)('m')): case ((unichar)('n')):
case ((unichar)('o')): case ((unichar)('p')): case ((unichar)('q')): case ((unichar)('r')):
case ((unichar)('s')): case ((unichar)('t')): case ((unichar)('u')): case ((unichar)('v')):
case ((unichar)('w')): case ((unichar)('x')): case ((unichar)('y')): case ((unichar)('z')):
{
[self mLETTERWithCreateToken:NO];
break;
}
case ((unichar)('_')):
{
[self matchCharacter:'_'];
break;
}
case ((unichar)('-')):
{
[self matchCharacter:'-'];
break;
}
case ((unichar)('0')): case ((unichar)('1')): case ((unichar)('2')): case ((unichar)('3')):
case ((unichar)('4')): case ((unichar)('5')): case ((unichar)('6')): case ((unichar)('7')):
case ((unichar)('8')): case ((unichar)('9')):
{
[self mDIGITWithCreateToken:NO];
break;
}
default:
{
goto _loop22;
}
}
} while (YES);
_loop22:;
}
_ttype = [self testLiteralsTable:_ttype];
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mLETTERWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_LETTER;
int _saveIndex;
//LOGObjectFnStart();
switch ( [self LA:1])
{
case ((unichar)('a')): case ((unichar)('b')): case ((unichar)('c')): case ((unichar)('d')):
case ((unichar)('e')): case ((unichar)('f')): case ((unichar)('g')): case ((unichar)('h')):
case ((unichar)('i')): case ((unichar)('j')): case ((unichar)('k')): case ((unichar)('l')):
case ((unichar)('m')): case ((unichar)('n')): case ((unichar)('o')): case ((unichar)('p')):
case ((unichar)('q')): case ((unichar)('r')): case ((unichar)('s')): case ((unichar)('t')):
case ((unichar)('u')): case ((unichar)('v')): case ((unichar)('w')): case ((unichar)('x')):
case ((unichar)('y')): case ((unichar)('z')):
{
[self matchRange:'a' :'z'];
break;
}
case ((unichar)('A')): case ((unichar)('B')): case ((unichar)('C')): case ((unichar)('D')):
case ((unichar)('E')): case ((unichar)('F')): case ((unichar)('G')): case ((unichar)('H')):
case ((unichar)('I')): case ((unichar)('J')): case ((unichar)('K')): case ((unichar)('L')):
case ((unichar)('M')): case ((unichar)('N')): case ((unichar)('O')): case ((unichar)('P')):
case ((unichar)('Q')): case ((unichar)('R')): case ((unichar)('S')): case ((unichar)('T')):
case ((unichar)('U')): case ((unichar)('V')): case ((unichar)('W')): case ((unichar)('X')):
case ((unichar)('Y')): case ((unichar)('Z')):
{
[self matchRange:'A' :'Z'];
break;
}
default:
{
[ANTLRScannerException raiseWithReason:[NSString stringWithFormat:@"no viable alt for char: %@",[ANTLRCharScanner charName:[self LA:1]]] line:[self line]];
}
}
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mDIGITWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_DIGIT;
int _saveIndex;
//LOGObjectFnStart();
[self matchRange:'0' :'9'];
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mASSIGNWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_ASSIGN;
int _saveIndex;
//LOGObjectFnStart();
[self matchCharacter:'='];
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mWSWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_WS;
int _saveIndex;
//LOGObjectFnStart();
{
switch ( [self LA:1])
{
case ((unichar)(' ')):
{
[self matchCharacter:' '];
break;
}
case ((unichar)('\t')):
{
[self matchCharacter:'\t'];
break;
}
case ((unichar)('\n')):
{
[self matchCharacter:'\n'];
break;
}
default:
if (([self LA:1]==((unichar)('\r'))) && ([self LA:2]==((unichar)('\n'))))
{
[self matchString:@"\r\n"];
}
else if (([self LA:1]==((unichar)('\r'))))
{
[self matchCharacter:'\r'];
}
else
{
[ANTLRScannerException raiseWithReason:[NSString stringWithFormat:@"no viable alt for char: %@",[ANTLRCharScanner charName:[self LA:1]]] line:[self line]];
}
}
}
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mSTRINGWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_STRING;
int _saveIndex;
//LOGObjectFnStart();
switch ( [self LA:1])
{
case ((unichar)('"')):
{
[self matchCharacter:'"'];
{
do
{
if (([GSWHTMLAttrLexer___tokenSet_1 isMember:[self LA:1]]))
{
[self matchNotCharacter:'"'];
}
else
{
goto _loop28;
}
} while (YES);
_loop28:;
}
[self matchCharacter:'"'];
break;
}
case ((unichar)('\'')):
{
[self matchCharacter:'\''];
{
do
{
if (([GSWHTMLAttrLexer___tokenSet_2 isMember:[self LA:1]]))
{
[self matchNotCharacter:'\''];
}
else
{
goto _loop30;
}
} while (YES);
_loop30:;
}
[self matchCharacter:'\''];
break;
}
default:
{
[ANTLRScannerException raiseWithReason:[NSString stringWithFormat:@"no viable alt for char: %@",[ANTLRCharScanner charName:[self LA:1]]] line:[self line]];
}
}
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mPOINTWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_POINT;
int _saveIndex;
//LOGObjectFnStart();
[self matchCharacter:'.'];
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mINTWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_INT;
int _saveIndex;
//LOGObjectFnStart();
{
int _cnt34=0;
do
{
if ((([self LA:1] >= ((unichar)('0')) && [self LA:1] <= ((unichar)('9')))))
{
[self mDIGITWithCreateToken:NO];
}
else
{
if ( _cnt34>=1 ) { goto _loop34; } else {[ANTLRScannerException raiseWithReason:[NSString stringWithFormat:@"no viable alt for char: %@",[ANTLRCharScanner charName:[self LA:1]]] line:[self line]];}
}
_cnt34++;
} while (YES);
_loop34:;
}
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mPCINTWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_PCINT;
int _saveIndex;
//LOGObjectFnStart();
{
int _cnt37=0;
do
{
if ((([self LA:1] >= ((unichar)('0')) && [self LA:1] <= ((unichar)('9')))))
{
[self mDIGITWithCreateToken:NO];
}
else
{
if ( _cnt37>=1 ) { goto _loop37; } else {[ANTLRScannerException raiseWithReason:[NSString stringWithFormat:@"no viable alt for char: %@",[ANTLRCharScanner charName:[self LA:1]]] line:[self line]];}
}
_cnt37++;
} while (YES);
_loop37:;
}
[self matchCharacter:'%'];
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mHEXNUMWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_HEXNUM;
int _saveIndex;
//LOGObjectFnStart();
[self matchCharacter:'#'];
[self mHEXINTWithCreateToken:NO];
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mHEXINTWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_HEXINT;
int _saveIndex;
//LOGObjectFnStart();
{
int _cnt41=0;
do
{
if (([GSWHTMLAttrLexer___tokenSet_3 isMember:[self LA:1]]))
{
[self mHEXDIGITWithCreateToken:NO];
}
else
{
if ( _cnt41>=1 ) { goto _loop41; } else {[ANTLRScannerException raiseWithReason:[NSString stringWithFormat:@"no viable alt for char: %@",[ANTLRCharScanner charName:[self LA:1]]] line:[self line]];}
}
_cnt41++;
} while (YES);
_loop41:;
}
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mHEXDIGITWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_HEXDIGIT;
int _saveIndex;
//LOGObjectFnStart();
{
switch ( [self LA:1])
{
case ((unichar)('0')): case ((unichar)('1')): case ((unichar)('2')): case ((unichar)('3')):
case ((unichar)('4')): case ((unichar)('5')): case ((unichar)('6')): case ((unichar)('7')):
case ((unichar)('8')): case ((unichar)('9')):
{
[self matchRange:'0' :'9'];
break;
}
case ((unichar)('A')): case ((unichar)('B')): case ((unichar)('C')): case ((unichar)('D')):
case ((unichar)('E')): case ((unichar)('F')):
{
[self matchRange:'A' :'F'];
break;
}
case ((unichar)('a')): case ((unichar)('b')): case ((unichar)('c')): case ((unichar)('d')):
case ((unichar)('e')): case ((unichar)('f')):
{
[self matchRange:'a' :'f'];
break;
}
default:
{
[ANTLRScannerException raiseWithReason:[NSString stringWithFormat:@"no viable alt for char: %@",[ANTLRCharScanner charName:[self LA:1]]] line:[self line]];
}
}
}
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
-(void) mLCLETTERWithCreateToken:(BOOL)_createToken
{
ANTLRDefToken _token=nil;
int _begin=[text length];
ANTLRTokenType _ttype = GSWHTMLAttrTokenType_LCLETTER;
int _saveIndex;
//LOGObjectFnStart();
[self matchRange:'a' :'z'];
if ( _createToken && _token==0 )
{
_token = [self makeToken:_ttype];
[_token setText:[text substringFromIndex:_begin]];
}
ASSIGN(_returnToken,_token);
//LOGObjectFnStop();
}
CONST unsigned long GSWHTMLAttrLexer___tokenSet_0_data_[] = { 0UL, 67043360UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrLexer___tokenSet_0=nil;
CONST unsigned long GSWHTMLAttrLexer___tokenSet_1_data_[] = { 4294967288UL, 4294967291UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrLexer___tokenSet_1=nil;
CONST unsigned long GSWHTMLAttrLexer___tokenSet_2_data_[] = { 4294967288UL, 4294967167UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrLexer___tokenSet_2=nil;
CONST unsigned long GSWHTMLAttrLexer___tokenSet_3_data_[] = { 0UL, 67043328UL, 126UL, 126UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrLexer___tokenSet_3=nil;
+(void)initialize
{
if (!GSWHTMLAttrLexer___tokenSet_0)
GSWHTMLAttrLexer___tokenSet_0=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrLexer___tokenSet_0_data_ length:20] retain];
if (!GSWHTMLAttrLexer___tokenSet_1)
GSWHTMLAttrLexer___tokenSet_1=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrLexer___tokenSet_1_data_ length:32] retain];
if (!GSWHTMLAttrLexer___tokenSet_2)
GSWHTMLAttrLexer___tokenSet_2=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrLexer___tokenSet_2_data_ length:32] retain];
if (!GSWHTMLAttrLexer___tokenSet_3)
GSWHTMLAttrLexer___tokenSet_3=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrLexer___tokenSet_3_data_ length:20] retain];
}
+(void)dealloc
{
DESTROY(GSWHTMLAttrLexer___tokenSet_0);
DESTROY(GSWHTMLAttrLexer___tokenSet_1);
DESTROY(GSWHTMLAttrLexer___tokenSet_2);
DESTROY(GSWHTMLAttrLexer___tokenSet_3);
[[self superclass] dealloc];
}
@end

View file

@ -1,60 +0,0 @@
#ifndef INC_GSWHTMLAttrParser_h_
#define INC_GSWHTMLAttrParser_h_
/*
* ANTLR-generated file resulting from grammar htmltag.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.7.1; 1996,1997,1998,1999,2000
*/
#include "GSWeb.h"
#include "gsantlr/ANTLRCommon.h"
#include "gsantlr/ANTLRTokenizer.h"
#include "gsantlr/ANTLRTokenBuffer.h"
#include "gsantlr/ANTLRLLkParser.h"
@class ANTLRBitSet;
@interface GSWHTMLAttrParser : ANTLRLLkParser
{
NSString* tagName;
NSMutableDictionary* attributes;
NSString* currentAttrName; //no retain
id currentValue; //no retain
NSMutableArray* errors;
NSMutableArray* warnings;
};
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer maxK:(int)_k;
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer;
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer maxK:(int)_k;
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer;
/*public: */-(void) tag;
/*public: */-(void) attr;
/*public: */-(void) mvalue;
@end;
GSWEB_EXPORT CONST NSString* GSWHTMLAttrParser___tokenNames[];
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrParser___tokenSet_0_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrParser___tokenSet_0;
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrParser___tokenSet_1_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrParser___tokenSet_1;
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrParser___tokenSet_2_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrParser___tokenSet_2;
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrParser___tokenSet_3_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrParser___tokenSet_3;
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrParser___tokenSet_4_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrParser___tokenSet_4;
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrParser___tokenSet_5_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrParser___tokenSet_5;
GSWEB_EXPORT CONST unsigned long GSWHTMLAttrParser___tokenSet_6_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLAttrParser___tokenSet_6;
#endif /*INC_GSWHTMLAttrParser_h_*/

View file

@ -1,446 +0,0 @@
/*
* ANTLR-generated file resulting from grammar htmltag.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.7.1; 1996,1997,1998,1999,2000
*/
#include "GSWeb.h"
#include "gsantlr/ANTLRCommon.h"
#include "GSWHTMLAttrParser.h"
#include "GSWHTMLAttrTokenTypes.h"
#include "gsantlr/ANTLRNoViableAltException.h"
#include "gsantlr/ANTLRBitSet.h"
#include "gsantlr/ANTLRAST.h"
#include "gsantlr/ANTLRASTPair.h"
@implementation GSWHTMLAttrParser
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer maxK:(int)_k
{
//LOGObjectFnStart();
self=[super initWithTokenBuffer:_buffer maxK:_k];
[self setTokenNames:GSWHTMLAttrParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer
{
//LOGObjectFnStart();
self=[super initWithTokenBuffer:_buffer maxK:5];
[self setTokenNames:GSWHTMLAttrParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer maxK:(int)_k
{
//LOGObjectFnStart();
self=[super initWithTokenizer:_lexer maxK:_k];
[self setTokenNames:GSWHTMLAttrParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer
{
//LOGObjectFnStart();
self=[self initWithTokenizer:_lexer maxK:5];
[self setTokenNames:GSWHTMLAttrParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(void) tag
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST tag_AST = ANTLRnullAST;
ANTLRDefToken tagNameLocal = nil;
ANTLRDefAST tagNameLocal_AST = ANTLRnullAST;
DESTROY(attributes);
DESTROY(tagName);
DESTROY(errors);
DESTROY(warnings);
attributes=[NSMutableDictionary new];
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
tagNameLocal = [self LT:1];
{
tagNameLocal_AST = [astFactory create:tagNameLocal];
[astFactory addASTChild:tagNameLocal_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_IDENT];
NSDebugMLLog(@"template",@"tagNameLocal:%@",[tagNameLocal_AST text]); ASSIGN(tagName,[tagNameLocal_AST text]); NSDebugMLLog(@"template",@"Found tagName=[%@]",tagName);
{
if (([self LA:1]==ANTLRToken_EOF_TYPE||[self LA:1]==GSWHTMLAttrTokenType_IDENT||[self LA:1]==GSWHTMLAttrTokenType_WS) && ([GSWHTMLAttrParser___tokenSet_0 isMember:[self LA:2]]))
{
{
do
{
if (([self LA:1]==GSWHTMLAttrTokenType_IDENT||[self LA:1]==GSWHTMLAttrTokenType_WS))
{
{
do
{
if (([self LA:1]==GSWHTMLAttrTokenType_WS))
{
{
ANTLRDefAST tmp1_AST = ANTLRnullAST;
tmp1_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp1_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_WS];
}
else
{
goto _loop5;
}
} while (YES);
_loop5:;
}
{
[self attr];
[astFactory addASTChild:returnAST in:currentAST];
}
}
else
{
goto _loop7;
}
} while (YES);
_loop7:;
}
}
else if (([self LA:1]==ANTLRToken_EOF_TYPE) && ([self LA:2]==ANTLRToken_EOF_TYPE))
{
}
else
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
tag_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWHTMLAttrParser___tokenSet_1];
}
NS_ENDHANDLER;
ASSIGN(returnAST,tag_AST);
//LOGObjectFnStop();
}
-(void) attr
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST attr_AST = ANTLRnullAST;
ANTLRDefToken attrName = nil;
ANTLRDefAST attrName_AST = ANTLRnullAST;
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
attrName = [self LT:1];
{
attrName_AST = [astFactory create:attrName];
[astFactory addASTChild:attrName_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_IDENT];
DESTROY(currentValue); currentAttrName=[[attrName text]lowercaseString];
NSDebugMLLog(@"template",@"Found currentAttrName=[%@]",currentAttrName);
{
if (([GSWHTMLAttrParser___tokenSet_0 isMember:[self LA:1]]) && ([GSWHTMLAttrParser___tokenSet_2 isMember:[self LA:2]]))
{
{
do
{
if (([self LA:1]==GSWHTMLAttrTokenType_WS) && ([GSWHTMLAttrParser___tokenSet_0 isMember:[self LA:2]]))
{
{
ANTLRDefAST tmp2_AST = ANTLRnullAST;
tmp2_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp2_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_WS];
}
else
{
goto _loop11;
}
} while (YES);
_loop11:;
}
}
else if (([GSWHTMLAttrParser___tokenSet_0 isMember:[self LA:1]]) && ([GSWHTMLAttrParser___tokenSet_2 isMember:[self LA:2]]))
{
}
else
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
{
switch ( [self LA:1])
{
case GSWHTMLAttrTokenType_ASSIGN:
{
{
ANTLRDefAST tmp3_AST = ANTLRnullAST;
tmp3_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp3_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_ASSIGN];
{
if (([GSWHTMLAttrParser___tokenSet_3 isMember:[self LA:1]]) && ([GSWHTMLAttrParser___tokenSet_4 isMember:[self LA:2]]))
{
{
do
{
if (([self LA:1]==GSWHTMLAttrTokenType_WS))
{
{
ANTLRDefAST tmp4_AST = ANTLRnullAST;
tmp4_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp4_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_WS];
}
else
{
goto _loop15;
}
} while (YES);
_loop15:;
}
}
else if (([GSWHTMLAttrParser___tokenSet_5 isMember:[self LA:1]]) && ([self LA:2]==ANTLRToken_EOF_TYPE||[self LA:2]==GSWHTMLAttrTokenType_IDENT||[self LA:2]==GSWHTMLAttrTokenType_WS))
{
}
else
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
{
[self mvalue];
[astFactory addASTChild:returnAST in:currentAST];
}
break;
}
case ANTLRToken_EOF_TYPE:
case GSWHTMLAttrTokenType_IDENT:
case GSWHTMLAttrTokenType_WS:
{
break;
}
default:
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
}
NSDebugMLLog(@"template",@"Add currentValue=[%@]",currentValue); [attributes setObject:currentValue forKey:currentAttrName];
attr_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWHTMLAttrParser___tokenSet_6];
}
NS_ENDHANDLER;
ASSIGN(returnAST,attr_AST);
//LOGObjectFnStop();
}
-(void) mvalue
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST mvalue_AST = ANTLRnullAST;
ANTLRDefToken intValue = nil;
ANTLRDefAST intValue_AST = ANTLRnullAST;
ANTLRDefToken stringValue = nil;
ANTLRDefAST stringValue_AST = ANTLRnullAST;
ANTLRDefToken hexNumValue = nil;
ANTLRDefAST hexNumValue_AST = ANTLRnullAST;
ANTLRDefToken pcValue = nil;
ANTLRDefAST pcValue_AST = ANTLRnullAST;
ANTLRDefToken identValue = nil;
ANTLRDefAST identValue_AST = ANTLRnullAST;
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
{
switch ( [self LA:1])
{
case GSWHTMLAttrTokenType_INT:
{
intValue = [self LT:1];
{
intValue_AST = [astFactory create:intValue];
[astFactory addASTChild:intValue_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_INT];
ASSIGN(currentValue,[NSNumber valueFromString:[intValue text]]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue);
break;
}
case GSWHTMLAttrTokenType_STRING:
{
stringValue = [self LT:1];
{
stringValue_AST = [astFactory create:stringValue];
[astFactory addASTChild:stringValue_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_STRING];
ASSIGN(currentValue,[stringValue text]);
if ([currentValue isQuotedWith:@"\""])
{
ASSIGN(currentValue,[currentValue stringWithoutQuote:@"\""]);
};
NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue);
break;
}
case GSWHTMLAttrTokenType_HEXNUM:
{
hexNumValue = [self LT:1];
{
hexNumValue_AST = [astFactory create:hexNumValue];
[astFactory addASTChild:hexNumValue_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_HEXNUM];
ASSIGN(currentValue,[NSNumber valueFromString:[hexNumValue text]]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue);
break;
}
case GSWHTMLAttrTokenType_INTPC:
{
pcValue = [self LT:1];
{
pcValue_AST = [astFactory create:pcValue];
[astFactory addASTChild:pcValue_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_INTPC];
ASSIGN(currentValue,[pcValue text]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue);
break;
}
case GSWHTMLAttrTokenType_IDENT:
{
identValue = [self LT:1];
{
identValue_AST = [astFactory create:identValue];
[astFactory addASTChild:identValue_AST in:currentAST];
}
[self matchTokenType:GSWHTMLAttrTokenType_IDENT];
ASSIGN(currentValue,[identValue text]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue);
break;
}
default:
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
}
mvalue_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWHTMLAttrParser___tokenSet_6];
}
NS_ENDHANDLER;
ASSIGN(returnAST,mvalue_AST);
//LOGObjectFnStop();
}
static CONST NSString* GSWHTMLAttrParser___tokenNames[] = {
@"<0>",
@"EOF",
@"<2>",
@"NULL_TREE_LOOKAHEAD",
@"IDENT",
@"WS",
@"ASSIGN",
@"INT",
@"STRING",
@"HEXNUM",
@"INTPC",
@"POINT",
@"PCINT",
@"HEXINT",
@"DIGIT",
@"HEXDIGIT",
@"LCLETTER",
@"LETTER",
0
};
CONST unsigned long GSWHTMLAttrParser___tokenSet_0_data_[] = { 114UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrParser___tokenSet_0=nil;
CONST unsigned long GSWHTMLAttrParser___tokenSet_1_data_[] = { 2UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrParser___tokenSet_1=nil;
CONST unsigned long GSWHTMLAttrParser___tokenSet_2_data_[] = { 2034UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrParser___tokenSet_2=nil;
CONST unsigned long GSWHTMLAttrParser___tokenSet_3_data_[] = { 1968UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrParser___tokenSet_3=nil;
CONST unsigned long GSWHTMLAttrParser___tokenSet_4_data_[] = { 1970UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrParser___tokenSet_4=nil;
CONST unsigned long GSWHTMLAttrParser___tokenSet_5_data_[] = { 1936UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrParser___tokenSet_5=nil;
CONST unsigned long GSWHTMLAttrParser___tokenSet_6_data_[] = { 50UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLAttrParser___tokenSet_6=nil;
+(void)initialize
{
if (!GSWHTMLAttrParser___tokenSet_0)
GSWHTMLAttrParser___tokenSet_0=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrParser___tokenSet_0_data_ length:8] retain];
if (!GSWHTMLAttrParser___tokenSet_1)
GSWHTMLAttrParser___tokenSet_1=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrParser___tokenSet_1_data_ length:8] retain];
if (!GSWHTMLAttrParser___tokenSet_2)
GSWHTMLAttrParser___tokenSet_2=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrParser___tokenSet_2_data_ length:8] retain];
if (!GSWHTMLAttrParser___tokenSet_3)
GSWHTMLAttrParser___tokenSet_3=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrParser___tokenSet_3_data_ length:8] retain];
if (!GSWHTMLAttrParser___tokenSet_4)
GSWHTMLAttrParser___tokenSet_4=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrParser___tokenSet_4_data_ length:8] retain];
if (!GSWHTMLAttrParser___tokenSet_5)
GSWHTMLAttrParser___tokenSet_5=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrParser___tokenSet_5_data_ length:8] retain];
if (!GSWHTMLAttrParser___tokenSet_6)
GSWHTMLAttrParser___tokenSet_6=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLAttrParser___tokenSet_6_data_ length:8] retain];
}
+(void)dealloc
{
DESTROY(GSWHTMLAttrParser___tokenSet_0);
DESTROY(GSWHTMLAttrParser___tokenSet_1);
DESTROY(GSWHTMLAttrParser___tokenSet_2);
DESTROY(GSWHTMLAttrParser___tokenSet_3);
DESTROY(GSWHTMLAttrParser___tokenSet_4);
DESTROY(GSWHTMLAttrParser___tokenSet_5);
DESTROY(GSWHTMLAttrParser___tokenSet_6);
[[self superclass] dealloc];
}
@end

View file

@ -1,34 +0,0 @@
#ifndef INC_GSWHTMLAttrTokenTypes_h_
#define INC_GSWHTMLAttrTokenTypes_h_
/*
* ANTLR-generated file resulting from grammar htmltag.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.7.1; 1996,1997,1998,1999,2000
*/
#include "GSWeb.h"
enum GSWHTMLAttrTokenTypes {
GSWHTMLAttrTokenType_EOF_ = 1,
GSWHTMLAttrTokenType_NULL_TREE_LOOKAHEAD = 3,
GSWHTMLAttrTokenType_IDENT = 4,
GSWHTMLAttrTokenType_WS = 5,
GSWHTMLAttrTokenType_ASSIGN = 6,
GSWHTMLAttrTokenType_INT = 7,
GSWHTMLAttrTokenType_STRING = 8,
GSWHTMLAttrTokenType_HEXNUM = 9,
GSWHTMLAttrTokenType_INTPC = 10,
GSWHTMLAttrTokenType_POINT = 11,
GSWHTMLAttrTokenType_PCINT = 12,
GSWHTMLAttrTokenType_HEXINT = 13,
GSWHTMLAttrTokenType_DIGIT = 14,
GSWHTMLAttrTokenType_HEXDIGIT = 15,
GSWHTMLAttrTokenType_LCLETTER = 16,
GSWHTMLAttrTokenType_LETTER = 17,
};
#endif /*INC_GSWHTMLAttrTokenTypes_h_*/

View file

@ -1,16 +0,0 @@
// $ANTLR 2.7.1: htmltag.g -> GSWHTMLAttrTokenTypes.txt$
GSWHTMLAttr // output token vocab name
IDENT=4
WS=5
ASSIGN=6
INT=7
STRING=8
HEXNUM=9
INTPC=10
POINT=11
PCINT=12
HEXINT=13
DIGIT=14
HEXDIGIT=15
LCLETTER=16
LETTER=17

View file

@ -1,90 +0,0 @@
#ifndef INC_GSWHTMLLexer_h_
#define INC_GSWHTMLLexer_h_
/*
* ANTLR-generated file resulting from grammar html.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.7.1; 1996,1997,1998,1999,2000
*/
#include "GSWeb.h"
#include "gsantlr/ANTLRCommon.h"
#include "gsantlr/ANTLRCommonToken.h"
#include "gsantlr/ANTLRCharBuffer.h"
#include "gsantlr/ANTLRBitSet.h"
#include "gsantlr/ANTLRCharScanner.h"
@interface GSWHTMLLexer : ANTLRCharScanner
{
};
-(void) initLiterals;
-(BOOL)getCaseSensitiveLiterals;
-(id)initWithTextStream:(ANTLRDefTextInputStream)_in;
-(id)initWithCharBuffer:(ANTLRCharBuffer*)_buffer;
-(ANTLRDefToken) nextToken;
/*public: */-(void) mOPENTAGWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mWORDWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mLETTERWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mWSWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mATTRWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mCLOSETAGWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mINTWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mSTRINGWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mHEXNUMWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mTEXTWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mCOMMENTWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mCOMMENT_DATAWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mDIGITWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mWSCHARSWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mSPECIALWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mHEXINTWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mHEXDIGITWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mLCLETTERWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mUPLETTERWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mUNDEFINED_TOKENWithCreateToken:(BOOL)_createToken ;
@end
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_0_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_0;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_1_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_1;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_2_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_2;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_3_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_3;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_4_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_4;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_5_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_5;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_6_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_6;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_7_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_7;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_8_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_8;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_9_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_9;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_10_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_10;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_11_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_11;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_12_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_12;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_13_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_13;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_14_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_14;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_15_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_15;
GSWEB_EXPORT CONST unsigned long GSWHTMLLexer___tokenSet_16_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLLexer___tokenSet_16;
#endif /*INC_GSWHTMLLexer_h_*/

File diff suppressed because it is too large Load diff

View file

@ -1,42 +0,0 @@
#ifndef INC_GSWHTMLParser_h_
#define INC_GSWHTMLParser_h_
/*
* ANTLR-generated file resulting from grammar html.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.7.1; 1996,1997,1998,1999,2000
*/
#include "GSWeb.h"
#include "gsantlr/ANTLRCommon.h"
#include "gsantlr/ANTLRTokenizer.h"
#include "gsantlr/ANTLRTokenBuffer.h"
#include "gsantlr/ANTLRLLkParser.h"
@class ANTLRBitSet;
@interface GSWHTMLParser : ANTLRLLkParser
{
NSMutableArray* errors;
NSMutableArray* warnings;
};
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer maxK:(int)_k;
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer;
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer maxK:(int)_k;
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer;
/*public: */-(void) document;
@end;
GSWEB_EXPORT CONST NSString* GSWHTMLParser___tokenNames[];
GSWEB_EXPORT CONST unsigned long GSWHTMLParser___tokenSet_0_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWHTMLParser___tokenSet_0;
#endif /*INC_GSWHTMLParser_h_*/

View file

@ -1,200 +0,0 @@
/*
* ANTLR-generated file resulting from grammar html.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.7.1; 1996,1997,1998,1999,2000
*/
#include "GSWeb.h"
#include "gsantlr/ANTLRCommon.h"
#include "GSWHTMLParser.h"
#include "GSWHTMLTokenTypes.h"
#include "gsantlr/ANTLRNoViableAltException.h"
#include "gsantlr/ANTLRBitSet.h"
#include "gsantlr/ANTLRAST.h"
#include "gsantlr/ANTLRASTPair.h"
@implementation GSWHTMLParser
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer maxK:(int)_k
{
//LOGObjectFnStart();
self=[super initWithTokenBuffer:_buffer maxK:_k];
[self setTokenNames:GSWHTMLParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer
{
//LOGObjectFnStart();
self=[super initWithTokenBuffer:_buffer maxK:5];
[self setTokenNames:GSWHTMLParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer maxK:(int)_k
{
//LOGObjectFnStart();
self=[super initWithTokenizer:_lexer maxK:_k];
[self setTokenNames:GSWHTMLParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer
{
//LOGObjectFnStart();
self=[self initWithTokenizer:_lexer maxK:5];
[self setTokenNames:GSWHTMLParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(void) document
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST document_AST = ANTLRnullAST;
ANTLRDefToken ot = nil;
ANTLRDefAST ot_AST = ANTLRnullAST;
ANTLRDefToken ct = nil;
ANTLRDefAST ct_AST = ANTLRnullAST;
ANTLRDefToken com = nil;
ANTLRDefAST com_AST = ANTLRnullAST;
DESTROY(errors);
DESTROY(warnings);
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
{
int _cnt3=0;
do
{
switch ( [self LA:1])
{
case GSWHTMLTokenType_WS:
{
{
ANTLRDefAST tmp1_AST = ANTLRnullAST;
tmp1_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp1_AST in:currentAST];
}
[self matchTokenType:GSWHTMLTokenType_WS];
break;
}
case GSWHTMLTokenType_TEXT:
{
{
ANTLRDefAST tmp2_AST = ANTLRnullAST;
tmp2_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp2_AST in:currentAST];
}
[self matchTokenType:GSWHTMLTokenType_TEXT];
break;
}
case GSWHTMLTokenType_OPENTAG:
{
ot = [self LT:1];
{
ot_AST = [astFactory create:ot];
[astFactory addASTChild:ot_AST in:currentAST];
}
[self matchTokenType:GSWHTMLTokenType_OPENTAG];
[ot_AST setText:[[[ot_AST text] stringByDeletingPrefix:@"<"] stringByDeletingSuffix:@">"]];
break;
}
case GSWHTMLTokenType_CLOSETAG:
{
ct = [self LT:1];
{
ct_AST = [astFactory create:ct];
[astFactory addASTChild:ct_AST in:currentAST];
}
[self matchTokenType:GSWHTMLTokenType_CLOSETAG];
[ct_AST setText:[[[ct_AST text] stringByDeletingPrefix:@"</"] stringByDeletingSuffix:@">"]];
break;
}
case GSWHTMLTokenType_COMMENT:
{
com = [self LT:1];
{
com_AST = [astFactory create:com];
[astFactory addASTChild:com_AST in:currentAST];
}
[self matchTokenType:GSWHTMLTokenType_COMMENT];
[com_AST setText:[[[com_AST text] stringByDeletingPrefix:@"<!--"] stringByDeletingSuffix:@"-->"]];
break;
}
default:
{
if ( _cnt3>=1 ) { goto _loop3; } else {[ANTLRNoViableAltException raiseWithToken:[self LT:1]];}
}
}
_cnt3++;
} while (YES);
_loop3:;
}
document_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWHTMLParser___tokenSet_0];
}
NS_ENDHANDLER;
ASSIGN(returnAST,document_AST);
//LOGObjectFnStop();
}
static CONST NSString* GSWHTMLParser___tokenNames[] = {
@"<0>",
@"EOF",
@"<2>",
@"NULL_TREE_LOOKAHEAD",
@"WS",
@"TEXT",
@"OPENTAG",
@"CLOSETAG",
@"COMMENT",
@"ATTR",
@"COMMENT_DATA",
@"WORD",
@"STRING",
@"WSCHARS",
@"SPECIAL",
@"HEXNUM",
@"INT",
@"HEXINT",
@"DIGIT",
@"HEXDIGIT",
@"LCLETTER",
@"UPLETTER",
@"LETTER",
@"UNDEFINED_TOKEN",
0
};
CONST unsigned long GSWHTMLParser___tokenSet_0_data_[] = { 2UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWHTMLParser___tokenSet_0=nil;
+(void)initialize
{
if (!GSWHTMLParser___tokenSet_0)
GSWHTMLParser___tokenSet_0=[[ANTLRBitSet bitSetWithULongBits:GSWHTMLParser___tokenSet_0_data_ length:8] retain];
}
+(void)dealloc
{
DESTROY(GSWHTMLParser___tokenSet_0);
[[self superclass] dealloc];
}
@end

View file

@ -1,40 +0,0 @@
#ifndef INC_GSWHTMLTokenTypes_h_
#define INC_GSWHTMLTokenTypes_h_
/*
* ANTLR-generated file resulting from grammar html.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.7.1; 1996,1997,1998,1999,2000
*/
#include "GSWeb.h"
enum GSWHTMLTokenTypes {
GSWHTMLTokenType_EOF_ = 1,
GSWHTMLTokenType_NULL_TREE_LOOKAHEAD = 3,
GSWHTMLTokenType_WS = 4,
GSWHTMLTokenType_TEXT = 5,
GSWHTMLTokenType_OPENTAG = 6,
GSWHTMLTokenType_CLOSETAG = 7,
GSWHTMLTokenType_COMMENT = 8,
GSWHTMLTokenType_ATTR = 9,
GSWHTMLTokenType_COMMENT_DATA = 10,
GSWHTMLTokenType_WORD = 11,
GSWHTMLTokenType_STRING = 12,
GSWHTMLTokenType_WSCHARS = 13,
GSWHTMLTokenType_SPECIAL = 14,
GSWHTMLTokenType_HEXNUM = 15,
GSWHTMLTokenType_INT = 16,
GSWHTMLTokenType_HEXINT = 17,
GSWHTMLTokenType_DIGIT = 18,
GSWHTMLTokenType_HEXDIGIT = 19,
GSWHTMLTokenType_LCLETTER = 20,
GSWHTMLTokenType_UPLETTER = 21,
GSWHTMLTokenType_LETTER = 22,
GSWHTMLTokenType_UNDEFINED_TOKEN = 23,
};
#endif /*INC_GSWHTMLTokenTypes_h_*/

View file

@ -1,22 +0,0 @@
// $ANTLR 2.7.1: html.g -> GSWHTMLTokenTypes.txt$
GSWHTML // output token vocab name
WS=4
TEXT=5
OPENTAG=6
CLOSETAG=7
COMMENT=8
ATTR=9
COMMENT_DATA=10
WORD=11
STRING=12
WSCHARS=13
SPECIAL=14
HEXNUM=15
INT=16
HEXINT=17
DIGIT=18
HEXDIGIT=19
LCLETTER=20
UPLETTER=21
LETTER=22
UNDEFINED_TOKEN=23

View file

@ -1,82 +0,0 @@
#ifndef INC_GSWPageDefLexer_h_
#define INC_GSWPageDefLexer_h_
/*
* ANTLR-generated file resulting from grammar /tmp/PageDef.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.5.0; 1996,1997,1998,1999
*/
#include "GSWeb.h"
#include "gsantlr/ANTLRCommon.h"
#include "gsantlr/ANTLRCommonToken.h"
#include "gsantlr/ANTLRCharBuffer.h"
#include "gsantlr/ANTLRBitSet.h"
#include "gsantlr/ANTLRCharScanner.h"
@interface GSWPageDefLexer : ANTLRCharScanner
{
};
-(void) initLiterals;
-(BOOL)getCaseSensitiveLiterals;
-(id)initWithTextStream:(ANTLRDefTextInputStream)_in;
-(id)initWithCharBuffer:(ANTLRCharBuffer*)_buffer;
-(ANTLRDefToken) nextToken;
/*public: */-(void) mSL_COMMENTWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mML_COMMENTWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mINCLUDEWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mIDENTWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mLETTERWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mDIGITWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mPIDENTWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mPOINTWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mSTRINGWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mIDENTREFWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mPIDENTREFWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mINTWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mYESWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mNOWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mLCURLYWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mRCURLYWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mSEMIWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mCIRCWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mTILDEWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mCOLUMNWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mASSIGNWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mQUESTIONMARKWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mEXCLAMATIONMARKWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mWSWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mESCWithCreateToken:(BOOL)_createToken ;
/*public: */-(void) mHEXNUMWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mHEXINTWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mHEXDIGITWithCreateToken:(BOOL)_createToken ;
/*protected: */-(void) mLCLETTERWithCreateToken:(BOOL)_createToken ;
@end
GSWEB_EXPORT CONST unsigned long GSWPageDefLexer___tokenSet_0_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefLexer___tokenSet_0;
GSWEB_EXPORT CONST unsigned long GSWPageDefLexer___tokenSet_1_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefLexer___tokenSet_1;
GSWEB_EXPORT CONST unsigned long GSWPageDefLexer___tokenSet_2_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefLexer___tokenSet_2;
GSWEB_EXPORT CONST unsigned long GSWPageDefLexer___tokenSet_3_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefLexer___tokenSet_3;
GSWEB_EXPORT CONST unsigned long GSWPageDefLexer___tokenSet_4_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefLexer___tokenSet_4;
GSWEB_EXPORT CONST unsigned long GSWPageDefLexer___tokenSet_5_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefLexer___tokenSet_5;
GSWEB_EXPORT CONST unsigned long GSWPageDefLexer___tokenSet_6_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefLexer___tokenSet_6;
GSWEB_EXPORT CONST unsigned long GSWPageDefLexer___tokenSet_7_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefLexer___tokenSet_7;
GSWEB_EXPORT CONST unsigned long GSWPageDefLexer___tokenSet_8_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefLexer___tokenSet_8;
#endif /*INC_GSWPageDefLexer_h_*/

File diff suppressed because it is too large Load diff

View file

@ -1,67 +0,0 @@
#ifndef INC_GSWPageDefParser_h_
#define INC_GSWPageDefParser_h_
/*
* ANTLR-generated file resulting from grammar /tmp/PageDef.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.5.0; 1996,1997,1998,1999
*/
#include "GSWeb.h"
#include "gsantlr/ANTLRCommon.h"
#include "gsantlr/ANTLRTokenizer.h"
#include "gsantlr/ANTLRTokenBuffer.h"
#include "gsantlr/ANTLRLLkParser.h"
@class ANTLRBitSet;
@interface GSWPageDefParser : ANTLRLLkParser
{
NSMutableDictionary* elements;
GSWPageDefElement* currentElement;
NSString* currentMemberName;
GSWAssociation* currentAssociation;
NSMutableArray* includes;
NSMutableArray* errors;
NSMutableArray* warnings;
};
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer maxK:(int)_k;
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer;
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer maxK:(int)_k;
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer;
/*public: */-(void) document;
/*public: */-(void) object;
/*public: */-(void) include;
/*public: */-(void) definition;
/*public: */-(void) classname;
/*public: */-(void) member;
/*public: */-(void) mname;
/*public: */-(void) mvalue;
/*public: */-(void) idref;
@end;
GSWEB_EXPORT CONST NSString* GSWPageDefParser___tokenNames[];
GSWEB_EXPORT CONST unsigned long GSWPageDefParser___tokenSet_0_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefParser___tokenSet_0;
GSWEB_EXPORT CONST unsigned long GSWPageDefParser___tokenSet_1_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefParser___tokenSet_1;
GSWEB_EXPORT CONST unsigned long GSWPageDefParser___tokenSet_2_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefParser___tokenSet_2;
GSWEB_EXPORT CONST unsigned long GSWPageDefParser___tokenSet_3_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefParser___tokenSet_3;
GSWEB_EXPORT CONST unsigned long GSWPageDefParser___tokenSet_4_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefParser___tokenSet_4;
GSWEB_EXPORT CONST unsigned long GSWPageDefParser___tokenSet_5_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefParser___tokenSet_5;
GSWEB_EXPORT CONST unsigned long GSWPageDefParser___tokenSet_6_data_[];
GSWEB_EXPORT ANTLRBitSet* GSWPageDefParser___tokenSet_6;
#endif /*INC_GSWPageDefParser_h_*/

View file

@ -1,788 +0,0 @@
/*
* ANTLR-generated file resulting from grammar /tmp/PageDef.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.5.0; 1996,1997,1998,1999
*/
#include "GSWeb.h"
#include "gsantlr/ANTLRCommon.h"
#include "GSWPageDefParser.h"
#include "GSWPageDefParserTokenTypes.h"
#include "gsantlr/ANTLRNoViableAltException.h"
#include "gsantlr/ANTLRBitSet.h"
#include "gsantlr/ANTLRAST.h"
#include "gsantlr/ANTLRASTPair.h"
@implementation GSWPageDefParser
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer maxK:(int)_k
{
//LOGObjectFnStart();
self=[super initWithTokenBuffer:_buffer maxK:_k];
[self setTokenNames:GSWPageDefParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(id)initWithTokenBuffer:(ANTLRTokenBuffer *)_buffer
{
//LOGObjectFnStart();
self=[super initWithTokenBuffer:_buffer maxK:5];
[self setTokenNames:GSWPageDefParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer maxK:(int)_k
{
//LOGObjectFnStart();
self=[super initWithTokenizer:_lexer maxK:_k];
[self setTokenNames:GSWPageDefParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(id)initWithTokenizer:(ANTLRDefTokenizer)_lexer
{
//LOGObjectFnStart();
self=[self initWithTokenizer:_lexer maxK:5];
[self setTokenNames:GSWPageDefParser___tokenNames];
//LOGObjectFnStop();
return self;
}
-(void) document
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST document_AST = ANTLRnullAST;
DESTROY(elements);
elements=[NSMutableDictionary new];
DESTROY(includes);
includes=[NSMutableArray new];
DESTROY(errors);
DESTROY(warnings);
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
{
int _cnt5=0;
do
{
switch ( [self LA:1])
{
case GSWPageDefParserTokenType_IDENT:
{
{
[self object];
[astFactory addASTChild:returnAST in:currentAST];
[elements setObject:currentElement forKey:[currentElement elementName]];
}
break;
}
case GSWPageDefParserTokenType_INCLUDE:
{
{
[self include];
[astFactory addASTChild:returnAST in:currentAST];
}
break;
}
default:
{
if ( _cnt5>=1 ) { goto _loop5; } else {[ANTLRNoViableAltException raiseWithToken:[self LT:1]];}
}
}
_cnt5++;
} while (YES);
_loop5:;
}
document_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWPageDefParser___tokenSet_0];
}
NS_ENDHANDLER;
ASSIGN(returnAST,document_AST);
//LOGObjectFnStop();
}
-(void) object
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST object_AST = ANTLRnullAST;
ANTLRDefToken objectId = nil;
ANTLRDefAST objectId_AST = ANTLRnullAST;
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
objectId = [self LT:1];
{
objectId_AST = [astFactory create:objectId];
[astFactory makeASTRoot:objectId_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_IDENT];
currentElement=[[GSWPageDefElement new] autorelease]; [currentElement setElementName:[objectId_AST text]];
{
ANTLRDefAST tmp1_AST = ANTLRnullAST;
tmp1_AST = [astFactory create:[self LT:1]];
[astFactory makeASTRoot:tmp1_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_COLUMN];
{
[self definition];
[astFactory addASTChild:returnAST in:currentAST];
}
object_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWPageDefParser___tokenSet_1];
}
NS_ENDHANDLER;
ASSIGN(returnAST,object_AST);
//LOGObjectFnStop();
}
-(void) include
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST include_AST = ANTLRnullAST;
ANTLRDefToken includeObj = nil;
ANTLRDefAST includeObj_AST = ANTLRnullAST;
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
{
{
ANTLRDefAST tmp2_AST = ANTLRnullAST;
tmp2_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp2_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_INCLUDE];
{
do
{
if (([self LA:1]==GSWPageDefParserTokenType_WS))
{
{
ANTLRDefAST tmp3_AST = ANTLRnullAST;
tmp3_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp3_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_WS];
}
else
{
goto _loop9;
}
} while (YES);
_loop9:;
}
}
includeObj = [self LT:1];
{
includeObj_AST = [astFactory create:includeObj];
[astFactory addASTChild:includeObj_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_STRING];
[includes addObject:[self unescapedString:[[[includeObj text] stringByDeletingPrefix:@"\""] stringByDeletingSuffix:@"\""]]];
include_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWPageDefParser___tokenSet_1];
}
NS_ENDHANDLER;
ASSIGN(returnAST,include_AST);
//LOGObjectFnStop();
}
-(void) definition
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST definition_AST = ANTLRnullAST;
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
{
[self classname];
[astFactory addASTChild:returnAST in:currentAST];
}
{
ANTLRDefAST tmp4_AST = ANTLRnullAST;
tmp4_AST = [astFactory create:[self LT:1]];
[astFactory makeASTRoot:tmp4_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_LCURLY];
{
do
{
if (([GSWPageDefParser___tokenSet_2 isMember:[self LA:1]]))
{
[self member];
[astFactory addASTChild:returnAST in:currentAST];
[currentElement setAssociation:currentAssociation forKey:currentMemberName]; DESTROY(currentMemberName); DESTROY(currentAssociation);
}
else
{
goto _loop15;
}
} while (YES);
_loop15:;
}
{
ANTLRDefAST tmp5_AST = ANTLRnullAST;
tmp5_AST = [astFactory create:[self LT:1]];
}
[self matchTokenType:GSWPageDefParserTokenType_RCURLY];
{
switch ( [self LA:1])
{
case GSWPageDefParserTokenType_SEMI:
{
{
ANTLRDefAST tmp6_AST = ANTLRnullAST;
tmp6_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp6_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_SEMI];
break;
}
case ANTLRToken_EOF_TYPE:
case GSWPageDefParserTokenType_INCLUDE:
case GSWPageDefParserTokenType_IDENT:
{
break;
}
default:
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
}
definition_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWPageDefParser___tokenSet_1];
}
NS_ENDHANDLER;
ASSIGN(returnAST,definition_AST);
//LOGObjectFnStop();
}
-(void) classname
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST classname_AST = ANTLRnullAST;
ANTLRDefToken objectClass = nil;
ANTLRDefAST objectClass_AST = ANTLRnullAST;
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
objectClass = [self LT:1];
{
objectClass_AST = [astFactory create:objectClass];
[astFactory addASTChild:objectClass_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_IDENT];
[currentElement setClassName:[objectClass text]];
classname_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWPageDefParser___tokenSet_3];
}
NS_ENDHANDLER;
ASSIGN(returnAST,classname_AST);
//LOGObjectFnStop();
}
-(void) member
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST member_AST = ANTLRnullAST;
ANTLRDefAST memberName_AST = ANTLRnullAST;
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
[self mname];
memberName_AST = returnAST;
[astFactory addASTChild:returnAST in:currentAST];
ASSIGN(currentMemberName,([memberName_AST toStringListWithSiblingSeparator:@"" openSeparator:@"" closeSeparator:@""]));
{
ANTLRDefAST tmp7_AST = ANTLRnullAST;
tmp7_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp7_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_ASSIGN];
{
[self mvalue];
[astFactory addASTChild:returnAST in:currentAST];
}
{
do
{
if (([self LA:1]==GSWPageDefParserTokenType_SEMI))
{
{
ANTLRDefAST tmp8_AST = ANTLRnullAST;
tmp8_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp8_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_SEMI];
}
else
{
goto _loop21;
}
} while (YES);
_loop21:;
}
member_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWPageDefParser___tokenSet_4];
}
NS_ENDHANDLER;
ASSIGN(returnAST,member_AST);
//LOGObjectFnStop();
}
-(void) mname
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST mname_AST = ANTLRnullAST;
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
{
switch ( [self LA:1])
{
case GSWPageDefParserTokenType_QUESTIONMARK:
{
{
ANTLRDefAST tmp9_AST = ANTLRnullAST;
tmp9_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp9_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_QUESTIONMARK];
break;
}
case GSWPageDefParserTokenType_EXCLAMATIONMARK:
{
{
ANTLRDefAST tmp10_AST = ANTLRnullAST;
tmp10_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp10_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_EXCLAMATIONMARK];
break;
}
case GSWPageDefParserTokenType_STRING:
case GSWPageDefParserTokenType_IDENT:
{
break;
}
default:
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
}
{
switch ( [self LA:1])
{
case GSWPageDefParserTokenType_IDENT:
{
{
ANTLRDefAST tmp11_AST = ANTLRnullAST;
tmp11_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp11_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_IDENT];
break;
}
case GSWPageDefParserTokenType_STRING:
{
{
ANTLRDefAST tmp12_AST = ANTLRnullAST;
tmp12_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp12_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_STRING];
break;
}
default:
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
}
mname_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWPageDefParser___tokenSet_5];
}
NS_ENDHANDLER;
ASSIGN(returnAST,mname_AST);
//LOGObjectFnStop();
}
-(void) mvalue
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST mvalue_AST = ANTLRnullAST;
ANTLRDefAST assocKeyPath_AST = ANTLRnullAST;
ANTLRDefToken assocConstantInt = nil;
ANTLRDefAST assocConstantInt_AST = ANTLRnullAST;
ANTLRDefToken assocConstantString = nil;
ANTLRDefAST assocConstantString_AST = ANTLRnullAST;
ANTLRDefToken assocConstantHexNum = nil;
ANTLRDefAST assocConstantHexNum_AST = ANTLRnullAST;
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
{
switch ( [self LA:1])
{
case GSWPageDefParserTokenType_IDENT:
case GSWPageDefParserTokenType_CIRC:
case GSWPageDefParserTokenType_TILDE:
case GSWPageDefParserTokenType_IDENTREF:
{
[self idref];
assocKeyPath_AST = returnAST;
[astFactory addASTChild:returnAST in:currentAST];
{ GSWAssociation* assoc=[GSWAssociation associationWithKeyPath:[assocKeyPath_AST toStringListWithSiblingSeparator:@"" openSeparator:@"" closeSeparator:@""]];
ASSIGN(currentAssociation,assoc); };
break;
}
case GSWPageDefParserTokenType_INT:
{
assocConstantInt = [self LT:1];
{
assocConstantInt_AST = [astFactory create:assocConstantInt];
[astFactory addASTChild:assocConstantInt_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_INT];
{ GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber valueFromString:[assocConstantInt text]]];
ASSIGN(currentAssociation,assoc); };
break;
}
case GSWPageDefParserTokenType_YES:
{
{
ANTLRDefAST tmp13_AST = ANTLRnullAST;
tmp13_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp13_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_YES];
{ GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber numberWithBool:YES]];
ASSIGN(currentAssociation,assoc); };
break;
}
case GSWPageDefParserTokenType_NO:
{
{
ANTLRDefAST tmp14_AST = ANTLRnullAST;
tmp14_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp14_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_NO];
{ GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber numberWithBool:NO]];
ASSIGN(currentAssociation,assoc); };
break;
}
case GSWPageDefParserTokenType_STRING:
{
assocConstantString = [self LT:1];
{
assocConstantString_AST = [astFactory create:assocConstantString];
[astFactory addASTChild:assocConstantString_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_STRING];
{ GSWAssociation* assoc=[GSWAssociation associationWithValue:[self unescapedString:[[[assocConstantString text] stringByDeletingPrefix:@"\""] stringByDeletingSuffix:@"\""]]];
ASSIGN(currentAssociation,assoc); };
break;
}
case GSWPageDefParserTokenType_HEXNUM:
{
assocConstantHexNum = [self LT:1];
{
assocConstantHexNum_AST = [astFactory create:assocConstantHexNum];
[astFactory addASTChild:assocConstantHexNum_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_HEXNUM];
{ GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber valueFromString:[assocConstantHexNum text]]];
ASSIGN(currentAssociation,assoc); };
break;
}
default:
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
}
mvalue_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWPageDefParser___tokenSet_6];
}
NS_ENDHANDLER;
ASSIGN(returnAST,mvalue_AST);
//LOGObjectFnStop();
}
-(void) idref
{
ANTLRASTPair* currentAST=[[ANTLRASTPair new] autorelease];
ANTLRDefAST idref_AST = ANTLRnullAST;
//LOGObjectFnStart();
ASSIGN(returnAST,ANTLRnullAST);
NS_DURING // for error handling
{
{
switch ( [self LA:1])
{
case GSWPageDefParserTokenType_CIRC:
{
{
ANTLRDefAST tmp15_AST = ANTLRnullAST;
tmp15_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp15_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_CIRC];
break;
}
case GSWPageDefParserTokenType_TILDE:
{
{
ANTLRDefAST tmp16_AST = ANTLRnullAST;
tmp16_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp16_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_TILDE];
break;
}
case GSWPageDefParserTokenType_IDENT:
case GSWPageDefParserTokenType_IDENTREF:
{
break;
}
default:
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
}
{
switch ( [self LA:1])
{
case GSWPageDefParserTokenType_IDENT:
{
{
ANTLRDefAST tmp17_AST = ANTLRnullAST;
tmp17_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp17_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_IDENT];
break;
}
case GSWPageDefParserTokenType_IDENTREF:
{
{
ANTLRDefAST tmp18_AST = ANTLRnullAST;
tmp18_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp18_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_IDENTREF];
break;
}
default:
{
[ANTLRNoViableAltException raiseWithToken:[self LT:1]];
}
}
}
{
do
{
switch ( [self LA:1])
{
case GSWPageDefParserTokenType_PIDENT:
{
{
ANTLRDefAST tmp19_AST = ANTLRnullAST;
tmp19_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp19_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_PIDENT];
break;
}
case GSWPageDefParserTokenType_PIDENTREF:
{
{
ANTLRDefAST tmp20_AST = ANTLRnullAST;
tmp20_AST = [astFactory create:[self LT:1]];
[astFactory addASTChild:tmp20_AST in:currentAST];
}
[self matchTokenType:GSWPageDefParserTokenType_PIDENTREF];
break;
}
default:
{
goto _loop31;
}
}
} while (YES);
_loop31:;
}
idref_AST = [currentAST root];
}
NS_HANDLER
{
[self reportErrorWithException:localException];
[self consume];
[self consumeUntilTokenBitSet:GSWPageDefParser___tokenSet_6];
}
NS_ENDHANDLER;
ASSIGN(returnAST,idref_AST);
//LOGObjectFnStop();
}
static CONST NSString* GSWPageDefParser___tokenNames[] = {
@"<0>",
@"EOF",
@"<2>",
@"NULL_TREE_LOOKAHEAD",
@"INCLUDE",
@"WS",
@"STRING",
@"IDENT",
@"COLUMN",
@"LCURLY",
@"RCURLY",
@"SEMI",
@"ASSIGN",
@"QUESTIONMARK",
@"EXCLAMATIONMARK",
@"INT",
@"YES",
@"NO",
@"HEXNUM",
@"CIRC",
@"TILDE",
@"IDENTREF",
@"PIDENT",
@"PIDENTREF",
@"SL_COMMENT",
@"ML_COMMENT",
@"POINT",
@"ESC",
@"HEXINT",
@"DIGIT",
@"HEXDIGIT",
@"LCLETTER",
@"LETTER",
0
};
CONST unsigned long GSWPageDefParser___tokenSet_0_data_[] = { 2UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWPageDefParser___tokenSet_0=nil;
CONST unsigned long GSWPageDefParser___tokenSet_1_data_[] = { 146UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWPageDefParser___tokenSet_1=nil;
CONST unsigned long GSWPageDefParser___tokenSet_2_data_[] = { 24768UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWPageDefParser___tokenSet_2=nil;
CONST unsigned long GSWPageDefParser___tokenSet_3_data_[] = { 512UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWPageDefParser___tokenSet_3=nil;
CONST unsigned long GSWPageDefParser___tokenSet_4_data_[] = { 25792UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWPageDefParser___tokenSet_4=nil;
CONST unsigned long GSWPageDefParser___tokenSet_5_data_[] = { 4096UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWPageDefParser___tokenSet_5=nil;
CONST unsigned long GSWPageDefParser___tokenSet_6_data_[] = { 27840UL, 0UL, 0UL, 0UL };
static ANTLRBitSet* GSWPageDefParser___tokenSet_6=nil;
+(void)initialize
{
if (!GSWPageDefParser___tokenSet_0)
GSWPageDefParser___tokenSet_0=[[ANTLRBitSet bitSetWithULongBits:GSWPageDefParser___tokenSet_0_data_ length:8] retain];
if (!GSWPageDefParser___tokenSet_1)
GSWPageDefParser___tokenSet_1=[[ANTLRBitSet bitSetWithULongBits:GSWPageDefParser___tokenSet_1_data_ length:8] retain];
if (!GSWPageDefParser___tokenSet_2)
GSWPageDefParser___tokenSet_2=[[ANTLRBitSet bitSetWithULongBits:GSWPageDefParser___tokenSet_2_data_ length:8] retain];
if (!GSWPageDefParser___tokenSet_3)
GSWPageDefParser___tokenSet_3=[[ANTLRBitSet bitSetWithULongBits:GSWPageDefParser___tokenSet_3_data_ length:8] retain];
if (!GSWPageDefParser___tokenSet_4)
GSWPageDefParser___tokenSet_4=[[ANTLRBitSet bitSetWithULongBits:GSWPageDefParser___tokenSet_4_data_ length:8] retain];
if (!GSWPageDefParser___tokenSet_5)
GSWPageDefParser___tokenSet_5=[[ANTLRBitSet bitSetWithULongBits:GSWPageDefParser___tokenSet_5_data_ length:8] retain];
if (!GSWPageDefParser___tokenSet_6)
GSWPageDefParser___tokenSet_6=[[ANTLRBitSet bitSetWithULongBits:GSWPageDefParser___tokenSet_6_data_ length:8] retain];
}
+(void)dealloc
{
DESTROY(GSWPageDefParser___tokenSet_0);
DESTROY(GSWPageDefParser___tokenSet_1);
DESTROY(GSWPageDefParser___tokenSet_2);
DESTROY(GSWPageDefParser___tokenSet_3);
DESTROY(GSWPageDefParser___tokenSet_4);
DESTROY(GSWPageDefParser___tokenSet_5);
DESTROY(GSWPageDefParser___tokenSet_6);
[[self superclass] dealloc];
}
@end

View file

@ -1,49 +0,0 @@
#ifndef INC_GSWPageDefParserTokenTypes_h_
#define INC_GSWPageDefParserTokenTypes_h_
/*
* ANTLR-generated file resulting from grammar /tmp/PageDef.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.5.0; 1996,1997,1998,1999
*/
#include "GSWeb.h"
enum GSWPageDefParserTokenTypes {
GSWPageDefParserTokenType_EOF_ = 1,
GSWPageDefParserTokenType_NULL_TREE_LOOKAHEAD = 3,
GSWPageDefParserTokenType_INCLUDE = 4,
GSWPageDefParserTokenType_WS = 5,
GSWPageDefParserTokenType_STRING = 6,
GSWPageDefParserTokenType_IDENT = 7,
GSWPageDefParserTokenType_COLUMN = 8,
GSWPageDefParserTokenType_LCURLY = 9,
GSWPageDefParserTokenType_RCURLY = 10,
GSWPageDefParserTokenType_SEMI = 11,
GSWPageDefParserTokenType_ASSIGN = 12,
GSWPageDefParserTokenType_QUESTIONMARK = 13,
GSWPageDefParserTokenType_EXCLAMATIONMARK = 14,
GSWPageDefParserTokenType_INT = 15,
GSWPageDefParserTokenType_YES = 16,
GSWPageDefParserTokenType_NO = 17,
GSWPageDefParserTokenType_HEXNUM = 18,
GSWPageDefParserTokenType_CIRC = 19,
GSWPageDefParserTokenType_TILDE = 20,
GSWPageDefParserTokenType_IDENTREF = 21,
GSWPageDefParserTokenType_PIDENT = 22,
GSWPageDefParserTokenType_PIDENTREF = 23,
GSWPageDefParserTokenType_SL_COMMENT = 24,
GSWPageDefParserTokenType_ML_COMMENT = 25,
GSWPageDefParserTokenType_POINT = 26,
GSWPageDefParserTokenType_ESC = 27,
GSWPageDefParserTokenType_HEXINT = 28,
GSWPageDefParserTokenType_DIGIT = 29,
GSWPageDefParserTokenType_HEXDIGIT = 30,
GSWPageDefParserTokenType_LCLETTER = 31,
GSWPageDefParserTokenType_LETTER = 32,
};
#endif /*INC_GSWPageDefParserTokenTypes_h_*/

View file

@ -1,45 +0,0 @@
#ifndef INC_GSWPageDefTokenTypes_h_
#define INC_GSWPageDefTokenTypes_h_
/*
* ANTLR-generated file resulting from grammar PageDef.g
*
* Terence Parr, MageLang Institute
* with John Lilley, Empathy Software
* and Manuel Guesdon, Software Builders
* ANTLR Version 2.7.1; 1996,1997,1998,1999,2000
*/
#include "GSWeb.h"
enum GSWPageDefTokenTypes {
GSWPageDefTokenType_EOF_ = 1,
GSWPageDefTokenType_NULL_TREE_LOOKAHEAD = 3,
GSWPageDefTokenType_INCLUDE = 4,
GSWPageDefTokenType_WS = 5,
GSWPageDefTokenType_STRING = 6,
GSWPageDefTokenType_IDENT = 7,
GSWPageDefTokenType_COLUMN = 8,
GSWPageDefTokenType_LCURLY = 9,
GSWPageDefTokenType_RCURLY = 10,
GSWPageDefTokenType_SEMI = 11,
GSWPageDefTokenType_ASSIGN = 12,
GSWPageDefTokenType_INT = 13,
GSWPageDefTokenType_YES = 14,
GSWPageDefTokenType_NO = 15,
GSWPageDefTokenType_HEXNUM = 16,
GSWPageDefTokenType_CIRC = 17,
GSWPageDefTokenType_TILDE = 18,
GSWPageDefTokenType_PIDENT = 19,
GSWPageDefTokenType_SL_COMMENT = 20,
GSWPageDefTokenType_ML_COMMENT = 21,
GSWPageDefTokenType_POINT = 22,
GSWPageDefTokenType_ESC = 23,
GSWPageDefTokenType_HEXINT = 24,
GSWPageDefTokenType_DIGIT = 25,
GSWPageDefTokenType_HEXDIGIT = 26,
GSWPageDefTokenType_LCLETTER = 27,
GSWPageDefTokenType_LETTER = 28,
};
#endif /*INC_GSWPageDefTokenTypes_h_*/

View file

@ -1,27 +0,0 @@
// $ANTLR 2.7.1: PageDef.g -> GSWPageDefTokenTypes.txt$
GSWPageDef // output token vocab name
INCLUDE=4
WS=5
STRING=6
IDENT=7
COLUMN=8
LCURLY=9
RCURLY=10
SEMI=11
ASSIGN=12
INT=13
YES=14
NO=15
HEXNUM=16
CIRC=17
TILDE=18
PIDENT=19
SL_COMMENT=20
ML_COMMENT=21
POINT=22
ESC=23
HEXINT=24
DIGIT=25
HEXDIGIT=26
LCLETTER=27
LETTER=28

View file

@ -40,7 +40,6 @@ typedef enum _GSWTemplateParserType
GSWTemplateParserType_XMLHTML,
GSWTemplateParserType_XMLHTMLNoOmittedTags,
GSWTemplateParserType_XML,
GSWTemplateParserType_ANTLR,
GSWTemplateParserType_RawHTML
} GSWTemplateParserType;

View file

@ -68,11 +68,6 @@ RCS_ID("$Id$")
NSWarnLog(@"XML parser is no more handled. Using RawHTML one");
type=GSWTemplateParserType_RawHTML;
}
else if ([string caseInsensitiveCompare:GSWOPTValue_DefaultTemplateParser_ANTLR] == NSOrderedSame)
{
NSWarnLog(@"ANTLR parser is no more handled. Using RawHTML one");
type=GSWTemplateParserType_RawHTML;
}
else
type=GSWTemplateParserType_RawHTML;
NSDebugMLog(@"templateParserTypeFromString:%@ ==> %d",string,type);
@ -183,10 +178,6 @@ RCS_ID("$Id$")
NSWarnLog(@"XML parser is no more handled. Using RawHTML one");
finalParserClass=[GSWHTMLTemplateParser class];
break;
case GSWTemplateParserType_ANTLR:
NSWarnLog(@"ANTLR parser is no more handled. Using RawHTML one");
finalParserClass=[GSWHTMLTemplateParser class];
break;
case GSWTemplateParserType_RawHTML:
finalParserClass=[GSWHTMLTemplateParser class];
break;

View file

@ -1,60 +0,0 @@
/** GSWTemplateParserANTLR.h - <title>GSWeb: Class GSWTemplateParserANTLR</title>
Copyright (C) 1999-2004 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</license>
**/
// $Id$
#ifndef _GSWTemplateParserANTLR_h__
#define _GSWTemplateParserANTLR_h__
#include <gsantlr/ANTLRCommon.h>
#include <gsantlr/ANTLRTextStreams.h>
#include "GSWTemplateParser.h"
#include "GSWHTMLTokenTypes.h"
#include "GSWHTMLAttrLexer.h"
#include "GSWHTMLAttrParser.h"
#include "GSWHTMLAttrParserExt.h"
//====================================================================
@interface GSWTemplateParserANTLR : GSWTemplateParser
{
NSMutableDictionary* _tagsNames;
NSMutableDictionary* _tagsAttrs;
};
-(void)dealloc;
-(NSArray*)templateElements;
-(NSArray*)createElementsStartingWithAST:(ANTLRDefAST*)AST
stopOnTagNamed:(NSString*)stopTagName;
-(BOOL)parseTag:(ANTLRDefAST)AST;
-(NSString*)getTagNameFor:(ANTLRDefAST)AST;
-(NSDictionary*)getTagAttrsFor:(ANTLRDefAST)AST;
@end
#endif //_GSWTemplateParserANTLR_h__

View file

@ -1,487 +0,0 @@
/** GSWTemplateParserANTLR.m - <title>GSWeb: Class GSWTemplateParserANTLR</title>
Copyright (C) 1999-2004 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Mar 1999
$Revision$
$Date$
$Id$
This file is part of the GNUstep Web Library.
<license>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</license>
**/
#include "config.h"
RCS_ID("$Id$")
#include "GSWeb.h"
#include "GSWTemplateParserANTLR.h"
//====================================================================
@implementation GSWTemplateParserANTLR
-(void)dealloc
{
DESTROY(_tagsNames);
DESTROY(_tagsAttrs);
[super dealloc];
};
-(NSArray*)templateElements
{
NSArray* elements=nil;
id<NSObject,ANTLRAST> htmlAST=nil;
NSAutoreleasePool* arpParse=nil;
ANTLRTextInputStreamString* htmlStream=nil;
GSWHTMLLexer* htmlLexer=nil;
ANTLRTokenBuffer* htmlTokenBuffer=nil;
GSWHTMLParser* htmlParser=nil;
LOGObjectFnStart();
NSDebugMLLog(@"low",@"template named:%@ frameworkName:%@ pageDefString=%@",
_templateName,
_frameworkName,
_declarationsString);
//TODO remove
/*
[ANTLRCharBuffer setTraceFlag_LA:YES];
[ANTLRCharScanner setTraceFlag_LA:YES];
[ANTLRLLkParser setTraceFlag_LA:YES];
[ANTLRTokenBuffer setTraceFlag_LA:YES];
*/
htmlStream=[[ANTLRTextInputStreamString newWithString:_string]
autorelease];
htmlLexer=[[[GSWHTMLLexer alloc]initWithTextStream:htmlStream]
autorelease];
htmlTokenBuffer=[ANTLRTokenBuffer tokenBufferWithTokenizer:htmlLexer];
htmlParser=[[[GSWHTMLParser alloc] initWithTokenBuffer:htmlTokenBuffer]
autorelease];
NSDebugMLLog(@"low",@"template named:%@ HTMLString=%@",
_templateName,
_string);
arpParse=[NSAutoreleasePool new];
NS_DURING
{
[htmlParser document];
if ([htmlParser isError])
{
LOGError(@"Parser Errors : %@",[htmlParser errors]);
ExceptionRaise(@"GSWTemplateParser",
@"GSWTemlateParser: Errors in HTML parsing template named %@: %@\nAST:\n%@",
_templateName,
[htmlParser errors],
[htmlParser AST]);
};
htmlAST=[htmlParser AST];
NSDebugMLLog0(@"low",@"HTML Parse OK!");
}
NS_HANDLER
{
LOGError(@"template named:%@ HTML Parse failed!",_templateName);
localException=ExceptionByAddingUserInfoObjectFrameInfo(localException,@"In [htmlParser document]... template named:%@ HTML Parse failed!",_templateName);
RETAIN(localException);
DESTROY(arpParse);
AUTORELEASE(localException);
[localException raise];
}
NS_ENDHANDLER;
[htmlAST retain];
DESTROY(arpParse);
arpParse=[NSAutoreleasePool new];
[htmlAST autorelease];
if (htmlAST)
{
_tagsNames=[[NSMutableDictionary dictionary] retain];
_tagsAttrs=[[NSMutableDictionary dictionary] retain];
NS_DURING
{
elements=[self createElementsStartingWithAST:&htmlAST
stopOnTagNamed:nil];
NSDebugMLLog(@"low",@"template named:%@ _template=%@",
_templateName,
elements);
}
NS_HANDLER
{
LOGSeriousError(@"template named:%@ createElements failed!",
_templateName);
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"In createElementsStartingWithAST...");
RETAIN(localException);
DESTROY(arpParse);
AUTORELEASE(localException);
[localException raise];
}
NS_ENDHANDLER;
};
[elements retain];
DESTROY(arpParse);
[elements autorelease];
NSDebugMLLog0(@"low",@"Display Template\n");
NSDebugMLLog(@"low",@"template named:%@ elements=%@",
_templateName,
elements);
LOGClassFnStop();
return elements;
};
//--------------------------------------------------------------------
-(BOOL)parseTag:(ANTLRDefAST)anAST
{
BOOL htmlAttrParseOK=YES;
NSString* tagName=[_tagsNames objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack
LOGClassFnStart();
if (!tagName
&& ([anAST tokenType]==GSWHTMLTokenType_OPENTAG
|| [anAST tokenType]==GSWHTMLTokenType_CLOSETAG))
{
NSAutoreleasePool* arpParse=nil;
ANTLRTextInputStreamString* _tagStream=[[[ANTLRTextInputStreamString alloc]
initWithString:[anAST text]]
autorelease];
GSWHTMLAttrLexer* htmlAttrLexer=[[[GSWHTMLAttrLexer alloc]
initWithTextStream:_tagStream]
autorelease];
ANTLRTokenBuffer* htmlAttrTokenBuffer=[ANTLRTokenBuffer tokenBufferWithTokenizer:htmlAttrLexer];
GSWHTMLAttrParser* _tagParser=[[[GSWHTMLAttrParser alloc] initWithTokenBuffer:htmlAttrTokenBuffer]
autorelease];
NSString* tagName=nil;
NSDictionary* tagAttrs=nil;
NSDebugMLLog(@"low",@"PARSE:[%@]",[anAST text]);
NSDebugMLLog(@"low",@"stream:[%@]",_tagStream);
htmlAttrParseOK=NO;
arpParse=[NSAutoreleasePool new];
NS_DURING
{
[_tagParser tag];
if ([_tagParser isError])
{
LOGError(@"Parser Errors : %@",[_tagParser errors]);
ExceptionRaise(@"GSWTemplateParser",
@"GSWTemlateParser: Errors in HTML Tag parsing: %@",
[_tagParser errors]);
};
tagName=[_tagParser tagName];
tagAttrs=[_tagParser attributes];
NSDebugMLLog(@"low",@"tagName=%@ tagAttrs=%@",
tagName,
tagAttrs);
htmlAttrParseOK=YES;
}
NS_HANDLER
{
htmlAttrParseOK=NO;
LOGError(@"PARSE PB:[%@]",[anAST text]);//TODO
localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,
@"In [_tagParser tag]...");
RETAIN(localException);
DESTROY(arpParse);
AUTORELEASE(localException);
[localException raise];
}
NS_ENDHANDLER;
DESTROY(arpParse);
NSDebugMLLog(@"low",@"END PARSE:[%@]",[anAST text]);
if (htmlAttrParseOK && tagName)
{
NSDebugMLLog(@"low",@"tagName:[%@]",tagName);
if ([tagName hasPrefix:@"\""] && [tagName hasSuffix:@"\""])
tagName=[[tagName stringByDeletingPrefix:@"\""]stringByDeletingSuffix:@"\""];
NSDebugMLLog(@"low",@"Add tagName:[%@]",
tagName);
[_tagsNames setObject:tagName
forKey:[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack
NSDebugMLLog(@"low",@"Verify tagName=%@",
[_tagsNames objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]); //TODO bad hack
NSDebugMLLog(@"low",@"Add tagsAttrs:[%@]",
tagAttrs);
if (tagAttrs)
{
[_tagsAttrs setObject:tagAttrs
forKey:[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack
NSDebugMLLog(@"low",@"Verify tagAttrs=%@",
[_tagsAttrs objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]); //TODO bad hack
};
};
};
LOGClassFnStop();
return htmlAttrParseOK;
};
//--------------------------------------------------------------------
-(NSString*)getTagNameFor:(ANTLRDefAST)anAST
{
NSString* tagName=[_tagsNames objectForKey:
[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack
LOGClassFnStart();
NSDebugMLLog(@"low",@"[%@]",[anAST text]);
if (!tagName)
{
BOOL htmlAttrParseOK=[self parseTag:anAST];
if (htmlAttrParseOK)
tagName=[_tagsNames objectForKey:
[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack
};
NSDebugMLLog(@"low",@"tagName:[%@]",tagName);
LOGClassFnStop();
return tagName;
};
//--------------------------------------------------------------------
-(NSDictionary*)getTagAttrsFor:(ANTLRDefAST)anAST
{
NSDictionary* tagAttrs=[_tagsAttrs objectForKey:
[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack
LOGClassFnStart();
NSDebugMLLog(@"low",@"[%@]",[anAST text]);
if (!tagAttrs)
{
BOOL htmlAttrParseOK=[self parseTag:anAST];
if (htmlAttrParseOK)
tagAttrs=[_tagsAttrs objectForKey:
[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack
};
NSDebugMLLog(@"low",@"tagAttrs:[%@]",tagAttrs);
LOGClassFnStop();
return tagAttrs;
};
//--------------------------------------------------------------------
-(NSArray*)createElementsStartingWithAST:(ANTLRDefAST*)anAST
stopOnTagNamed:(NSString*)stopTagName
{
NSMutableArray* elements=[NSMutableArray array];
ANTLRDefAST currentAST=*anAST;
BOOL end=NO;
BOOL inHTMLBareString=NO;
NSMutableString* htmlBareString=nil;
LOGClassFnStart();
NSDebugMLLog(@"low",@"stopTagName:[%@]",stopTagName);
while(currentAST && !end)
{
GSWElement* element=nil;
NSString* tagName=nil;
NSDictionary* tagAttrs=nil;
BOOL stopBareString=NO;
NSDebugMLLog(@"low",@"[currentAST: text=[%@] Type=%d",
[currentAST text],
[currentAST tokenType]);
NSDebugMLLog(@"low",@"end=%s inHTMLBareString=%s stopBareString=%s",
end ? "YES" : "NO",
inHTMLBareString ? "YES" : "NO",
stopBareString ? "YES" : "NO");
if ([currentAST tokenType]==GSWHTMLTokenType_OPENTAG
|| [currentAST tokenType]==GSWHTMLTokenType_CLOSETAG)
{
tagName=[self getTagNameFor:currentAST];
NSDebugMLLog(@"low",@"Result tagName:[%@]",tagName);
if (!tagName)
{
LOGError0(@"");//TODO
}
else
{
NSDebugMLLog(@"low",@"[currentAST tokenType]=%d",(int)[currentAST tokenType]);
if ([currentAST tokenType]==GSWHTMLTokenType_OPENTAG)
{
NSDebugMLLog0(@"low",@"Found Open Tag");
tagAttrs=[self getTagAttrsFor:currentAST];
NSDebugMLLog(@"low",@"tagAttrs=%@",tagAttrs);
if ([tagName caseInsensitiveCompare:GSWTag_Name[GSWNAMES_INDEX]]==NSOrderedSame
|| [tagName caseInsensitiveCompare:GSWTag_Name[WONAMES_INDEX]]==NSOrderedSame)
{
NSDebugMLLog0(@"low",@"Found GSWeb Tag");
NSDebugMLLog(@"low",@"tagAttrs=%@",
tagAttrs);
if (inHTMLBareString)
{
NSDebugMLLog0(@"low",@"==>Stop BareString");
stopBareString=YES;
}
else
{
ANTLRDefAST nextAST=[currentAST nextSibling];
NSString* name=[tagAttrs objectForKey:@"name"];
NSDebugMLLog0(@"low",@"Process GSWeb Tag");
NSDebugMLLog(@"low",@"GSWeb Tag: name:[%@]",
name);
if (!name)
{
LOGError(@"No name for Element:%@",
[currentAST text]);//TODO
ExceptionRaise(@"GSWTemplateParser",
@"GSWTemlateParser: no name for GNUstepWeb tag in template named %@",
_templateName);
}
else
{
GSWDeclaration* declaration=[_declarations objectForKey:name];
NSDebugMLLog(@"low",@"declaration:[%@]",
declaration);
NSDebugMLLog(@"low",@"GSWeb Tag declaration:[%@]",
declaration);
if (declaration)
{
NSDictionary* _associations=[declaration associations];
NSString* className=nil;
className=[declaration type];
NSDebugMLLog(@"low",@"GSWeb Tag className:[%@]",
className);
if (className)
{
NSArray* children=nil;
children=[self createElementsStartingWithAST:&nextAST
stopOnTagNamed:tagName];
NSDebugMLLog(@"low",@"CREATE Element of Class:%@",className);
NSDebugMLLog(@"low",@"children:%@",children);
NSDebugMLLog(@"low",@"associations:%@",_associations);
{
NSEnumerator* _tagAttrsEnum = [tagAttrs keyEnumerator];
id _tagAttrKey=nil;
id _tagAttrValue=nil;
NSMutableDictionary* _addedAssoc=nil;
while ((_tagAttrKey = [_tagAttrsEnum nextObject]))
{
if (![_tagAttrKey isEqualToString:@"name"]
&& ![_associations objectForKey:_tagAttrKey])
{
if (!_addedAssoc)
_addedAssoc=(NSMutableDictionary*)[NSMutableDictionary dictionary];
_tagAttrValue=[tagAttrs objectForKey:_tagAttrKey];
[_addedAssoc setObject:[GSWAssociation associationWithValue:_tagAttrValue]
forKey:_tagAttrKey];
};
};
if (_addedAssoc)
{
_associations=[_associations dictionaryByAddingEntriesFromDictionary:_addedAssoc];
};
};
element=[GSWApp dynamicElementWithName:className
associations:_associations
template:[[[GSWHTMLStaticGroup alloc]initWithContentElements:children]autorelease]
languages:_languages];
if (element)
[element setDeclarationName:[declaration name]];
else
{
ExceptionRaise(@"GSWTemplateParser",
@"GSWTemplateParser: Creation failed for element named:%@ className:%@ in template named %@",
[declaration name],
className,
_templateName);
};
}
else
{
ExceptionRaise(@"GSWTemplateParser",
@"GSWTemplateParser: No class name in page definition for tag named:%@ declaration=%@ in template named %@",
name,
declaration,
_templateName);
};
}
else
{
ExceptionRaise(@"GSWTemplateParser",
@"No element definition for tag named:%@ in template named %@",
name,
_templateName);
};
};
currentAST=nextAST;
};
};
}
else
{
if (stopTagName
&& [tagName caseInsensitiveCompare:stopTagName]==NSOrderedSame)
{
NSDebugMLLog(@"low",@"stopTagName found: %@",stopTagName);
end=YES;
stopBareString=YES;
currentAST=[currentAST nextSibling];
};
};
};
}
else if ([currentAST tokenType]==GSWHTMLTokenType_COMMENT)
{
stopBareString=YES;
element=[GSWHTMLComment elementWithString:[currentAST text]];
currentAST=[currentAST nextSibling];
}
NSDebugMLLog(@"low",@"end=%s inHTMLBareString=%s stopBareString=%s",
end ? "YES" : "NO",
inHTMLBareString ? "YES" : "NO",
stopBareString ? "YES" : "NO");
if (!element && !end && !stopBareString)
{
NSDebugMLLog0(@"low",@"!element && !end && !stopBareString");
if (!inHTMLBareString)
{
NSDebugMLLog0(@"low",@"!inHTMLBareString ==> inHTMLBareString=YES");
inHTMLBareString=YES;
htmlBareString=[[NSMutableString new] autorelease];
};
NSDebugMLLog(@"low",@"inHTMLBareString: adding [%@]",[currentAST text]);
if ([currentAST tokenType]==GSWHTMLTokenType_OPENTAG)
[htmlBareString appendFormat:@"<%@>",[currentAST text]];
else if ([currentAST tokenType]==GSWHTMLTokenType_CLOSETAG)
[htmlBareString appendFormat:@"</%@>",[currentAST text]];
else
[htmlBareString appendString:[currentAST text]];
NSDebugMLLog(@"low",@"htmlBareString: ==> [%@]",htmlBareString);
currentAST=[currentAST nextSibling];
};
if (inHTMLBareString && (stopBareString || !currentAST))
{
NSDebugMLLog0(@"low",@"inHTMLBareString && stopBareString");
NSDebugMLLog(@"low",@"CREATE GSWHTMLBareString:\n%@",htmlBareString);
element=[GSWHTMLBareString elementWithString:htmlBareString];
NSDebugMLLog(@"low",@"element:%@",element);
htmlBareString=nil;
inHTMLBareString=NO;
};
if (element)
{
NSDebugMLLog(@"low",@"element to add: element=[%@]",element);
[elements addObject:element];
element=nil;
};
NSDebugMLLog(@"low",@"element:%@",element);
NSDebugMLLog(@"low",@"inHTMLBareString:%d",(int)inHTMLBareString);
NSDebugMLLog(@"low",@"htmlBareString:%@",htmlBareString);
};
*anAST=currentAST;
NSDebugMLLog(@"low",@"elements]:%@",elements);
LOGClassFnStop();
return elements;
};
@end

View file

@ -1,313 +0,0 @@
/*
*/
header {
#include "GSWeb.h"
}
options {
language="Objc";
}
class GSWPageDefParser extends Parser;
options {
/*exportVocab=GSWPageDef;*/
buildAST=true;
k = 4;
}
{
NSMutableDictionary* elements;
GSWPageDefElement* currentElement;
NSString* currentMemberName;
GSWAssociation* currentAssociation;
NSMutableArray* includes;
NSMutableArray* errors;
NSMutableArray* warnings;
}
/*
imaginaryTokenDefinitions
: INCLUDE
;
*/
document
{
DESTROY(elements);
elements=[NSMutableDictionary new];
DESTROY(includes);
includes=[NSMutableArray new];
DESTROY(errors);
DESTROY(warnings);
}
: ((object { [elements setObject:currentElement forKey:[currentElement elementName]]; } )
| (include))+
;
//TODO unescapedString
include:
(INCLUDE (WS)*)
includeObj:STRING { [includes addObject:[self unescapedString:[[[includeObj text] stringByDeletingPrefix:@"\""] stringByDeletingSuffix:@"\""]]]; }
;
object:
objectId:IDENT^ {currentElement=[[GSWPageDefElement new] autorelease]; [currentElement setElementName:[objectId_AST text]]; }
COLUMN^
( definition )!
;
definition:
( classname )
LCURLY^
( member { [currentElement setAssociation:currentAssociation forKey:currentMemberName]; DESTROY(currentMemberName); DESTROY(currentAssociation); })*! RCURLY!
(SEMI)?
;
classname:
objectClass:IDENT { [currentElement setClassName:[objectClass text]]; }
;
member:
memberName:mname { ASSIGN(currentMemberName,([memberName_AST toStringListWithSiblingSeparator:@"" openSeparator:@"" closeSeparator:@""])); }
ASSIGN ( mvalue )
(SEMI)*!
;
mname:
// (QUESTIONMARK)? (IDENT)
(QUESTIONMARK | EXCLAMATIONMARK)? (IDENT | STRING)
;
//TODO unescapedString
mvalue:
( assocKeyPath:idref
{ { GSWAssociation* assoc=[GSWAssociation associationWithKeyPath:[assocKeyPath_AST toStringListWithSiblingSeparator:@"" openSeparator:@"" closeSeparator:@""]];
ASSIGN(currentAssociation,assoc); }; }
| assocConstantInt:INT
{ { GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber valueFromString:[assocConstantInt text]]];
ASSIGN(currentAssociation,assoc); }; }
| YES
{ { GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber numberWithBool:YES]];
ASSIGN(currentAssociation,assoc); }; }
| NO
{ { GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber numberWithBool:NO]];
ASSIGN(currentAssociation,assoc); }; }
| assocConstantString:STRING
{ { GSWAssociation* assoc=[GSWAssociation associationWithValue:[self unescapedString:[[[assocConstantString text] stringByDeletingPrefix:@"\""] stringByDeletingSuffix:@"\""]]];
ASSIGN(currentAssociation,assoc); }; }
| assocConstantHexNum:HEXNUM
{ { GSWAssociation* assoc=[GSWAssociation associationWithValue:[NSNumber valueFromString:[assocConstantHexNum text]]];
ASSIGN(currentAssociation,assoc); }; }
)
;
idref:
(CIRC | TILDE)? (IDENT | IDENTREF ) (PIDENT | PIDENTREF)*
;
class GSWPageDefLexer extends Lexer;
options {
k = 4;
/*exportVocab=GSWPageDef;*/
charVocabulary = '\3'..'\377';
caseSensitive=true;
filter=UNDEFINED_TOKEN;
}
// Single-line comments
SL_COMMENT
: "//"
(~('\n'|'\r'))* ('\n'|'\r'('\n')?)
{ _ttype = ANTLRToken_SKIP; [self newline]; } //{$setType(Token.SKIP); newline();}
;
// multiple-line comments
ML_COMMENT
: "/*"
( /* '\r' '\n' can be matched in one alternative or by matching
'\r' in one iteration and '\n' in another. I am trying to
handle any flavor of newline that comes in, but the language
that allows both "\r\n" and "\r" and "\n" to all be valid
newline is ambiguous. Consequently, the resulting grammar
must be ambiguous. I'm shutting this warning off.
*/
options {
generateAmbigWarnings=false;
}
:
{ [self LA:2]!='/' }? '*'
| '\r' '\n' { [self newline]; } // {newline();}
| '\r' { [self newline]; } // {newline();}
| '\n' { [self newline]; } // {newline();}
| ~('*'|'\n'|'\r')
)*
"*/"
{ _ttype = ANTLRToken_SKIP; } // {$setType(Token.SKIP);}
;
/* STRUCTURAL tags
*/
INCLUDE: "#include"
;
IDENT
options { testLiterals = true; }
: (LETTER|'_') (LETTER|'_'|DIGIT)*
;
PIDENT
options { testLiterals = true; }
: POINT (IDENT | STRING)
;
IDENTREF
options { testLiterals = true; }
: (LETTER|'_'|'@') (LETTER|'_'|DIGIT)*
;
PIDENTREF
options { testLiterals = true; }
: POINT (IDENTREF | INT | STRING)
;
YES
options { testLiterals = true; }
: "YES"
;
NO
options { testLiterals = true; }
: "NO"
;
LCURLY: '{'
;
RCURLY: '}'
;
SEMI: ';'
;
CIRC: '^'
;
TILDE: '~'
;
COLUMN: ':'
;
ASSIGN: '='
;
QUESTIONMARK: '?'
;
EXCLAMATIONMARK: '!'
;
WS:
( ' '
| '\t'
| '\n' { [self newline]; }
| "\r\n" { [self newline]; }
| '\r' { [self newline]; }
) { _ttype = ANTLRToken_SKIP; }
;
STRING
// : '"' (~'"')* '"'
// | '\'' (~'\'')* '\''
: '\'' ( ESC |~('\''|'\\'))* '\''
| '"' ( ESC |~('"'|'\\'))* '"'
;
POINT: '.';
INT : (DIGIT)+
;
HEXNUM
: '#' HEXINT
;
// escape sequence -- note that this is protected; it can only be called
// from another lexer rule -- it will not ever directly return a token to
// the parser
// There are various ambiguities hushed in this rule. The optional
// '0'...'9' digit matches should be matched here rather than letting
// them go back to STRING_LITERAL to be matched. ANTLR does the
// right thing by matching immediately; hence, it's ok to shut off
// the FOLLOW ambig warnings.
protected
ESC
: '\\'
( 'n'
| 'r'
| 't'
| 'b'
| 'f'
| '"'
| '\''
| '\\'
| ('u')+ HEXDIGIT HEXDIGIT HEXDIGIT HEXDIGIT
| ('0'..'3')
(
options {
warnWhenFollowAmbig = false;
}
: ('0'..'9')
(
options {
warnWhenFollowAmbig = false;
}
: '0'..'9'
)?
)?
| ('4'..'7')
(
options {
warnWhenFollowAmbig = false;
}
: ('0'..'9')
)?
)
;
protected
HEXINT
: (
/* Technically, HEXINT cannot be followed by a..f, but due to our
loose grammar, the whitespace that normally would follow this
rule is optional. ANTLR reports that #4FACE could parse as
HEXINT "#4" followed by WORD "FACE", which is clearly bogus.
ANTLR does the right thing by consuming a much input as
possible here. I shut the warning off.
*/
options {
generateAmbigWarnings=false;
}
: HEXDIGIT
)+
;
protected
DIGIT
: '0'..'9'
;
protected
HEXDIGIT
: ('0'..'9'|'A'..'F'|'a'..'f')
;
protected
LCLETTER
: 'a'..'z'
;
protected
LETTER
: 'a'..'z'
| 'A'..'Z'
;

View file

@ -1,335 +0,0 @@
/*
Based on the HTML 3.2 spec. by the W3 (http://www.w3.org)
Alexander Hinds & Terence Parr
Magelang Institute, Ltd.
Send comments to: parrt@parr-research.com
v1.0 Terence John Parr (version 2.5.0 of ANTLR required)
Fixed how whitespace as handled, removing some ambiguities; some
because of ANTLR lexical filtering in 2.5.0.
Changed (TEXT)* loops to (TEXT)? general since TEXT matches
everything between valid tags (how could there be more than one
between tags?)
Made the DOCTYPE optional.
Reduced lookahead from k=5 to k=1 on the parser and number
of parser ambiguities to 2. Reduced lexer lookahead from 6
to 4; had to left factor a bunch of stuff.
List items couldn't contain nested lists...fixed it.
Fixed def of WORD so it can't be an INT. Removed '-' from WORD.
Fixed HEXNUM so it will allow letters A..F.
KNOWN ISSUES:
1. Does not handle "staggered" tags, eg: <p> <i> <p> <i>
2. Adhere's somewhat strictly to the html spec, so many pages
won't parse without errors.
3. Doesn't convert &(a signifier) to it's proper single char
representation
4. Checks only the syntax of element attributes, not the semantics,
e.g. won't very that a base element's attribute is actually
called "href"
5. Tags split across lines, for example, <A (NEWLINE) some text >
won't be properly recognized. TJP: I think I fixed this.
7. Lines not counted properly due to the def'n of TEXT - see the
alternate def'n for a possible fix. TJP: I think I fixed this.
*/
header {
#include "GSWeb.h"
}
options {
language="Objc";
}
class GSWHTMLParser extends Parser;
options {
exportVocab=GSWHTML;
buildAST=true;
k = 1;
}
{
NSMutableArray* errors;
NSMutableArray* warnings;
}
document
{
DESTROY(errors);
DESTROY(warnings);
}
: (
WS
| TEXT
| ot:OPENTAG { [ot_AST setText:[[[ot_AST text] stringByDeletingPrefix:@"<"] stringByDeletingSuffix:@">"]]; }
| ct:CLOSETAG { [ct_AST setText:[[[ct_AST text] stringByDeletingPrefix:@"</"] stringbyDeletingSuffix:@">"]]; }
| com:COMMENT { [com_AST setText:[[[com_AST text] stringByDeletingPrefix:@"<!--"] stringByDeletingSuffix:@"-->"]]; }
/* | inc:INCLUDE { [inc_AST setText:[[[inc_AST text] stringByDeletingPrefix:@"<#include "] stringByDeletingSuffix:@"#>"]]; }*/
)+
;
/*4*/
class GSWHTMLLexer extends Lexer;
options {
k = 3;
exportVocab=GSWHTML;
charVocabulary = '\3'..'\377';
caseSensitive=true;
filter=UNDEFINED_TOKEN;
}
/* STRUCTURAL tags
*/
OPENTAG
/*LAST : '<' (WORD | LETTER) (WS (ATTR )*)? '>'*/
: '<' (WORD | LETTER) ((WS)* ((ATTR) (WS)*)*)? '>'
;
CLOSETAG
: "</" (WORD | LETTER) '>'
;
protected
ATTR
/* LAST options {
ignore=WS;
}*/
/* : WORD ('=' (WORD ('%')? | ('-')? INT | STRING | HEXNUM))?*/
: WORD ( (WS)* '=' (WS)* (WORD | ('-')? INT ('%')? | STRING | HEXNUM))?
;
/*MISC STUFF*/
TEXT
/* : (WS | ~('<'|'\n'|'\r'|'"'|'>'))+ */
: (WS | ~('<'|'\n'|'\r'|'>'))+
;
/* : (
See comment in WS. Language for combining any flavor
newline is ambiguous. Shutting off the warning.
options {
generateAmbigWarnings=false;
}
: '\r' '\n' {[self newline];}
| '\r' {[self newline];}
| '\n' {[self newline];}
| ~('<'|'\n'|'\r'|'"'|'>')
)+
;
*/
COMMENT
: "<!--" (COMMENT_DATA)? "-->"
;
/*
INCLUDE
: "<#include " (INCLUDE_DATA)* "#>"
;
*/
protected
/*
INCLUDE_DATA
: (~("#>"))+
;
*/
/*
COMMENT_DATA
: (~('<' | '!' | '>'))+
;
*/
COMMENT_DATA
: ( /* '\r' '\n' can be matched in one alternative or by matching
'\r' in one iteration and '\n' in another. I am trying to
handle any flavor of newline that comes in, but the language
that allows both "\r\n" and "\r" and "\n" to all be valid
newline is ambiguous. Consequently, the resulting grammar
must be ambiguous. I'm shutting this warning off.
*/
options {
generateAmbigWarnings=false;
}
:
{[self LA:2]!='-' && [self LA:3]!='>'}? '-' // allow '-' if not "-->"
| '\r' '\n' {[self newline];}
| '\r' {[self newline];}
| '\n' {[self newline];}
| ~('-'|'\n'|'\r')
)*
;
/*
PROTECTED LEXER RULES
*/
protected
WS : (
/* '\r' '\n' can be matched in one alternative or by matching
'\r' in one iteration and '\n' in another. I am trying to
handle any flavor of newline that comes in, but the language
that allows both "\r\n" and "\r" and "\n" to all be valid
newline is ambiguous. Consequently, the resulting grammar
must be ambiguous. I'm shutting this warning off.
*/
options {
generateAmbigWarnings=false;
}
: ' '
| '\t'
| '\n' { [self newline]; }
| "\r\n" { [self newline]; }
| '\r' { [self newline]; }
)+
;
//the '.' is for words like "image.gif"
protected
WORD: ( LETTER
| '.'
| '_'
)
(
/* In reality, a WORD must be followed by whitespace, '=', or
what can follow an ATTR such as '>'. In writing this grammar,
however, we just list all the possibilities as optional
elements. This is loose, allowing the case where nothing is
matched after a WORD and then the (ATTR)* loop means the
grammar would allow "widthheight" as WORD WORD or WORD, hence,
an ambiguity. Naturally, ANTLR will consume the input as soon
as possible, combing "widthheight" into one WORD.
I am shutting off the ambiguity here because ANTLR does the
right thing. The exit path is ambiguous with ever
alternative. The only solution would be to write an unnatural
grammar (lots of extra productions) that laid out the
possibilities explicitly, preventing the bogus WORD followed
immediately by WORD without whitespace etc...
*/
options {
generateAmbigWarnings=false;
}
: LETTER
| DIGIT
| '.'
| '-'
| '_'
)+
;
protected
STRING
: '"' (~'"')* '"'
| '\'' (~'\'')* '\''
;
protected
WSCHARS
: ' '
| '\t'
| '\n' { [self newline]; }
| '\r' { [self newline]; }
;
protected
SPECIAL
: '<' | '~'
;
protected
HEXNUM
: '#' HEXINT
;
protected
INT : (DIGIT)+
;
protected
HEXINT
: (
/* Technically, HEXINT cannot be followed by a..f, but due to our
loose grammar, the whitespace that normally would follow this
rule is optional. ANTLR reports that #4FACE could parse as
HEXINT "#4" followed by WORD "FACE", which is clearly bogus.
ANTLR does the right thing by consuming a much input as
possible here. I shut the warning off.
*/
options {
generateAmbigWarnings=false;
}
: HEXDIGIT
)+
;
protected
DIGIT
: '0'..'9'
;
protected
HEXDIGIT
: ('0'..'9'|'A'..'F'|'a'..'f')
;
protected
LCLETTER
: 'a'..'z'
;
protected
UPLETTER
: 'A'..'Z'
;
protected
LETTER
: LCLETTER
| UPLETTER
;
protected
UNDEFINED_TOKEN
: '<' (~'>')* '>'
(
( /* the usual newline hassle: \r\n can be matched in alt 1
* or by matching alt 2 followed by alt 3 in another iteration.
*/
options {
generateAmbigWarnings=false;
}
: "\r\n" | '\r' | '\n'
)
{ [self newline];}
)*
{NSLog(@"invalid tag: %@",[self text]);}
| ( "\r\n" | '\r' | '\n' ) {[self newline];}
| .
;
/*
: ('<' { NSLog(@"Warning: non-standard tag <%c",(char)[self LA:1]); } )
(~'>' { NSLog(@"%c",(char)[self LA:1]);} )*
('>' { NSLog(@" skipped."); } )
{ _ttype = ANTLRToken_SKIP; }
;
*/

File diff suppressed because it is too large Load diff

View file

@ -1,142 +0,0 @@
/*
*/
header {
#include "GSWeb.h"
}
options {
language="Objc";
}
class GSWHTMLAttrParser extends Parser;
options {
exportVocab=GSWHTMLAttr;
buildAST=true;
k = 2;
}
{
NSString* tagName;
NSMutableDictionary* attributes;
NSString* currentAttrName; //no retain
id currentValue; //no retain
NSMutableArray* errors;
NSMutableArray* warnings;
}
tag
{
DESTROY(attributes);
DESTROY(tagName);
DESTROY(errors);
DESTROY(warnings);
attributes=[NSMutableDictionary new];
}
: tagNameLocal:IDENT { NSDebugMLLog(@"template",@"tagNameLocal:%@",[tagNameLocal_AST text]); ASSIGN(tagName,[tagNameLocal_AST text]); NSDebugMLLog(@"template",@"Found tagName=[%@]",tagName); }
(((WS)* (attr))*)?
;
attr:
attrName:IDENT { DESTROY(currentValue); currentAttrName=[[attrName text]lowercaseString];
NSDebugMLLog(@"template",@"Found currentAttrName=[%@]",currentAttrName);
}
((WS)*)?
(ASSIGN ((WS)*)? ( mvalue ))? { NSDebugMLLog(@"template",@"Add currentValue=[%@]",currentValue); [attributes setObject:currentValue forKey:currentAttrName]; }
;
mvalue:
( intValue:INT
{ ASSIGN(currentValue,[NSNumber valueFromString:[intValue text]]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue); }
| stringValue:STRING
{ ASSIGN(currentValue,[stringValue text]);
if ([currentValue isQuotedWith:@"\""])
{
ASSIGN(currentValue,[currentValue stringWithoutQuote:@"\""]);
};
NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue);
}
| hexNumValue:HEXNUM
{ ASSIGN(currentValue,[NSNumber valueFromString:[hexNumValue text]]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue); }
| pcValue:INTPC
{ ASSIGN(currentValue,[pcValue text]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue); }
| identValue:IDENT
{ ASSIGN(currentValue,[identValue text]); NSDebugMLLog(@"template",@"currentValue=[%@]",currentValue); }
)
;
class GSWHTMLAttrLexer extends Lexer;
options {
k = 8;
exportVocab=GSWHTMLAttr;
charVocabulary = '\3'..'\377';
caseSensitive=true;
filter=UNDEFINED_TOKEN;
}
/* STRUCTURAL tags
*/
IDENT
options { testLiterals = true; }
: (LETTER|'_')(LETTER|'_'|'-'|DIGIT)*
;
ASSIGN: '='
;
WS: ( ' ' | '\t' | '\n' | "\r\n" | '\r' )
;
STRING
: '"' (~'"')* '"'
| '\'' (~'\'')* '\''
;
POINT: '.';
INT : (DIGIT)+
;
PCINT : (DIGIT)+ '%'
;
HEXNUM
: '#' HEXINT
;
protected
HEXINT
: (
/* Technically, HEXINT cannot be followed by a..f, but due to our
loose grammar, the whitespace that normally would follow this
rule is optional. ANTLR reports that #4FACE could parse as
HEXINT "#4" followed by WORD "FACE", which is clearly bogus.
ANTLR does the right thing by consuming a much input as
possible here. I shut the warning off.
*/
options {
generateAmbigWarnings=false;
}
: HEXDIGIT
)+
;
protected
DIGIT
: '0'..'9'
;
protected
HEXDIGIT
: ('0'..'9'|'A'..'F'|'a'..'f')
;
protected
LCLETTER
: 'a'..'z'
;
protected
LETTER
: 'a'..'z'
| 'A'..'Z'
;