118
119
private parseVariable(str: string, start: number): { replacement: Replacement; end: number } | undefined {
121
return undefined;
122
}
124
>
let end = start + 2;
125
>
let braceCount = 1;
126
>
while (end < str.length) {
127
>
if (str[end] === '{') {
128
braceCount++;
130
>
braceCount--;
131
>
if (braceCount === 0) {
132
>
break;
133
>
}
134
>
}
135
>
end++;
136
>
}
137
>
138
>
if (braceCount !== 0) {
139
return undefined;
140
}
142
>
const id = str.slice(start, end + 1);
143
>
const inner = str.substring(start + 2, end);
144
>
const colonIdx = inner.indexOf(':');
145
>
if (colonIdx === -1) {
146
>
return { replacement: { id, name: inner, inner }, end };
147
>
}
148
>
149
>
return {
150
>
replacement: {
151
>
id,
152
>
inner,
153
>
name: inner.slice(0, colonIdx),
154
>
arg: inner.slice(colonIdx + 1)
155
>
},
156
>
end
157
>
};
158
>
}
159
160
private parseObject(obj: any): void {