From aff01025364544505f2769d6037e04540a55c08c Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 24 Sep 2023 16:14:59 -0400 Subject: [PATCH] Document the prefix statement --- doc/user_guide.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/doc/user_guide.md b/doc/user_guide.md index 491fde3..3c04534 100644 --- a/doc/user_guide.md +++ b/doc/user_guide.md @@ -478,6 +478,29 @@ module proj.parser; If a module statement is not present, then the generated D module will not contain a module statement and the default module name will be used. +##> Specifying the generated API prefix - the `prefix` statement + +By default the public API (types, constants, and functions) of the generated +lexer and parser uses a prefix of `p_`. + +This prefix can be changed with the `prefix` statement. + +Example: + +``` +prefix myparser_; +``` + +With a parser generated with this `prefix` statement, instead of calling +`p_context_init()` you would call `myparser_context_init()`. + +The `prefix` statement can be optionally used if you would like to change the +prefix used by your generated lexer and parser to something other than the +default. + +It can also be used when generating multiple lexers/parsers to be used in the +same program to avoid symbol collisions. + #> License Propane is licensed under the terms of the MIT License: