Matching parentheses

Top  Previous  Next

(tranport.gms)

The IDE provides a way of checking on how the parentheses match up in GAMS code.  This feature will also match up { } or [ ].  This involves usage of the button containing the symbol _img30 from the menu bar or typing the F8 key coupled with appropriate cursor positioning.  In particular positioning the cursor just after an open or close parenthesis and pressing the button or F8 jumps to the matching close or open parenthesis.  For example, suppose we have a line of GAMS code like

 _img30a

and we position the cursor right after the first open parenthesis where the vertical line appears.  Then clicking on the parenthesis matching button will jump the cursor to the position right after the matching ending parentheses as show below where the vertical line indicates the resultant cursor position.  This will work whether it be 1, 100, or 1000+ lines away and vice versa.  (Note it is not smart enough to ignore parentheses in comment statements so be sure any of those match up.)  If a matching one is not found the cursor does not move.

 _img30b

Equivalently positioning the cursor right after an closing parenthesis and clicking on the button repositions the cursor right after the matching opening parenthesis.  If a matching one is not found the cursor does not move.