
Read an expert-system file losslessly
resy_read_expert.RdParses an expert-system definition file (the EUNIS-ESy .txt format and
compatible expert systems) into a structured tree that preserves the source
byte-for-byte.
This is the lossless counterpart to resy_parse_expert. Where
resy_parse_expert rewrites the formulas into the solver's internal
form (and is therefore one-way), resy_read_expert retains the file's
structure verbatim for inspection or conversion to other formats.
Arguments
- file
Path to an expert-system
.txtfile (for example an official release such asEUNIS-ESy-2025-10-03.txt).- entries
Logical, default
TRUE. IfTRUE, each known section also carries a structuredentriesview of its content (aggregations, groups, definitions). IfFALSEonly the raw lines are kept, which is faster when the goal is a pure round-trip and the semantic view is not needed.
Value
An object of class resy_expert: a list with components
metaFile-level metadata:
line_terminator(CRLF or LF) andtrailing_newline(whether the file ends with a terminator).preambleCharacter vector of any lines before the first
SECTIONheader.sectionsA list, in source order, of section objects. Each has
number,name,header_line,body_lines,end_line(NAwhen the section has no matchingSECTION N: End),trailing(lines between this section's end and the next section or end of file), and, whenentries = TRUEand the section type is known,entries: a structured view of the section content.
Examples
if (FALSE) { # \dontrun{
f <- "/path/to/EUNIS-ESy-2025-10-03.txt"
x <- resy_read_expert(f)
length(x$sections)
} # }