Method: defineUdt()
APG parsers provide for user-written, phrase-matching functions. These are called "User Defined Terminals" or UDTs. UDTs can be used in apg-exp pattern syntax as well. This provides the user the opportunity to hand write a JavaScript function for special phrase-matching needs. The defineUdt() method is used to tell apg-exp what function to use.
Syntax
var exp = new apgExp(pattern[, flags]); exp.defineUdt(name, function);
Parameters
- name: string: The name of the UDT as specified in the pattern syntax.
- function: a function reference to the user-written UDT.
Return
none
Examples
The use of APG's UDTs is beyond the scope of this guide. See the examples in the GitHub repository.