From f28edddedbc084b017c58f2ed796ce60e486dbfd Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Wed, 29 Nov 2023 11:13:38 +0300 Subject: [PATCH 1/3] feat(#2639): added info --- .../src/main/java/org/eolang/parser/XeListener.java | 9 +++++++++ eo-parser/src/main/resources/XMIR.xsd | 1 + .../test/resources/org/eolang/parser/packs/has-info.yaml | 5 +++++ 3 files changed, 15 insertions(+) create mode 100644 eo-parser/src/test/resources/org/eolang/parser/packs/has-info.yaml 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 f5fdb2c346..cf7457296b 100644 --- a/eo-parser/src/main/java/org/eolang/parser/XeListener.java +++ b/eo-parser/src/main/java/org/eolang/parser/XeListener.java @@ -56,6 +56,14 @@ "PMD.ExcessiveClassLength" }) public final class XeListener implements ProgramListener, Iterable { + /** + * Info about xmir. + */ + private static final String INFO = String.join( + "", + "This is XMIR - a dialect of XML, which is used to present a parsed EO program. ", + "For more information please visit https://news.eolang.org/2022-11-25-xmir-guide.html" + ); /** * The name of it. @@ -102,6 +110,7 @@ public void enterProgram(final ProgramParser.ProgramContext ctx) { DateTimeFormatter.ISO_INSTANT ) ) + .add("info").set(XeListener.INFO).up() .add("listing").set(XeListener.sourceText(ctx)).up() .add("errors").up() .add("sheets").up() diff --git a/eo-parser/src/main/resources/XMIR.xsd b/eo-parser/src/main/resources/XMIR.xsd index 2032196dc3..0b1068be2d 100644 --- a/eo-parser/src/main/resources/XMIR.xsd +++ b/eo-parser/src/main/resources/XMIR.xsd @@ -50,6 +50,7 @@ SOFTWARE. + diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/has-info.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/has-info.yaml new file mode 100644 index 0000000000..2ac577ff23 --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/has-info.yaml @@ -0,0 +1,5 @@ +xsls: [] +tests: + - /program/info[text()!=''] +eo: | + [] > main From ec1f7c41eed2ddeb90814554807b90dcd233c695 Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Wed, 29 Nov 2023 11:48:28 +0300 Subject: [PATCH 2/3] feat(#2639): comment --- eo-parser/src/main/java/org/eolang/parser/XeListener.java | 2 +- eo-parser/src/main/resources/XMIR.xsd | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) 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 cf7457296b..36f9c134f5 100644 --- a/eo-parser/src/main/java/org/eolang/parser/XeListener.java +++ b/eo-parser/src/main/java/org/eolang/parser/XeListener.java @@ -110,7 +110,7 @@ public void enterProgram(final ProgramParser.ProgramContext ctx) { DateTimeFormatter.ISO_INSTANT ) ) - .add("info").set(XeListener.INFO).up() + .comment(XeListener.INFO) .add("listing").set(XeListener.sourceText(ctx)).up() .add("errors").up() .add("sheets").up() diff --git a/eo-parser/src/main/resources/XMIR.xsd b/eo-parser/src/main/resources/XMIR.xsd index 0b1068be2d..2032196dc3 100644 --- a/eo-parser/src/main/resources/XMIR.xsd +++ b/eo-parser/src/main/resources/XMIR.xsd @@ -50,7 +50,6 @@ SOFTWARE. - From e3ffb945878c4876a118d2359a295ebeb5b00b7a Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Wed, 29 Nov 2023 12:03:03 +0300 Subject: [PATCH 3/3] feat(#2639): test --- .../org/eolang/parser/packs/{has-info.yaml => has-comment.yaml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename eo-parser/src/test/resources/org/eolang/parser/packs/{has-info.yaml => has-comment.yaml} (53%) diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/has-info.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/has-comment.yaml similarity index 53% rename from eo-parser/src/test/resources/org/eolang/parser/packs/has-info.yaml rename to eo-parser/src/test/resources/org/eolang/parser/packs/has-comment.yaml index 2ac577ff23..9b414a5fe4 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/has-info.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/has-comment.yaml @@ -1,5 +1,5 @@ xsls: [] tests: - - /program/info[text()!=''] + - /program/comment()[1] eo: | [] > main