Fixed type checking for multidimensional arrays.
1 /* vim: set ts=4 sw=4 tw=99 et:
3 * Copyright (C) 2012 David Anderson
5 * This file is part of SourcePawn.
7 * SourcePawn is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 3 of the License, or (at your option)
12 * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with
17 * SourcePawn. If not, see http://www.gnu.org/licenses/.
19 #ifndef _include_jitcraft_parser_h_
20 #define _include_jitcraft_parser_h_
23 #include "../Strings.h"
36 PoolList<NameProxy *> *unbound_;
37 PoolList<ImportStatement *> *imports_;
38 bool encounteredReturn_;
41 bool peek(TokenKind kind);
42 bool match(TokenKind kind);
43 bool expect(TokenKind kind);
44 bool matchSemicolon();
52 VariableDeclaration *var(TypeQualifiers qual);
53 Statement *vars(TypeQualifiers qual);
54 bool matchName(String **name, TokenKind kind = TOK_NAME);
55 bool typeAndName(Expression **type, String **namep);
56 bool fullTypeAndName(Expression **type, String **namep, DeclKind kind);
58 ExpressionList *dimensions();
61 Expression *primitive();
62 Expression *fixedArrayLiteral();
63 Expression *call(Expression *callee);
64 Expression *field(Expression *left);
65 Expression *index(Expression *left);
67 Expression *primary();
69 Expression *multiplication();
70 Expression *addition();
72 Expression *bitand_();
75 Expression *relational();
79 Expression *ternary();
80 Expression *assignment();
81 Expression *expression();
85 Statement *enum_(TokenKind kind);
88 Statement *function(TokenKind tok);
89 Statement *expressionStatement();
92 Statement *forStatement();
93 Statement *localStatement();
94 Statement *globalStatement();
95 Statement *returnStatement();
96 ImportStatement *import(TokenKind kind);
99 Parser(Zone *zone, CompileContext &cc, const char *stream, size_t length);
106 #endif // _include_jitcraft_parser_h_