User blog:Fubuki風吹/Parser Functions

In this blog, I'll try my best to explain the working of the various parser functions (provided by the ParserFunctions extension). However, I will not explain the working of the magic words, the basic set of parser functions (for instance, ). Let's get started then.

Syntax
Parser functions by the said extension will always be enclosed within two pairs of braces. The name of the function is always at the beginning prefixed by a hash and suffixed by a colon. All arguments are placed after the colon, separated by a pipe. Like so: where  is the name of the function and   and   are the various arguments. The output depends upon, i.e., if the value of   is altered, the output will also be changed likewise.

Parser Functions
A list of parser functions can be found below:
 * #expr
 * #if
 * #ifeq
 * #ifeq
 * #ifexist
 * #switch
 * #time

#expr

 * If the first argument is not specified, the output will be an empty string:
 * If the first argument possess an invalid expression, it will result in an error:
 * But if the operands are placed so as to form meaningful expressions, the output will not result in an error:
 * Illustrative examples:
 * {{User:Fubuki風吹/c/1| {{#expr: 560 * 12 mod 9 }} → {{#expr: 560 * 12 mod 9 }}
 * {{User:Fubuki風吹/c/1| {{#expr: 1 + 2 - 3 * 4 mod 5 ^ 6 }} }} → {{#expr: 1 + 2 - 3 * 4 mod 5 ^ 6 }}
 * Illustrative examples:
 * {{User:Fubuki風吹/c/1| {{#expr: 560 * 12 mod 9 }} → {{#expr: 560 * 12 mod 9 }}
 * {{User:Fubuki風吹/c/1| {{#expr: 1 + 2 - 3 * 4 mod 5 ^ 6 }} }} → {{#expr: 1 + 2 - 3 * 4 mod 5 ^ 6 }}
 * {{User:Fubuki風吹/c/1| {{#expr: 560 * 12 mod 9 }} → {{#expr: 560 * 12 mod 9 }}
 * {{User:Fubuki風吹/c/1| {{#expr: 1 + 2 - 3 * 4 mod 5 ^ 6 }} }} → {{#expr: 1 + 2 - 3 * 4 mod 5 ^ 6 }}
 * {{User:Fubuki風吹/c/1| {{#expr: 560 * 12 mod 9 }} → {{#expr: 560 * 12 mod 9 }}
 * {{User:Fubuki風吹/c/1| {{#expr: 1 + 2 - 3 * 4 mod 5 ^ 6 }} }} → {{#expr: 1 + 2 - 3 * 4 mod 5 ^ 6 }}

#if

 * The first argument is always interpreted as pure text, hence integers are not evaluated:
 * Either or both the values may be omitted:
 * →   (empty string as the second argument is not specified)
 * Illustrative examples:
 * → (case of a nested  )
 * →   (empty string as the second argument is not specified)
 * Illustrative examples:
 * → (case of a nested  )
 * → (case of a nested  )

#ifeq

 * If both the strings have a numerical value, they are compared numerically:
 * Comparison made as text is always case-sensitive:
 * Illustrative examples:
 * → (case of a nested  )
 * Illustrative examples:
 * → (case of a nested  )
 * Illustrative examples:
 * → (case of a nested  )
 * → (case of a nested  )
 * → (case of a nested  )

#ifexpr

 * If the first argument is empty, the output is evaluated to :
 * As with #expr, if the value of first argument is not a valid expression, the output results in an error:
 * Either or both return values may be omitted. The output results in an empty string when the required argument is not specified:
 * Illustrative examples:
 * Either or both return values may be omitted. The output results in an empty string when the required argument is not specified:
 * Illustrative examples:
 * Illustrative examples:
 * Illustrative examples:

#ifexist

 * For system messages, the function returns  for messages that have been customized:
 * → (said message has been customized)
 * Files can also be checked via this function. However, note that if a file page is created with the description, with no file present at the target, the return value would be :
 * Illustrative examples:
 * {{User:Fubuki風吹/c/1| {{#ifexist: Community Guidelines | {{#ifexist: Chat Guidelines | both guidelines exist | Community Guidelines exists | {{#ifexist: Chat Guidelines | Chat Guidelines exist | no guidelines exist }} }} → {{#ifexist: Community Guidelines | {{#ifexist: Chat Guidelines | both guidelines exist | Community Guidelines exists }} | {{#ifexist: Chat Guidelines | Chat Guidelines exist | no guidelines exist }} }} (case of a nested )
 * {{User:Fubuki風吹/c/1| {{#ifexist: Community Guidelines | {{#ifexist: Chat Guidelines | both guidelines exist | Community Guidelines exists | {{#ifexist: Chat Guidelines | Chat Guidelines exist | no guidelines exist }} }} → {{#ifexist: Community Guidelines | {{#ifexist: Chat Guidelines | both guidelines exist | Community Guidelines exists }} | {{#ifexist: Chat Guidelines | Chat Guidelines exist | no guidelines exist }} }} (case of a nested )
 * {{User:Fubuki風吹/c/1| {{#ifexist: Community Guidelines | {{#ifexist: Chat Guidelines | both guidelines exist | Community Guidelines exists | {{#ifexist: Chat Guidelines | Chat Guidelines exist | no guidelines exist }} }} → {{#ifexist: Community Guidelines | {{#ifexist: Chat Guidelines | both guidelines exist | Community Guidelines exists }} | {{#ifexist: Chat Guidelines | Chat Guidelines exist | no guidelines exist }} }} (case of a nested )

#switch

 * The comparison and the case string, both are case-sensitive. Additionally, the default value when no match is found, can be declared with a case string, :
 * It is possible to group results by providing a case string with no value:
 * For a comparison string, a numerical value must be used with #expr:
 * It is possible for a case string to be empty:
 * If a match is found, subsequent case strings with equal values are ignored:
 * Case strings cannot contain raw equal signs:
 * Illustrative examples:
 * → (case of a nested  )
 * If a match is found, subsequent case strings with equal values are ignored:
 * Case strings cannot contain raw equal signs:
 * Illustrative examples:
 * → (case of a nested  )
 * Illustrative examples:
 * → (case of a nested  )
 * → (case of a nested  )
 * → (case of a nested  )

#time

 * Inside the function, characters can be escaped either by a backslash followed by a formatting character, or by wrapping that character inside double quotes:
 * Illustrative examples:
 * → (time stamp)
 * Illustrative examples:
 * → (time stamp)

There are a few more parser functions (, for example), which I have not explained in this post. If you have any questions, comments or feedback, feel free to post them in the comments.