Create a new instance of the GeneralFileReader with the specified options for parsing content from a file.
Optionaloptions: Partial<GeneralFileReaderOptions>Optional configuration for the reader.
ProtectedoptionsProtectedruleProtectedfunctionProtectedtypeProtectedworkspaceThe workspace instance to which the parsed rules, functions, types, and constants will be added. This allows for components to recognize earlier declared components.
ProtectedblocksProtectedremoveProtectedreadProtectedreadProtectedisProtectedisProtectedisParse the content of a functions file and return the result, including the successfully parsed components and any errors encountered during parsing. A general file can read types, constants, rules, and functions.
The content of the file to parse.
The result of parsing, including the successfully parsed constants, functions, types, rules, and any errors encountered.
ProtectedparseProtectedparseProtectedparseProtectedparseProtectedparseProtectedparse
Reader class for parsing general files that can contain constants, types, rules, and functions to be used within the rule engine. You should use this class to read content from a text file or stream, where each line (or block) defines a constant, type, rule, or function. The reader will parse the file content and return an object containing the successfully parsed elements as well as any errors encountered during parsing. The reader supports both line-by-line and block-by-block reading, allowing for flexible formatting of the file. It also includes error handling for invalid syntax and duplicate keys, ensuring that the resulting objects are valid and usable within the rule engine.
N.B. Declarations do not need to be in order, although that is still recommended.
N.B. This is a transactional safe reader. If you provide a workspace and select the option accept: 'all', then that workplace will not be affected if any errors are encountered.