@@ -177,7 +177,7 @@ private boolean isEndOperator(final PrologTerm operator, final Koi7CharOpMap end
177177 return false ;
178178 }
179179
180- return operator .getTermType () == __OPERATOR_CONTAINER__ && endOperators .contains (operator .getTermText ());
180+ return operator .getType () == __OPERATOR_CONTAINER__ && endOperators .contains (operator .getText ());
181181 }
182182
183183 public ParserContext getContext () {
@@ -191,7 +191,7 @@ public boolean hasNext() {
191191 if (found != null ) {
192192 final TokenizerResult endAtom = this .tokenizer .readNextToken ();
193193 try {
194- if (endAtom == null || !endAtom .getResult ().getTermText ().equals (OPERATOR_DOT .getTermText ())) {
194+ if (endAtom == null || !endAtom .getResult ().getText ().equals (OPERATOR_DOT .getText ())) {
195195 throw new PrologParserException ("End operator is not found" , this .tokenizer .getLine (), this .tokenizer .getPos ());
196196 }
197197 } finally {
@@ -237,7 +237,7 @@ private PrologStruct readStruct(final PrologTerm functor) {
237237 }
238238
239239 try {
240- final String nextText = nextAtom .getResult ().getTermText ();
240+ final String nextText = nextAtom .getResult ().getText ();
241241
242242 switch (getOnlyCharCode (nextText )) {
243243 case ',' : {
@@ -283,7 +283,7 @@ private PrologTerm readList(final TokenizerResult openingBracket) {
283283 }
284284
285285 try {
286- final String text = nextAtom .getResult ().getTermText ();
286+ final String text = nextAtom .getResult ().getText ();
287287
288288 switch (getOnlyCharCode (text )) {
289289 case ']' : {
@@ -308,8 +308,8 @@ private PrologTerm readList(final TokenizerResult openingBracket) {
308308 rightPart = readBlock (OPERATORS_END_LIST );
309309
310310 if (rightPart != null
311- && rightPart .getTermType () == TermType .STRUCT
312- && rightPart .getFunctor ().getTermText ().equals (OPERATOR_VERTICALBAR .getTermText ())) {
311+ && rightPart .getType () == TermType .STRUCT
312+ && rightPart .getFunctor ().getText ().equals (OPERATOR_VERTICALBAR .getText ())) {
313313 throw new PrologParserException (
314314 "Duplicated list tail definition" ,
315315 tokenizer .getLastTokenLine (),
@@ -321,7 +321,7 @@ private PrologTerm readList(final TokenizerResult openingBracket) {
321321 throw new PrologParserException ("Can't find expected token in list" , this .tokenizer .getLine (), this .tokenizer .getPos ());
322322 }
323323 try {
324- if (!nextAtomTwo .getResult ().getTermText ().equals (OPERATOR_RIGHTSQUAREBRACKET .getTermText ())) {
324+ if (!nextAtomTwo .getResult ().getText ().equals (OPERATOR_RIGHTSQUAREBRACKET .getText ())) {
325325 throw new PrologParserException ("Wrong end of the list tail" , this .tokenizer .getLastTokenLine (), this .tokenizer .getLastTokenPos ());
326326 }
327327 } finally {
@@ -356,10 +356,10 @@ private PrologTerm readList(final TokenizerResult openingBracket) {
356356 if (rightPart == null ) {
357357 throw new PrologParserException ("There is not any term as the tail at the list" , this .tokenizer .getLastTokenLine (), this .tokenizer .getLastTokenPos ());
358358 }
359- if (rightPart .getTermType () == TermType .ATOM && rightPart .getQuotation () == Quotation .NONE && "," .equals (rightPart .getTermText ())) {
359+ if (rightPart .getType () == TermType .ATOM && rightPart .getQuotation () == Quotation .NONE && "," .equals (rightPart .getText ())) {
360360 throw new PrologParserException ("Comma operator in list tail" , this .tokenizer .getLastTokenLine (), this .tokenizer .getLastTokenPos ());
361361 }
362- leftPartFirst .replaceTail (rightPart );
362+ leftPartFirst .replaceEndListElement (rightPart );
363363 }
364364 return leftPartFirst ;
365365 }
@@ -403,7 +403,7 @@ private PrologTerm readBlock(final Koi7CharOpMap endOperators) {
403403 // same as the natural precedence)
404404 int readAtomPrecedence = 0 ; // we make it as highest precedence
405405
406- if (readAtom .getTermType () == __OPERATOR_CONTAINER__ ) {
406+ if (readAtom .getType () == __OPERATOR_CONTAINER__ ) {
407407 // it is operator list
408408 // try to get the single operator from the list if the list
409409 // contains only one
@@ -436,18 +436,18 @@ private PrologTerm readBlock(final Koi7CharOpMap endOperators) {
436436 if (readAtom == null ) {
437437 if (currentTreeItem == null && !(leftPresented || rightPresented )) {
438438 // alone operator, it is an atom
439- return new PrologAtom (readOperators .getTermText (), Quotation .SINGLE , readOperators .getLine (), readOperators .getPos ());
439+ return new PrologAtom (readOperators .getText (), Quotation .SINGLE , readOperators .getLine (), readOperators .getPos ());
440440 }
441441 // we didn't get any operator for our criteria, so throw
442442 // an exception
443- throw new PrologParserException ("Operator clash detected [" + readAtomContainer .getResult ().getTermText () + ']' ,
443+ throw new PrologParserException ("Operator clash detected [" + readAtomContainer .getResult ().getText () + ']' ,
444444 readAtomContainer .getLine (), readAtomContainer .getPos ());
445445 }
446446 // we have found needed operator so get its precedence
447447 readAtomPrecedence = readAtom .getPrecedence ();
448448 } else {
449449 readAtom = readOperator ;
450- final String operatorText = readOperator .getTermText ();
450+ final String operatorText = readOperator .getText ();
451451
452452 if (operatorText .length () == 1 ) {
453453 final int onlyCharCode = getOnlyCharCode (operatorText );
@@ -503,7 +503,7 @@ private PrologTerm readBlock(final Koi7CharOpMap endOperators) {
503503 token .release ();
504504 }
505505
506- if (closingAtom == null || !closingAtom .getTermText ().equals ((onlyCharCode == '{' ? OPERATOR_RIGHTCURLYBRACKET : OPERATOR_RIGHTBRACKET ).getTermText ())) {
506+ if (closingAtom == null || !closingAtom .getText ().equals ((onlyCharCode == '{' ? OPERATOR_RIGHTCURLYBRACKET : OPERATOR_RIGHTBRACKET ).getText ())) {
507507 throw new PrologParserException ("Non-closed brackets: " + onlyCharCode , this .tokenizer .getLine (), this .tokenizer .getPos ());
508508 }
509509 }
@@ -519,22 +519,22 @@ private PrologTerm readBlock(final Koi7CharOpMap endOperators) {
519519 }
520520 }
521521 } else {
522- if (readAtom .getTermType () != TermType .VAR || (this .parserFlags & FLAG_VAR_AS_FUNCTOR ) != 0 ) {
522+ if (readAtom .getType () != TermType .VAR || (this .parserFlags & FLAG_VAR_AS_FUNCTOR ) != 0 ) {
523523 TokenizerResult nextToken = this .tokenizer .readNextToken ();
524524
525525 if (nextToken == null ) {
526526 throw new PrologParserException ("Non-closed clause" , this .tokenizer .getLastTokenLine (), this .tokenizer .getLastTokenPos ());
527527 }
528528
529529 try {
530- if (nextToken .getResult ().getTermText ().equals (OPERATOR_LEFTBRACKET .getTermText ())) {
530+ if (nextToken .getResult ().getText ().equals (OPERATOR_LEFTBRACKET .getText ())) {
531531 final int nextTokenLineNumber = nextToken .getLine ();
532532 final int nextTokenStrPosition = nextToken .getPos ();
533533
534534 // it is a structure
535535 if (
536- readAtom .getTermType () == TermType .ATOM
537- || (readAtom .getTermType () == TermType .VAR
536+ readAtom .getType () == TermType .ATOM
537+ || (readAtom .getType () == TermType .VAR
538538 && (this .parserFlags & FLAG_VAR_AS_FUNCTOR ) != 0 )
539539 ) {
540540
@@ -585,7 +585,7 @@ private PrologTerm readBlock(final Koi7CharOpMap endOperators) {
585585 if (currentTreeItem .getType () == TermType .OPERATOR ) {
586586 // it's not first operator
587587 if (currentTreeItem .getPrecedence () <= readAtomPrecedence ) {
588- if (readAtom .getTermType () == TermType .OPERATOR && ((Op ) readAtom ).getOpAssoc ().isPrefix ()) {
588+ if (readAtom .getType () == TermType .OPERATOR && ((Op ) readAtom ).getOpAssoc ().isPrefix ()) {
589589 // it is a prefix operator so that it can be there
590590 currentTreeItem = currentTreeItem .makeAsRightBranch (readAtomTreeItem );
591591 } else {
0 commit comments