[Tcsh] One-line command parsing

Matheus tateusg at protonmail.com
Mon Aug 24 12:59:27 EDT 2026


Because I first tried to implement this on top of a temporary function, I altered how semicolons are parsed. Notably, the command-line must end with a semicolon. This is only true when a semicolon is inserted. I.e.: a ; b ;. However, the behavior in sh.sem.c wasn't altered.

Though I don't know if this is the best solution to implement one-line command parsing for control structures, this is what I achieved.

I've only decided to implement this because of this issue somebody posted on my repository. I, for one, couldn't care less whether one-line command parsing for control structures is a feature or not. I mean one could achieve this behavior using a function.

Regarding functions, I came to realize the implementation is somewhat bad. I dislike the use of pipe(). This is messy. I need to reorganize the project.

> What is the implication for the existing syntax? I.e. how are existing scripts affected?
> 
> christos
> 
> > On Aug 24, 2026, at 10:51 AM, Matheus <tateusg at protonmail.com> wrote:
> >
> > https://github.com/Krush206/etcsh/pull/2
> > Hello. I'm writing this e-mail as a matter of contribution. I forked Tcsh, and added some features. My most-recent contribution is on one-line command parsing. I'm currently working on an implementation to parse control structures in a single line, as in Bourne shells.
> >
> > At first, I thought on parsing one-line commands on top of a temporary function. This turned out to be too complicated. Instead, I parse semicolons into a new node mode [NODE_FUNC]. I implemented a new mode [F_LINE]. I "reparse" the entire tree, setting the F_LINE bit to every command node [NODE_COMMAND]. Then, in execute(), I walk through the entire tree, analyzing which of the NODE_COMMAND entries contain the F_LINE mode. The node shall be saved in a circular linked list for each containing the F_LINE mode. Next, the circular linked list is analyzed from search1(). The parsing is almost the same from search().
> >
> > This is still a work in progress. Not ready for production use. I don't know if this is 100% feasible, though, compared to past implementations, progressed quite fairly.
> >
> > I'd appreciate for contributions and feedback.
> >
> > Thank you.
> > --
> > Tcsh mailing list
> > Tcsh at astron.com
> > https://mailman.astron.com/mailman/listinfo/tcsh
> 
> 


More information about the Tcsh mailing list