#include <interpret.h>
Inheritance diagram for Lexer:
Public Member Functions | |
Lexer (const string &aBuffer) | |
~Lexer (void) | |
virtual const int | GetTopSymbol (void) |
virtual const char | atSr (const int ati, const int atj)=0 |
virtual const int | EofId (void) const=0 |
virtual const int | IdentifierId (void) const=0 |
virtual const int | NumberId (void) const=0 |
const bool | IsReal (void) const |
const string & | GetConstant (void) const |
Data Fields | |
int | lineno |
std::map< string, int, greater< string > > | symbol |
Protected Member Functions | |
virtual const bool | isSeparator (void) |
virtual const int | SkipComment (void) |
virtual const int | LexNext (void) |
virtual const int | GetIdentifier (void) |
virtual const int | GetNumber (void) |
Private Attributes | |
const string & | buffer |
string::size_type | at |
string::size_type | bufLen |
string | constantStr |
bool | realConstant |
|
Definition at line 3 of file interpret.cpp.
|
|
Definition at line 23 of file interpret.h.
00023 {}; |
|
Implemented in Ars::ExprInt, Expr, and Ars::ExprInt. Referenced by Interpret::Run(). |
|
Implemented in Ars::ExprInt, Expr, and Ars::ExprInt. Referenced by Interpret::Initialize(), and SkipComment(). |
|
Definition at line 33 of file interpret.h. References constantStr. Referenced by Interpret::Run(), and Interpret::ShiftRule().
00033 { return constantStr; } |
|
Definition at line 66 of file interpret.cpp. References at, buffer, constantStr, and IdentifierId(). Referenced by LexNext().
00067 { 00068 while( isalnum( buffer[at] ) || buffer[at] == '_' ) 00069 constantStr += buffer[at++]; 00070 00071 return IdentifierId(); 00072 } |
|
Definition at line 74 of file interpret.cpp. References at, buffer, constantStr, NumberId(), and realConstant. Referenced by LexNext().
00075 { 00076 while( isdigit( buffer[at] ) ) 00077 constantStr += buffer[at++]; 00078 if( buffer[at] == '.' ) 00079 { 00080 at += 1; 00081 realConstant = true; 00082 constantStr += '.'; 00083 while( isdigit( buffer[at] ) ) 00084 constantStr += buffer[at++]; 00085 } 00086 return NumberId(); 00087 } |
|
Definition at line 8 of file interpret.cpp. References at, constantStr, isSeparator(), realConstant, and SkipComment(). Referenced by Interpret::Run(), and SkipComment().
00009 { 00010 realConstant = false; 00011 constantStr.clear(); 00012 00013 while( isSeparator() ) 00014 at++; 00015 00016 return SkipComment(); 00017 } |
|
Implemented in Ars::ExprInt, Expr, and Ars::ExprInt. Referenced by GetIdentifier(). |
|
Definition at line 32 of file interpret.h. References realConstant.
00032 { return realConstant; } |
|
Definition at line 19 of file interpret.cpp. References at, buffer, bufLen, and lineno. Referenced by GetTopSymbol().
|
|
Definition at line 48 of file interpret.cpp. References at, buffer, constantStr, GetIdentifier(), GetNumber(), and symbol. Referenced by SkipComment().
00049 { 00050 for( map<string,int,greater<string> >::iterator it = symbol.begin() ; it != symbol.end() ; ++it ) 00051 if( buffer.substr( at , it->first.length() ) == it->first ) 00052 { 00053 constantStr = it->first; 00054 at += it->first.length(); 00055 return it->second; 00056 } 00057 00058 if( isalpha( buffer[at] ) ) 00059 return GetIdentifier(); 00060 else if( isdigit( buffer[at] ) ) 00061 return GetNumber(); 00062 00063 return -1; 00064 } |
|
Implemented in Ars::ExprInt, Expr, and Ars::ExprInt. Referenced by GetNumber(). |
|
Definition at line 30 of file interpret.cpp. References at, buffer, bufLen, EofId(), GetTopSymbol(), and LexNext(). Referenced by GetTopSymbol().
00031 { 00032 if( at > bufLen ) 00033 return -1; 00034 else if( at == bufLen ) 00035 { 00036 at += 1; 00037 return EofId(); 00038 } 00039 else if( (at + 2) < bufLen && buffer.substr( at , 2 ) == "//" ) 00040 { 00041 at = buffer.find( '\n' , at ); 00042 00043 return GetTopSymbol(); 00044 } 00045 return LexNext(); 00046 } |
|
Definition at line 10 of file interpret.h. Referenced by GetIdentifier(), GetNumber(), GetTopSymbol(), isSeparator(), LexNext(), and SkipComment(). |
|
Definition at line 9 of file interpret.h. Referenced by GetIdentifier(), GetNumber(), isSeparator(), LexNext(), and SkipComment(). |
|
Definition at line 10 of file interpret.h. Referenced by isSeparator(), and SkipComment(). |
|
Definition at line 12 of file interpret.h. Referenced by GetConstant(), GetIdentifier(), GetNumber(), GetTopSymbol(), and LexNext(). |
|
Definition at line 17 of file interpret.h. Referenced by isSeparator(). |
|
Definition at line 13 of file interpret.h. Referenced by GetNumber(), GetTopSymbol(), and IsReal(). |
|
Definition at line 19 of file interpret.h. Referenced by Expr::Expr(), Ars::ExprInt::ExprInt(), and LexNext(). |