%{ /* ======================================================================== bisl.l - lex code for BISL compiler Copyright 1996 Micah Beck / Simon D. Levy University of Tennessee All distributions of this product must include source code. Source code is not to be distributed in any modified form. ======================================================================== */ static char *my_strdup(char *s) { char *r=malloc(strlen(s) + 1); strcpy(r, s); return r; } int lineno = 1; %} %% "#".* {return COMMENT;} "image" {return IMAGE;} "sound" {return SOUND;} "url" {return URL;} "rect" {return RECT;} "circ" {return CIRC;} "dclick" {return DCLICK;} "click" {return CLICK;} "roll" {return ROLL;} "tog" {return TOG;} "string" {return STRING;} "text" {return TEXT;} "back" {return BACK;} "giff" {return GIFF;} "place" {return PLACE;} "&" {return AND;} "|" {return OR;} "^" {return XOR;} "~" {return NOT;} "(" {return LPAR;} ")" {return RPAR;} "," {return COM;} "=" {return CNSTR;} "<" {return ARROW;} [0-9]+ {yylval.number=atoi(yytext); return INT;} [a-zA-Z]+[a-zA-Z0-9_]* {yylval.name=my_strdup(yytext); return ID;} [a-zA-Z0-9\.-]+ {yylval.name=my_strdup(yytext); return FNAME;} [a-zA-Z]+"://"[a-zA-Z0-9\.-~_]* {yylval.name=my_strdup(yytext); return URLID;} '.+' {yylval.name=my_strdup(yytext); return STR;} [ \t] {;} [\n] {lineno++;} . {return ERROR;} %%