[postgis-tickets] r17235 - Add generated lexer
Paul Ramsey
pramsey at cleverelephant.ca
Mon Feb 11 09:17:16 PST 2019
Author: pramsey
Date: 2019-02-11 09:17:16 -0800 (Mon, 11 Feb 2019)
New Revision: 17235
Modified:
trunk/liblwgeom/lwin_wkt_lex.c
Log:
Add generated lexer
Modified: trunk/liblwgeom/lwin_wkt_lex.c
===================================================================
--- trunk/liblwgeom/lwin_wkt_lex.c 2019-02-11 17:17:03 UTC (rev 17234)
+++ trunk/liblwgeom/lwin_wkt_lex.c 2019-02-11 17:17:16 UTC (rev 17235)
@@ -863,12 +863,12 @@
#include "lwin_wkt_parse.h"
#include "lwgeom_log.h"
-static YY_BUFFER_STATE wkt_yy_buf_state;
+static YY_BUFFER_STATE wkt_yy_buf_state;
/*
* Handle errors due to unexpected junk in WKT strings.
*/
-static void wkt_lexer_unknown()
+static void wkt_lexer_unknown()
{
/* Set the global error state */
global_parser_result.errcode = PARSER_ERROR_OTHER;
@@ -876,8 +876,8 @@
global_parser_result.errlocation = wkt_yylloc.last_column;
}
-/*
-* This macro is magically run after a rule is found but before the main
+/*
+* This macro is magically run after a rule is found but before the main
* action is run. We use it to update the parse location information
* so we can report on where things fail. Also optionally to dump
* debugging info.
@@ -889,7 +889,7 @@
LWDEBUGF(5,"lex: %s", wkt_yytext); \
} while (0);
-
+
#line 893 "lwin_wkt_lex.c"
#define YY_NO_INPUT 1
/* Suppress the default implementations. */
@@ -1172,16 +1172,16 @@
LWDEBUG(5,"DOUBLE");
wkt_yylval.doublevalue = atof(wkt_yytext);
yyless(wkt_yyleng-1);
- return DOUBLE_TOK;
+ return DOUBLE_TOK;
}
YY_BREAK
case 2:
YY_RULE_SETUP
#line 58 "lwin_wkt_lex.l"
-{
+{
LWDEBUG(5,"SRID");
- wkt_yylval.integervalue = wkt_lexer_read_srid(wkt_yytext);
- return SRID_TOK;
+ wkt_yylval.integervalue = wkt_lexer_read_srid(wkt_yytext);
+ return SRID_TOK;
}
YY_BREAK
case 3:
@@ -1267,10 +1267,10 @@
case 19:
YY_RULE_SETUP
#line 81 "lwin_wkt_lex.l"
-{
+{
LWDEBUG(5,"DIMENSIONALITY");
wkt_yylval.stringvalue = wkt_yytext;
- return DIMENSIONALITY_TOK;
+ return DIMENSIONALITY_TOK;
}
YY_BREAK
case 20:
@@ -1303,9 +1303,9 @@
YY_RULE_SETUP
#line 94 "lwin_wkt_lex.l"
{ /* Error out and stop parsing on unknown/unexpected characters */
- LWDEBUG(5,"UNKNOWN");
+ LWDEBUG(5,"UNKNOWN");
wkt_lexer_unknown();
- yyterminate();
+ yyterminate();
}
YY_BREAK
case 26:
@@ -2280,17 +2280,18 @@
/*
* Set up the lexer!
*/
-void wkt_lexer_init(char *src)
-{
- wkt_yy_buf_state = wkt_yy_scan_string(src);
-}
+void wkt_lexer_init(char *src)
+{
+ yy_init_globals();
+ wkt_yy_buf_state = wkt_yy_scan_string(src);
+}
/*
* Clean up the lexer!
*/
-void wkt_lexer_close()
-{
- wkt_yy_delete_buffer(wkt_yy_buf_state);
-}
+void wkt_lexer_close()
+{
+ wkt_yy_delete_buffer(wkt_yy_buf_state);
+}
More information about the postgis-tickets
mailing list