Module plugin.example
Example of a plugin for LuaSrcDiet.
WARNING: highly experimental! interface liable to change
Notes:
- Any function can be omitted and LuaSrcDiet won't call it.
- The functions are: (1) init(_option, _srcfl, destfl) (2) postload(z) can return z (3) postlex(toklist, seminfolist, toklnlist) (4) postparse(globalinfo, localinfo) (5) postoptparse() (6) postoptlex(toklist, seminfolist, toklnlist)
- Older tables can be copied and kept in the plugin and used later.
- If you modify 'option', remember that LuaSrcDiet might be processing more than one file.
- Arrangement of the functions is not final!
- TODO: can't process additional options from command line yet
Functions
init (_option, _srcfl, _destfl) | Initialization. |
post_load (z) | Message display, post-load processing, can return z. |
post_lex (toklist, seminfolist, toklnlist) | Post-lexing processing, can work on lexer table output. |
post_parse (globalinfo, localinfo) | Post-parsing processing, gives globalinfo, localinfo. |
post_optparse () | Post-parser optimization processing, can get tables from elsewhere. |
post_optlex (toklist, seminfolist, toklnlist) | Post-lexer optimization processing, can get tables from elsewhere. |
Functions
- init (_option, _srcfl, _destfl)
-
Initialization.
Parameters:
- _option {[string]=bool,...}
- _srcfl string Path of the source file.
- _destfl string Path of the destination file.
- post_load (z)
-
Message display, post-load processing, can return z.
Parameters:
- z this message will print after the LuaSrcDiet title message
- post_lex (toklist, seminfolist, toklnlist)
-
Post-lexing processing, can work on lexer table output.
Parameters:
- toklist luacheck
- seminfolist
- toklnlist ignore
- post_parse (globalinfo, localinfo)
-
Post-parsing processing, gives globalinfo, localinfo.
Parameters:
- globalinfo
- localinfo
- post_optparse ()
- Post-parser optimization processing, can get tables from elsewhere.
- post_optlex (toklist, seminfolist, toklnlist)
-
Post-lexer optimization processing, can get tables from elsewhere.
Parameters:
- toklist luacheck
- seminfolist
- toklnlist ignore