MCPcopy Create free account
hub / github.com/REditorSupport/vscode-R / extractCompilerInfo

Function extractCompilerInfo

src/cppProperties.ts:139–160  ·  view source on GitHub ↗
(compileOutput: string)

Source from the content-addressed store, hash-verified

137}
138
139function extractCompilerInfo(compileOutput: string) {
140 const rxCompArg = /-(I|D)("[^"]+"|[\S]+)/gm;
141
142 const compDefines: string[] = [];
143 const compIncludes: string[] = [];
144 const compLookup = { 'D': compDefines, 'I': compIncludes };
145
146 let m: RegExpExecArray | null;
147 while ((m = rxCompArg.exec(compileOutput)) !== null) {
148 if (m.index === rxCompArg.lastIndex) {
149 rxCompArg.lastIndex++;
150 }
151
152 // The regex guarantees that the first group is 'I' or 'D'
153 compLookup[(m[1] as 'D' | 'I')].push(ensureUnquoted(m[2]));
154 }
155
156 return {
157 compDefines: compDefines,
158 compIncludes: compIncludes
159 };
160}
161
162function extractCompilerStd(compileOutput: string): string | undefined {
163 const rxStd = /-std=(\S+)/;

Callers 1

Calls 1

ensureUnquotedFunction · 0.85

Tested by

no test coverage detected