Skip one lexical unit whose braces are not structure: a # comment, a "..." * or """...""" string, or a JS ${...} template interpolation. Returns p * unchanged when p starts none of them. */
| 945 | * or """...""" string, or a JS ${...} template interpolation. Returns p |
| 946 | * unchanged when p starts none of them. */ |
| 947 | static const char *gql_skip_opaque(const char *p) { |
| 948 | if (*p == '#') { |
| 949 | while (*p && *p != '\n' && *p != '\r') { |
| 950 | p++; |
| 951 | } |
| 952 | return p; |
| 953 | } |
| 954 | if (strncmp(p, "\"\"\"", 3) == 0) { |
| 955 | const char *end = strstr(p + 3, "\"\"\""); |
| 956 | return end ? end + 3 : p + strlen(p); |
| 957 | } |
| 958 | if (*p == '"') { |
| 959 | p++; |
| 960 | while (*p && *p != '"') { |
| 961 | p += (*p == '\\' && p[1]) ? 2 : 1; |
| 962 | } |
| 963 | return *p ? p + 1 : p; |
| 964 | } |
| 965 | if (p[0] == '$' && p[1] == '{') { |
| 966 | int depth = 1; |
| 967 | p += 2; |
| 968 | while (*p && depth > 0) { |
| 969 | depth += (*p == '{') - (*p == '}'); |
| 970 | p++; |
| 971 | } |
| 972 | return p; |
| 973 | } |
| 974 | return p; |
| 975 | } |
| 976 | |
| 977 | /* Skip GraphQL "ignored tokens" (whitespace, commas, comments). */ |
| 978 | static const char *gql_skip_ignored(const char *p) { |
no outgoing calls
no test coverage detected