-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from polystat/develop
Latest changes
- Loading branch information
Showing
512 changed files
with
11,581 additions
and
2,561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,7 @@ jobs: | |
with: | ||
arguments: build | ||
|
||
- uses: gradle/gradle-build-action@v1 | ||
with: | ||
arguments: test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package eotree; | ||
|
||
public class EOAnonExpr extends EOBnd { | ||
public EOAnonExpr(EOExpr expr) { | ||
super(expr); | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return expr.generateEO(indent); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package eotree; | ||
|
||
/** | ||
* EBNF representation: | ||
* <code> | ||
* '@' | name [ '...' ] | ||
* </code> | ||
*/ | ||
public class EOAttribute extends EONode { | ||
public static final EOAttribute DECORATEE = new EOAttribute("@", false); | ||
public static final EOAttribute PARENT = new EOAttribute("^", false); | ||
public static final EOAttribute CURRENT = new EOAttribute("$", false); | ||
|
||
public String name; | ||
public boolean isVarArg; | ||
|
||
public EOAttribute(String name, boolean isVarArg) { | ||
this.name = name; | ||
this.isVarArg = isVarArg; | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return name + (isVarArg ? " ..." : ""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package eotree; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class EOAttributes extends EONode { | ||
public List<EOAttribute> attributes; | ||
|
||
public EOAttributes(List<EOAttribute> attributes) { | ||
this.attributes = attributes; | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return "[" + | ||
attributes.stream() | ||
.map(attribute -> attribute.generateEO(indent)) | ||
.collect(Collectors.joining(" ")) | ||
+ "]"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package eotree; | ||
|
||
public abstract class EOBnd extends EONode { | ||
public EOExpr expr; | ||
|
||
public EOBnd(EOExpr expr) { | ||
this.expr = expr; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package eotree; | ||
|
||
public class EOBndExpr extends EOBnd { | ||
public EOBndName bndName; | ||
|
||
public EOBndExpr(EOExpr expr, EOBndName bndName) { | ||
super(expr); | ||
this.bndName = bndName; | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return expr.generateEO(indent) + " > " + bndName.generateEO(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package eotree; | ||
|
||
public class EOBndName extends EONode { | ||
public String name; | ||
|
||
public EOBndName(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package eotree; | ||
|
||
/** | ||
* EBNF representation: | ||
* <code> | ||
* '#' ANY EOL | ||
* </code> | ||
*/ | ||
public class EOComment extends EONode { | ||
public String comment; | ||
|
||
public EOComment(String comment) { | ||
this.comment = comment; | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return "# " + comment; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package eotree; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class EOCopy extends EOExpr { | ||
public EOExpr trg; | ||
public List<EOBnd> args; | ||
|
||
public EOCopy(EOExpr trg, List<EOBnd> args) { | ||
this.trg = trg; | ||
this.args = args; | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return trg.generateEO(indent) + args.stream() | ||
.map(arg -> " " + arg.generateEO(indent + 1)) | ||
.collect(Collectors.joining()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package eotree; | ||
|
||
import java.util.Optional; | ||
|
||
public class EODot extends EOExpr { | ||
public Optional<EOExpr> src; | ||
public String name; | ||
|
||
public EODot(Optional<EOExpr> src, String name) { | ||
this.src = src; | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return | ||
src | ||
.map(eoExpr -> eoExpr.generateEO(indent) + ".") | ||
.orElse(indent(indent)) | ||
+ name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package eotree; | ||
|
||
public abstract class EOExpr extends EONode { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package eotree; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* EBNF representation: | ||
* <code> | ||
* { comment EOL } EOL | ||
* </code> | ||
*/ | ||
public class EOLicense extends EONode { | ||
public List<EOComment> comments; | ||
|
||
public EOLicense(List<EOComment> comments) { | ||
this.comments = comments; | ||
} | ||
|
||
public EOLicense(EOComment... comments) { | ||
this(Arrays.stream(comments).collect(Collectors.toList())); | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return comments.stream() | ||
.map(comment -> comment.generateEO(indent)) | ||
.collect(Collectors.joining("\n")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package eotree; | ||
|
||
/** | ||
* EBNF representation: | ||
* <code> | ||
* '+' name '␣' ANY EOL | ||
* </code> | ||
*/ | ||
public class EOMeta extends EONode { | ||
public String name; | ||
public String value; | ||
|
||
public EOMeta(String name, String value) { | ||
this.name = name; | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return "+" + name + " " + value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package eotree; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* EBNF representation: | ||
* <code> | ||
* { meta EOL } EOL | ||
* </code> | ||
*/ | ||
public class EOMetas extends EONode { | ||
public Optional<String> packageName; | ||
public List<EOMeta> metas; | ||
|
||
public EOMetas(Optional<String> packageName, List<EOMeta> metas) { | ||
this.packageName = packageName; | ||
this.metas = metas; | ||
} | ||
|
||
@Override | ||
public String generateEO(int indent) { | ||
return packageName | ||
.map(p -> "+package " + p + "\n") | ||
.orElse("") + | ||
metas.stream() | ||
.map(m -> m.generateEO(indent)) | ||
.collect(Collectors.joining("\n")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package eotree; | ||
|
||
public abstract class EONode { | ||
public static final int INDENT_SIZE = 2; | ||
|
||
public static String indent(int indent) { | ||
return " ".repeat(indent * INDENT_SIZE); | ||
} | ||
|
||
public abstract String generateEO(int indent); | ||
} |
Oops, something went wrong.
7346153
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to yegor256/0pdd:
Please, copy and paste this stack trace to GitHub: