WPS tokenizer
Introduction
%W% This article is Work-in-progress
This page aims to explain the principles of the WPS tokenizer and give all the information needed to maintain and extend it.
Code structure explanation
The parser
The main function for WPS loading and parsing is
wps_data_load()
. It does the following:
- reset the WPS data structure
- copy the WPS source to the plugin buffer
- parses the source
- load the bitmaps
The renderer
How to add a WPS tag
- Add a new token to
enum wps_token_type
in gwps.h
.
- Add your token and the corresponding WPS tag to the
all_tags
array in wps_parser.c
. If necessary, add a special parsing function that will be called when the tag is encountered.
- Add a case for the new token to the switch in
get_tag()
in gwps-common.c
.
- Add a case for the new token to the switch in
dump_wps_tokens()
in wps_debug.c
(this isn't vital but helpful).
Copyright © by the contributing authors.