Cheap pre-filter: does the source contain a Jinja expression opener? Files * without one cannot hold a ref()/source() call, and skipping them keeps the * second parse off every ordinary .sql file in the repository. */
| 47 | * without one cannot hold a ref()/source() call, and skipping them keeps the |
| 48 | * second parse off every ordinary .sql file in the repository. */ |
| 49 | static bool source_has_jinja_expr(const char *s, int len) { |
| 50 | for (int i = 0; i + 1 < len; i++) { |
| 51 | if (s[i] == '{' && s[i + 1] == '{') { |
| 52 | return true; |
| 53 | } |
| 54 | } |
| 55 | return false; |
| 56 | } |
| 57 | |
| 58 | /* Strip one pair of surrounding quotes from a jinja lit_string. The grammar |
| 59 | * hands back the token with its quotes attached. */ |