Wexus2 0.20
wexus2.src/wexus/CPPScanner.h
00001 
00002 /*
00003  * Copyright (c) 2011 Aleksander B. Demko
00004  * This source code is distributed under the MIT license.
00005  * See the accompanying file LICENSE.MIT.txt for details.
00006  */
00007 
00008 #ifndef __INCLUDED_WEXUS_CPPSCANNER_H__
00009 #define __INCLUDED_WEXUS_CPPSCANNER_H__
00010 
00011 #include <QList>
00012 #include <QByteArray>
00013 
00014 namespace wexus
00015 {
00016   class CPPToken;
00017 
00018   typedef QList<CPPToken> CPPTokenList;
00019 
00020   void CPPScanner(const QByteArray &ary, CPPTokenList &outlist);
00021 }
00022 
00023 class wexus::CPPToken
00024 {
00025   public:
00026     static const int TK_Dlit = 256;
00027     static const int TK_Slit = 257;
00028     static const int TK_Float = 258;
00029     static const int TK_Id = 259;
00030     static const int TK_NameSep = 260;
00031     static const int TK_Arrow = 261;
00032     static const int TK_PlusPlus = 262;
00033     static const int TK_MinusMinus = 263;
00034     static const int TK_ArrowStar = 264;
00035     static const int TK_DotStar = 265;
00036     static const int TK_ShiftLeft = 266;
00037     static const int TK_ShiftRight = 267;
00038     static const int TK_IntegerDecimal = 268;
00039     static const int TK_IntegerOctal = 269;
00040     static const int TK_IntegerHex = 270;
00041     static const int TK_EqualsEquals = 271;
00042     static const int TK_NotEquals = 272;
00043     static const int TK_AndAnd = 273;
00044     static const int TK_OrOr = 274;
00045     static const int TK_MultAssign = 275;
00046     static const int TK_DivAssign = 276;
00047     static const int TK_PercentAssign = 277;
00048     static const int TK_PlusAssign = 278;
00049     static const int TK_MinusAssign = 279;
00050     static const int TK_AmpAssign = 280;
00051     static const int TK_CaretAssign = 281;
00052     static const int TK_BarAssign = 282;
00053     static const int TK_DotDotDot = 283;
00054     static const int TK_Whitespace = 284;
00055     static const int TK_Comment = 285;
00056     // + a lot of single char tokens for val <256
00057 
00058   public:
00059     int id;
00060     QByteArray::const_iterator ts, te;
00061 
00062   public:
00063     CPPToken(int _id, QByteArray::const_iterator _ts, QByteArray::const_iterator _te);
00064 
00065     /// returns this token as a debug-printable like string
00066     QString toString(void) const;
00067     /// returns ts/te as a string
00068     QString value(void) const;
00069 
00070     operator int(void) const { return id; }
00071 };
00072 
00073 #endif
00074 
 All Classes Namespaces Functions Variables Enumerations Enumerator