Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mustache
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
mustache
Commits
2bf86903
Commit
2bf86903
authored
4 years ago
by
René Schöne
Browse files
Options
Downloads
Patches
Plain Diff
Remove old content, make pretty methods, fix some formatting.
parent
93db1345
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Mustache.relast
+1
-1
1 addition, 1 deletion
Mustache.relast
Navigation.jrag
+0
-5
0 additions, 5 deletions
Navigation.jrag
Printing.jrag
+28
-20
28 additions, 20 deletions
Printing.jrag
with
29 additions
and
26 deletions
Mustache.relast
+
1
−
1
View file @
2bf86903
Document ::= <FileName> ComplexElement
*
;
Document ::= <FileName>
[RootElement:
ComplexElement
]
;
abstract Element ;
abstract ComplexElement : Element ;
MappingElement : ComplexElement ::= KeyValuePair* ;
...
...
This diff is collapsed.
Click to expand it.
Navigation.jrag
+
0
−
5
View file @
2bf86903
aspect Navigation {
eq Document.getChild().program() = null;
eq Document.getChild().ragconnect() = null;
eq Document.getChild().containedFile() = null;
eq Document.getChild().containedFileName() = getFileName();
syn boolean Element.isComplex() = false;
eq ComplexElement.isComplex() = true;
...
...
This diff is collapsed.
Click to expand it.
Printing.jrag
+
28
−
20
View file @
2bf86903
aspect Printing {
String ASTNode.PRINT_INDENT = " ";
syn String MappingDefinitionType.prettyPrint();
eq JavaMappingDefinitionType.prettyPrint() = getType().getName();
eq JavaArrayMappingDefinitionType.prettyPrint() = getType().getName() + "[]";
syn String JavaTypeUse.prettyPrint() {
StringBuilder sb = new StringBuilder();
generateAbstractGrammar(sb);
return sb.toString();
public String Document.prettyPrint() {
return prettyPrint(true);
}
syn
String Document.prettyPrint() {
public
String Document.prettyPrint(
boolean prependCreationComment
) {
StringBuilder sb = new StringBuilder();
if (prependCreationComment) {
sb.append("# RagConnect created at ").append(java.time.Instant.now()).append("\n");
for (ComplexElement element : getComplexElementList()) {
element.prettyPrint(sb, false, "");
}
if (sb.charAt(sb.length() - 1) != '\n') {
if (hasRootElement()) {
getRootElement().prettyPrint(sb, false, "");
}
if (sb.length() > 0 && sb.charAt(sb.length() - 1) != '\n') {
sb.append("\n");
}
return sb.toString();
}
syn StringBuilder Element.prettyPrint(StringBuilder sb, boolean printIndent, String indent);
eq ValueElement.prettyPrint(StringBuilder sb, boolean printIndent, String indent) {
abstract protected StringBuilder Element.prettyPrint(StringBuilder sb, boolean printIndent, String indent);
@Override
protected StringBuilder ValueElement.prettyPrint(StringBuilder sb, boolean printIndent, String indent) {
sb.append(getValue());
return sb;
}
eq StringElement.prettyPrint(StringBuilder sb, boolean printIndent, String indent) {
@Override
protected StringBuilder StringElement.prettyPrint(StringBuilder sb, boolean printIndent, String indent) {
sb.append("\"").append(getValue()).append("\"");
return sb;
}
eq ListElement.prettyPrint(StringBuilder sb, boolean printIndent, String indent) {
@Override
protected StringBuilder ListElement.prettyPrint(StringBuilder sb, boolean printIndent, String indent) {
if (isEmpty()) {
sb.append("[]");
} else {
...
...
@@ -45,18 +48,23 @@ aspect Printing {
}
return sb;
}
eq KeyValuePair.prettyPrint(StringBuilder sb, boolean printIndent, String indent) {
@Override
protected StringBuilder KeyValuePair.prettyPrint(StringBuilder sb, boolean printIndent, String indent) {
if (printIndent) sb.append(indent);
sb.append(getKey()).append(":");
if (getValue().isComplex() && !getValue().isEmpty()) {
sb.append("\n");
getValue().prettyPrint(sb, true, indent + PRINT_INDENT); //);
} else {
sb.append(" ");
getValue().prettyPrint(sb, false, indent);
}
return sb;
}
eq MappingElement.prettyPrint(StringBuilder sb, boolean printIndent, String indent) {
@Override
protected StringBuilder MappingElement.prettyPrint(StringBuilder sb, boolean printIndent, String indent) {
if (isEmpty()) {
sb.append("{}");
} else {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment