Update ChangeLog
[gss-tcad.git] / src / cmd / lex.l
blobfb83badf4e0d12172d0581170efa66f788736a56
1 %{
2 #include <stdio.h>
3 #include <ctype.h>
4 #include <string.h>
5 #include <ctype.h>
6 #include "parser.h"
8 /*#define DEBUG*/
10 int initial = 1;
14 D       [0-9]
15 E       [EeDd][+-]?{D}+
16 SIGN    ([+-]?)
18 %s COMMAND PARAMETERS
22         if(initial==1)
23         {
24                 initial = 0;
25                 BEGIN(COMMAND);
26         }
28 ^\#[^\n]*                         {
29 /* comment line */
30 #ifdef DEBUG
31         printf("COMMENT LINE:");ECHO;
32 #endif
33         return COMMENT;
36 \#[^\n]*                          {
37 /* inline comment */
38 #ifdef DEBUG
39         printf("COMMENT:");ECHO;
40 #endif
44 \\[ \t\r]*\n                      {
45 /* continue line */
46 #ifdef DEBUG
47         printf("CONTINUE LINE:");ECHO;
48 #endif
52 \n                                {
53 /* new command */
54 BEGIN COMMAND;
55 #ifdef DEBUG
56         ECHO;
57 #endif
58         return BLANK;
61 [ \t\r]*                          {
62 /* use to drop blankspace/tab/cr */
63 #ifdef DEBUG
64         ECHO;
65 #endif
69 <COMMAND>ASSIGN        {
70 BEGIN  PARAMETERS;
71 #ifdef DEBUG
72         printf("ASSIGN");
73 #endif
74         strncpy(yylval.sval, yytext,31);
75         for(unsigned int c=0;c<strlen(yylval.sval);c++)
76         {
77           if(islower(yylval.sval[c]))
78             yylval.sval[c]=toupper(yylval.sval[c]);
79         }
80         return ASSIGN;
84 <COMMAND>SET           |
85 <COMMAND>VSOURCE       |
86 <COMMAND>ISOURCE       |
87 <COMMAND>LSOURCE       |
88 <COMMAND>BOUNDARY      |
89 <COMMAND>CONTACT       |
90 <COMMAND>XMESH         |
91 <COMMAND>YMESH         |
92 <COMMAND>MESH          |
93 <COMMAND>ELIMINATE     |
94 <COMMAND>SPREAD        |
95 <COMMAND>REGION        |
96 <COMMAND>SEGMENT       |
97 <COMMAND>ELECTRODE     |
98 <COMMAND>PROFILE       |
99 <COMMAND>METHOD        |
100 <COMMAND>PMIS          |
101 <COMMAND>SOLVE         |
102 <COMMAND>EXPORT        |
103 <COMMAND>IMPORT        |
104 <COMMAND>ATTACH        |
105 <COMMAND>REFINE        |
106 <COMMAND>PLOT          |
107 <COMMAND>PLOTMESH      |
108 <COMMAND>PROBE         |
109 <COMMAND>PLOTVTK       |
110 <COMMAND>PHOTOGEN      |
111 <COMMAND>END                               {
112 BEGIN  PARAMETERS;
113 #ifdef DEBUG
114         printf("KEYWORD:");ECHO;
115 #endif
116         strncpy(yylval.sval, yytext,31);
117         for(unsigned int c=0;c<strlen(yylval.sval);c++)
118         {
119           if(islower(yylval.sval[c]))
120             yylval.sval[c]=toupper(yylval.sval[c]);
121         }
122         return KEYWORD;
126 <PARAMETERS>X"."ORG         |//copyed by zhangxih ----06-12-20
127 <PARAMETERS>Y"."ORG         |
128 <PARAMETERS>ANGLE           |
129 <PARAMETERS>WAVELEN         |
130 <PARAMETERS>INTENSITY       |
131 <PARAMETERS>WAVE"."STA      |
132 <PARAMETERS>WAVE"."END      |
133 <PARAMETERS>WAVE"."NUM      |
134 <PARAMETERS>RAY"."WIDTH     |
135 <PARAMETERS>QUAN"."EFF      |
136 <PARAMETERS>WTE             |
137 <PARAMETERS>WTM             |
138 <PARAMETERS>phase"."diff    |
139 <PARAMETERS>power           |
140 <PARAMETERS>powerlo         |
141 <PARAMETERS>powerhi         |
142 <PARAMETERS>Tpeak           |
143 <PARAMETERS>Tradius         |
144 <PARAMETERS>TC              |
145 <PARAMETERS>Width           |
146 <PARAMETERS>Depth           |
147 <PARAMETERS>H1              |
148 <PARAMETERS>H2              |
149 <PARAMETERS>X               |
150 <PARAMETERS>Y               |
151 <PARAMETERS>X"."Min         |
152 <PARAMETERS>X"."Left        |
153 <PARAMETERS>X"."Max         |
154 <PARAMETERS>X"."Right       |
155 <PARAMETERS>Y"."Min         |
156 <PARAMETERS>Y"."Bottom      |
157 <PARAMETERS>Y"."Max         |
158 <PARAMETERS>Y"."Top         |
159 <PARAMETERS>CentreX         |
160 <PARAMETERS>CentreY         |
161 <PARAMETERS>MajorRadii      |
162 <PARAMETERS>MinorRadii      |
163 <PARAMETERS>Theta           |
164 <PARAMETERS>Ratio           |
165 <PARAMETERS>Encroach        |
166 <PARAMETERS>Y.Lower         |
167 <PARAMETERS>VOL.RAT         |
168 <PARAMETERS>Grading         |
169 <PARAMETERS>Middle          |
170 <PARAMETERS>Y.Middle        |
171 <PARAMETERS>GR1             |
172 <PARAMETERS>GR2             |
173 <PARAMETERS>N"."Peak        |
174 <PARAMETERS>Dose            |
175 <PARAMETERS>X"."CHAR        |
176 <PARAMETERS>Y"."CHAR        |
177 <PARAMETERS>XY"."RATIO      |
178 <PARAMETERS>Y"."JUNCTION    |
179 <PARAMETERS>X"."MOLE        |
180 <PARAMETERS>Mole"."Slope    |
181 <PARAMETERS>Mole"."End      |
182 <PARAMETERS>Z.Width         |
183 <PARAMETERS>LatticeTemp     |
184 <PARAMETERS>DopingScale     |
185 <PARAMETERS>Tdelay          |
186 <PARAMETERS>Vconst          |
187 <PARAMETERS>Vamp            |
188 <PARAMETERS>Iconst          |
189 <PARAMETERS>Iamp            |
190 <PARAMETERS>Freq            |
191 <PARAMETERS>Alpha           |
192 <PARAMETERS>TRC             |
193 <PARAMETERS>TFD             |
194 <PARAMETERS>TFC             |
195 <PARAMETERS>Vlo             |
196 <PARAMETERS>Vhi             |
197 <PARAMETERS>Ilo             |
198 <PARAMETERS>Ihi             |
199 <PARAMETERS>Tr              |
200 <PARAMETERS>Tf              |
201 <PARAMETERS>Pw              |
202 <PARAMETERS>Pr              |
203 <PARAMETERS>Res             |
204 <PARAMETERS>Cap             |
205 <PARAMETERS>Ind             |
206 <PARAMETERS>Eps             |
207 <PARAMETERS>Thickness       |
208 <PARAMETERS>QF              |
209 <PARAMETERS>Heat"."Transfer |
210 <PARAMETERS>EXT"."TEMP      |
211 <PARAMETERS>WorkFunction    |
212 <PARAMETERS>VBarrier        |
213 <PARAMETERS>Dispersion      |
214 <PARAMETERS>DivisionRatio   |
215 <PARAMETERS>QNFactor        |
216 <PARAMETERS>QPFactor        |
217 <PARAMETERS>relative"."tol  |
218 <PARAMETERS>toler"."relax   |
219 <PARAMETERS>possion"."tol   |
220 <PARAMETERS>elec"."continuty"."tol |
221 <PARAMETERS>hole"."continuty"."tol |
222 <PARAMETERS>latt"."temp"."tol      |
223 <PARAMETERS>elec"."energy"."tol    | 
224 <PARAMETERS>hole"."energy"."tol    | 
225 <PARAMETERS>elec"."quantum"."tol   | 
226 <PARAMETERS>hole"."quantum"."tol   | 
227 <PARAMETERS>electrode"."tol        | 
228 <PARAMETERS>VStart                 |
229 <PARAMETERS>VStep                  |
230 <PARAMETERS>VStepMax               |
231 <PARAMETERS>VStop                  |
232 <PARAMETERS>IStart                 |
233 <PARAMETERS>IStep                  |
234 <PARAMETERS>IStop                  |
235 <PARAMETERS>TStart                 |
236 <PARAMETERS>TStep                  |
237 <PARAMETERS>TStop                  |
238 <PARAMETERS>VAC                    |
239 <PARAMETERS>FStart                 |
240 <PARAMETERS>FMultiple              |
241 <PARAMETERS>FStop                  |
242 <PARAMETERS>AutoSave               |
243 <PARAMETERS>AzAngle                |
244 <PARAMETERS>ElAngle                               {
246 #ifdef DEBUG
247         printf("PARAMETER:");ECHO;
248 #endif
249         strncpy(yylval.sval, yytext,31);
250         for(unsigned int c=0;c<strlen(yylval.sval);c++)
251         {
252           if(isupper(yylval.sval[c]))
253             yylval.sval[c]=tolower(yylval.sval[c]);
254         }
255         return REAL_PARAMETER;
259 <PARAMETERS>IX            |
260 <PARAMETERS>IX            |
261 <PARAMETERS>IX"."Min      |
262 <PARAMETERS>IX"."Left     |
263 <PARAMETERS>IX"."Max      |
264 <PARAMETERS>IX"."Right    |
265 <PARAMETERS>IY"."Min      |
266 <PARAMETERS>IY"."Bottom   |
267 <PARAMETERS>IY"."Max      |
268 <PARAMETERS>IY"."Top      |
269 <PARAMETERS>Upper         |
270 <PARAMETERS>Lower         |
271 <PARAMETERS>N"."Spaces    |
272 <PARAMETERS>Division      |
273 <PARAMETERS>MaxIteration  |
274 <PARAMETERS>ServerPort                        {
276 #ifdef DEBUG
277         printf("PARAMETER:");ECHO;
278 #endif
279         strncpy(yylval.sval, yytext,31);
280         for(unsigned int c=0;c<strlen(yylval.sval);c++)
281         {
282           if(isupper(yylval.sval[c]))
283             yylval.sval[c]=tolower(yylval.sval[c]);
284         }
285         return INT_PARAMETER;
289 <PARAMETERS>Direction        |
290 <PARAMETERS>Label            |
291 <PARAMETERS>Material         |
292 <PARAMETERS>Location         |
293 <PARAMETERS>Shape            |
294 <PARAMETERS>Mole.Grad        |
295 <PARAMETERS>ModelFile        |
296 <PARAMETERS>Triangle         |
297 <PARAMETERS>Ion              |
298 <PARAMETERS>Carrier          |
299 <PARAMETERS>Type             |
300 <PARAMETERS>ID               |
301 <PARAMETERS>Variable         |
302 <PARAMETERS>Measure          |
303 <PARAMETERS>Region           |
304 <PARAMETERS>Mobility         |
305 <PARAMETERS>II.Model         |
306 <PARAMETERS>Optical.Model    |
307 <PARAMETERS>Scheme           |
308 <PARAMETERS>NS               |
309 <PARAMETERS>LS               |
310 <PARAMETERS>Damping          |
311 <PARAMETERS>II"."Type        |
312 <PARAMETERS>IVRecord         |
313 <PARAMETERS>IVFile           |
314 <PARAMETERS>CoreFile         |
315 <PARAMETERS>AscFile          |
316 <PARAMETERS>VTKFile          |
317 <PARAMETERS>Segment          |
318 <PARAMETERS>ProbeFile        |
319 <PARAMETERS>Electrode        |
320 <PARAMETERS>ConnectTo        |
321 <PARAMETERS>VScan            |
322 <PARAMETERS>IScan            |
323 <PARAMETERS>ACScan           |
324 <PARAMETERS>DLL              |
325 <PARAMETERS>Func             |
326 <PARAMETERS>ODE"."Formula    |
327 <PARAMETERS>VApp             |
328 <PARAMETERS>IApp             |
329 <PARAMETERS>Resolution       |
330 <PARAMETERS>PS.Out           |
331 <PARAMETERS>TIFF.Out         |
332 <PARAMETERS>Style                             {
334 #ifdef DEBUG
335         printf("PARAMETER:");ECHO;
336 #endif
337         strncpy(yylval.sval, yytext,31);
338         for(unsigned int c=0;c<strlen(yylval.sval);c++)
339         {
340           if(isupper(yylval.sval[c]))
341             yylval.sval[c]=tolower(yylval.sval[c]);
342         }
343         return STRING_PARAMETER;
347 <PARAMETERS>Fix.Lower         |
348 <PARAMETERS>HighFieldMobility | 
349 <PARAMETERS>ImpactIonization  |
350 <PARAMETERS>BandBandTunneling |
351 <PARAMETERS>Fermi             |
352 <PARAMETERS>PseudoTime        |
353 <PARAMETERS>Append            |
354 <PARAMETERS>EJModel                           {
356 #ifdef DEBUG
357         printf("PARAMETER:");ECHO;
358 #endif
359         strncpy(yylval.sval, yytext,31);
360         for(unsigned int c=0;c<strlen(yylval.sval);c++)
361         {
362           if(isupper(yylval.sval[c]))
363             yylval.sval[c]=tolower(yylval.sval[c]);
364         }
365         return BOOL_PARAMETER;
369 <PARAMETERS>\=                                {
370 #ifdef DEBUG
371         ECHO;
372 #endif
373         return '=';
376 <PARAMETERS>\+                                {
377 #ifdef DEBUG
378         ECHO;
379 #endif
380         return '+';
383 <PARAMETERS>\-                                {
384 #ifdef DEBUG
385         ECHO;
386 #endif
387         return '-';
390 <PARAMETERS>\*                                {
391 #ifdef DEBUG
392         ECHO;
393 #endif
394         return '*';
397 <PARAMETERS>\/                                {
398 #ifdef DEBUG
399         ECHO;
400 #endif
401         return '/';
404 <PARAMETERS>\(                                {
405 #ifdef DEBUG
406         ECHO;
407 #endif
408         return '(';
411 <PARAMETERS>\)                                {
412 #ifdef DEBUG
413         ECHO;
414 #endif
415         return ')';
418 <PARAMETERS>{D}+                        {
419         sscanf(yytext, "%d", &yylval.ival);
420 #ifdef DEBUG
421         printf("int_value: %d",yylval.ival);
422 #endif
423         return INT_NUMBER;
427 <PARAMETERS>{D}+"."{D}*({E})?     |
428 <PARAMETERS>{D}*"."{D}+({E})?     |
429 <PARAMETERS>{D}+({E})                       {
430         sscanf(yytext, "%lf", &yylval.dval);
431 #ifdef DEBUG
432         printf("double_value: %lf",yylval.dval);
433 #endif
434         return REAL_NUMBER;
439 <PARAMETERS>TRUE         |
440 <PARAMETERS>True         |
441 <PARAMETERS>true         |
442 <PARAMETERS>ON           |
443 <PARAMETERS>On           |
444 <PARAMETERS>on                                {
445         yylval.bval = true;
446 #ifdef DEBUG
447         printf("BOOL True:%s",yytext);
448 #endif
449         return BOOL;
454 <PARAMETERS>FALSE         |
455 <PARAMETERS>False         |
456 <PARAMETERS>false         |
457 <PARAMETERS>OFF           |
458 <PARAMETERS>Off           |
459 <PARAMETERS>off                                {
460         yylval.bval = false;
461 #ifdef DEBUG
462         printf("BOOL False:%s",yytext);
463 #endif
464         return BOOL;
468 <PARAMETERS>[a-zA-Z0-9\_][a-zA-Z0-9\.\_]*     {
469 #ifdef DEBUG
470         printf("STRING:%s",yytext);
471 #endif
472         strncpy(yylval.sval,yytext,31);
473         return STRING;
478 <PARAMETERS>\"[a-zA-Z0-9\.\_\ \-]*\"          {
479         yytext[yyleng-1]='\0';
480 #ifdef DEBUG
481         printf("STRING:%s",&yytext[1]);
482 #endif
483         strncpy(yylval.sval, &yytext[1],31);
484         return STRING;
487 <COMMAND>[a-zA-Z0-9[:punct:]]+        {
488         printf("Bad String: %s",yytext);
489         strncpy(yylval.sval,yytext,31);
490         return BAD_WORD;
495 int yywrap()
497 #ifdef DEBUG
498         printf("\nline %d\n",yylineno);
499 #endif
500         return 1;