Posted 18 years ago
by Karl Grambow
I've recently started thinking about using Outlining and I'm unsure about how best to achieve what I want. So I thought I'd ask the opinion of those that have used outlining about your thoughts seeing as someone might have already done what I'm hoping to do.
When deciding on what to outline I want to check whether the End token for a given Start token exists. For example, if I want to outline "If...End If" statements, I want to hold off on creating the outline until I can confirm that the corresponding "End If" token key has been found. If the End token wasn't found then the outline won't be created.
Staying with the "If...End If" example and assuming I've just found an "If" token key:
I figured that I could parse the document until I find a corresponding "End If". Obviously, I will need to keep track of any further "If" statements that I might find along the way and process those first - perhaps using recursion?
Does my suggestion have any flaws in it or is there a better way I can achieve the same result? Also, is it better to use automatic outlining or manual? I guess I could implement a class that inherits from SemanticDefaultParser and extend that to suit this situation but I wasn't sure if there was a preferred way.
If there's anything obvious that I'm overlooking please let me know.
Thanks,
Karl
When deciding on what to outline I want to check whether the End token for a given Start token exists. For example, if I want to outline "If...End If" statements, I want to hold off on creating the outline until I can confirm that the corresponding "End If" token key has been found. If the End token wasn't found then the outline won't be created.
Staying with the "If...End If" example and assuming I've just found an "If" token key:
I figured that I could parse the document until I find a corresponding "End If". Obviously, I will need to keep track of any further "If" statements that I might find along the way and process those first - perhaps using recursion?
Does my suggestion have any flaws in it or is there a better way I can achieve the same result? Also, is it better to use automatic outlining or manual? I guess I could implement a class that inherits from SemanticDefaultParser and extend that to suit this situation but I wasn't sure if there was a preferred way.
If there's anything obvious that I'm overlooking please let me know.
Thanks,
Karl