Go to the first, previous, next, last section, table of contents.


Defining New Scanners in the Source Code

To add a new scanner in source code, you should add a new section to the file `scanners.c'. It might be easiest to clone one of the existing scanners and modify it as necessary. For the hypothetical language foo, you must define the functions get_token_foo, parse_args_foo, help_me_foo, as well as the tables long_options_foo and args_foo. If your scanner is modelled after one of the existing scanners, you'll also need a character-attribute table ctype_foo.

This is not a terribly difficult programming task, but it requires recompiling and installing the new version of `mkid' and `xtokid'. You should use `xtokid' to test the operation of the new scanner.

Once these functions and tables are ready, add function prototypes and an entry to to the languages_0 table near the beginning of the file.

Be warned that the existing scanners are built for speed, not elegance or readability. You might wish to create a new scanner that's easier to read and understand if you don't feel that speed is so important.


Go to the first, previous, next, last section, table of contents.