Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

exprint.cpp

Go to the documentation of this file.
00001 #include <SdlArs.h>
00002 
00003 #include "exprint.h"
00004 
00005 namespace Ars
00006 {
00007 /*
00008         BNF
00009         ===
00010 
00011         <Expr> ::= <Expr> <op> <Expr>
00012         <Expr> ::= ( <Expr> )
00013         <Expr> ::= - <Expr>
00014         <Expr> ::= Identifier | value
00015         <Op> ::= + | - | * | / | |
00016 */
00017 
00018 const char ExprInt::sr[10][10] =        
00019 {       //                               +         -     *     /     |     Id    (     )     $    Val 
00020         /* +  */        {       '>' , '>' , '<' , '<' , '>' , '<' , '<' , '>' , '>'     , '<' } ,
00021         /* -  */        {       '>' , '>' , '<' , '<' , '>' , '<' , '<' , '>' , '>'     , '<' } ,
00022         /* *  */        {       '>' , '>' , '>' , '>' , '>' , '<' , '<' , '>' , '>'     , '<' } ,
00023         /* /  */        {       '>' , '>' , '>' , '>' , '>' , '<' , '<' , '>' , '>'     , '<' } ,
00024         /* |  */        {       '>' , '>' , '<' , '<' , '>' , '<' , '<' , '>' , '>'     , '<' } ,
00025         /* Id */        {       '>' , '>' , '>' , '>' , '>' , ' ' , ' ' , '>' , '>'     , ' ' } ,
00026         /* (  */        {       '<' , '<' , '<' , '<' , '<' , '<' , '<' , '=' , '>'     , '<' } ,
00027         /* )  */        {       '>' , '>' , '>' , '>' , '>' , ' ' , ' ' , '>' , '>'     , ' ' } ,
00028         /* $  */        {       '<' , '<' , '<' , '<' , '<' , '<' , '<' , ' ' , '$'     , '<' } ,
00029         /*Val */        {       '>' , '>' , '>' , '>' , '>' , ' ' , ' ' , '>' , '>'     , ' ' } 
00030 };
00032 ExprInt::ExprInt( const string &aBuffer )
00033 : Lexer( aBuffer )
00034 {
00036         symbol.insert( std::make_pair( string( "$" ) , 8) );
00037         symbol.insert( std::make_pair( string( "(" ) , 6) );
00038         symbol.insert( std::make_pair( string( ")" ) , 7) );
00039         symbol.insert( std::make_pair( string( "|" ) , 4) );
00040         symbol.insert( std::make_pair( string( "+" ) , 0) );
00041         symbol.insert( std::make_pair( string( "-" ) , 1) );
00042         symbol.insert( std::make_pair( string( "/" ) , 3) );
00043         symbol.insert( std::make_pair( string( "*" ) , 2) );
00044         symbol.insert( std::make_pair( string( "Id" ) , 5) );
00045 
00046         symbol.insert( std::make_pair( string( "Val" ) , 9) );
00047 
00048 
00049 }
00050 const int ExprInt::EofId( void ) const
00051 {
00052         return 8;
00053 }
00054 
00055 const int ExprInt::IdentifierId( void ) const
00056 {
00057         return 5;
00058 }
00059 
00060 const int ExprInt::NumberId( void ) const
00061 {
00062         return 9;
00063 }
00064 
00065 }

Generated on Fri Dec 5 04:05:59 2003 for Borqueror by doxygen 1.3.3