summaryrefslogtreecommitdiff
path: root/sys/src/cmd/rc/syn.y
AgeCommit message (Collapse)Author
2022-02-16rc: fix globbing with lists (thanks qwx)cinap_lenrek
Pattern matching with lists no longer works: ; ls /tmp/*.c /tmp/npage.c /tmp/pagedebug.c /tmp/pageold.c /tmp/scheduler.c /tmp/writeimagetest.c ; ls /tmp/^(*.c) ls: /tmp/*.c: '/tmp/*.c' directory entry not found ; 9fs dump ; bind /n/dump/2021/1002/amd64/bin/rc /bin/rc ; rc ; ls /tmp/^(*.c) /tmp/npage.c /tmp/pagedebug.c /tmp/pageold.c /tmp/scheduler.c /tmp/writeimagetest.c the fix: we have to propagate the glob attribute thru lists as well. before it was only handled for single words and propagated thru concatenations... the Xglob instruction now works on list, and we propagate the glob attribute thru PAREN and WORDS and ARGLIST nodes. also, avoid using negative numbers for the Tree.glob field as char might be unsigned on some targets.
2022-01-07rc: read heredoc when receiving '\n' (thanks Eckard Brauer)cinap_lenrek
Eckard's test case: cat <<! | cat asdf ! The issue is that we have to continue parsing until we see the '\n' before consuming the here document. So we revert to the old approach of having two functions: heredoc() which remembers if we'v seen a heredoc redirection and a second readhere() function that reads the doc from the lexers input and sets Tree.str on thee REDIR node.
2021-12-31rc: fix everythingcinap_lenrek
Untangle the lexer and interpreter thread state. Fix the file and line number error reporting, getting rid of Xsrcfile instruction, as the whole code block can only come from a single file, stuff the source file in slot[1] of the code block instead. Remove limitations for globber (path element limits) and be more intelligent about handling globbing by inserting Xglob instruction only when needed and not run it over every Xsimple argument list. Remove fragile ndot magic and make it explicit by adding the -q flag to . builtin command. Add -b flag for full compilation. Make exitnext() smart, so we can speculate thru rcmain and avoid the fork(). Get rid of all print(2) format functions and use io instead. Improve the io library, adding rstr() to handle tokenization, which allows us to look ahead in the already read buffer for the terminators, avoiding alot of string copies. Auto indent pcmd(), to make line number reporting more usefull. Implement here documents properly, so they can work everywhere.
2021-09-08rc: revert 2f8a59f4b5bfe028c022855acc19666d69eed909Ori Bernstein
this patch doesn't pull its weight; it's not worth it.
2021-07-08rc: add subshell-function syntaxOri Bernstein
fn foo @{bar} is now equivalent to fn foo {@{bar}}. As a side effect, this disallows creating functions named after keywords without first quoting them.
2016-06-30rc: implement 9atoms ` split {command} syntax extensioncinap_lenrek
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen