summaryrefslogtreecommitdiffstats
path: root/src/poem/read
Commit message (Collapse)AuthorAgeFilesLines
* Rewrite of the next! macroRory Dudley2024-05-171-11/+34
| | | | | | | This patch replaces the next! macro with a next() function. It serves the same purpose, but instead of only checking for two different runes (a fallback, or one that matches the peek), it can now take a list of runes/characters to look ahead for, in addition to the fallback.
* Fix regression with aliasesRory Dudley2024-05-121-28/+0
| | | | | | | | | Fixed a regression that was introduced in: 1415c8f9b89699000ef8d864ff8f0e1bebca4a5f. Moving aliases to read() broke how pipes worked. This commit removes the troublesome append!() macro, and replaces it with some logic in the add() function (impl Appendable for Poem).
* Add 'strings' to the verse after the string!() macroRory Dudley2024-04-061-1/+0
| | | | | | This patches fixes a bug, where sometimes, when a Rune::String was detected, the resulting string from the string!() macro wasn't getting pushed to the current verse.
* Handle aliases in read()Rory Dudley2024-04-041-2/+30
| | | | | | Instead of handling aliases in the recite() function, which requires two loops to handle properly with the current implementation, offload checking for aliases to the read() function.
* Don't interpret environment variables in single quoted stringscomposeRory Dudley2024-03-311-0/+4
| | | | | | | | | | | | Previously, if an environment variable was given in a string, such as: '$PATH' or "$PATH", both would be replaced with the value of $PATH from the environment. However, for single quotes strings, any values inside should be taken at face value. In other words, echo '$PATH' should simply write out: $PATH, and not whatever environment value $PATH happens to be. This patch replaced '$' in single quoted strings with the ASCII shift out (x0e) character. Any ASCII SO placeholder is replaced with a '$' in recite(), after the environment variables have been accounted for.
* Add comments (`#`) to the parserRory Dudley2024-03-281-0/+15
| | | | | 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.
* read() and recite() overhaulRory Dudley2024-03-231-0/+68
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.