summaryrefslogtreecommitdiffstats
path: root/src/poem/elements/rune.rs
Commit message (Collapse)AuthorAgeFilesLines
* Capture STDOUT as bytes, and convert to string when necessaryRory Dudley2024-04-061-33/+51
| | | | | | | | | | | | | Previously, the recite() function created the 'out' variable, which was a String, that got passed to the various incant functions, in order to capture STDOUT in certain situations. In cases where STDOUT was captured, it was first converted to a String, and then appended to the 'out' variable, by means of String::from_utf8_lossy(). This works for basic text, however, does NOT work for binary data. This becomes problematic, when for example, downling a tar file with curl/wget, that is then piped ('|') to the tar program. Using from_utf8_lossy() in this case can corrupt the tar file. This patch makes it so that out is stored as bytes by default, and only converted to a String when necessary.
* Add comments (`#`) to the parserRory Dudley2024-03-281-1/+3
| | | | | The parser will now interpret the '#' character as a single-line comment string, which works on it's own line, or at the end of an existing line.
* Documentation for incant_Rory Dudley2024-03-241-0/+1
| | | | Add docstring for `incant_quiet_io`.
* read() and recite() overhaulRory Dudley2024-03-231-0/+363
Rebuilt the LR parser (i.e. read()) from the ground up. This required that some changes be made to recite(), in order to accomodate the new data structures. These data structures were each split out into their own file, in order to make working with each component a bit easier. In addition to reworking the parts of the parser already present, some new features were also added, such as: - Support for strings (' and ") - Support for environment variables ($) - Support for interpreting tild as $HOME (~) - Support for sub-reading and sub-reciting (`) Notes: This is a huge commit that changes almost the entire program (main.rs is still the same, except for imports). Ideally, huge sweeping changes like this should not occur on the codebase, but since this is still pre-alpha, I guess this is acceptable. This is far from the end of patch set, however, as there is quite a lot of cleanup that needs to be done. For instance, checking for internal poems and environment variables should get split out to their own functions/macros. There is also some defunct code (that's commented out), that is unlikely to be useful in the future.