(source: string)
| 900 | /(?:[A-Z][A-Z0-9_]{2,}\b(?:\s*\((?:[^()]|\((?:[^()]|\([^()]*\))*\))*\))?\s*)+/y; |
| 901 | const CPP_TRAILING_ATTR_FOLLOW_RE = /(?:\{|;|=(?!=)|:(?!:)|->|(?:override|final|const|noexcept)\b)/y; |
| 902 | export function blankCppTrailingAttributeMacros(source: string): string { |
| 903 | if (!/\)[\s\w&]*?\b[A-Z][A-Z0-9_]{2,}\b/.test(source)) return source; |
| 904 | const code = maskCppCode(source); |
| 905 | const spans: Array<[number, number]> = []; |
| 906 | const re = new RegExp(CPP_TRAILING_ATTR_CANDIDATE_RE.source, 'g'); |
| 907 | const run = new RegExp(CPP_TRAILING_ATTR_RUN_RE.source, 'y'); |
| 908 | const follow = new RegExp(CPP_TRAILING_ATTR_FOLLOW_RE.source, 'y'); |
| 909 | let m: RegExpExecArray | null; |
| 910 | while ((m = re.exec(code)) !== null) { |
| 911 | const macroStart = m.index + m[0].length; |
| 912 | if (/\n[ \t]*\r?\n/.test(m[0])) continue; |
| 913 | run.lastIndex = macroStart; |
| 914 | const r = run.exec(code); |
| 915 | if (!r) continue; |
| 916 | follow.lastIndex = macroStart + r[0].length; |
| 917 | if (!follow.test(code)) continue; |
| 918 | if (!closesParameterList(code, m.index)) continue; |
| 919 | pushCppRunTokens(spans, r[0], macroStart); |
| 920 | re.lastIndex = macroStart + r[0].length; |
| 921 | } |
| 922 | return blankCppSpans(source, spans, code); |
| 923 | } |
| 924 | |
| 925 | // Type keywords that may stand right before a declared name (`int count_ …`). |
| 926 | const CPP_TYPE_KEYWORDS = new Set([ |
no test coverage detected