source: branches/z3950-branch/gsdl/src/recpt/parse.fl@ 1174

Last change on this file since 1174 was 1174, checked in by johnmcp, 24 years ago

checkpoint - can now connect and get status information from a z39.50 server.
Still need to get queries and data retrieval working.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/* This is the lexical analyser - it returns tokens to the parsers.
2 This is used by both parsers - one for the build-time config files
3 and one for the run-time config files. Note the included file "parse.h"
4 is a symlink to the relevant header file. */
5
6%{
7#include <string.h>
8#include <stdlib.h>
9#include <stdio.h>
10
11/*#define YYSTYPE char * - YYSTYPE is defined in zparse.tab.h */
12#include "zparse.tab.h"
13
14/* forward declarations for std functions not picked up. */
15/*int fileno(FILE *);*/
16/*char *strdup(char *);*/
17
18int lineno=1;
19%}
20
21%option noyywrap
22
23COMMENT \#.*(\n|\r)
24
25%x STRINGCOND
26%%
27 char *string;
28 int string_len;
29
30{COMMENT} lineno++;yylval.string=yytext;
31, return (',');
32: return (':');
33\_ return ('_');
34\[GSDL[0-9]+\.[0-9]+\] yylval.string=yytext;return(GSDLVERSION);
35\[General\] return (GENERAL_SECTION);
36\[Search\ [fF]ields\] return (SEARCH_SECTION);
37\[Browse\ [fF]ields\] return (BROWSE_SECTION);
38\[Macros\] return (MACROS_SECTION);
39maintainer return (MAINTAINER);
40Languages return(LANGUAGES);
41About return(ABOUT);
42Browse return(BROWSE);
43Date[lL]ist return(DATELIST);
44Document[aA]rrows[bB]ottom return(DOCUMENTARROWSBOTTOM);
45Document[bB]uttons return(DOCUMENTBUTTONS);
46Document[hH]eader return(DOCUMENTHEADER);
47Document[iI]mages return(DOCUMENTIMAGES);
48Document[tT]ext return(DOCUMENTTEXT);
49Icon[lL]ink return(ICONLINK);
50List return(LIST);
51Format return(FORMAT);
52Name return(NAME);
53Search[tT]ext return(SEARCHTEXT);
54Section[lL]ist return(SECTIONLIST);
55Sorted[lL]ist return(SORTEDLIST);
56Sorted[sS]ection[lL]ist return(SORTEDSECTIONLIST);
57Text[lL]ink return(TEXTLINK);
58Type return(TYPE);
59public return (PUBLIC);
60true return (TRUE);
61false return (FALSE);
62^document return (DOCUMENT);
63^section return (SECTION);
64[iI]con return (ICON);
65[sS]mall[iI]con return (SMALLICON);
66\" {string=NULL;BEGIN(STRINGCOND);}
67<STRINGCOND>{
68 ([^\"\\])* {/* append this to our current string */
69 if (string==NULL) string_len=0; else
70 string_len=strlen(string);
71 string=realloc(string,string_len+strlen(yytext)+1);
72 /* +1 is for trailing \0 */
73 strcpy(string+string_len,yytext);
74 }
75 "\\"\" |
76 \"\" { /*replace quoted quote with one quote*/
77 string_len=strlen(string);
78 string=realloc(string,string_len+2);
79 string[string_len]='\"';
80 string[string_len+1]='\0';
81 }
82 \" {
83 BEGIN(INITIAL);
84 yylval.string=string;
85 return(STRING);
86 /* note that the string may have long bits of
87 whitespace in it that we could remove. */
88 }
89}
90[[:alnum:]@\.]+ yylval.string=strdup(yytext);return (DATA);
91(" "|\t) ;
92(\n|\r) lineno++;
93%%
94/******** deleted rules: *******
95en return(EN);
96fr return(FR);
97mi return(MI);
98zh return(ZH);
99de return(DE);
100***************/
101
102
103
104
Note: See TracBrowser for help on using the repository browser.