mirror of
https://github.com/tonydamage/nux-env.git
synced 2025-12-11 13:24:28 +01:00
nuxsh: Added support for @command keyword and use it
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
parent
27f3986528
commit
e148c76fbe
6 changed files with 103 additions and 82 deletions
|
|
@ -30,13 +30,19 @@ nux.nuxsh.language.def() {
|
|||
.match.line block_end '(\})' \
|
||||
syntax
|
||||
|
||||
|
||||
.match.line if_start "(if)( +)$prefixed_id( +)$args?( *)(\{)" \
|
||||
keyword indent2 prefix identifier indent3 args - - - - - indent4 syntax3
|
||||
|
||||
|
||||
.match.line task_start "((@command)( +))($identifier)((\()|( *))(($identifier,? *)*)(\))?( *)(\{)" \
|
||||
- keyword indent2 identifier - syntax indent3 args - syntax2 indent4 syntax3
|
||||
|
||||
|
||||
.match.line function_start "((function)( +))($identifier)((\()|( *))(($identifier,? *)*)(\))?( *)(\{)" \
|
||||
- keyword indent2 identifier - syntax indent3 args - syntax2 indent4 syntax3
|
||||
|
||||
|
||||
|
||||
.match.line block_start "($identifier)(( +)$args)?( *)(\{)" \
|
||||
identifier - indent2 args - - - - - indent3 syntax3
|
||||
|
||||
|
|
@ -51,12 +57,12 @@ nux.nuxsh.language.def() {
|
|||
|
||||
.highlight prefix cyan
|
||||
.highlight identifier green
|
||||
.highlight keyword blue
|
||||
.highlight keyword cyan
|
||||
.highlight args yellow
|
||||
|
||||
.highlight comment magenta
|
||||
|
||||
.highlight unmatched red
|
||||
.highlight unmatched white
|
||||
|
||||
.highlight syntax white
|
||||
.highlight syntax2 white
|
||||
|
|
@ -172,6 +178,20 @@ nux.nuxsh.language.def() {
|
|||
done
|
||||
}
|
||||
|
||||
.match.task_start.plan() {
|
||||
.block.push task
|
||||
case $identifier in
|
||||
:*) identifier="task.${identifier#:}";;
|
||||
*) identifier="task.$identifier"
|
||||
esac;
|
||||
echo "${indent}$identifier() {";
|
||||
echo "${indent} nux.log trace $identifier: invoked";
|
||||
for arg in ${args//,/ }; do
|
||||
echo "${indent} local $arg="'"$1"'";shift;"
|
||||
echo "${indent} nux.log trace ' ' arg $arg: "'$'$arg";"
|
||||
done
|
||||
}
|
||||
|
||||
.block.start.plan() {
|
||||
case $identifier in
|
||||
function) echo "$line";;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue