]> granicus.if.org Git - postgresql/blob - src/backend/bootstrap/bootscanner.l
Remove tqual.h includes not needed.
[postgresql] / src / backend / bootstrap / bootscanner.l
1 %{
2 /*-------------------------------------------------------------------------
3  *
4  * bootscanner.lex--
5  *        a lexical scanner for the bootstrap parser
6  *
7  * Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  *        $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.8 1997/11/24 05:07:56 momjian Exp $
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include <time.h>
16 #include <string.h>
17
18 #include "postgres.h"
19
20 #include "storage/block.h"
21 #include "storage/off.h"
22 #include "storage/itemptr.h"
23 #include "catalog/pg_attribute.h"
24 #include "access/attnum.h"
25 #include "nodes/pg_list.h"
26 #include "access/tupdesc.h"
27 #include "access/itup.h"
28 #include "access/funcindex.h"
29 #include "storage/fd.h"
30 #include "catalog/pg_am.h"
31 #include "catalog/pg_class.h"
32 #include "nodes/nodes.h"
33 #include "rewrite/prs2lock.h"
34 #include "access/skey.h"
35 #include "access/strat.h"
36 #include "utils/rel.h"
37 #include "bootstrap/bootstrap.h"
38
39 #include "nodes/primnodes.h"
40 #include "utils/nabstime.h"
41 #include "access/htup.h"
42 #include "nodes/parsenodes.h"
43
44 #include "parser/scansup.h"
45
46 #include "bootstrap_tokens.h"
47
48 #define                 YY_NO_UNPUT
49
50 /* some versions of lex define this as a macro */
51 #if defined(yywrap)
52 #undef yywrap
53 #endif /* yywrap */
54
55 YYSTYPE yylval;
56 int             yyline;  /* keep track of the line number for error reporting */
57
58 %}
59
60 D               [0-9]
61 oct             \\{D}{D}{D}
62 Exp             [Ee][-+]?{D}+
63 id              ([A-Za-z0-9_]|{oct}|\-)+
64 sid             \"([^\"])*\"
65 arrayid [A-Za-z0-9_]+\[{D}*\]
66
67 %%
68
69 open                    { return(OPEN); }
70
71 close                   { return(XCLOSE); }
72
73 create                  { return(XCREATE); }
74
75 OID                             { return(OBJ_ID); }
76 bootstrap               { return(XBOOTSTRAP); }
77 _null_                  { return(NULLVAL); }
78
79 insert                  { return(INSERT_TUPLE); }
80
81 ","                             { return(COMMA); }
82 "="                             { return(EQUALS); }
83 "("                             { return(LPAREN); }
84 ")"                             { return(RPAREN); }
85
86 [\n]                    { yyline++; }
87 [\t]                    ;
88 " "                             ;
89
90 ^\#[^\n]* ; /* drop everything after "#" for comments */
91
92
93 "declare"               { return(XDECLARE); }
94 "build"                 { return(XBUILD); }
95 "indices"               { return(INDICES); }
96 "index"                 { return(INDEX); }
97 "on"                    { return(ON); }
98 "using"                 { return(USING); }
99 {arrayid}               {
100                                         yylval.ival = EnterString(MapArrayTypeName((char*)yytext));
101                                         return(ID);
102                                 }
103 {id}                    {
104                                         yylval.ival = EnterString(scanstr((char*)yytext));
105                                         return(ID);
106                                 }
107 {sid}                   {
108                                         yytext[strlen(yytext)-1] = '\0'; /* strip off quotes */
109                                         yylval.ival = EnterString(scanstr((char*)yytext+1));
110                                         yytext[strlen(yytext)] = '"'; /* restore quotes */
111                                         return(ID);
112                                 }
113
114 (-)?{D}+"."{D}*({Exp})? |
115 (-)?{D}*"."{D}+({Exp})? |
116 (-)?{D}+{Exp}                   {
117                                                         yylval.ival = EnterString((char*)yytext);
118                                                         return(CONST);
119                                                 }
120
121 .                               {
122                                         printf("syntax error %d : -> %s\n", yyline, yytext);
123                                 }
124
125
126
127 %%
128
129 int
130 yywrap(void)
131 {
132         return 1;
133 }
134
135 void
136 yyerror(const char *str)
137 {
138         fprintf(stderr,"\tsyntax error %d : %s",yyline, str);
139 }