I was thinking that TreeUtils:fullPreproText( mobToken ) might get me the rest of the statement from the specified node forward to the end of the statement, but it seems to only provide the text of the specified token.
Is there some other function that does this or am I going to have to code my own?
In limited trials, the
In limited trials, the following code seems to work if I hand it the first token past the last one processed. What I don't understand is why I had to add the IF tests on whether to recurse and I would have expected the IF tests at the start to merely return when the recursion hit an end. My test so far is on a define query statement whether the only thing past the file name, the last token I processed individually, is the word scrolling.
method private character RestOfLine(
ipobNode as JPNode,
ipchRestOfLine as character
):
if ipobNode = ? then return ipchRestOfLine.
if NodeTypes:getTypeName(ipobNode:getType()) = "PERIOD" then return ipchRestOfLine.
ipchRestOfLine = ipchRestOfLine + " " + ipobNode:getText().
if ipobNode:firstChild() <> ? and NodeTypes:getTypeName(ipobNode:firstChild():getType()) <> "PERIOD"
then ipchRestOfLine = ipchRestOfLine + " " + RestOfLine( ipobNode:firstChild(), ipchRestOfLine ).
if ipobNode:nextSibling() <> ? and NodeTypes:getTypeName(ipobNode:nextSibling():getType()) <> "PERIOD"
then ipchRestOfLine = ipchRestOfLine + " " + RestOfLine( ipobNode:nextSibling(), ipchRestOfLine ).
return ipchRestOfLine.
end method.
This does work
method private character RestOfLine(
ipobNode as JPNode
):
define variable mchRestOfLine as character initial "" no-undo.
if ipobNode = ? then return mchRestOfLine.
if NodeTypes:getTypeName(ipobNode:getType()) = "PERIOD" then return mchRestOfLine.
mchRestOfLine = ipobNode:getText().
if ipobNode:firstChild() <> ? and NodeTypes:getTypeName(ipobNode:firstChild():getType()) <> "PERIOD"
then mchRestOfLine = mchRestOfLine + " " + RestOfLine( ipobNode:firstChild() ).
if ipobNode:nextSibling() <> ? and NodeTypes:getTypeName(ipobNode:nextSibling():getType()) <> "PERIOD"
then mchRestOfLine = mchRestOfLine + " " + RestOfLine( ipobNode:nextSibling() ).
return mchRestOfLine.
end method.
I know have a couple of
I know have a couple of versions of this depending on whether I want the whole rest of the statement or just the rest of a phrase, like picking up the fields portion of a query. The latter uses a test for comma or period.
This is not working. define
This is not working.
define new shared query q3 for bf_FileS cache 5 scrolling rcode-information.
is giving me
cache cache 5 cache cache 5 scrolling cache cache 5 scrolling rcode-information