Commit 1b1e0251 authored by Claes Sjofors's avatar Claes Sjofors

Wb lexer and parser files removed

parent 04c4fa6f
This diff is collapsed.
/*
* Make sure to run antlr.Tool on the lexer.g file first!
*/
options {
mangleLiteralPrefix = "t_";
language="Cpp";
}
class wb_wbllexer extends Lexer;
options {
k=2;
exportVocab=wb_wblvocab;
charVocabulary = '\3'..'\377';
defaultErrorHandler=false;
}
tokens {
OBJECT;
ENDOBJECT;
VOLUME;
ENDVOLUME;
SOBJECT;
ENDSOBJECT;
BODY;
ENDBODY;
ATTRIBUTE;
BUFFER;
ENDBUFFER;
DOBJECT;
ENDDOBJECT;
DBUFFER;
ENDDBUFFER;
DATTRIBUTE;
NUM_FLOAT;
INT;
OID;
DOCBLOCK;
ASC_TIME;
}
EQ : '='
;
OREQ
: "|="
;
WS : (' '
| '\t'
| '\n' {newline();}
| '\r')+
{ _ttype = antlr::Token::SKIP; }
;
COMMENT
: ("!" ( ' ' | '\t') (~'\n')* '\n'
| "!" '\n')
{ _ttype = antlr::Token::SKIP; newline(); }
;
DOCBLOCK
: "!/**"
( /* '\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;
}
:
{ LA(2)!='*' }? '!'
| '\r' '\n' {newline();}
| '\r' {newline();}
| '\n' {newline();}
| ~('!'|'\n'|'\r')
)*
"!*/"
;
INDEX
options {
paraphrase="an index";
}
: '['! ('0'..'9')+ ']'!
;
VALUE
options {
testLiterals = false;
paraphrase = "an identifer";
}
/* :
('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'_'|':')+
;
*/
: ("Object" WS) => "Object"! WS! oname:('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'_'|SWEC)+
{$setType(OBJECT);}
| ("EndObject" WS) => "EndObject" WS!
{$setType(ENDOBJECT);}
| ("SObject" WS) => "SObject"! WS! soname:('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'_'|':'|'-'|SWEC)+
{$setType(SOBJECT);}
| ("EndSObject" WS) => "EndSObject" WS!
{$setType(ENDSOBJECT);}
| ("DObject" WS) => "DObject"! WS! doname:('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'_'|SWEC)+
{$setType(DOBJECT);}
| ("EndDObject" WS) => "EndDObject" WS!
{$setType(ENDDOBJECT);}
| ("Volume" WS) => "Volume"! WS! vname:('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'_'|SWEC)+ (':')?!
{$setType(VOLUME);}
| ("EndVolume" WS) => "EndVolume" WS!
{$setType(ENDVOLUME);}
| ("Buffer" WS) => "Buffer"! WS! buname:('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'_'|SWEC)+
{$setType(BUFFER);}
| ("EndBuffer" WS) => "EndBuffer" WS!
{$setType(ENDBUFFER);}
| ("Body" WS) => "Body"! WS! boname:('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'_'|SWEC)+
{$setType(BODY);}
| ("EndBody" WS) => "EndBody" WS!
{$setType(ENDBODY);}
| ("Attr" WS) => "Attr"! WS! aname:('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'_'|SWEC|'['|']')+ ('.'('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'_'|SWEC|'['|']')+)*
{$setType(ATTRIBUTE);}
| (DIGITS '.' DIGITS '.' ) => DIGITS '.' DIGITS '.' DIGITS '.' DIGITS (':' DIGITS)?
{$setType(OID);}
| ( ('0'..'9') ('0'..'9') '-' ('a'..'z'|'A'..'Z')('a'..'z'|'A'..'Z')('a'..'z'|'A'..'Z') '-') => ( ('0'..'9') ('0'..'9') '-' ('a'..'z'|'A'..'Z')('a'..'z'|'A'..'Z')('a'..'z'|'A'..'Z') '-' ('0'..'9')('0'..'9')('0'..'9')('0'..'9') ' ' ('0'..'9')('0'..'9') ':' ('0'..'9')('0'..'9') ':' ('0'..'9')('0'..'9') ('.' ('0'..'9')('0'..'9'))?)
{$setType(ASC_TIME);}
| (DIGITS '.') => DIGITS '.' ('0'..'9')* (('e'|'E') ('+'|'-')? ('0'..'9')+)?
{$setType(NUM_FLOAT);}
| ('-' DIGITS '.') => '-' DIGITS '.' ('0'..'9')* (('e'|'E') ('+'|'-')? ('0'..'9')+)?
{$setType(NUM_FLOAT);}
| '.' ('0'..'9')+ (('e'|'E') ('+'|'-')? ('0'..'9')+)?
{$setType(NUM_FLOAT);}
| DIGITS
{$setType(INT);}
| '-' DIGITS
{$setType(INT);}
| ('a'..'z'|'A'..'Z'|'$'|'_'|SWEC) ('a'..'z'|'A'..'Z'|'0'..'9'|'$'|'_'|SWEC)*
;
/*
{$setType(ASC_TIME);}
| ('0'..'9')+ '-' (SWEC)+ '-' ('0'..'9')+ ' ' ('0'..'9')+ ':' ('0'..'9')+ ':' ('0'..'9')+ ('.' ('0'..'9')+)?
*/
CHAR_LITERAL
: '\'' (ESC|~'\'') '\''
;
STRING_LITERAL
: '"' (ESC|'\n' {newline();} |~'"')* '"'
;
protected
DIGITS
:
('0'..'9')+
;
protected
ESC : '\\'
( 'n'
| 'r'
| 't'
| 'b'
| 'f'
| 'x'
| '"'
| '0'
| '\''
| '\\'
)
;
protected
SWEC : '\345' | '\344' | '\366' | '\305' | '\304' | '\326';
#ifndef INC_wb_wbllexer_hpp_
#define INC_wb_wbllexer_hpp_
#include <antlr/config.hpp>
/* $ANTLR 2.7.6 (20060211): "wb_wbllexer.g" -> "wb_wbllexer.hpp"$ */
#include <antlr/CommonToken.hpp>
#include <antlr/InputBuffer.hpp>
#include <antlr/BitSet.hpp>
#include "wb_wblvocabTokenTypes.hpp"
#include <antlr/CharScanner.hpp>
class CUSTOM_API wb_wbllexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public wb_wblvocabTokenTypes
{
#line 1 "wb_wbllexer.g"
#line 15 "wb_wbllexer.hpp"
private:
void initLiterals();
public:
bool getCaseSensitiveLiterals() const
{
return true;
}
public:
wb_wbllexer(ANTLR_USE_NAMESPACE(std)istream& in);
wb_wbllexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib);
wb_wbllexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state);
ANTLR_USE_NAMESPACE(antlr)RefToken nextToken();
public: void mEQ(bool _createToken);
public: void mOREQ(bool _createToken);
public: void mWS(bool _createToken);
public: void mCOMMENT(bool _createToken);
public: void mDOCBLOCK(bool _createToken);
public: void mINDEX(bool _createToken);
public: void mVALUE(bool _createToken);
protected: void mSWEC(bool _createToken);
protected: void mDIGITS(bool _createToken);
public: void mCHAR_LITERAL(bool _createToken);
protected: void mESC(bool _createToken);
public: void mSTRING_LITERAL(bool _createToken);
private:
static const unsigned long _tokenSet_0_data_[];
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0;
static const unsigned long _tokenSet_1_data_[];
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1;
static const unsigned long _tokenSet_2_data_[];
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2;
static const unsigned long _tokenSet_3_data_[];
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3;
static const unsigned long _tokenSet_4_data_[];
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4;
static const unsigned long _tokenSet_5_data_[];
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5;
};
#endif /*INC_wb_wbllexer_hpp_*/
#ifndef INC_wb_wblvocabTokenTypes_hpp_
#define INC_wb_wblvocabTokenTypes_hpp_
/* $ANTLR 2.7.6 (20060211): "wb_wbllexer.g" -> "wb_wblvocabTokenTypes.hpp"$ */
#ifndef CUSTOM_API
# define CUSTOM_API
#endif
#ifdef __cplusplus
struct CUSTOM_API wb_wblvocabTokenTypes {
#endif
enum {
EOF_ = 1,
OBJECT = 4,
ENDOBJECT = 5,
VOLUME = 6,
ENDVOLUME = 7,
SOBJECT = 8,
ENDSOBJECT = 9,
BODY = 10,
ENDBODY = 11,
ATTRIBUTE = 12,
BUFFER = 13,
ENDBUFFER = 14,
DOBJECT = 15,
ENDDOBJECT = 16,
DBUFFER = 17,
ENDDBUFFER = 18,
DATTRIBUTE = 19,
NUM_FLOAT = 20,
INT = 21,
OID = 22,
DOCBLOCK = 23,
ASC_TIME = 24,
EQ = 25,
OREQ = 26,
WS = 27,
COMMENT = 28,
INDEX = 29,
VALUE = 30,
CHAR_LITERAL = 31,
STRING_LITERAL = 32,
DIGITS = 33,
ESC = 34,
SWEC = 35,
NULL_TREE_LOOKAHEAD = 3
};
#ifdef __cplusplus
};
#endif
#endif /*INC_wb_wblvocabTokenTypes_hpp_*/
// $ANTLR 2.7.6 (20060211): wb_wbllexer.g -> wb_wblvocabTokenTypes.txt$
wb_wblvocab // output token vocab name
OBJECT=4
ENDOBJECT=5
VOLUME=6
ENDVOLUME=7
SOBJECT=8
ENDSOBJECT=9
BODY=10
ENDBODY=11
ATTRIBUTE=12
BUFFER=13
ENDBUFFER=14
DOBJECT=15
ENDDOBJECT=16
DBUFFER=17
ENDDBUFFER=18
DATTRIBUTE=19
NUM_FLOAT=20
INT=21
OID=22
DOCBLOCK=23
ASC_TIME=24
EQ=25
OREQ=26
WS=27
COMMENT=28
INDEX("an index")=29
VALUE("an identifer")=30
CHAR_LITERAL=31
STRING_LITERAL=32
DIGITS=33
ESC=34
SWEC=35
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment