Skip to content

Commit

Permalink
#155: hsuffix removed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 11, 2020
1 parent be02fb1 commit 8b1abed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
9 changes: 2 additions & 7 deletions eo-compiler/src/main/antlr4/org/eolang/compiler/Program.g4
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ application
htail?
|
application
hsuffix
suffix
htail?
;

Expand All @@ -135,15 +135,10 @@ htail
|
SPACE
application
hsuffix
suffix
)+
;

hsuffix
:
suffix
;

hhead
:
AT
Expand Down
16 changes: 4 additions & 12 deletions eo-compiler/src/main/java/org/eolang/compiler/XeListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ public void enterAbstraction(final ProgramParser.AbstractionContext ctx) {
.attr("name", attr.getText())
.up();
}
this.dirs.up();
}

@Override
public void exitAbstraction(final ProgramParser.AbstractionContext ctx) {
this.dirs.up();
}

@Override
Expand All @@ -139,14 +139,16 @@ public void exitTail(final ProgramParser.TailContext ctx) {

@Override
public void enterSuffix(final ProgramParser.SuffixContext ctx) {
this.dirs.attr("name", ctx.NAME().getText());
this.dirs.xpath("o[last()]").strict(1)
.attr("name", ctx.NAME().getText());
if (ctx.CONST() != null) {
this.dirs.attr("const", "");
}
}

@Override
public void exitSuffix(final ProgramParser.SuffixContext ctx) {
this.dirs.up();
}

@Override
Expand Down Expand Up @@ -206,16 +208,6 @@ public void exitHtail(final ProgramParser.HtailContext ctx) {
this.dirs.up();
}

@Override
public void enterHsuffix(final ProgramParser.HsuffixContext ctx) {
this.dirs.xpath("o[last()]").strict(1);
}

@Override
public void exitHsuffix(final ProgramParser.HsuffixContext ctx) {
this.dirs.up();
}

@Override
public void enterData(final ProgramParser.DataContext ctx) {
final String type;
Expand Down

0 comments on commit 8b1abed

Please sign in to comment.