Recovered from microbel
This commit is contained in:
76
util/asc2bog/asc_scan.l
Normal file
76
util/asc2bog/asc_scan.l
Normal file
@@ -0,0 +1,76 @@
|
||||
/* Lex spesification for asc2bog */
|
||||
%option noyywrap
|
||||
%o 4000
|
||||
%{
|
||||
#define YYLEX
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
|
||||
int lineno;
|
||||
|
||||
char tokenString[MAXTOKENLEN+1];
|
||||
|
||||
%}
|
||||
|
||||
digit [0-9]
|
||||
nat {digit}+
|
||||
signedNat ("+"|"-")?{nat}
|
||||
floating {signedNat}("."{nat})?
|
||||
string \"([^\"]|\\\")+\"
|
||||
newline \n
|
||||
whitespace [ \t\r]+
|
||||
|
||||
%%
|
||||
|
||||
"Ambient light color" { return AMBIENT_LIGHT_COLOR; }
|
||||
"Solid background color" { return SOLID_BACKGROUND_COLOR; }
|
||||
"Red" { return RED; }
|
||||
"Green" { return GREEN; }
|
||||
"Blue" { return BLUE; }
|
||||
"Named object" { return NAMED_OBJECT; }
|
||||
"Tri-mesh" { return TRIMESH; }
|
||||
"Vertices" { return VERTICES; }
|
||||
"Faces" { return FACES; }
|
||||
"Mapped" { return MAPPED; }
|
||||
"Vertex list" { return VERTEX_LIST; }
|
||||
"Vertex" { return VERTEX; }
|
||||
"Face list" { return FACE_LIST; }
|
||||
"Face" { return FACE; }
|
||||
"Material" { return MATERIAL; }
|
||||
"Smoothing" { return SMOOTHING; }
|
||||
"AB" { return AB; }
|
||||
"BC" { return BC; }
|
||||
"CA" { return CA; }
|
||||
"=" { return ASSIGN; }
|
||||
[:,XYZUVABC] { return yytext[0]; }
|
||||
{nat} { return NUM; }
|
||||
{floating} { return FLOAT; }
|
||||
{string} { return STRING; }
|
||||
{whitespace} { /* Skip */ }
|
||||
{newline} { lineno++; }
|
||||
. { return ERROR; }
|
||||
%%
|
||||
|
||||
TokenType getToken(){
|
||||
TokenType currentToken;
|
||||
static int firstTime = TRUE;
|
||||
|
||||
if (firstTime){
|
||||
firstTime = FALSE;
|
||||
yyin = source;
|
||||
lineno++;
|
||||
}
|
||||
|
||||
currentToken = yylex();
|
||||
strncpy(tokenString,yytext,MAXTOKENLEN);
|
||||
|
||||
return currentToken;
|
||||
}
|
||||
|
||||
#if 0 /* ndef LINUX */
|
||||
int yywrap(void){
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user