75c8f2f1648ce3f8799f9709eaf6d11b98f5e8cd
[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
31 DECLARE(token);
32 DECLARE_LIST(token);
33 DECLARE(param);
34 DECLARE_LIST(param);
35 DECLARE(params);
36 DECLARE(typedcode);
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 struct _typedcode {
63     code_t*c;
64     classinfo_t*t;
65 };
66
67
68 /* small helper structs: */
69 typedef struct _codeandnumber {
70     code_t*cc;
71     int number;
72 } codeandnumber_t;
73 typedef struct _for_start {
74     char*name;
75     char each;
76 } for_start_t;
77 typedef struct _regexp {
78     char*pattern;
79     char*options;
80 } regexp_t;
81
82 extern char start_of_expression;
83
84 typedef token_t*tokenptr_t;
85
86 extern trie_t*active_namespaces;
87
88 #include "parser.tab.h"
89
90 extern unsigned int as3_tokencount;
91
92 void as3_buffer_input(void*buffer, int len);
93 void as3_file_input(FILE*fi);
94
95 #define T_EOF 0
96
97 extern int avm2_lex();
98 extern int avm2_lex_destroy();
99
100 #endif