1.1 --- a/src/Parser.h Mon Sep 17 00:10:01 2012 -0700
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,106 +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_parser_h_
1.23 -#define _include_jitcraft_parser_h_
1.24 -
1.25 -#include <stdio.h>
1.26 -#include "AST.h"
1.27 -#include "Scanner.h"
1.28 -#include "Scopes.h"
1.29 -#include "Strings.h"
1.30 -
1.31 -namespace ke {
1.32 -
1.33 -class Parser
1.34 -{
1.35 - Zone *zone_;
1.36 - CompileContext &cc_;
1.37 - PoolAllocator &pool_;
1.38 - Scanner scanner_;
1.39 - Scope *scope_;
1.40 - PoolList<NameProxy *> *unbound_;
1.41 - bool encounteredReturn_;
1.42 -
1.43 - private:
1.44 - void redeclarationError(BoundName *name);
1.45 - bool peek(TokenKind kind);
1.46 - bool match(TokenKind kind);
1.47 - bool expect(TokenKind kind);
1.48 - bool matchSemicolon();
1.49 -
1.50 - Scope *enterScope(Scope::Kind kind);
1.51 -
1.52 -
1.53 - VariableDeclaration *var(TokenKind scope, TokenKind kind);
1.54 - Statement *vars(TokenKind scope, TokenKind kind);
1.55 - bool matchName(String **name, TokenKind kind = TOK_NAME);
1.56 -
1.57 - NameProxy *bind(Handle<String> name);
1.58 - BoundName *bindType(Handle<String> string);
1.59 -
1.60 - ExpressionList *dimensions();
1.61 - String *expectName();
1.62 -
1.63 - Expression *primitive();
1.64 - Expression *arrayLiteral(TokenKind kind);
1.65 - Expression *call(Expression *callee);
1.66 - Expression *field(Expression *left);
1.67 - Expression *index(Expression *left);
1.68 - Expression *prefix();
1.69 - Expression *primary();
1.70 - Expression *unary();
1.71 - Expression *multiplication();
1.72 - Expression *addition();
1.73 - Expression *shift();
1.74 - Expression *bitand_();
1.75 - Expression *bitxor();
1.76 - Expression *bitor_();
1.77 - Expression *relational();
1.78 - Expression *equals();
1.79 - Expression *and_();
1.80 - Expression *or_();
1.81 - Expression *ternary();
1.82 - Expression *assignment();
1.83 - Expression *expression();
1.84 -
1.85 - Statement *switch_();
1.86 - Statement *struct_();
1.87 - Statement *enum_();
1.88 - Statement *if_();
1.89 - Statement *block(Scope *scope = NULL);
1.90 - Statement *function(TokenKind tok);
1.91 - Statement *expressionStatement();
1.92 - Statement *while_();
1.93 - Statement *do_();
1.94 - Statement *forStatement();
1.95 - Statement *localStatement();
1.96 - Statement *globalStatement();
1.97 - Statement *returnStatement();
1.98 -
1.99 - bool setupIntrinsics();
1.100 -
1.101 - public:
1.102 - Parser(Zone *zone, CompileContext &cc, const char *stream, size_t length);
1.103 -
1.104 - ParseTree *parse();
1.105 -};
1.106 -
1.107 -}
1.108 -
1.109 -#endif // _include_jitcraft_parser_h_