finished ast implementation
[swftools.git] / lib / as3 / tokenizer.h
1 /* tokenizer.h
2
3    Copyright (c) 2008 Matthias Kramm <kramm@quiss.org>
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
18
19 #ifndef __parser_h__
20 #define __parser_h__
21
22 #include "../q.h"
23 #include "abc.h"
24 #include "pool.h"
25 #include "files.h"
26 #include "tokenizer.h"
27 #include "registry.h"
28 #include "code.h"
29 #include "opcodes.h"
30 #include "ast.h"
31
32 DECLARE(token);
33 DECLARE_LIST(token);
34 DECLARE(param);
35 DECLARE_LIST(param);
36 DECLARE(params);
37 DECLARE(modifiers);
38 DECLARE(namespace_decl);
39 DECLARE_LIST(namespace_decl);
40 DECLARE_LIST(typedcode);
41
42 struct _param {
43     char*name;
44     classinfo_t*type;
45     constant_t*value;
46 };
47
48 struct _params {
49     param_list_t*list;
50     char varargs;
51 };
52
53 struct _modifiers {
54     int flags;
55     char*ns;
56 };
57 struct _namespace_decl {
58     const char*name;
59     const char*url;
60 };
61
62 /* small helper structs: */
63 typedef struct _codeandnumber {
64     code_t*cc;
65     int number;
66 } codeandnumber_t;
67 typedef struct _for_start {
68     char*name;
69     char each;
70 } for_start_t;
71 typedef struct _regexp {
72     char*pattern;
73     char*options;
74 } regexp_t;
75
76 extern char start_of_expression;
77
78 typedef token_t*tokenptr_t;
79
80 extern trie_t*active_namespaces;
81
82 #include "parser.tab.h"
83
84 extern unsigned int as3_tokencount;
85
86 void as3_buffer_input(void*buffer, int len);
87 void as3_file_input(FILE*fi);
88
89 #define T_EOF 0
90
91 extern int avm2_lex();
92 extern int avm2_lex_destroy();
93
94 #endif