#ifndef GRAMMAR_H #define GRAMMAR_H ///////////////////////////////////////////////////////////////////// // grammar.h - provides detectors for grammatical constructs // // ver 1.0 // // // // Language: Visual C++, ver 7.0 // // Platfrom: Dell Dimension 8100, Windows 2000, SP 2.0 // // Application: Prototype for CSE687 Pr#2, Spring 2003 // // Author: Jim Fawcett, CST 2-187, Syracuse University // // (315) 443-3948, jfawcett@twcny.rr.com // ///////////////////////////////////////////////////////////////////// /* Module Operation: ================= The grammar module provides a set of detector functions that identify gramatical constructs captured by the tokens in a semiExp object. Public Interface: ================= semiExp se(in); // create a semiExp object grammar g(se); // create a grammar object bool b = g.functionDef(); // is a function definition? bool b = g.include(); // is an include statement? */ ///////////////////////////////////////////////////////////////////// // Build Process // ///////////////////////////////////////////////////////////////////// // Required Files: // // grammar.h, grammar.cpp, semi.h, semi.cpp, tok.h, tok.cpp // // // // Compiler command: // // cl /DTEST_SCANNER grammar.cpp semi.cpp tok.cpp display.cpp // ///////////////////////////////////////////////////////////////////// /* Maintenance History: ==================== ver 1.0 : 02/08/03 - first release */ // #include "semi.h" class grammar { public: grammar(semiExp &se); bool include(); bool functionDef(); bool invocation(); bool declar(); private: bool specialKeys(const std::string &s); semiExp& _se; // don't copy }; //----< initializes a grammar object with a semiExp >---------- inline grammar::grammar(semiExp &se) : _se(se) {} //----< detects #include statements >-------------------------- inline bool grammar::include() { return (_se[0]=="#" && _se[1]=="include"); } #endif