diff options
author | Molly Miller <33266253+sysvinit@users.noreply.github.com> | 2020-04-10 12:35:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-10 13:35:15 +0200 |
commit | 5d12061c534f9d277711830f9de8416de544fd49 (patch) | |
tree | 1690487457a276a32320c416a179029e61847f9b /tests | |
parent | 80221ddde4e3663bf70bb7f7681d9b4b70c76ee9 (diff) | |
download | pygments-git-5d12061c534f9d277711830f9de8416de544fd49.tar.gz |
Add execline lexer (#1393)
* Implement lexer for execline.
This commit introduces a lexer for Laurent Bercot's execline scripting language
(https://skarnet.org/software/execline) based on Pygments' existing bash lexer,
with some minor adaptations for execline's variable naming rules.
* Add versionadded note and website link to execline lexer.
* Add execline to languages.rst and example execline script
* Explicitly mark non-special characters in execline lexer as Text
* Correct execline lexer version addded
Co-authored-by: Molly Miller <sysvinit@users.noreply.github.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examplefiles/example.exec | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/examplefiles/example.exec b/tests/examplefiles/example.exec new file mode 100644 index 00000000..563bf991 --- /dev/null +++ b/tests/examplefiles/example.exec @@ -0,0 +1,37 @@ +#!/usr/bin/execlineb + +importas -iu SPEC 1 +shift +elgetpositionals + +ifelse -nX { + heredoc -d 0 ${SPEC} + s6-grep -qE "^([[:alpha:]]+(_[[:digit:]]+)?/)*([[:alpha:]]+(_[[:digit:]]+)?):[[:digit:]]+$" +} { + foreground { + fdmove 1 2 + echo "Bad argument" + } + exit 1 +} + +multidefine -0d: ${SPEC} { QUEUESPEC THREADSPEC } + +define -s -d/ QUEUELIST ${QUEUESPEC} +backtick -ni CMDLINE { + forx -o0 QUEUEPAT { ${QUEUELIST} } + importas -i Q QUEUEPAT + ifelse -X { + heredoc -d 0 ${Q} + s6-grep -qE "^[[:alpha:]]+_[[:digit:]]+$" + } { + multidefine -0d_ ${Q} { QNAM QPRIO } + echo -n "-q ${QNAM},${QPRIO} " + } + echo -n "-q ${Q} " +} + +importas -ui CMDLINE CMDLINE +define -s -d" " ARGS ${CMDLINE} +${@} ${ARGS} -c ${THREADSPEC} + |