File: cfglex.l

package info (click to toggle)
ssystem 1.6-17
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 1,452 kB
  • ctags: 211
  • sloc: ansic: 2,487; yacc: 227; makefile: 96; lex: 89
file content (89 lines) | stat: -rw-r--r-- 2,255 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
%{
#include <math.h>
#include "ssystem.h"

int reserverd_word(char *s);
extern int yylineno;
#define YY_NO_UNPUT
%}

%option noyywrap

DIGIT    [0-9]
TEXT     [a-z_\-:/0-9.]*

%%



data_directory		return DATA_DIR;
border			return BORDER;
atmospheres		return ATMOSPHERES;
openbitmap              return OPENBITMAP;
filter			return FILTER;
shading			return SHADING;
date			return DATE;
pause			return PAUSE;
realtime		return REALTIME;
demo			return DEMO;
planets_labels		return PLANETS_LABELS;
stars_labels		return STARS_LABELS;
info			return INFO;
star_brightness_factor	return STAR_BRIGHT;
star_size		return STAR_SIZE;
camera_speed		return CAM_SPEED;
camera_mode		return CAM_MODE;
target			return TARGET;
source			return SOURCE;
slices			return SLICES;
stacks			return STACKS;
jpeg_quality		return JPEG_QUALITY;
sun			return SUN;
planet			return PLANET;
satellite		return SATELLITE;
asteroid		return ASTEROID;
atmosphere		return ATMOSPHERE;
ring			return RING;


{DIGIT}+    {	cfglval.ival=atoi(yytext); return INTEGER; }

{DIGIT}+"."{DIGIT}* { cfglval.dval=atof(yytext); return DOUBLE; }

{TEXT}		    { strcpy(cfglval.name,yytext); return NAME; }


"\#"(.)*"\n"	yylineno++;
"/*"		{
                              register int c;

                              for ( ; ; )
                                  {
                                  while ( (c = input()) != '*' &&
                                          c != EOF )
                                      ;    /* eat up text of comment */

                                  if ( c == '*' )
                                      {
                                      while ( (c = input()) == '*' )
                                          ;
                                      if ( c == '/' )
                                          break;    /* found the end */
                                      }

                                  if ( c == EOF )
                                      {
                                      error( "EOF in comment" );
                                      break;
                                      }
                                  }
		}
[ \t]+
\n		{ yylineno++;}
"{"		return('{');
"}"		return('}');
"="		return('=');
";"		return(';');
.

%%