Create a new instance of the ConstantsFileReader with the specified options for parsing constants from a file.
Optionaloptions: Partial<ConstantsFileReaderOptions>Optional configuration for the reader.
ProtectedremoveProtectedreadProtectedreadProtectedisProtectedisProtectedisParse the content of a constants file and return the result, including the successfully parsed constants and any errors encountered during parsing. If a Workspace was passed in options, that Workspace will be changed to reflect successful declarations.
The content of the constants file to parse.
The result of parsing, including the successfully parsed constants and any errors encountered.
ProtectedparseProtectedcollect
Reader class for parsing constants files that define key-value pairs of constants to be used within the rule engine. You should use this class to read constants from a text file, where each line (or block) defines a constant in the format "CONST KEY = VALUE" or "KEY = VALUE". The reader will parse the file content and return an object containing the successfully parsed constants 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 constants file. It also includes error handling for invalid syntax and duplicate keys, ensuring that the resulting constants object is valid and usable within the rule engine.
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.