| 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 library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library 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 GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef TLEXEME_H |
| 21 | #define TLEXEME_Hcxx . . $ `Kernel/tLexeme.h:21:9`! |
| 22 | |
| 23 | #include "grammar.h"cxx . . $ `<file>/Kernel/grammar.h`/ |
| 24 | #include "tNamedEntry.h"cxx . . $ `<file>/Kernel/tNamedEntry.h`/ |
| 25 | |
| 26 | /// Lexeme (smallest lexical element) in a syntax tree |
| 27 | class TLexemecxx . . $ TLexeme# |
| 28 | { |
| 29 | private: // members |
| 30 | /// Lexeme's Token |
| 31 | Tokencxx . . $ Token# tokencxx . . $ TLexeme#token.; |
| 32 | /// pointer to information (for names) |
| 33 | unioncxx . . $ TLexeme#$anonymous_type_0# |
| 34 | { |
| 35 | TNamedEntrycxx . . $ TNamedEntry#* pNEcxx . . $ TLexeme#$anonymous_type_0#pNE.; |
| 36 | unsigned int datacxx . . $ TLexeme#$anonymous_type_0#data.; |
| 37 | } valuecxx . . $ TLexeme#value.; |
| 38 | |
| 39 | public: // interface |
| 40 | /// default c'tor for pointers |
| 41 | explicit TLexemecxx . . $ TLexeme#TLexeme(fd83bdfbf3306061). ( Tokencxx . . $ Token# tok, TNamedEntrycxx . . $ TNamedEntry#* p = nullptr ) : tokencxx . . $ TLexeme#token.(tok) { valuecxx . . $ TLexeme#value..pNEcxx . . $ TLexeme#$anonymous_type_0#pNE. = p; } |
| 42 | /// default c'tor for numbers |
| 43 | TLexemecxx . . $ TLexeme#TLexeme(631a59f97281b4ff). ( Tokencxx . . $ Token# tok, unsigned int val ) : tokencxx . . $ TLexeme#token.(tok) { valuecxx . . $ TLexeme#value..datacxx . . $ TLexeme#$anonymous_type_0#data. = val; } |
| 44 | /// Copy c'tor |
| 45 | TLexemecxx . . $ TLexeme#TLexeme(53cc9c01a6b2d9a9). ( const TLexemecxx . . $ TLexeme#& ) = default; |
| 46 | /// Assignment |
| 47 | TLexemecxx . . $ TLexeme#& operatorcxx . . $ TLexeme#`operator=`(d573732c929da5f6). = ( const TLexemecxx . . $ TLexeme#& ) = default; |
| 48 | |
| 49 | // access |
| 50 | |
| 51 | /// get Token of given Lexeme |
| 52 | Tokencxx . . $ Token# getTokencxx . . $ TLexeme#getToken(d71a1020745f3953). ( void ) const { return tokencxx . . $ TLexeme#token.; } |
| 53 | /// get name pointer of given lexeme |
| 54 | TNamedEntrycxx . . $ TNamedEntry#* getNEcxx . . $ TLexeme#getNE(28c03b9fd3c689f8). ( void ) const { return valuecxx . . $ TLexeme#value..pNEcxx . . $ TLexeme#$anonymous_type_0#pNE.; } |
| 55 | /// get name pointer of given lexeme |
| 56 | const char* getNamecxx . . $ TLexeme#getName(a9f41ea0e82d88cf). ( void ) const { return valuecxx . . $ TLexeme#value..pNEcxx . . $ TLexeme#$anonymous_type_0#pNE.->getNamecxx . . $ TNamedEntry#getName(a9f41ea0e82d88cf).(); } |
| 57 | /// get data value of given lexeme |
| 58 | unsigned int getDatacxx . . $ TLexeme#getData(ddd8539a2fcdd4ce). ( void ) const { return valuecxx . . $ TLexeme#value..datacxx . . $ TLexeme#$anonymous_type_0#data.; } |
| 59 | |
| 60 | // comparison |
| 61 | |
| 62 | /// full lexeme comparison (equality) |
| 63 | bool operatorcxx . . $ TLexeme#`operator==`(74388fceb8e04cbf). == ( const TLexemecxx . . $ TLexeme#& lex ) const { return ( tokencxx . . $ TLexeme#token. == lex.tokencxx . . $ TLexeme#token. && valuecxx . . $ TLexeme#value..datacxx . . $ TLexeme#$anonymous_type_0#data. == lex.valuecxx . . $ TLexeme#value..datacxx . . $ TLexeme#$anonymous_type_0#data. ); } |
| 64 | /// full lexeme comparison (inequality) |
| 65 | bool operatorcxx . . $ TLexeme#`operator!=`(74388fceb8e04cbf). != ( const TLexemecxx . . $ TLexeme#& lex ) const { return !( *this ==cxx . . $ TLexeme#`operator==`(74388fceb8e04cbf). lex ); } |
| 66 | /// just token comparison (equality) |
| 67 | bool operatorcxx . . $ TLexeme#`operator==`(b418e6031985303a). == ( Tokencxx . . $ Token# tok ) const { return ( tokencxx . . $ TLexeme#token. == tok ); } |
| 68 | /// just token comparison (inequality) |
| 69 | bool operatorcxx . . $ TLexeme#`operator!=`(b418e6031985303a). != ( Tokencxx . . $ Token# tok ) const { return ( tokencxx . . $ TLexeme#token. != tok ); } |
| 70 | }; // TLexeme |
| 71 | |
| 72 | #endif |