- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstringTable.cpp
More file actions
Latest commit
62 lines (54 loc) · 2.05 KB
/
Copy pathstringTable.cpp
File metadata and controls
62 lines (54 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2018 LPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include<assert.h>
#include"stringTable.h"
#include"_parser.h"
///////////////////////////////////////////////////////////////////////////////
//
constchar* Token::name() const
{
switch(token)
{
case Parser::T_PLUS: return"+";
case Parser::T_MINUS: return"-";
case Parser::T_STAR: return"*";
case Parser::T_SLASH: return"/";
case Parser::T_EQ: return"=";
case Parser::T_LT: return"<";
case Parser::T_GT: return">";
case Parser::T_LBRACKET: return"[";
case Parser::T_RBRACKET: return"]";
case Parser::T_DOT: return".";
case Parser::T_COMMA: return",";
case Parser::T_COLON: return":";
case Parser::T_SEMICOLON: return";";
case Parser::T_UPARROW: return"^";
case Parser::T_LPAREN: return"(";
case Parser::T_RPAREN: return")";
case Parser::T_NE: return"<>";
case Parser::T_LE: return"<=";
case Parser::T_GE: return">=";
case Parser::T_ASSIGN: return":=";
case Parser::T_DOTDOT: return"..";
case Parser::T_NOT: return"not";
case Parser::T_DIV: return"div";
case Parser::T_MOD: return"mod";
case Parser::T_AND: return"and";
case Parser::T_OR: return"or";
case Parser::T_IN: return"in";
default:
assert(!"unexpected token");
return"???";
}
}