1
秦芳睿
8 天以前 e70a362606b78a822e93d5117a9013e8f9086faf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
 
/*
 * NOTE: this file is only meant to be included in the Cypher parsing files,
 *       i.e., cypher_gram.y, cypher_keywords.c, and cypher_parser.c.
 *       Definitions that are needed outside the Cypher parser should be in
 *       cypher_parser.h.
 */
 
#ifndef AG_CYPHER_GRAM_H
#define AG_CYPHER_GRAM_H
 
#include "nodes/nodes.h"
#include "nodes/pg_list.h"
 
#include "parser/ag_scanner.h"
 
// override the default data type of locations (yylloc)
#define YYLTYPE int
 
/*
 * Extra data that is passed to the generated parser.
 * The resulting abstract syntax tree is stored in result field.
 */
typedef struct cypher_yy_extra
{
    List *result;
    /*
     * This node currently holds the EXPLAIN ExplainStmt node. It is generic in
     * the event we need to allow more than just EXPLAIN to be passed up.
     */
    Node *extra;
} cypher_yy_extra;
 
/*
 * cypher_gram_def.h is generated by Bison.
 *
 * nodes/nodes.h and nodes/pg_list.h must be included before this due to the
 * use of Node and List in YYSTYPE.
 *
 * ag_scanner.h must be included before this because ag_scanner_t is one of the
 * parameters of cypher_yyparse() which is generated by Bison.
 *
 * YYLTYPE must be defined before this. (see above)
 *
 * cypher_yy_extra must be defined before this because it is another parameter
 * of cypher_yyparse().
 */
#include "parser/cypher_gram_def.h"
 
// cypher_parser.c
int cypher_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, ag_scanner_t scanner);
void cypher_yyerror(YYLTYPE *llocp, ag_scanner_t scanner,
                    cypher_yy_extra *extra, const char *msg);
 
#endif