I'm trying to implement a custom language inheriting from SyntaxLanguage. I've got lexical parsing and syntax coloring almost working, with the following glitch:
In PerformLexicalParse(), I correctly parse all the tokens in the document (as verified by printing all tokens to the console) and callon them. However, when I get into semantical parsing, the list of tokens is missing the last token and instead has one InvalidToken and one EndOfStream token.
Inspecting PerformLexicalParse, I noticed that parseTarget contains these two tokens already when the PerformLexicalParse() method is entered, with InvalidToken spanning the whole document. As tokens are added by OnTokenParsed, the TextRange of InvalidToken shrinks until it is just one character long (1481-1482). Then when the last token (a single-character curly brace, with StartOffset=1481 and Length=1) is sent to OnTokenParsed, it seems to be simpy thrown away.
Obviously I'm missing something, but I can't figure it out. Any suggestions?
btw, thanks for an excellent piece of software!
In PerformLexicalParse(), I correctly parse all the tokens in the document (as verified by printing all tokens to the console) and call
parseTarget.OnTokenParsed(token, token.Length)
Inspecting PerformLexicalParse, I noticed that parseTarget contains these two tokens already when the PerformLexicalParse() method is entered, with InvalidToken spanning the whole document. As tokens are added by OnTokenParsed, the TextRange of InvalidToken shrinks until it is just one character long (1481-1482). Then when the last token (a single-character curly brace, with StartOffset=1481 and Length=1) is sent to OnTokenParsed, it seems to be simpy thrown away.
Obviously I'm missing something, but I can't figure it out. Any suggestions?
btw, thanks for an excellent piece of software!