Table of Contents

Continuing Language File Creation

With that little aside out of the way, now we can continue defining the root context for the test language.


You have already seen an example of this method, so here we will use it again to add support for highlighting types:

        'bool', 'boolean', 'float',  'int', 'integer', 'string', 'object'
    ), 'type', true, '{FNAME}');

There’s just one type missing - “double” - but that does not have documentation at 1). I will leave it as an exercise for you to add another keyword group that handles that case.

You may also want to add a keyword group for the macros like __FILE__. They are case sensitive.

Other groups you could add include groups for constants like E_ERROR and for functions like strpos. Both groups are rather large and I have omitted them here. In the actual PHP files the keyword groups are split out to each dialect of PHP (php, php4 and php5) so that PHP4 does not highlight functions that it does not have.



1) strange but true, see for yourself: You’d think it could be redirected to float, just like the keyword is an alias for float but evidently not.
lang/dev/tutorial/6.txt · Last modified: 2011/09/01 13:03
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki