xref: /php-src/ext/pdo_mysql/mysql_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_mysql_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	COMMENTS	= ("/*"([^*]+|[*]+[^/*])*[*]*"*/"|(("--"[ \t\v\f\r])|[#]).*);
31	SPECIALS	= [:?"'`/#-];
32	MULTICHAR	= ([:]{2,}|[?]{2,});
33	ANYNOEOF	= [\001-\377];
34	*/
35
36	/*!re2c
37		(["]((["]["])|([\\]ANYNOEOF)|ANYNOEOF\["\\])*["]) { RET(PDO_PARSER_TEXT); }
38		(['](([']['])|([\\]ANYNOEOF)|ANYNOEOF\['\\])*[']) { RET(PDO_PARSER_TEXT); }
39		([`]([`][`]|ANYNOEOF\[`])*[`])			{ RET(PDO_PARSER_TEXT); }
40		MULTICHAR								{ RET(PDO_PARSER_TEXT); }
41		BINDCHR									{ RET(PDO_PARSER_BIND); }
42		QUESTION								{ RET(PDO_PARSER_BIND_POS); }
43		SPECIALS								{ SKIP_ONE(PDO_PARSER_TEXT); }
44		COMMENTS								{ RET(PDO_PARSER_TEXT); }
45		(ANYNOEOF\SPECIALS)+ 					{ RET(PDO_PARSER_TEXT); }
46	*/
47}
48