src/Token.h
changeset 195 c1ba166f3fc4
parent 194 b029d63565a2
child 196 9904633b1dfc
     1.1 --- a/src/Token.h	Mon Sep 17 00:10:01 2012 -0700
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,144 +0,0 @@
     1.4 -/* vim: set ts=4 sw=4 tw=99 et:
     1.5 - * 
     1.6 - * Copyright (C) 2012 David Anderson
     1.7 - *
     1.8 - * This file is part of SourcePawn.
     1.9 - *
    1.10 - * SourcePawn is free software: you can redistribute it and/or modify it under
    1.11 - * the terms of the GNU General Public License as published by the Free
    1.12 - * Software Foundation, either version 3 of the License, or (at your option)
    1.13 - * any later version.
    1.14 - * 
    1.15 - * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY
    1.16 - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.17 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    1.18 - *
    1.19 - * You should have received a copy of the GNU General Public License along with
    1.20 - * SourcePawn. If not, see http://www.gnu.org/licenses/.
    1.21 - */
    1.22 -#ifndef _include_jitcraft_token_h_
    1.23 -#define _include_jitcraft_token_h_
    1.24 -
    1.25 -namespace ke {
    1.26 -
    1.27 -struct SourcePosition
    1.28 -{
    1.29 -    int line;
    1.30 -    int col;
    1.31 -
    1.32 -    SourcePosition()
    1.33 -      : line(-1),
    1.34 -        col(-1)
    1.35 -    {
    1.36 -    }
    1.37 -
    1.38 -    SourcePosition(unsigned line, unsigned col)
    1.39 -      : line(line),
    1.40 -        col(col)
    1.41 -    {
    1.42 -    }
    1.43 -};
    1.44 -
    1.45 -// List of tokens the scanner can recognize.
    1.46 -//
    1.47 -// Some restrictions:
    1.48 -//   * (ASSIGN_ADD - TOK_PLUS) must be the delta between an operator and its
    1.49 -//     op-and-assign equivalent.
    1.50 -#define TOKENMAP(_)                                     \
    1.51 -    _(NONE,               "<none>")                     \
    1.52 -    _(ERROR,              "<error>")                    \
    1.53 -    _(NEW,                "'new'")                      \
    1.54 -    _(FOR,                "'for'")                      \
    1.55 -    _(RETURN,             "'return'")                   \
    1.56 -    _(NAME,               "<name>")                     \
    1.57 -    _(INTEGER_LITERAL,    "<integer>")                  \
    1.58 -    _(HEX_LITERAL,        "<hex>")                      \
    1.59 -    _(FLOAT_LITERAL,      "<float>")                    \
    1.60 -    _(STRING_LITERAL,     "<string>")                   \
    1.61 -    _(IF,                 "<if>")                       \
    1.62 -    _(ELSE,               "<else>")                     \
    1.63 -    _(ENUM,               "<enum>")                     \
    1.64 -    _(LABEL,              "<label>")                    \
    1.65 -    _(WHILE,              "<while>")                    \
    1.66 -    _(DO,                 "<do>")                       \
    1.67 -    _(BREAK,              "<break>")                    \
    1.68 -    _(CONTINUE,           "<continue>")                 \
    1.69 -    _(FORWARD,            "<forward>")                  \
    1.70 -    _(PUBLIC,             "<public>")                   \
    1.71 -    _(CONST,              "<const>")                    \
    1.72 -    _(NATIVE,             "<native>")                   \
    1.73 -    _(STOCK,              "<stock>")                    \
    1.74 -    _(TRUE,               "<true>")                     \
    1.75 -    _(FALSE,              "<false>")                    \
    1.76 -    _(STRUCT,             "<struct>")                   \
    1.77 -    _(SWITCH,             "<switch>")                   \
    1.78 -    _(CASE,               "<case>")                     \
    1.79 -    _(DEFAULT,            "<default>")                  \
    1.80 -    _(TYPEDEF,            "<typedef>")                  \
    1.81 -    _(VOID,               "<void>")                     \
    1.82 -    _(INT,                "<int>")                      \
    1.83 -    _(SIZEOF,             "<sizeof>")                   \
    1.84 -    _(ELLIPSES,           "...")                        \
    1.85 -    _(PLUS,               "+")                          \
    1.86 -    _(MINUS,              "-")                          \
    1.87 -    _(STAR,               "*")                          \
    1.88 -    _(SLASH,              "/")                          \
    1.89 -    _(PERCENT,            "%")                          \
    1.90 -    _(AMPERSAND,          "&")                          \
    1.91 -    _(BITOR,              "|")                          \
    1.92 -    _(BITXOR,             "^")                          \
    1.93 -    _(SHR,                ">>")                         \
    1.94 -    _(USHR,               ">>>")                        \
    1.95 -    _(SHL,                "<<")                         \
    1.96 -    _(ASSIGN,             "=")                          \
    1.97 -    _(SEMICOLON,          ";")                          \
    1.98 -    _(LBRACE,             "{")                          \
    1.99 -    _(RBRACE,             "}")                          \
   1.100 -    _(LPAREN,             "(")                          \
   1.101 -    _(RPAREN,             ")")                          \
   1.102 -    _(LBRACKET,           "[")                          \
   1.103 -    _(RBRACKET,           "]")                          \
   1.104 -    _(ASSIGN_ADD,         "+=")                         \
   1.105 -    _(ASSIGN_SUB,         "-=")                         \
   1.106 -    _(ASSIGN_MUL,         "*=")                         \
   1.107 -    _(ASSIGN_DIV,         "/=")                         \
   1.108 -    _(ASSIGN_MOD,         "%=")                         \
   1.109 -    _(ASSIGN_BITAND,      "&=")                         \
   1.110 -    _(ASSIGN_BITOR,       "|=")                         \
   1.111 -    _(ASSIGN_BITXOR,      "^=")                         \
   1.112 -    _(ASSIGN_SHR,         ">>=")                        \
   1.113 -    _(ASSIGN_USHR,        ">>>=")                       \
   1.114 -    _(ASSIGN_SHL,         "<<=")                        \
   1.115 -    _(INCREMENT,          "++")                         \
   1.116 -    _(DECREMENT,          "--")                         \
   1.117 -    _(EQUALS,             "==")                         \
   1.118 -    _(NOTEQUALS,          "!=")                         \
   1.119 -    _(LT,                 "<")                          \
   1.120 -    _(LE,                 "<=")                         \
   1.121 -    _(GT,                 ">")                          \
   1.122 -    _(GE,                 ">=")                         \
   1.123 -    _(AND,                "&&")                         \
   1.124 -    _(OR,                 "||")                         \
   1.125 -    _(COMMA,              ",")                          \
   1.126 -    _(NOT,                "!")                          \
   1.127 -    _(TILDE,              "~")                          \
   1.128 -    _(QMARK,              "?")                          \
   1.129 -    _(COLON,              ":")                          \
   1.130 -    _(UNDERSCORE,         "_")                          \
   1.131 -    _(DOT,                ".")                          \
   1.132 -    _(EOF,                "<end-of-file>")
   1.133 -
   1.134 -enum TokenKind
   1.135 -{
   1.136 -#   define _(name, str) TOK_##name,
   1.137 -    TOKENMAP(_)
   1.138 -#   undef _
   1.139 -    TOK_BITAND = TOK_AMPERSAND,
   1.140 -    TOKENS_TOTAL
   1.141 -};
   1.142 -
   1.143 -extern const char *TokenNames[];
   1.144 -
   1.145 -} // namespace ke
   1.146 -
   1.147 -#endif //_include_jitcraft_token_h_