A perl preprocessor

























Last change at 26. of May, 2001




This is a preprocessor that is written in perl and also uses perl for its commands. It roughly works like this:

  • read a file completely into memory.
  • scan it for preprocessor commands (everything between @@ and the end of the line it appeared in and everything between /@ and @/).
  • extract that command and execute it, remember the return string.
  • replace the original sequence with the return string.
  • The preprocessor has only one command built-in, that is "include", which works like this:

  • take its argument (the file name) and "require" it. That's all.
  • This way you can define your own functions in a separate file and just add them whenever you need to. Here's the source with an example: parser.tbz2 (1700 Bytes).