Index: gc_core/js/lang_core/gc_engine.js ================================================================== --- gc_core/js/lang_core/gc_engine.js +++ gc_core/js/lang_core/gc_engine.js @@ -179,10 +179,13 @@ s += "\t" + dToken["lMorph"].toString(); } if (dToken.hasOwnProperty("aTags")) { s += "\t" + dToken["aTags"].toString(); } + if (dToken.hasOwnProperty("nMultiStartTo")) { + s += "\t>>" + dToken["nMultiStartTo"].toString(); + } s += "\n"; } return s; } @@ -635,11 +638,11 @@ for (let oPointer of lPointers) { if (oPointer["nMultiEnd"] != -1) { if (oToken["i"] < oPointer["nMultiEnd"]) { continue; } - if (oToken["i"] == oPointer["nMultiEnd"]) { + if (oToken["i"] >= oPointer["nMultiEnd"]) { oPointer["nMultiEnd"] = -1; } } if (oGraph[oPointer["iNode"]].hasOwnProperty("")) { let bChange = this._executeActions(oGraph, oGraph[oPointer["iNode"]][""], oPointer["iToken1"]-1, iToken, dOptions, sCountry, bShowRuleId, bDebug, bContext); @@ -768,24 +771,27 @@ this.dError.delete(nErrorStart); } } } } - else if (cActionType == "#") { + else if (cActionType == "&") { // multi-tokens let nTokenStart = (eAct[0] > 0) ? nTokenOffset + eAct[0] : nLastToken + eAct[0]; let nTokenEnd = (eAct[1] > 0) ? nTokenOffset + eAct[1] : nLastToken + eAct[1]; let oMultiToken = { "nTokenStart": nTokenStart, "nTokenEnd": nTokenEnd, "lTokens": this.lTokens.slice(nTokenStart, nTokenEnd+1), "lMorph": (sAction) ? sAction.split("|") : [":HM"] } - this.lTokens[nTokenStart]["nMultiStartTo"] = nTokenEnd; - this.lTokens[nTokenEnd]["nMultiEndFrom"] = nTokenStart; + this.lTokens[nTokenStart]["nMultiStartTo"] = this.lTokens[nTokenEnd]["i"]; + this.lTokens[nTokenEnd]["nMultiEndFrom"] = this.lTokens[nTokenStart]["i"]; this.lTokens[nTokenStart]["oMultiToken"] = oMultiToken; this.lTokens[nTokenEnd]["oMultiToken"] = oMultiToken; + if (bDebug) { + console.log(`" MULTI-TOKEN: ${sAction} [${this.lTokens[nTokenStart]["sValue"]}:${this.lTokens[nTokenEnd]["sValue"]}]`); + } } else { console.log("# error: unknown action at " + sLineId); } } Index: gc_core/py/lang_core/gc_engine.py ================================================================== --- gc_core/py/lang_core/gc_engine.py +++ gc_core/py/lang_core/gc_engine.py @@ -252,10 +252,12 @@ s += '#{i}\t{nStart}:{nEnd}\t{sValue}\t{sType}'.format(**dToken) if "lMorph" in dToken: s += "\t" + str(dToken["lMorph"]) if "aTags" in dToken: s += "\t" + str(dToken["aTags"]) + if "nMultiStartTo" in dToken: + s += "\t>>" + str(dToken["nMultiStartTo"]) s += "\n" #for nPos, dToken in self.dTokenPos.items(): # s += "{}\t{}\n".format(nPos, dToken) return s @@ -593,11 +595,11 @@ # check if there is rules to check for each pointer for dPointer in lPointers: if dPointer["nMultiEnd"] != -1: if dToken["i"] < dPointer["nMultiEnd"]: continue - if dToken["i"] == dPointer["nMultiEnd"]: + if dToken["i"] >= dPointer["nMultiEnd"]: dPointer["nMultiEnd"] = -1 if "" in dGraph[dPointer["iNode"]]: bChange = self._executeActions(dGraph, dGraph[dPointer["iNode"]][""], dPointer["iToken1"]-1, iToken, dOptions, sCountry, bShowRuleId, bDebug, bContext) if bChange: bTagAndRewrite = True @@ -702,16 +704,16 @@ "nTokenStart": nTokenStart, "nTokenEnd": nTokenEnd, "lTokens": self.lTokens[nTokenStart:nTokenEnd+1], "lMorph": sAction.split("|") if sAction else [":HM"] } - self.lTokens[nTokenStart]["nMultiStartTo"] = nTokenEnd - self.lTokens[nTokenEnd]["nMultiEndFrom"] = nTokenStart + self.lTokens[nTokenStart]["nMultiStartTo"] = self.lTokens[nTokenEnd]["i"] + self.lTokens[nTokenEnd]["nMultiEndFrom"] = self.lTokens[nTokenStart]["i"] self.lTokens[nTokenStart]["dMultiToken"] = dMultiToken self.lTokens[nTokenEnd]["dMultiToken"] = dMultiToken if bDebug: - echo(" MULTI-TOKEN: ({}) [{}:{}]".format(sAction, self.lTokens[nTokenOffset+1]["sValue"], self.lTokens[nLastToken]["sValue"])) + echo(" MULTI-TOKEN: ({}) [{}:{}]".format(sAction, self.lTokens[nTokenStart]["sValue"], self.lTokens[nTokenEnd]["sValue"])) #print(dMultiToken) else: echo("# error: unknown action at " + sLineId) elif cActionType == ">": if bDebug: