<feed xmlns='http://www.w3.org/2005/Atom'>
<title>dwarvish.git/src/recite, branch escsq</title>
<subtitle>a (mostly) posix compliant shell and tiny functional programming language
</subtitle>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/'/>
<entry>
<title>read() and recite() overhaul</title>
<updated>2024-03-23T08:45:54+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-03-23T08:45:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=5a7718698373d07a29fffcb792acdb81aa7712d7'/>
<id>5a7718698373d07a29fffcb792acdb81aa7712d7</id>
<content type='text'>
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 (`)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 (`)
</pre>
</div>
</content>
</entry>
<entry>
<title>Poem::read macros</title>
<updated>2024-03-05T07:42:28+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-03-05T07:42:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=37e1ae98dc9309715e9415962f21484a807d2c56'/>
<id>37e1ae98dc9309715e9415962f21484a807d2c56</id>
<content type='text'>
Added the following macros:

push!: Creates a Verse from a stanza, taking into account some extra
options (such as the Meter).

push1!: Creates a Verse from a stanza, but also allows looking ahead
by a single character, in order to pattern match certain meters (i.e.
And ('&amp;&amp;') and Addendum ('&gt;&gt;')).

Replaced the code in the huge, redundant match statements in Poem::read
with the macros described above.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Added the following macros:

push!: Creates a Verse from a stanza, taking into account some extra
options (such as the Meter).

push1!: Creates a Verse from a stanza, but also allows looking ahead
by a single character, in order to pattern match certain meters (i.e.
And ('&amp;&amp;') and Addendum ('&gt;&gt;')).

Replaced the code in the huge, redundant match statements in Poem::read
with the macros described above.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix macro_export formatting</title>
<updated>2024-03-05T07:30:35+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-03-05T07:30:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=e03ceec834aeca1f383b19354e32987bc2d59506'/>
<id>e03ceec834aeca1f383b19354e32987bc2d59506</id>
<content type='text'>
Fixed formatting of macro_export in src/recite/ps.rs to be more
consistent.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixed formatting of macro_export in src/recite/ps.rs to be more
consistent.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix handling of SIGINT</title>
<updated>2024-02-29T08:40:27+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-02-29T08:40:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=718f45492a4b2c31a67458c13c4cd4b3268703bc'/>
<id>718f45492a4b2c31a67458c13c4cd4b3268703bc</id>
<content type='text'>
Keep track of a new atomic variable: at_prompt, which is set to true
just before blocking on io::stdin.read_line, and set to false just
calling Poem::read. Additionally, for background tasks, there is a new
ps macro called btask, which changes the process group of commands that
are forked into the background, so that they don't receive SIGINT from
the keyboard.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Keep track of a new atomic variable: at_prompt, which is set to true
just before blocking on io::stdin.read_line, and set to false just
calling Poem::read. Additionally, for background tasks, there is a new
ps macro called btask, which changes the process group of commands that
are forked into the background, so that they don't receive SIGINT from
the keyboard.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix ps macros doc comments</title>
<updated>2024-02-29T06:04:51+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-02-29T06:04:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=75407774ce163df53c28391fb653c3714abd1aef'/>
<id>75407774ce163df53c28391fb653c3714abd1aef</id>
<content type='text'>
[Verse] is not in scope for the ps module, so removed the link in the
documentation comments.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Verse] is not in scope for the ps module, so removed the link in the
documentation comments.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add doc comments for ps macros</title>
<updated>2024-02-29T06:02:20+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-02-29T06:02:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=55e9a27bde60a8e4fbb6306871b6317d68685987'/>
<id>55e9a27bde60a8e4fbb6306871b6317d68685987</id>
<content type='text'>
Added documentation comments for the recite::ps::task and
recite::ps::ctask macros.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Added documentation comments for the recite::ps::task and
recite::ps::ctask macros.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove custom errors and fix background forking</title>
<updated>2024-02-27T10:49:01+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-02-27T10:49:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=e94d09da9449cabd7ece2acd98d52b1946a922a4'/>
<id>e94d09da9449cabd7ece2acd98d52b1946a922a4</id>
<content type='text'>
Removes the custom errors in src/recite/erro.rs, and replaces them with
std::io::Errors throughout (recite(), incant_, macros).

Fixed a bug with the way forking to the background is handled, where
registering the signal handler in main for all processes would break
couplets (i.e. pipes). Instead, this sets up a new signal handler each
time a process is forked into the background. It uses a Vec&lt;i32&gt; to keep
track of all the background processes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Removes the custom errors in src/recite/erro.rs, and replaces them with
std::io::Errors throughout (recite(), incant_, macros).

Fixed a bug with the way forking to the background is handled, where
registering the signal handler in main for all processes would break
couplets (i.e. pipes). Instead, this sets up a new signal handler each
time a process is forked into the background. It uses a Vec&lt;i32&gt; to keep
track of all the background processes.
</pre>
</div>
</content>
</entry>
<entry>
<title>Cleanup recite(), custom errors, fixed forking</title>
<updated>2024-02-27T06:14:13+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-02-27T06:14:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=0548e74cb3227716cf445f27bd64b8c0b4d0f981'/>
<id>0548e74cb3227716cf445f27bd64b8c0b4d0f981</id>
<content type='text'>
First off, moved the giant match statements out of recite(), and into
macros in src/recite/ps.rs. There still needs to be two, since any verse
using the 'couplet' meter will need to redirect its STDOUT. Now the
recite() function returns a Result&lt;(), Mishap&gt;, which can be invoked
when calling the incant_ functions.

Custom errors were added in the form of 'Mishap''s. They are intended to
be returned from the incant_ functions, in the event that something goes
wrong with the Command::spawn() or Child::wait(). They each take a
String, which should be the verb or stanza that was entered by the user.

The incant_ functions separate the functionality of each type of meter
from the recite() function. They return a Result&lt;i32, Mishap&gt;, where
i32 is the exit code of the program that ran, and Mishap is a possible
error.

Before, the shell was cheating at forking a process to the background.
It would actually spawn a thread to wait for that process to finish.
Now, the program simply registers a handler for SIGCHLD, and uses libc's
waitpid() function to reap the child process, and print some output to
the user, indicating that it's finished.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
First off, moved the giant match statements out of recite(), and into
macros in src/recite/ps.rs. There still needs to be two, since any verse
using the 'couplet' meter will need to redirect its STDOUT. Now the
recite() function returns a Result&lt;(), Mishap&gt;, which can be invoked
when calling the incant_ functions.

Custom errors were added in the form of 'Mishap''s. They are intended to
be returned from the incant_ functions, in the event that something goes
wrong with the Command::spawn() or Child::wait(). They each take a
String, which should be the verb or stanza that was entered by the user.

The incant_ functions separate the functionality of each type of meter
from the recite() function. They return a Result&lt;i32, Mishap&gt;, where
i32 is the exit code of the program that ran, and Mishap is a possible
error.

Before, the shell was cheating at forking a process to the background.
It would actually spawn a thread to wait for that process to finish.
Now, the program simply registers a handler for SIGCHLD, and uses libc's
waitpid() function to reap the child process, and print some output to
the user, indicating that it's finished.
</pre>
</div>
</content>
</entry>
<entry>
<title>Reorganization and comments</title>
<updated>2024-02-23T06:12:24+00:00</updated>
<author>
<name>Rory Dudley</name>
</author>
<published>2024-02-23T06:12:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dwarvish.org/dwarvish.git/commit/?id=536e250653e5c140a6d9e60f1cd652b79135e7a6'/>
<id>536e250653e5c140a6d9e60f1cd652b79135e7a6</id>
<content type='text'>
Broke out the structs for a poem into their own file: src/recite.rs.
Also put the 'prefresh' function into it's own file: src/recite/path.rs.
Commented most of the parser code (including structs and helper methods
related to parsing (i.e. Verse, Stanza, Meter, Poem)). Renamed any
instance of the 'paths' variable to 'path'.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Broke out the structs for a poem into their own file: src/recite.rs.
Also put the 'prefresh' function into it's own file: src/recite/path.rs.
Commented most of the parser code (including structs and helper methods
related to parsing (i.e. Verse, Stanza, Meter, Poem)). Renamed any
instance of the 'paths' variable to 'path'.
</pre>
</div>
</content>
</entry>
</feed>
