Here's how it should really look like:I had the relevant search patterns defined more or less correctly, but the problem was that I had put them in the wrong place. You see, in Vim syntax highlighting, the order in which the patterns appear matters a whole lot. Usually we will structure the most general matching to create an initial assignment, and then bring up specific patterns to refine it to special case input.
So in this case, the (simplified version of) general matching is that of a Comment, which is
syn region qbComment start="'" end="$" contains=qbTodoAnd the pattern for the '$INCLUDE: 'FILEPAK.BI' metacommand is
syn region qbMetacommand start="'\s*\$include" end="$"This means that the pattern for $INCLUDE is more specific than the one for regular comments.
In my bid to refactor, I had shifted all the QuickBASIC-only patterns up to the front of the file. So it had first assigned the matching for $INCLUDE correctly, but then when it encountered the rule for comments, it re-assigned the matching to that of the comments since it was more general.
I fixed that this morning, and filled in quite a few more quality-of-life type updates, specifically detecting and highlighting some lexical-level errors where possible, as well as tweaking some edge case-related stuff that I ``know''.
Anyway, I'm basically done with this side-track for now. You can download it from here if you are interested for some reason. Note that this isn't exemplary of how a Vim syntax file should look like---I did hack it up in a moment of annoyance in less than a day.
Till the next update.
No comments:
Post a Comment