@appthreat/atom-parsetools 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astgen.js +49 -25
- package/package.json +1 -1
- package/plugins/composer/installed.php +6 -6
- package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/prism-1.7.0/gem_make.out +5 -5
- package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/racc-1.8.1/gem_make.out +5 -5
package/astgen.js
CHANGED
|
@@ -262,34 +262,29 @@ const toEjsAst = (file) => {
|
|
|
262
262
|
let arr = originalCode.split("");
|
|
263
263
|
const scriptRegex = /(<script>)([\s\S]*?)(<\/script>)/gi;
|
|
264
264
|
let match;
|
|
265
|
-
|
|
266
265
|
while ((match = scriptRegex.exec(originalCode)) !== null) {
|
|
267
266
|
const openStart = match.index;
|
|
268
267
|
const openLen = match[1].length;
|
|
269
268
|
arr[openStart] = "<";
|
|
270
269
|
arr[openStart + 1] = "%";
|
|
271
|
-
for (let i = 2; i < openLen; i++)
|
|
270
|
+
for (let i = 2; i < openLen; i++) {
|
|
271
|
+
arr[openStart + i] = " ";
|
|
272
|
+
}
|
|
272
273
|
const closeStart = match.index + match[0].length - match[3].length;
|
|
273
274
|
const closeLen = match[3].length;
|
|
274
275
|
arr[closeStart] = "%";
|
|
275
276
|
arr[closeStart + 1] = ">";
|
|
276
|
-
for (let i = 2; i < closeLen; i++)
|
|
277
|
+
for (let i = 2; i < closeLen; i++) {
|
|
278
|
+
arr[closeStart + i] = " ";
|
|
279
|
+
}
|
|
277
280
|
const content = match[2];
|
|
278
281
|
const contentOffset = openStart + openLen;
|
|
279
282
|
const innerRegex = /(<%[=\-_#]?)([\s\S]*?)([-_#]?%>)/g;
|
|
280
283
|
let innerMatch;
|
|
281
284
|
while ((innerMatch = innerRegex.exec(content)) !== null) {
|
|
282
285
|
const innerAbsStart = contentOffset + innerMatch.index;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
arr[innerAbsStart + k] = " ";
|
|
286
|
-
} else {
|
|
287
|
-
for (let k = 0; k < innerMatch[1].length; k++)
|
|
288
|
-
arr[innerAbsStart + k] = " ";
|
|
289
|
-
const endDelimStart =
|
|
290
|
-
innerAbsStart + innerMatch[0].length - innerMatch[3].length;
|
|
291
|
-
for (let k = 0; k < innerMatch[3].length; k++)
|
|
292
|
-
arr[endDelimStart + k] = " ";
|
|
286
|
+
for (let k = 0; k < innerMatch[0].length; k++) {
|
|
287
|
+
arr[innerAbsStart + k] = " ";
|
|
293
288
|
}
|
|
294
289
|
}
|
|
295
290
|
}
|
|
@@ -299,26 +294,55 @@ const toEjsAst = (file) => {
|
|
|
299
294
|
const c = codeWithoutScriptTag[i];
|
|
300
295
|
if (c === "\n" || c === "\r") out[i] = c;
|
|
301
296
|
}
|
|
302
|
-
|
|
303
297
|
const tagRegex = /(<%[=\-_#]?)([\s\S]*?)([-_#]?%>)/g;
|
|
304
298
|
let tagMatch;
|
|
305
299
|
while ((tagMatch = tagRegex.exec(codeWithoutScriptTag)) !== null) {
|
|
306
300
|
const [fullMatch, openTag, content, closeTag] = tagMatch;
|
|
307
301
|
if (openTag === "<%#" || content.trim().startsWith("include ")) continue;
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
302
|
+
let processedContent = content.trim();
|
|
303
|
+
if (processedContent === "end") {
|
|
304
|
+
processedContent = "}";
|
|
305
|
+
} else if (processedContent === "else") {
|
|
306
|
+
processedContent = "} else {";
|
|
307
|
+
} else if (processedContent.startsWith("else if")) {
|
|
308
|
+
let sub = processedContent.substring(4).trim();
|
|
309
|
+
const controlMatch = sub.match(/^(if)\s+(?!\()(.+)$/);
|
|
310
|
+
if (controlMatch) {
|
|
311
|
+
sub = `if (${controlMatch[2]})`;
|
|
312
|
+
}
|
|
313
|
+
processedContent = `} else ${sub} {`;
|
|
314
|
+
} else {
|
|
315
|
+
const controlMatch = processedContent.match(
|
|
316
|
+
/^(if|while|for)\s+(?!\()(.+)$/
|
|
317
|
+
);
|
|
318
|
+
if (controlMatch) {
|
|
319
|
+
const keyword = controlMatch[1];
|
|
320
|
+
const condition = controlMatch[2];
|
|
321
|
+
processedContent = `${keyword} (${condition})`;
|
|
322
|
+
}
|
|
323
|
+
if (
|
|
324
|
+
/^(if|while|for|try|switch|catch)/.test(processedContent) &&
|
|
325
|
+
!processedContent.endsWith("{") &&
|
|
326
|
+
!processedContent.endsWith("}") &&
|
|
327
|
+
!processedContent.endsWith(";")
|
|
328
|
+
) {
|
|
329
|
+
processedContent += " {";
|
|
330
|
+
}
|
|
312
331
|
}
|
|
313
|
-
const trimmed = content.trim();
|
|
314
332
|
const needsSemi =
|
|
315
|
-
|
|
316
|
-
!
|
|
317
|
-
!
|
|
318
|
-
!
|
|
319
|
-
|
|
333
|
+
processedContent.length > 0 &&
|
|
334
|
+
!processedContent.endsWith("{") &&
|
|
335
|
+
!processedContent.endsWith("}") &&
|
|
336
|
+
!processedContent.endsWith(";");
|
|
320
337
|
if (needsSemi) {
|
|
321
|
-
|
|
338
|
+
processedContent += ";";
|
|
339
|
+
}
|
|
340
|
+
const startIndex = tagMatch.index;
|
|
341
|
+
const maxLen = fullMatch.length;
|
|
342
|
+
for (let k = 0; k < processedContent.length; k++) {
|
|
343
|
+
if (k < maxLen) {
|
|
344
|
+
out[startIndex + k] = processedContent[k];
|
|
345
|
+
}
|
|
322
346
|
}
|
|
323
347
|
}
|
|
324
348
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<?php return array(
|
|
2
2
|
'root' => array(
|
|
3
3
|
'name' => '__root__',
|
|
4
|
-
'pretty_version' => 'v1.1.
|
|
5
|
-
'version' => '1.1.
|
|
6
|
-
'reference' => '
|
|
4
|
+
'pretty_version' => 'v1.1.1',
|
|
5
|
+
'version' => '1.1.1.0',
|
|
6
|
+
'reference' => 'f6576535af9e41e44bbfaf278b32edc0dfbaef01',
|
|
7
7
|
'type' => 'library',
|
|
8
8
|
'install_path' => __DIR__ . '/../../',
|
|
9
9
|
'aliases' => array(),
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
),
|
|
12
12
|
'versions' => array(
|
|
13
13
|
'__root__' => array(
|
|
14
|
-
'pretty_version' => 'v1.1.
|
|
15
|
-
'version' => '1.1.
|
|
16
|
-
'reference' => '
|
|
14
|
+
'pretty_version' => 'v1.1.1',
|
|
15
|
+
'version' => '1.1.1.0',
|
|
16
|
+
'reference' => 'f6576535af9e41e44bbfaf278b32edc0dfbaef01',
|
|
17
17
|
'type' => 'library',
|
|
18
18
|
'install_path' => __DIR__ . '/../../',
|
|
19
19
|
'aliases' => array(),
|
package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/prism-1.7.0/gem_make.out
CHANGED
|
@@ -6,10 +6,10 @@ checking for whether -fvisibility=hidden is accepted as CFLAGS... yes
|
|
|
6
6
|
creating Makefile
|
|
7
7
|
|
|
8
8
|
current directory: /home/runner/work/atom-parsetools/atom-parsetools/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.7.0/ext/prism
|
|
9
|
-
make -j5 DESTDIR\= sitearchdir\=./.gem.
|
|
9
|
+
make -j5 DESTDIR\= sitearchdir\=./.gem.20260105-2215-ju1bl3 sitelibdir\=./.gem.20260105-2215-ju1bl3 clean
|
|
10
10
|
|
|
11
11
|
current directory: /home/runner/work/atom-parsetools/atom-parsetools/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.7.0/ext/prism
|
|
12
|
-
make -j5 DESTDIR\= sitearchdir\=./.gem.
|
|
12
|
+
make -j5 DESTDIR\= sitearchdir\=./.gem.20260105-2215-ju1bl3 sitelibdir\=./.gem.20260105-2215-ju1bl3
|
|
13
13
|
compiling api_node.c
|
|
14
14
|
compiling api_pack.c
|
|
15
15
|
compiling extension.c
|
|
@@ -37,8 +37,8 @@ compiling ./../../src/util/pm_strpbrk.c
|
|
|
37
37
|
linking shared-object prism/prism.so
|
|
38
38
|
|
|
39
39
|
current directory: /home/runner/work/atom-parsetools/atom-parsetools/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.7.0/ext/prism
|
|
40
|
-
make -j5 DESTDIR\= sitearchdir\=./.gem.
|
|
41
|
-
/usr/bin/install -c -m 0755 prism.so ./.gem.
|
|
40
|
+
make -j5 DESTDIR\= sitearchdir\=./.gem.20260105-2215-ju1bl3 sitelibdir\=./.gem.20260105-2215-ju1bl3 install
|
|
41
|
+
/usr/bin/install -c -m 0755 prism.so ./.gem.20260105-2215-ju1bl3/prism
|
|
42
42
|
|
|
43
43
|
current directory: /home/runner/work/atom-parsetools/atom-parsetools/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.7.0/ext/prism
|
|
44
|
-
make DESTDIR\= sitearchdir\=./.gem.
|
|
44
|
+
make DESTDIR\= sitearchdir\=./.gem.20260105-2215-ju1bl3 sitelibdir\=./.gem.20260105-2215-ju1bl3 clean
|
package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/racc-1.8.1/gem_make.out
CHANGED
|
@@ -3,16 +3,16 @@ current directory: /home/runner/work/atom-parsetools/atom-parsetools/plugins/rub
|
|
|
3
3
|
creating Makefile
|
|
4
4
|
|
|
5
5
|
current directory: /home/runner/work/atom-parsetools/atom-parsetools/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ext/racc/cparse
|
|
6
|
-
make -j5 DESTDIR\= sitearchdir\=./.gem.
|
|
6
|
+
make -j5 DESTDIR\= sitearchdir\=./.gem.20260105-2215-74o4o6 sitelibdir\=./.gem.20260105-2215-74o4o6 clean
|
|
7
7
|
|
|
8
8
|
current directory: /home/runner/work/atom-parsetools/atom-parsetools/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ext/racc/cparse
|
|
9
|
-
make -j5 DESTDIR\= sitearchdir\=./.gem.
|
|
9
|
+
make -j5 DESTDIR\= sitearchdir\=./.gem.20260105-2215-74o4o6 sitelibdir\=./.gem.20260105-2215-74o4o6
|
|
10
10
|
compiling cparse.c
|
|
11
11
|
linking shared-object racc/cparse.so
|
|
12
12
|
|
|
13
13
|
current directory: /home/runner/work/atom-parsetools/atom-parsetools/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ext/racc/cparse
|
|
14
|
-
make -j5 DESTDIR\= sitearchdir\=./.gem.
|
|
15
|
-
/usr/bin/install -c -m 0755 cparse.so ./.gem.
|
|
14
|
+
make -j5 DESTDIR\= sitearchdir\=./.gem.20260105-2215-74o4o6 sitelibdir\=./.gem.20260105-2215-74o4o6 install
|
|
15
|
+
/usr/bin/install -c -m 0755 cparse.so ./.gem.20260105-2215-74o4o6/racc
|
|
16
16
|
|
|
17
17
|
current directory: /home/runner/work/atom-parsetools/atom-parsetools/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ext/racc/cparse
|
|
18
|
-
make DESTDIR\= sitearchdir\=./.gem.
|
|
18
|
+
make DESTDIR\= sitearchdir\=./.gem.20260105-2215-74o4o6 sitelibdir\=./.gem.20260105-2215-74o4o6 clean
|