* Whether an `.inc` file is a Pascal include rather than a PHP one (#2279). * * A PHP include always opens a PHP tag somewhere, so a tag anywhere keeps the * file PHP. Without one, a Pascal-only line shape (`PASCAL_INCLUDE_SIGNALS`, * or a `begin` … `end;` pair) makes it Pascal. Anything else ke
(source: string)
| 712 | * would flip an untouched include whenever the last `.pas` file came or went. |
| 713 | */ |
| 714 | function looksLikePascalInclude(source: string): boolean { |
| 715 | if (PHP_OPEN_TAG_RE.test(source)) return false; |
| 716 | if (PASCAL_INCLUDE_SIGNALS.some((re) => re.test(source))) return true; |
| 717 | return PASCAL_BEGIN_RE.test(source) && PASCAL_END_RE.test(source); |
| 718 | } |
| 719 | |
| 720 | /** Whether a JavaScript file's leading comments carry Flow's `@flow` pragma (and not `@noflow`). */ |
| 721 | export function hasFlowPragma(source: string): boolean { |