Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
06c4813
test(eo-parser): add test case for auto phi formation with applicatio…
h1alexbel Sep 17, 2025
9bdb52f
test: update test cases to reflect new auto phi formation behavior wi…
h1alexbel Sep 17, 2025
da64738
refactor(XeEoListener): rename APPLICATION_PRECEDENCE to A_PRECEDENCE…
h1alexbel Sep 17, 2025
554385c
bug(#4559): add new transpile pack for auto phi formation with applic…
h1alexbel Sep 17, 2025
d2f2257
bug(#4559): add new transpile pack for auto phi formation with applic…
h1alexbel Sep 17, 2025
2ebe627
bug(#4559): last application
h1alexbel Sep 17, 2025
32c2eec
bug(#4559): add auto-phi-with-application-precendence.yaml test resou…
h1alexbel Sep 19, 2025
18aeaaf
bug(#4559): refine XSL template to exclude positioned objects from au…
h1alexbel Sep 19, 2025
96763d6
bug(#4559): typo
h1alexbel Sep 19, 2025
eb1c1eb
bug(#4559): test case
h1alexbel Sep 22, 2025
d36d73f
bug(#4559): handle fully qualified names in auto-phi formation by str…
h1alexbel Sep 22, 2025
e2a0396
chore(#4559): remove empty line from test resource file
h1alexbel Sep 22, 2025
ece0c48
empty commit to restart pipelines
h1alexbel Sep 22, 2025
7bedfad
bug(#4559): add test case for auto phi formation from FQN precedence …
h1alexbel Sep 24, 2025
82cd9ba
bug(#4559): simplify Q-prefixed application handling by replacing Q w…
h1alexbel Sep 24, 2025
d9bea33
empty commit to restart pipelines
h1alexbel Sep 24, 2025
4ae096f
bug(#4559): auto-phi formation from application with \rho
h1alexbel Sep 25, 2025
ac2de15
bug(#4559): extend identifier pattern to support Unicode letters and …
h1alexbel Sep 25, 2025
0971a90
bug(#4559): redundant loop
h1alexbel Sep 25, 2025
82f1cb7
bug(#4559): typo
h1alexbel Sep 25, 2025
a67b94b
bug(#4559): add support for QQ prefix in EO applications to map to Φ.…
h1alexbel Sep 25, 2025
cfc1e13
bug(#4559): add test case for auto phi formation from nested application
h1alexbel Sep 25, 2025
f384915
bug(#4559): skip auto-phi formation test due to parsing issues with n…
h1alexbel Sep 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion eo-parser/src/main/java/org/eolang/parser/XeEoListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.Token;
Expand All @@ -35,6 +37,11 @@
"PMD.GodClass"
})
final class XeEoListener implements EoListener, Iterable<Directive> {
/**
* Application precedence.
*/
private static final Pattern A_PRECEDENCE = Pattern.compile("\\([^()]*\\)\\.(\\w+)");

/**
* Xembly directives we are building (mutable).
*/
Expand Down Expand Up @@ -1210,10 +1217,17 @@ private String alphaAttr(final ParserRuleContext ctx, final String msg) {
* @param application Application base
*/
private void startAutoPhiFormation(final ParserRuleContext ctx, final String application) {
final Matcher matcher = XeEoListener.A_PRECEDENCE.matcher(application);
final String abase;
if (matcher.find()) {
abase = String.format(".%s", matcher.group(1));
} else {
abase = String.format("ξ.ρ.%s", application);
}
this.startAbstract(ctx)
.enter().prop("name", new AutoName(ctx, "p").asString())
.start(ctx)
.prop("base", String.format("ξ.ρ.%s", application))
.prop("base", abase)
.prop("name", "φ");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
sheets: []
asserts:
- /object[not(errors)]
- //o[not(@base) and @name='ap🌵34' and o[@name='φ' and @base='.what']]
- //o[not(@base) and @name='ap🌵66' and o[@name='φ' and @base='.contains']]
input: |
[cont-list] > custom-map
foo > boom
((text orgn).what b).ttt >> [y]
mapped. > @
cont-list
(text orgn).contains x >> [x]
origin > orgn!
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
sheets: []
asserts:
- /object[not(errors)]
- //o[not(@base) and @name='a🌵34' and o[2][@name='i' and @base='∅'] and o[3][@name='φ']]
- //o[@base='Φ.org.eolang.foo' and o[@base='ξ.a🌵34']]
- //o[not(@base) and @name='ap🌵34' and o[2][@name='i' and @base='∅'] and o[3][@name='φ']]
- //o[@base='Φ.org.eolang.foo' and o[@base='ξ.ap🌵34']]
input: |
[] > main
foo > @
Expand Down
Loading