Skip to content

Commit 38c6d2a

Browse files
committed
refactoring
1 parent 2b08756 commit 38c6d2a

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,7 @@ private PrologTerm readBlock(final Koi7CharOpMap endOperators) {
482482
}
483483
break;
484484
default: {
485-
if (readAtom.getTermType() == TermType.VAR && (this.parserFlags & FLAG_VAR_AS_FUNCTOR) == 0) {
486-
// do nothing
487-
} else {
488-
485+
if (readAtom.getTermType() != TermType.VAR || (this.parserFlags & FLAG_VAR_AS_FUNCTOR) != 0) {
489486
TokenizerResult nextToken = this.tokenizer.readNextToken();
490487

491488
if (nextToken == null) {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,6 @@ public void testConformity() {
11861186
assertThrows(PrologParserException.class, () -> parseEd("/**/ write_canonical(fy yf).").next());
11871187
assertThrows(PrologParserException.class, () -> parseEd("/**/ write_canonical(f f).").next());
11881188
assertThrows(PrologParserException.class, () -> parseEd("writeq(0'f').", DefaultParserContext.of(FLAG_BLOCK_COMMENTS, Op.make(100, XF, "f"))).next());
1189-
11901189
assertThrows(PrologParserException.class, () -> parseEd("/**/ X = 1.e.", DefaultParserContext.of(FLAG_BLOCK_COMMENTS, Op.make(100, XF, "f"))).next());
11911190
assertThrows(PrologParserException.class, () -> parseEd("/**/ writeq(1 .2).").next());
11921191
assertThrows(PrologParserException.class, () -> parseEd("is 0'mod'1.").next());
@@ -1219,6 +1218,7 @@ public void testConformity() {
12191218
assertThrows(NoSuchElementException.class, () -> parseEd(".").next());
12201219
assertThrows(PrologParserException.class, () -> parseEd("writeq('\t'). % horiz. tab ").next());
12211220
assertThrows(PrologParserException.class, () -> parseEd("writeq('\n').").next());
1221+
assertThrows(PrologParserException.class, () -> parseEd("Finis ().").next());
12221222

12231223
assertEquals("writeq('*/')", parseEd("writeq('*/').").next().toString());
12241224
assertEquals("writeq('/**')", parseEd("writeq('/**').").next().toString());
@@ -1233,7 +1233,6 @@ public void testConformity() {
12331233
assertEquals("writeq(((':-') :- (':-')))", parseEd("writeq(((:-):-(:-))).").next().toString());
12341234
assertEquals("writeq((*) = (*))", parseEd("writeq((*)=(*)).").next().toString());
12351235
assertEquals("writeq([':-', '-'])", parseEd("writeq([:-,-]).").next().toString());
1236-
assertThrows(PrologParserException.class, () -> parseEd("Finis ().").next());
12371236
assertEquals("writeq('\\b\\r\\f\\t\\n')", parseEd("writeq('\\b\\r\\f\\t\\n').").next().toString());
12381237
assertEquals("writeq('^`')", parseEd("writeq('^`').").next().toString());
12391238
}

0 commit comments

Comments
 (0)