Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

InputParser.h

Go to the documentation of this file.
00001 // Parser.h: interface for the CParser class.
00002 // Eindhoven University of Technology 1997
00003 // OOPS team (Serge vd Boom, Erwin Coumans, Tom Geelen, Wynke Stuylemeier)
00005 /*
00006  * Copyright (c) 1996-2000 Erwin Coumans <[email protected]>
00007  *
00008  * Permission to use, copy, modify, distribute and sell this software
00009  * and its documentation for any purpose is hereby granted without fee,
00010  * provided that the above copyright notice appear in all copies and
00011  * that both that copyright notice and this permission notice appear
00012  * in supporting documentation.  Erwin Coumans makes no
00013  * representations about the suitability of this software for any
00014  * purpose.  It is provided "as is" without express or implied warranty.
00015  *
00016  */
00017 #ifndef __INPUTPARSER_H__
00018 #define __INPUTPARSER_H__
00019 
00020 class CParser;
00021 #include "Expression.h"
00022 
00023 
00024 class CParser {
00025 public:
00026         CParser();
00027         virtual                         ~CParser();
00028 
00029         float                           GetFloat(CCString txt);
00030         CValue*                         GetValue(CCString txt, bool bFallbackToText=false);
00031         CExpression*            ProcessText(CCString intext);
00032         void                            SetContext(CValue* context);
00033 
00034 private:
00035         enum symbols {errorsym, lbracksym, rbracksym, cellsym, commasym,
00036                 opsym, constsym, sumsym, ifsym, whocodedsym, eolsym,idsym};                     // all kinds of symbols
00037         enum optype { OPplus, OPminus, OPtimes, OPdivide, OPand, OPor, OPequal,
00038                 OPunequal, OPgreater, OPless, OPgreaterequal, OPlessequal, OPnot };             // all kinds of operators
00039         enum consttype { booltype, inttype, floattype, stringtype };            // all kinds of constants
00040         
00041         int sym,                                        // current symbol
00042                 opkind,                                 // kind of operator, if symbol is an operator
00043                 constkind;                              // kind of operator, if symbol is a constant
00044         
00045         char ch;                                        // current character
00046         int chcount;                            // index to character in input string
00047         CExpression *errmsg;            // contains a errormessage, if scanner error
00048         
00049         CCString text,                          // contains a copy of the original text
00050                 const_as_string;                // string representation of the symbol, if symbol is a constant
00051         bool boolvalue;                         // value of the boolean, if symbol is a constant of type boolean
00052         CValue* m_identifierContext;// context in which identifiers are looked up
00053         
00054         
00055         void ScanError(CCString str);
00056         CExpression* Error(CCString str);
00057         void NextCh();
00058         void TermChar(char c);
00059         void DigRep();
00060         void CharRep();
00061         void GrabString(int start);
00062         void NextSym();
00063         int MakeInt();
00064         CCString Symbol2Str(int s);
00065         void Term(int s);
00066         int Priority(int optor);
00067         CExpression *Ex(int i);
00068         CExpression *Expr();
00069 
00070 };
00071 
00072 #endif

Generated at Thu Feb 1 13:03:03 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000