char* ClassBuffer::ParentName (TextBuffer* tb, int& beg) { Regexp delimiter("{"); int delim = tb->ForwardSearch(&delimiter, beg); if (delim < 0) { return nil; } for (;;) { char* string = Identifier(tb, beg); if (string == nil || beg >= delim) { delete string; beg = delim; return nil; } else if (KeyWord(string)) { delete string; string = nil; } else { return string; } } }
#include "Token.h" #include "TokenTypeTable.h" #include "KeyWord.h" Token nextToken(); int nextChar(); bool is_ope2(int c1, int c2); TokenType get_type(const std::string & s); TokenTypeTable tokens; Token token; std::ifstream fin; KeyWord tblKeyWord[] = { KeyWord("if", If), KeyWord("else", Else), KeyWord("end", End), KeyWord("print", Print), KeyWord("(", Lparen), KeyWord(")", Rparen), KeyWord("+", Plus), KeyWord("-", Minus), KeyWord("*", Multi), KeyWord("/", Divi), KeyWord("=", Assign), KeyWord(",", Comma), KeyWord("==", Equal), KeyWord("!=", NotEqual), KeyWord("<", Less), KeyWord("<=", LessEq), KeyWord(">", Great), KeyWord(">=", GreatEq), KeyWord("", END_List), }; int main(int argc, char * argv[]) { if(argc == 1) {