summaryrefslogtreecommitdiff
path: root/tests/lexers/execline
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lexers/execline')
-rw-r--r--tests/lexers/execline/example.txt289
1 files changed, 289 insertions, 0 deletions
diff --git a/tests/lexers/execline/example.txt b/tests/lexers/execline/example.txt
new file mode 100644
index 00000000..ed4683da
--- /dev/null
+++ b/tests/lexers/execline/example.txt
@@ -0,0 +1,289 @@
+---input---
+#!/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}
+
+
+---tokens---
+'#!/usr/bin/execlineb\n' Comment.Hashbang
+
+'\n' Text
+
+'importas' Name.Builtin
+' ' Text
+'-iu' Text
+' ' Text
+'SPEC' Text
+' ' Text
+'1' Text
+'\n' Text
+
+'shift' Name.Builtin
+'\n' Text
+
+'elgetpositionals' Name.Builtin
+'\n\n' Text
+
+'ifelse' Name.Builtin
+' ' Text
+'-nX' Text
+' ' Text
+'{' Operator
+'\n ' Text
+'heredoc' Name.Builtin
+' ' Text
+'-d' Text
+' ' Text
+'0' Text
+' ' Text
+'${' Literal.String.Interpol
+'SPEC' Name.Variable
+'}' Literal.String.Interpol
+'\n ' Text
+'s6-grep' Text
+' ' Text
+'-qE' Text
+' ' Text
+'"' Literal.String.Double
+'^([[:alpha:]]+(_[[:digit:]]+)?/)*([[:alpha:]]+(_[[:digit:]]+)?):[[:digit:]]+' Literal.String.Double
+'$' Text
+'"' Literal.String.Double
+'\n' Text
+
+'}' Operator
+' ' Text
+'{' Operator
+'\n ' Text
+'foreground' Name.Builtin
+' ' Text
+'{' Operator
+'\n ' Text
+'fdmove' Name.Builtin
+' ' Text
+'1' Text
+' ' Text
+'2' Text
+'\n ' Text
+'echo' Text
+' ' Text
+'"Bad argument"' Literal.String.Double
+'\n ' Text
+'}' Operator
+'\n ' Text
+'exit' Name.Builtin
+' ' Text
+'1' Text
+'\n' Text
+
+'}' Operator
+'\n\n' Text
+
+'multidefine' Name.Builtin
+' ' Text
+'-0d:' Text
+' ' Text
+'${' Literal.String.Interpol
+'SPEC' Name.Variable
+'}' Literal.String.Interpol
+' ' Text
+'{' Operator
+' ' Text
+'QUEUESPEC' Text
+' ' Text
+'THREADSPEC' Text
+' ' Text
+'}' Operator
+'\n\n' Text
+
+'define' Name.Builtin
+' ' Text
+'-s' Text
+' ' Text
+'-d/' Text
+' ' Text
+'QUEUELIST' Text
+' ' Text
+'${' Literal.String.Interpol
+'QUEUESPEC' Name.Variable
+'}' Literal.String.Interpol
+'\n' Text
+
+'backtick' Name.Builtin
+' ' Text
+'-ni' Text
+' ' Text
+'CMDLINE' Text
+' ' Text
+'{' Operator
+'\n ' Text
+'forx' Name.Builtin
+' ' Text
+'-o0' Text
+' ' Text
+'QUEUEPAT' Text
+' ' Text
+'{' Operator
+' ' Text
+'${' Literal.String.Interpol
+'QUEUELIST' Name.Variable
+'}' Literal.String.Interpol
+' ' Text
+'}' Operator
+'\n ' Text
+'importas' Name.Builtin
+' ' Text
+'-i' Text
+' ' Text
+'Q' Text
+' ' Text
+'QUEUEPAT' Text
+'\n ' Text
+'ifelse' Name.Builtin
+' ' Text
+'-X' Text
+' ' Text
+'{' Operator
+'\n ' Text
+'heredoc' Name.Builtin
+' ' Text
+'-d' Text
+' ' Text
+'0' Text
+' ' Text
+'${' Literal.String.Interpol
+'Q' Name.Variable
+'}' Literal.String.Interpol
+'\n ' Text
+'s6-grep' Text
+' ' Text
+'-qE' Text
+' ' Text
+'"' Literal.String.Double
+'^[[:alpha:]]+_[[:digit:]]+' Literal.String.Double
+'$' Text
+'"' Literal.String.Double
+'\n ' Text
+'}' Operator
+' ' Text
+'{' Operator
+'\n ' Text
+'multidefine' Name.Builtin
+' ' Text
+'-0d_' Text
+' ' Text
+'${' Literal.String.Interpol
+'Q' Name.Variable
+'}' Literal.String.Interpol
+' ' Text
+'{' Operator
+' ' Text
+'QNAM' Text
+' ' Text
+'QPRIO' Text
+' ' Text
+'}' Operator
+'\n ' Text
+'echo' Text
+' ' Text
+'-n' Text
+' ' Text
+'"' Literal.String.Double
+'-q ' Literal.String.Double
+'${' Literal.String.Interpol
+'QNAM' Name.Variable
+'}' Literal.String.Interpol
+',' Literal.String.Double
+'${' Literal.String.Interpol
+'QPRIO' Name.Variable
+'}' Literal.String.Interpol
+' ' Literal.String.Double
+'"' Literal.String.Double
+'\n ' Text
+'}' Operator
+'\n ' Text
+'echo' Text
+' ' Text
+'-n' Text
+' ' Text
+'"' Literal.String.Double
+'-q ' Literal.String.Double
+'${' Literal.String.Interpol
+'Q' Name.Variable
+'}' Literal.String.Interpol
+' ' Literal.String.Double
+'"' Literal.String.Double
+'\n' Text
+
+'}' Operator
+'\n\n' Text
+
+'importas' Name.Builtin
+' ' Text
+'-ui' Text
+' ' Text
+'CMDLINE' Text
+' ' Text
+'CMDLINE' Text
+'\n' Text
+
+'define' Name.Builtin
+' ' Text
+'-s' Text
+' ' Text
+'-d' Text
+'" "' Literal.String.Double
+' ' Text
+'ARGS' Text
+' ' Text
+'${' Literal.String.Interpol
+'CMDLINE' Name.Variable
+'}' Literal.String.Interpol
+'\n' Text
+
+'${' Literal.String.Interpol
+'@' Name.Variable
+'}' Literal.String.Interpol
+' ' Text
+'${' Literal.String.Interpol
+'ARGS' Name.Variable
+'}' Literal.String.Interpol
+' ' Text
+'-c' Text
+' ' Text
+'${' Literal.String.Interpol
+'THREADSPEC' Name.Variable
+'}' Literal.String.Interpol
+'\n' Text