5 static SECStatus parserStatus = SECSuccess;
6 static CRLGENGeneratorData *parserData;
7 static PRFileDesc *src;
9 #define YY_INPUT(buf,result,max_size) \
10 if ( parserStatus != SECFailure) { \
11 if (((result = PR_Read(src, buf, max_size)) == 0) && \
14 } else { return SECFailure; }
21 DIGIT_RANGE [0-9]+-[0-9]+
22 ID [a-zA-Z][a-zA-Z0-9]*
24 DATE [0-9]{4}[01][0-9][0-3][0-9][0-2][0-9][0-6][0-9][0-6][0-9]
25 ZDATE [0-9]{4}[01][0-9][0-3][0-9][0-2][0-9][0-6][0-9][0-6][0-9]Z
26 N_SP_STRING [a-zA-Z0-9\:\|\.]+
31 parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_ZDATE);
32 if (parserStatus != SECSuccess)
37 parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_DIGIT);
38 if (parserStatus != SECSuccess)
43 parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_DIGIT_RANGE);
44 if (parserStatus != SECSuccess)
49 parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_OID);
50 if (parserStatus != SECSuccess)
55 parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_ISSUER_CONTEXT);
56 if (parserStatus != SECSuccess)
61 parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_UPDATE_CONTEXT);
62 if (parserStatus != SECSuccess)
66 parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_NEXT_UPDATE_CONTEXT);
67 if (parserStatus != SECSuccess)
72 parserStatus = crlgen_createNewLangStruct(parserData, CRLGEN_CHANGE_RANGE_CONTEXT);
73 if (parserStatus != SECSuccess)
78 if (strcmp(yytext, "addcert") == 0) {
79 parserStatus = crlgen_createNewLangStruct(parserData,
80 CRLGEN_ADD_CERT_CONTEXT);
81 if (parserStatus != SECSuccess)
83 } else if (strcmp(yytext, "rmcert") == 0) {
84 parserStatus = crlgen_createNewLangStruct(parserData,
85 CRLGEN_RM_CERT_CONTEXT);
86 if (parserStatus != SECSuccess)
88 } else if (strcmp(yytext, "addext") == 0) {
89 parserStatus = crlgen_createNewLangStruct(parserData,
90 CRLGEN_ADD_EXTENSION_CONTEXT);
91 if (parserStatus != SECSuccess)
94 parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_ID);
95 if (parserStatus != SECSuccess)
103 if (yytext[yyleng-1] == '\\') {
109 printf( "Error: Line ending \" is missing: %c\n", c);
112 parserStatus = crlgen_setNextData(parserData, yytext + 1,
114 if (parserStatus != SECSuccess)
121 parserStatus = crlgen_setNextData(parserData, yytext, CRLGEN_TYPE_STRING);
122 if (parserStatus != SECSuccess)
128 ^#[^\n]* /* eat up one-line comments */ {}
133 parserStatus = crlgen_updateCrl(parserData);
134 if (parserStatus != SECSuccess)
139 fprintf(stderr, "Syntax error at line %d: unknown token %s\n",
140 parserData->parsedLineNum, yytext);
147 static PRLock *parserInvocationLock;
149 void CRLGEN_InitCrlGenParserLock()
151 parserInvocationLock = PR_NewLock();
154 void CRLGEN_DestroyCrlGenParserLock()
156 PR_DestroyLock(parserInvocationLock);
160 SECStatus CRLGEN_StartCrlGen(CRLGENGeneratorData *parserCtlData)
164 PR_Lock(parserInvocationLock);
166 parserStatus = SECSuccess;
167 parserData = parserCtlData;
168 src = parserCtlData->src;
172 PR_Unlock(parserInvocationLock);
177 int yywrap() {return 1;}