* parseNodeString * * Given a character string representing a node tree, parseNodeString creates * the internal node structure. * * The string to be read must already have been loaded into pg_strtok(). */
| 2937 | * The string to be read must already have been loaded into pg_strtok(). |
| 2938 | */ |
| 2939 | Node * |
| 2940 | parseNodeString(void) |
| 2941 | { |
| 2942 | void *return_value; |
| 2943 | |
| 2944 | READ_TEMP_LOCALS(); |
| 2945 | |
| 2946 | /* Guard against stack overflow due to overly complex expressions */ |
| 2947 | check_stack_depth(); |
| 2948 | |
| 2949 | token = pg_strtok(&length); |
| 2950 | |
| 2951 | #define MATCH(tokname, namelen) \ |
| 2952 | (length == namelen && memcmp(token, tokname, namelen) == 0) |
| 2953 | |
| 2954 | /* |
| 2955 | * Same as MATCH, but we make our life a bit easier by relying on the |
| 2956 | * compiler to be smart, and evaluate the strlen("<constant>") at |
| 2957 | * compilation time for us. |
| 2958 | */ |
| 2959 | #define MATCHX(tokname) \ |
| 2960 | (length == strlen(tokname) && strncmp(token, tokname, strlen(tokname)) == 0) |
| 2961 | |
| 2962 | if (MATCH("QUERY", 5)) |
| 2963 | return_value = _readQuery(); |
| 2964 | else if (MATCH("WITHCHECKOPTION", 15)) |
| 2965 | return_value = _readWithCheckOption(); |
| 2966 | else if (MATCH("SORTGROUPCLAUSE", 15)) |
| 2967 | return_value = _readSortGroupClause(); |
| 2968 | else if (MATCH("GROUPINGSET", 11)) |
| 2969 | return_value = _readGroupingSet(); |
| 2970 | else if (MATCH("WINDOWCLAUSE", 12)) |
| 2971 | return_value = _readWindowClause(); |
| 2972 | else if (MATCH("ROWMARKCLAUSE", 13)) |
| 2973 | return_value = _readRowMarkClause(); |
| 2974 | else if (MATCH("CTESEARCHCLAUSE", 15)) |
| 2975 | return_value = _readCTESearchClause(); |
| 2976 | else if (MATCH("CTECYCLECLAUSE", 14)) |
| 2977 | return_value = _readCTECycleClause(); |
| 2978 | else if (MATCH("COMMONTABLEEXPR", 15)) |
| 2979 | return_value = _readCommonTableExpr(); |
| 2980 | else if (MATCH("SETOPERATIONSTMT", 16)) |
| 2981 | return_value = _readSetOperationStmt(); |
| 2982 | else if (MATCH("ALIAS", 5)) |
| 2983 | return_value = _readAlias(); |
| 2984 | else if (MATCH("RANGEVAR", 8)) |
| 2985 | return_value = _readRangeVar(); |
| 2986 | else if (MATCH("INTOCLAUSE", 10)) |
| 2987 | return_value = _readIntoClause(); |
| 2988 | else if (MATCH("COPYINTOCLAUSE", 14)) |
| 2989 | return_value = _readCopyIntoClause(); |
| 2990 | else if (MATCH("REFRESHCLAUSE", 13)) |
| 2991 | return_value = _readRefreshClause(); |
| 2992 | else if (MATCH("TABLEFUNC", 9)) |
| 2993 | return_value = _readTableFunc(); |
| 2994 | else if (MATCH("VAR", 3)) |
| 2995 | return_value = _readVar(); |
| 2996 | else if (MATCH("CONST", 5)) |
no test coverage detected