Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@

package com.github.javaparser.printer.concretesyntaxmodel;

import static com.github.javaparser.utils.CodeGenerationUtils.f;

import com.github.javaparser.GeneratedJavaParserConstants;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.expr.IntegerLiteralExpr;
import com.github.javaparser.ast.observer.ObservableProperty;
import com.github.javaparser.printer.SourcePrinter;

import static com.github.javaparser.utils.CodeGenerationUtils.f;

public class CsmAttribute implements CsmElement {
public ObservableProperty getProperty() {
return property;
Expand Down Expand Up @@ -85,4 +85,9 @@ public int getTokenType(Node node, String text, String tokenText) {
throw new UnsupportedOperationException("getTokenType does not know how to handle property "
+ property + " with text: " + text);
}

@Override
public String toString() {
return String.format("%s(property:%s)", this.getClass().getSimpleName(), getProperty());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,20 @@ public class CsmChar implements CsmElement {
public CsmChar(ObservableProperty property) {
this.property = property;
}

public ObservableProperty getProperty() {
return property;
}

@Override
public void prettyPrint(Node node, SourcePrinter printer) {
printer.print("'");
printer.print(property.getValueAsStringAttribute(node));
printer.print("'");
}

@Override
public String toString() {
return String.format("%s(property:%s)", this.getClass().getSimpleName(), getProperty());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

package com.github.javaparser.printer.concretesyntaxmodel;

import java.util.Collection;
import java.util.Iterator;

import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.observer.ObservableProperty;
import com.github.javaparser.printer.ConcreteSyntaxModel;
import com.github.javaparser.printer.SourcePrinter;

import java.util.Collection;
import java.util.Iterator;

public class CsmList implements CsmElement {
private final ObservableProperty property;
private final CsmElement separatorPost;
Expand Down Expand Up @@ -117,4 +117,9 @@ public void prettyPrint(Node node, SourcePrinter printer) {
}
}
}

@Override
public String toString() {
return String.format("%s(property:%s)", this.getClass().getSimpleName(), getProperty());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@

package com.github.javaparser.printer.concretesyntaxmodel;

import com.github.javaparser.ast.Node;
import com.github.javaparser.printer.SourcePrinter;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

import com.github.javaparser.ast.Node;
import com.github.javaparser.printer.SourcePrinter;

public class CsmSequence implements CsmElement {
private List<CsmElement> elements;
Expand All @@ -48,4 +49,9 @@ public List<CsmElement> getElements() {
public void prettyPrint(Node node, SourcePrinter printer) {
elements.forEach(e -> e.prettyPrint(node, printer));
}

@Override
public String toString() {
return elements.stream().map(e -> e.toString()).collect(Collectors.joining(",", "CsmSequence[", "]"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@ public void prettyPrint(Node node, SourcePrinter printer) {
ConcreteSyntaxModel.genericPrettyPrint(child, printer);
}
}

@Override
public String toString() {
return String.format("%s(property:%s)", this.getClass().getSimpleName(), getProperty());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public class CsmString implements CsmElement {
public CsmString(ObservableProperty property) {
this.property = property;
}

public ObservableProperty getProperty() {
return property;
}

@Override
public void prettyPrint(Node node, SourcePrinter printer) {
Expand All @@ -41,7 +45,7 @@ public void prettyPrint(Node node, SourcePrinter printer) {

@Override
public String toString() {
return String.format("CsmString(property:%s)", property);
return String.format("%s(property:%s)", this.getClass().getSimpleName(), getProperty());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public class CsmTextBlock implements CsmElement {
public CsmTextBlock(ObservableProperty property) {
this.property = property;
}

public ObservableProperty getProperty() {
return property;
}

@Override
public void prettyPrint(Node node, SourcePrinter printer) {
Expand All @@ -42,7 +46,7 @@ public void prettyPrint(Node node, SourcePrinter printer) {

@Override
public String toString() {
return String.format("CsmTextBlock(property:%s)", property);
return String.format("%s(property:%s)", this.getClass().getSimpleName(), getProperty());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@

package com.github.javaparser.printer.concretesyntaxmodel;

import static com.github.javaparser.TokenTypes.isEndOfLineToken;
import static com.github.javaparser.TokenTypes.isWhitespaceButNotEndOfLine;

import com.github.javaparser.GeneratedJavaParserConstants;
import com.github.javaparser.TokenTypes;
import com.github.javaparser.ast.Node;
import com.github.javaparser.printer.SourcePrinter;
import com.github.javaparser.utils.LineSeparator;

import static com.github.javaparser.TokenTypes.*;

public class CsmToken implements CsmElement {
private final int tokenType;
private String content;
Expand Down Expand Up @@ -87,7 +88,7 @@ public void prettyPrint(Node node, SourcePrinter printer) {

@Override
public String toString() {
return "token(" + content + ")";
return String.format("%s(property:%s)", this.getClass().getSimpleName(), content);
}

@Override
Expand Down