Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb703c12

Browse files
author
Michael Meskes
committed
Parser sync.
1 parent94d8bbe commitb703c12

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,5 +1004,10 @@ Tue Oct 31 16:09:55 CET 2000
10041004

10051005
- Added patch by Christof Petig <christof.petig@wtal.de> fixing some
10061006
parser bugs.
1007+
1008+
Fri Nov 3 11:34:43 CET 2000
1009+
1010+
- Synced pgc.l with scan.l.
1011+
- Synced gram.y and preproc.y.
10071012
- Set ecpg version to 2.8.0.
10081013
- Set library version to 3.2.0.

‎src/interfaces/ecpg/preproc/pgc.l

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.66 2000/10/25 07:00:33 meskes Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.67 2000/11/03 10:47:54 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -21,8 +21,6 @@
2121
#include<limits.h>
2222
#include<errno.h>
2323

24-
#include"postgres.h"
25-
2624
#include"miscadmin.h"
2725
#include"nodes/parsenodes.h"
2826
#include"nodes/pg_list.h"
@@ -89,14 +87,14 @@ static struct _if_value {
8987
* We use exclusive states for quoted strings, extended comments,
9088
* and to eliminate parsing troubles for numeric strings.
9189
* Exclusive states:
92-
* <xb> binary numericstring- thomas 1997-11-16
90+
* <xbit> bitstringliteral
9391
* <xc> extended C-style comments - thomas 1997-07-12
9492
* <xd> delimited identifiers (double-quoted identifiers) - thomas 1997-10-27
9593
* <xh> hexadecimal numeric string - thomas 1997-11-16
9694
* <xq> quoted strings - thomas 1997-07-30
9795
*/
9896

99-
%xxb
97+
%xxbit
10098
%xxc
10199
%xxd
102100
%xxdc
@@ -106,12 +104,12 @@ static struct _if_value {
106104
%xxcond
107105
%xxskip
108106

109-
/*Binary number
107+
/*Bit string
110108
*/
111-
xbstart[bB]{quote}
112-
xbstop{quote}
113-
xbinside[^']+
114-
xbcat{quote}{whitespace_with_newline}{quote}
109+
xbitstart[bB]{quote}
110+
xbitstop{quote}
111+
xbitinside[^']*
112+
xbitcat{quote}{whitespace_with_newline}{quote}
115113

116114
/* Hexadecimal number
117115
*/
@@ -192,7 +190,7 @@ typecast"::"
192190
* If you change either set, adjust the character lists appearing in the
193191
* rule for "operator"!
194192
*/
195-
self[,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
193+
self[,()\[\].;$\:\+\-\*\/\%\^\<\>\=]
196194
op_chars[\~\!\@\#\^\&\|\`\?\$\+\-\*\/\%\<\>\=]
197195
operator{op_chars}+
198196

@@ -313,30 +311,29 @@ cppline{space}*#(.*\\{line_end})*.*
313311

314312
<xc><<EOF>> {mmerror(ET_ERROR,"Unterminated /* comment"); }
315313

316-
<SQL>{xbstart}{
317-
BEGIN(xb);
314+
<SQL>{xbitstart}{
315+
BEGIN(xbit);
318316
startlit();
319317
}
320-
<xb>{xbstop}{
318+
<xbit>{xbitstop}{
321319
char* endptr;
322320

323321
BEGIN(SQL);
324-
errno =0;
325-
yylval.ival =strtol(literalbuf, &endptr,2);
326-
if (*endptr !='\0' || errno == ERANGE)
327-
mmerror(ET_ERROR,"Bad binary integer input!");
328-
return ICONST;
322+
if (literalbuf[strspn(literalbuf,"01") +1] !='\0')
323+
mmerror(ET_ERROR,"invalid bit string input.");
324+
yylval.str = literalbuf;
325+
return BITCONST;
329326
}
330327

331328
<xh>{xhinside}|
332-
<xb>{xbinside}{
329+
<xbit>{xbitinside}{
333330
addlit(yytext, yyleng);
334331
}
335332
<xh>{xhcat}|
336-
<xb>{xbcat}{
333+
<xbit>{xbitcat}{
337334
/* ignore */
338335
}
339-
<xb><<EOF>>{mmerror(ET_ERROR,"Unterminatedbinary integer"); }
336+
<xbit><<EOF>>{mmerror(ET_ERROR,"Unterminatedbit string"); }
340337

341338
<SQL>{xhstart}{
342339
BEGIN(xh);
@@ -490,7 +487,7 @@ cppline{space}*#(.*\\{line_end})*.*
490487
* that the "self" rule would have.
491488
*/
492489
if (nchars ==1 &&
493-
strchr(",()[].;$:+-*/%^<>=|", yytext[0]))
490+
strchr(",()[].;$:+-*/%^<>=", yytext[0]))
494491
return yytext[0];
495492
}
496493

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ make_name(void)
242242
%tokenUNIONJOIN
243243

244244
/* Special keywords, not in the query language - see the "lex" file*/
245-
%token<str>IDENTSCONSTOpCSTRINGCVARIABLECPP_LINEIP
245+
%token<str>IDENTSCONSTOpCSTRINGCVARIABLECPP_LINEIPBITCONST
246246
%token<ival>ICONSTPARAM
247247
%token<dval>FCONST
248248

@@ -281,7 +281,7 @@ make_name(void)
281281
%type<str>CreateAsElementOptCreateAsCreateAsListCreateAsStmt
282282
%type<str>OptUnderkey_referencecomment_textConstraintDeferrabilitySpec
283283
%type<str>key_matchColLabelSpecialRuleRelationColIdcolumnDef
284-
%type<str>ColConstraintColConstraintElemdrop_type
284+
%type<str>ColConstraintColConstraintElemdrop_typeBitconst
285285
%type<str>OptTableElementListOptTableElementTableConstraint
286286
%type<str>ConstraintElemkey_actionsColQualListTokenIdDropSchemaStmt
287287
%type<str>target_listtarget_elupdate_target_listalias_clause
@@ -3790,6 +3790,7 @@ ParamNo: PARAM opt_indirection
37903790

37913791
Iconst:ICONST {$$ = make_name();};
37923792
Fconst:FCONST {$$ = make_name();};
3793+
Bitconst:BITCONST {$$ = make_name();};
37933794
Sconst:SCONST {
37943795
$$ = (char *)mm_alloc(strlen($1) +3);
37953796
$$[0]='\'';
@@ -3825,6 +3826,7 @@ AllConst:Sconst{ $$ = $1; }
38253826
PosAllConst:Sconst {$$ =$1; }
38263827
|Fconst{$$ =$1; }
38273828
|Iconst {$$ =$1; }
3829+
|Bitconst{$$ =$1; }
38283830
|civar {$$ = make_str("?"); }
38293831
;
38303832

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp