Previous: Syntax Highlighting, Up: Code Formatting

4.1.6 Octals and Highlighting

A rare syntax highlighting problem results from an extremely unfortunate notation for octal numbers in IDL: "123. This unpaired quotation mark is very difficult to parse, given that it can be mixed on a single line with any number of strings. Emacs will incorrectly identify this as a string, and the highlighting of following lines of code can be distorted, since the string is never terminated.

One solution to this involves terminating the mistakenly identified string yourself by providing a closing quotation mark in a comment:

       string("305B) + $ ;" <--- for font-lock
        ' is an Angstrom.'

A far better solution is to abandon this notation for octals altogether, and use the more sensible alternative IDL provides:

        string('305'OB) + ' is an Angstrom.'

This simultaneously solves the font-lock problem and is more consistent with the notation for hexadecimal numbers, e.g., 'C5'XB.