xref: /php-src/ext/pdo_pgsql/pgsql_sql_parser.re (revision a57ce052)
1/*
2  +----------------------------------------------------------------------+
3  | Copyright (c) The PHP Group                                          |
4  +----------------------------------------------------------------------+
5  | This source file is subject to version 3.01 of the PHP license,      |
6  | that is bundled with this package in the file LICENSE, and is        |
7  | available through the world-wide-web at the following url:           |
8  | https://www.php.net/license/3_01.txt                                 |
9  | If you did not receive a copy of the PHP license and are unable to   |
10  | obtain it through the world-wide-web, please send a note to          |
11  | license@php.net so we can mail you a copy immediately.               |
12  +----------------------------------------------------------------------+
13  | Author: Matteo Beccati <mbeccati@php.net>                            |
14  +----------------------------------------------------------------------+
15*/
16
17
18#include "php.h"
19#include "ext/pdo/php_pdo_driver.h"
20#include "ext/pdo/pdo_sql_parser.h"
21
22int pdo_pgsql_scanner(pdo_scanner_t *s)
23{
24	const char *cursor = s->cur;
25
26	s->tok = cursor;
27	/*!re2c
28	BINDCHR		= [:][a-zA-Z0-9_]+;
29	QUESTION	= [?];
30	ESCQUESTION	= [?][?];
31	COMMENTS	= ("/*"([^*]+|[*]+[^/*])*[*]*"*/"|"--".*);
32	DOLQ_START	= [A-Za-z\200-\377_];
33	DOLQ_CONT	= [A-Za-z\200-\377_0-9];
34	SPECIALS	= [$eE:?"'/-];
35	MULTICHAR	= [:]{2,};
36	ANYNOEOF	= [\001-\377];
37	*/
38
39	/*!re2c
40		[eE](['](([']['])|([\\]ANYNOEOF)|ANYNOEOF\['\\])*[']) { RET(PDO_PARSER_TEXT); }
41		(["]((["]["])|ANYNOEOF\["])*["])		{ RET(PDO_PARSER_TEXT); }
42		(['](([']['])|ANYNOEOF\['])*['])		{ RET(PDO_PARSER_TEXT); }
43		[$](DOLQ_START DOLQ_CONT*)?[$]			{ RET(PDO_PARSER_CUSTOM_QUOTE); }
44		MULTICHAR								{ RET(PDO_PARSER_TEXT); }
45		ESCQUESTION								{ RET(PDO_PARSER_ESCAPED_QUESTION); }
46		BINDCHR									{ RET(PDO_PARSER_BIND); }
47		QUESTION								{ RET(PDO_PARSER_BIND_POS); }
48		SPECIALS								{ SKIP_ONE(PDO_PARSER_TEXT); }
49		COMMENTS								{ RET(PDO_PARSER_TEXT); }
50		(ANYNOEOF\SPECIALS)+ 					{ RET(PDO_PARSER_TEXT); }
51	*/
52}
53