]> git.saurik.com Git - wxWidgets.git/blob - src/common/parser.y
Changed values passed to SetClientSize() in CreateWidgets() so that buttons are not...
[wxWidgets.git] / src / common / parser.y
1 %{
2 #include "wx/setup.h"
3 #include <string.h>
4 #ifdef _MSC_VER
5 #include <io.h>
6 #endif
7 #if defined(__GNUWIN32__) && !defined(__TWIN32__)
8 #include <sys/unistd.h>
9 #endif
10
11 #include "wx/expr.h"
12
13 #ifndef __EXTERN_C__
14 #define __EXTERN_C__ 1
15 #endif
16
17 #if defined(__cplusplus) || defined(__STDC__)
18 #if defined(__cplusplus) && defined(__EXTERN_C__)
19 extern "C" {
20 #endif
21 #endif
22 int yylex(void);
23 int yylook(void);
24 int yywrap(void);
25 int yyback(int *, int);
26 void yyerror(char *);
27
28 /* You may need to put /DLEX_SCANNER in your makefile
29 * if you're using LEX!
30 */
31 void yyoutput(int);
32
33 #if defined(__cplusplus) || defined(__STDC__)
34 #if defined(__cplusplus) && defined(__EXTERN_C__)
35 }
36 #endif
37 #endif
38 %}
39
40 %union {
41 char *s;
42 /* struct pexpr *expr; */
43 }
44
45
46 %start commands
47
48 %token <s> INTEGER 1
49 %token <s> WORD 2
50 %token <s> STRING 3
51 %token <s> PERIOD 13
52 %token OPEN 4
53 %token CLOSE 5
54 %token COMMA 6
55 %token NEWLINE 7
56 %token ERROR 8
57 %token OPEN_SQUARE 9
58 %token CLOSE_SQUARE 10
59 %token EQUALS 11
60 %token EXP 14
61
62 /* %type <expr> command expr arglist arg arg1 */
63 %type <s> command expr arglist arg arg1
64
65 %%
66
67 commands : /* empty */
68 | commands command
69 ;
70
71 command : WORD PERIOD
72 {process_command(proio_cons(wxmake_word($1), NULL)); free($1);}
73 | expr PERIOD
74 {process_command($1);}
75 | error PERIOD
76 {syntax_error("Unrecognized command.");}
77 ;
78
79 expr : WORD OPEN arglist CLOSE
80 {$$ = proio_cons(wxmake_word($1), $3); free($1);}
81 | OPEN_SQUARE CLOSE_SQUARE
82 {$$ = proio_cons(NULL, NULL);}
83 | OPEN_SQUARE arglist CLOSE_SQUARE
84 {$$ = $2; }
85 ;
86
87 arglist :
88 {$$ = NULL;}
89 | arg
90 {$$ = proio_cons($1, NULL);}
91 |
92 arg COMMA arglist
93 {$$ = proio_cons($1, $3);}
94 ;
95
96 arg : WORD EQUALS arg1
97 {$$ = proio_cons(wxmake_word("="), proio_cons(wxmake_word($1), proio_cons($3, NULL)));
98 free($1); }
99 | arg1
100 {$$ = $1; }
101
102 arg1 : WORD
103 {$$ = wxmake_word($1); free($1);}
104 | STRING
105 {$$ = wxmake_string($1); free($1);}
106 | INTEGER
107 {$$ = wxmake_integer($1); free($1);}
108 | INTEGER PERIOD INTEGER
109 {$$ = wxmake_real($1, $3); free($1); free($3); }
110 | INTEGER EXP INTEGER
111 {$$ = wxmake_exp($1, $3); free($1); free($3); }
112 |
113 INTEGER PERIOD INTEGER EXP INTEGER
114 {$$ = wxmake_exp2($1, $3, $5); free($1); free($3);
115 free($5); }
116
117 | expr
118 {$$ = $1;}
119 ;
120
121 %%
122
123 #if (defined(__WXGTK__) || defined(__WXWINE__) || defined(__WXMOTIF__)) && !defined(NO_CONFIGURE)
124 #include "lexer.c"
125 #else
126 #if (defined(__MWERKS__))
127 #include "../common/cwlex_yy.c"
128 #else
129 #include "../common/lex_yy.c"
130 #endif
131 #endif
132
133 /*
134 void yyerror(s)
135 char *s;
136 {
137 syntax_error(s);
138 }
139 */
140
141 /* Ansi prototype. If this doesn't work for you... uncomment
142 the above instead.
143 */
144
145 void yyerror(char *s)
146 {
147 syntax_error(s);
148 }
149
150 /*
151 * Unfortunately, my DOS version of FLEX
152 * requires yywrap to be #def'ed, whereas
153 * the UNIX flex expects a proper function.
154 */
155
156 /* Not sure if __SC__ is the appropriate thing
157 * to test
158 */
159
160 /* HH: Added test for __WX_SETUP_H__ for gnuwin builds
161 * using configure */
162 #if !defined(__SC__) && !defined(__GNUWIN32__)
163 #ifdef USE_DEFINE
164 #ifndef yywrap
165 #define yywrap() 1
166 #endif
167 #else if !defined(__alpha___) && !defined(__alpha) && !defined(__ultrix)
168 int yywrap() { return 1; }
169 #endif
170 #elif defined(__WX_SETUP_H__)
171 int yywrap() { return 1; }
172 #endif