diff --git a/eo-maven-plugin/src/main/resources/org/eolang/maven/pre/to-java.xsl b/eo-maven-plugin/src/main/resources/org/eolang/maven/pre/to-java.xsl
index 1db229e257..5d2fe85913 100644
--- a/eo-maven-plugin/src/main/resources/org/eolang/maven/pre/to-java.xsl
+++ b/eo-maven-plugin/src/main/resources/org/eolang/maven/pre/to-java.xsl
@@ -485,9 +485,16 @@ SOFTWARE.
,
- "
-
- "
+
+
+
+
+
+ "
+
+ "
+
+
"α"
diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/packs/pre/bindings-to-java.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/packs/pre/bindings-to-java.yaml
new file mode 100644
index 0000000000..d9338eaed9
--- /dev/null
+++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/packs/pre/bindings-to-java.yaml
@@ -0,0 +1,16 @@
+xsls:
+ - /org/eolang/parser/add-default-package.xsl
+ - /org/eolang/maven/pre/classes.xsl
+ - /org/eolang/maven/pre/attrs.xsl
+ - /org/eolang/maven/pre/data.xsl
+ - /org/eolang/maven/pre/to-java.xsl
+tests:
+ - /program/errors[count(*)=0]
+ - //java/text()[contains(., 'new PhWith(ret, 0')]
+ - //java/text()[contains(., 'new PhWith(ret, "ρ"')]
+ - //java/text()[contains(., 'new PhWith(ret, "text"')]
+eo: |
+ [] > main
+ stdout x:0 > print1
+ stdout x:^ > print2
+ stdout x:text > print3
diff --git a/eo-parser/src/main/antlr4/org/eolang/parser/Program.g4 b/eo-parser/src/main/antlr4/org/eolang/parser/Program.g4
index 2bf048e5aa..47896d4f0b 100644
--- a/eo-parser/src/main/antlr4/org/eolang/parser/Program.g4
+++ b/eo-parser/src/main/antlr4/org/eolang/parser/Program.g4
@@ -442,7 +442,7 @@ version
;
// Binding
-as : COLON (NAME | RHO)
+as : COLON (NAME | RHO | INT)
;
// Data
diff --git a/eo-parser/src/main/java/org/eolang/parser/ParsingTrain.java b/eo-parser/src/main/java/org/eolang/parser/ParsingTrain.java
index d73f65bec4..0431c53280 100644
--- a/eo-parser/src/main/java/org/eolang/parser/ParsingTrain.java
+++ b/eo-parser/src/main/java/org/eolang/parser/ParsingTrain.java
@@ -43,6 +43,9 @@
* Train of XSL shifts.
*
* @since 0.1
+ * @todo #2665:30min Check negative int bindings via xsl. It's possible now to make application
+ * with integer bindings like {@code x a:0 b:1}. Need to add xsl transformation that would check
+ * if such binding is negative and would add an error to "errors" section.
*/
public final class ParsingTrain extends TrEnvelope {
diff --git a/eo-parser/src/main/java/org/eolang/parser/XeListener.java b/eo-parser/src/main/java/org/eolang/parser/XeListener.java
index 35d9ce8f9a..435c939e13 100644
--- a/eo-parser/src/main/java/org/eolang/parser/XeListener.java
+++ b/eo-parser/src/main/java/org/eolang/parser/XeListener.java
@@ -948,11 +948,14 @@ public void exitVersion(final ProgramParser.VersionContext ctx) {
}
@Override
+ @SuppressWarnings("PMD.ConfusingTernary")
public void enterAs(final ProgramParser.AsContext ctx) {
this.objects.enter();
final String has;
- if (ctx.RHO() == null) {
+ if (ctx.NAME() != null) {
has = ctx.NAME().getText();
+ } else if (ctx.INT() != null) {
+ has = ctx.INT().getText();
} else {
has = "^";
}
diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/full-syntax.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/full-syntax.yaml
index b2ab1a779a..4b4508d106 100644
--- a/eo-parser/src/test/resources/org/eolang/parser/packs/full-syntax.yaml
+++ b/eo-parser/src/test/resources/org/eolang/parser/packs/full-syntax.yaml
@@ -7,6 +7,8 @@ tests:
- //o[@base='string']
- //o[@name='hello' and @const]
- //o[@as='i']
+ - //o[@as='1']
+ - //o[@as='0']
- //o[@base='&']
- //o[@base='.<']
- //o[@base='.five']
@@ -55,8 +57,8 @@ eo: |
"家"
f'
z'
- (z 5):hey
- z:hoi
+ (z 5):0
+ z:1
a.
b.
c.