summaryrefslogtreecommitdiff
path: root/src/fe_utils
diff options
context:
space:
mode:
authorTom Lane2018-11-13 17:57:52 +0000
committerTom Lane2018-11-13 17:57:52 +0000
commitec937d0805b205e5b33ed4f3cb54f40230a826e3 (patch)
tree79bdb4c84952b7dc08f8d8d0e25d8dd96d9c39e5 /src/fe_utils
parentd20dceaf50ea093234ef6a66bb2dae485468bea2 (diff)
Align ECPG lexer more closely with the core and psql lexers.
Make a bunch of basically-cosmetic changes to reduce the diffs between the flex rules in scan.l, psqlscan.l, and pgc.l. Reorder some code, adjust a lot of whitespace, sync some comments, make use of flex start condition scopes to do that. There are a few non-cosmetic changes in the ECPG lexer: * Bring over the decimalfail rule (and support function process_integer_literal) so that ECPG will lex "1..10" into the same tokens as the backend would. I'm not sure this makes any visible difference to users, but I'm not sure it doesn't, either. * <xdc><<EOF>> gets its own rule so as to produce a more on-point error message. * Remove duplicate <SQL>{xdstart} rule. John Naylor, with a few additional changes by me Discussion: https://postgr.es/m/CAJVSVGWGqY9YBs2EwtRUkbNv=hXkN8yRPOoD1wxE6COgvvrz5g@mail.gmail.com
Diffstat (limited to 'src/fe_utils')
-rw-r--r--src/fe_utils/psqlscan.l22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/fe_utils/psqlscan.l b/src/fe_utils/psqlscan.l
index fdf49875a72..ae5418e7da0 100644
--- a/src/fe_utils/psqlscan.l
+++ b/src/fe_utils/psqlscan.l
@@ -23,6 +23,7 @@
*
* See psqlscan_int.h for additional commentary.
*
+ *
* Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
@@ -39,6 +40,9 @@
}
%{
+
+/* LCOV_EXCL_START */
+
#include "fe_utils/psqlscan_int.h"
/*
@@ -71,8 +75,6 @@ typedef int YYSTYPE;
extern int psql_yyget_column(yyscan_t yyscanner);
extern void psql_yyset_column(int column_no, yyscan_t yyscanner);
-/* LCOV_EXCL_START */
-
%}
%option reentrant
@@ -128,8 +130,8 @@ extern void psql_yyset_column(int column_no, yyscan_t yyscanner);
%x xc
%x xd
%x xh
-%x xe
%x xq
+%x xe
%x xdolq
%x xui
%x xuiend
@@ -151,7 +153,7 @@ extern void psql_yyset_column(int column_no, yyscan_t yyscanner);
* XXX perhaps \f (formfeed) should be treated as a newline as well?
*
* XXX if you change the set of whitespace characters, fix scanner_isspace()
- * to agree, and see also the plpgsql lexer.
+ * to agree.
*/
space [ \t\n\r\f]
@@ -402,14 +404,15 @@ other .
ECHO;
}
-<xc>{xcstart} {
+<xc>{
+{xcstart} {
cur_state->xcdepth++;
/* Put back any characters past slash-star; see above */
yyless(2);
ECHO;
}
-<xc>{xcstop} {
+{xcstop} {
if (cur_state->xcdepth <= 0)
BEGIN(INITIAL);
else
@@ -417,17 +420,18 @@ other .
ECHO;
}
-<xc>{xcinside} {
+{xcinside} {
ECHO;
}
-<xc>{op_chars} {
+{op_chars} {
ECHO;
}
-<xc>\*+ {
+\*+ {
ECHO;
}
+} /* <xc> */
{xbstart} {
BEGIN(xb);