Topic: Matching #if...#endif and HTML tags (1 of 1), Read 54 times, 2 File Attachments
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Friday, February 04, 2000 05:14 AM

I have made two macros that work in similar fashion as the
'match parenthesis' function on Vedit.

1. IFS.VDM

matches C preprocessor directives #if, #ifdef etc.
Detects #if, #ifdef, #ifndef, #elif, #else, #endif.

If the cursor line contains #if, either #else or #endif is searched.
If the cursor line contains #else, then #endif is searched.
If the cursor line contains #endif, then #if is searched.

The directive must start from the first column on the line.
Cursor may be anywhere on the line.
If the first character of the line is not #, nothing is done.


2. HTML_TAG.VDM

matches HTML tags, e.g. <table> ... </table>.

The macro works with any tag in format <xxx> ... </xxx> and handles nested tags.
If the cursor is not within a tag, the file is searched forward for next tag.
If the tag does not have matching pair, a beep is sounded and the cursor is not moved.

 
HTML_TAG.VDM (1KB)
 
IFS.VDM (1KB)