Posted 19 years ago
by Marianne
Presumably, this property provides a boolean that indicates whether the token has been modified since the last lexical parse. I'm having some difficulty understanding how this works. If I have the following code in my semantic parser:
And I modify a single token via a keypress, I would assume only that Token would be processed with this code. Based on my test, not only does it include unchanged tokens in the code, but it does NOT contain the token that I modified via a keypress. Here is my sample script:
The only change I make is to type a '1' at the end of the Dim line so that it reads:
Dim test, test2, test31
I would expect that I would only see that the test31 token would be returned but the result I get is:So I guess I don't understand two things. First, why is it returning tokens that have NOT changed since the last lexical parse? Second, why is it NOT returning the one token that I have in fact modified? I'm sure I just don't understand how the semantic parsing works, and after seeing these results I'm guessing that it doesn't work at all the way I thought it did.
if (modification.HasFlag(DocumentModificationFlags.ProgrammaticTextParse))
{ ...
}
else
{
if (modification.Type != DocumentModificationType.Typing) return;
TokenStream ts = document.GetTokenStream(modification.StartOffset);
Token t = ts.Read();
while (!ts.IsPastEnd)
{
if(t.Modified)
Console.WriteLine(document.GetTokenText(t));
t = ts.Read();
}
}
Dim test, test2, test3
Set oFirstNode = GetObject(RootNodePath)
If Err <> 0 Then
Display "Couldn't get the first node!"
WScript.Quit (1)
End If
' Begin displaying tree
Call DisplayTree(oFirstNode, 0)
Dim test, test2, test31
I would expect that I would only see that the test31 token would be returned but the result I get is:
WScript.Quit (1)
End If
------------------------------- Marianne