/** BEGIN COPYRIGHT BLOCK * Copyright 2001 Sun Microsystems, Inc. * Portions copyright 1999, 2001-2003 Netscape Communications Corporation. * All rights reserved. * END COPYRIGHT BLOCK **/ %{ #include #include #include #include #include "y.tab.h" #include "libaccess/ava.h" #include "netsite.h" int linenum = 1; int first_time = 1; int old_state; int num_nested_comments = 0; extern AVAEntry tempEntry; extern AVATable entryTable; void strip_quotes(void); %} %s COMMENT NORM DEFINES DEF_TYPE uc_letter [A-Z] lc_letter [a-z] digit [0-9] under_score _ letter ([A-Z,a-z]) white_space ([ \t]*) identifier ([_,A-Z,a-z][_,A-Z,a-z,0-9]*) def_identifier (({white_space}{identifier})+) text (\"[^\"]*\") comments (([^"*/"\n])*) %% %{ if (first_time) { BEGIN NORM; first_time = tempEntry.numOrgs = 0; old_state = NORM; tempEntry.userid = 0; tempEntry.country = 0; tempEntry.CNEntry = 0; tempEntry.email = 0; tempEntry.locality = 0; tempEntry.state = 0; entryTable.numEntries = 0; } %} "/*" {BEGIN COMMENT; num_nested_comments++;} "*/" {num_nested_comments--; if (!num_nested_comments) BEGIN old_state;} . {;} {identifier} {yylval.string = PERM_STRDUP(yytext); return USER_ID;} ":"{white_space}\{ {BEGIN DEF_TYPE; old_state = DEF_TYPE;} "C" {BEGIN DEFINES; old_state = DEFINES; return DEF_C; } "O" {BEGIN DEFINES; old_state = DEFINES; return DEF_CO;} "OU" {BEGIN DEFINES; old_state = DEFINES; return DEF_OU;} "CN" {BEGIN DEFINES; old_state = DEFINES; return DEF_CN;} "L" {BEGIN DEFINES; old_state = DEFINES; return DEF_L;} "E" {BEGIN DEFINES; old_state = DEFINES; return DEF_E;} "ST" {BEGIN DEFINES; old_state = DEFINES; return DEF_ST;} "}" {BEGIN NORM;old_state = NORM;} = {return EQ_SIGN;} {text} {BEGIN DEF_TYPE; old_state = DEF_TYPE; strip_quotes(); return DEF_ID;} {white_space} {;} \n {linenum++;} . {yyerror("Bad input character");} %% int yywrap () { return 1; } void strip_quotes(void) { yytext[strlen(yytext)-1]= '\0'; yylval.string = PERM_STRDUP(&yytext[1]); }