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