| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2003-2015 Dmitry Tsarkov and The University of Manchester |
| 3 | Copyright (C) 2015-2017 Dmitry Tsarkov |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU General Public License |
| 7 | as published by the Free Software Foundation; either version 2 |
| 8 | of the License, or (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software |
| 17 | Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | //------------------------------------------------------------------------- |
| 21 | // |
| 22 | // Scanner class for FaCT++ |
| 23 | // |
| 24 | //------------------------------------------------------------------------- |
| 25 | #ifndef SCANNER_H |
| 26 | #define SCANNER_H |
| 27 | |
| 28 | #include "lispgrammar.h" |
| 29 | #include "comscanner.h" |
| 30 | |
| 31 | /// more-or-less general simple scanner implementation |
| 32 | class TsScanner: public CommonScanner |
| 33 | { |
| 34 | protected: // methods |
| 35 | /// fill buffer with name in '|'-s; c should be starting '|' |
| 36 | void FillNameBuffer ( register char c ); |
| 37 | /// fill buffer with legal ID chars, starting from c |
| 38 | void FillBuffer ( register char c ); |
| 39 | /// check if given character is legal in ID |
| 40 | bool isLegalIdChar ( char c ) const; |
| 41 | |
| 42 | public: // interface |
| 43 | /// c'tor |
| 44 | explicit TsScanner ( std::istream* inp ) : CommonScanner(inp) {} |
| 45 | |
| 46 | /// get next token from stream |
| 47 | LispToken GetLex ( void ); |
| 48 | /// get keyword for a command by given text in buffer; @return BAD_LEX if no keyword found |
| 49 | LispToken getCommandKeyword ( void ) const; |
| 50 | /// get keyword for a concept/role expression; @return BAD_LEX if no keyword found |
| 51 | LispToken getExpressionKeyword ( void ) const; |
| 52 | /// get keyword for a concept/role special name; @return ID if no keyword found |
| 53 | LispToken getNameKeyword ( void ) const; |
| 54 | }; // TsScanner |
| 55 | |
| 56 | #endif |