Skip to content

Commit 6a0fb27

Browse files
committed
formatting
1 parent db72b65 commit 6a0fb27

File tree

3 files changed

+17
-38
lines changed

3 files changed

+17
-38
lines changed

src/main/java/com/igormaznitsa/prologparser/PrologParser.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,15 @@ private PrologTerm readBlock(final Koi7CharOpMap endOperators) {
479479
if (readAtom == null) {
480480
if (onlyCharCode == '{') {
481481
emptyCurly = true;
482-
} else
483-
throw new PrologParserException("Illegal start of term",
484-
readAtomContainer.getLine(), readAtomContainer.getPos());
482+
} else {
483+
throw new PrologParserException("Illegal start of term",
484+
readAtomContainer.getLine(), readAtomContainer.getPos());
485+
}
485486
}
486487

487488
if (emptyCurly) {
488489
readAtom = new PrologStruct(Op.VIRTUAL_OPERATOR_CURLY_BLOCK, EMPTY_TERM_ARRAY, readAtomContainer.getLine(), readAtomContainer.getPos());
489-
}else {
490+
} else {
490491
readAtom.setLine(readAtomContainer.getLine());
491492
readAtom.setPos(readAtomContainer.getPos());
492493
readAtom = new PrologStruct(onlyCharCode == '{' ? Op.VIRTUAL_OPERATOR_CURLY_BLOCK : Op.VIRTUAL_OPERATOR_BLOCK, new PrologTerm[] {readAtom}, readAtomContainer.getLine(), readAtomContainer.getPos());

src/main/java/com/igormaznitsa/prologparser/tokenizer/TreeItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public PrologTerm convertToTermAndRelease() {
255255
}
256256

257257
if (this.leftBranch == null) {
258-
if (this.rightBranch.getType() == TermType.STRUCT && this.rightBranch.savedTerm.isBlock() && !((PrologStruct)this.rightBranch.savedTerm).isEmpty()) {
258+
if (this.rightBranch.getType() == TermType.STRUCT && this.rightBranch.savedTerm.isBlock() && !((PrologStruct) this.rightBranch.savedTerm).isEmpty()) {
259259
final PrologTerm rightTerm = this.rightBranch.convertToTermAndRelease();
260260
Op operator = (Op) wrapper.getWrappedTerm();
261261
final PrologTerm blockContent = ((PrologStruct) rightTerm).getTermAt(0);
@@ -280,7 +280,7 @@ public PrologTerm convertToTermAndRelease() {
280280
} else {
281281
operator = this.parser.getContext().findOpForName(this.parser, operator.getTermText()).findForArity(1);
282282
return operator == null ? new PrologStruct(new PrologAtom(wrapper.getTermText(), Quotation.SINGLE, wrapper.getLine(), wrapper.getPos()), new PrologTerm[] {blockContent}, wrapper.getLine(), wrapper.getPos())
283-
: new PrologStruct(operator, new PrologTerm[] {blockContent}, wrapper.getLine(), wrapper.getPos());
283+
: new PrologStruct(operator, new PrologTerm[] {blockContent}, wrapper.getLine(), wrapper.getPos());
284284
}
285285
}
286286
}

src/test/java/com/igormaznitsa/prologparser/IntegrationTest.java

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,5 @@
11
package com.igormaznitsa.prologparser;
22

3-
import static com.igormaznitsa.prologparser.DefaultParserContext.of;
4-
import static com.igormaznitsa.prologparser.ParserContext.FLAG_BLOCK_COMMENTS;
5-
import static com.igormaznitsa.prologparser.ParserContext.FLAG_CURLY_BRACKETS;
6-
import static com.igormaznitsa.prologparser.ParserContext.FLAG_NONE;
7-
import static com.igormaznitsa.prologparser.ParserContext.FLAG_VAR_AS_FUNCTOR;
8-
import static com.igormaznitsa.prologparser.ParserContext.FLAG_ZERO_QUOTATION_CHARCODE;
9-
import static com.igormaznitsa.prologparser.ParserContext.FLAG_ZERO_STRUCT;
10-
import static com.igormaznitsa.prologparser.terms.OpContainer.make;
11-
import static com.igormaznitsa.prologparser.terms.Quotation.BACK_TICK;
12-
import static com.igormaznitsa.prologparser.terms.Quotation.DOUBLE;
13-
import static com.igormaznitsa.prologparser.terms.Quotation.NONE;
14-
import static com.igormaznitsa.prologparser.terms.Quotation.SINGLE;
15-
import static com.igormaznitsa.prologparser.terms.TermType.ATOM;
16-
import static com.igormaznitsa.prologparser.tokenizer.OpAssoc.FX;
17-
import static com.igormaznitsa.prologparser.tokenizer.OpAssoc.FY;
18-
import static com.igormaznitsa.prologparser.tokenizer.OpAssoc.XF;
19-
import static com.igormaznitsa.prologparser.tokenizer.OpAssoc.XFX;
20-
import static com.igormaznitsa.prologparser.tokenizer.OpAssoc.XFY;
21-
import static com.igormaznitsa.prologparser.tokenizer.OpAssoc.YFX;
22-
import static java.util.stream.Collectors.joining;
23-
import static org.junit.jupiter.api.Assertions.assertEquals;
24-
import static org.junit.jupiter.api.Assertions.assertFalse;
25-
import static org.junit.jupiter.api.Assertions.assertNotNull;
26-
import static org.junit.jupiter.api.Assertions.assertNotSame;
27-
import static org.junit.jupiter.api.Assertions.assertSame;
28-
import static org.junit.jupiter.api.Assertions.assertThrows;
29-
import static org.junit.jupiter.api.Assertions.assertTrue;
30-
import static org.junit.jupiter.api.Assertions.fail;
31-
import static org.mockito.Mockito.clearInvocations;
32-
import static org.mockito.Mockito.mock;
33-
import static org.mockito.Mockito.when;
34-
353
import com.igormaznitsa.prologparser.exceptions.PrologParserException;
364
import com.igormaznitsa.prologparser.terms.OpContainer;
375
import com.igormaznitsa.prologparser.terms.PrologAtom;
@@ -66,6 +34,16 @@
6634
import java.util.Set;
6735
import java.util.concurrent.atomic.AtomicInteger;
6836

37+
import static com.igormaznitsa.prologparser.DefaultParserContext.of;
38+
import static com.igormaznitsa.prologparser.ParserContext.*;
39+
import static com.igormaznitsa.prologparser.terms.OpContainer.make;
40+
import static com.igormaznitsa.prologparser.terms.Quotation.*;
41+
import static com.igormaznitsa.prologparser.terms.TermType.ATOM;
42+
import static com.igormaznitsa.prologparser.tokenizer.OpAssoc.*;
43+
import static java.util.stream.Collectors.joining;
44+
import static org.junit.jupiter.api.Assertions.*;
45+
import static org.mockito.Mockito.*;
46+
6947
public class IntegrationTest {
7048

7149
private static PrologParser parseCpl(final String str) {

0 commit comments

Comments
 (0)