diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:09:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:09:20 +0000 |
commit | 029f72b1a93430b24b88eb3a72c6114d9f149737 (patch) | |
tree | 765d5c2041967f9c6fef195fe343d9234a030e90 /runtime/syntax/testdir/input | |
parent | Initial commit. (diff) | |
download | vim-029f72b1a93430b24b88eb3a72c6114d9f149737.tar.xz vim-029f72b1a93430b24b88eb3a72c6114d9f149737.zip |
Adding upstream version 2:9.1.0016.upstream/2%9.1.0016
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/syntax/testdir/input')
-rw-r--r-- | runtime/syntax/testdir/input/c.c | 122 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/html_html | 146 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/modula2_iso.def | 114 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/modula2_pim.def | 111 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/modula2_r10.def | 146 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/sh_01.sh | 4 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/sh_02.sh | 30 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/sh_03.sh | 33 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/sh_04.sh | 27 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/sh_05.sh | 373 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/sh_06.sh | 71 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/sh_07.sh | 93 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/sh_08.sh | 82 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/sh_09.sh | 19 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/vim_ex_commands.vim | 1191 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/vim_keymap.vim | 26 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/vim_syntax.vim | 75 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/vim_variables.vim | 138 |
18 files changed, 2801 insertions, 0 deletions
diff --git a/runtime/syntax/testdir/input/c.c b/runtime/syntax/testdir/input/c.c new file mode 100644 index 0000000..c96fb33 --- /dev/null +++ b/runtime/syntax/testdir/input/c.c @@ -0,0 +1,122 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +#define EXTERN +#include "vim.h" + +#ifdef __CYGWIN__ +# include <cygwin/version.h> +# include <sys/cygwin.h> // for cygwin_conv_to_posix_path() and/or + // cygwin_conv_path() +# include <limits.h> +#endif + +#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# include "iscygpty.h" +#endif + +// Values for edit_type. +#define EDIT_NONE 0 // no edit type yet +#define EDIT_FILE 1 // file name argument[s] given, use argument list +#define EDIT_STDIN 2 // read file from stdin +#define EDIT_TAG 3 // tag name argument given, use tagname +#define EDIT_QF 4 // start in quickfix mode + +#if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN) +static int file_owned(char *fname); +#endif +static void mainerr(int, char_u *); +static void early_arg_scan(mparm_T *parmp); +#ifndef NO_VIM_MAIN +static void usage(void); +static void parse_command_name(mparm_T *parmp); +static void command_line_scan(mparm_T *parmp); +static void check_tty(mparm_T *parmp); +static void read_stdin(void); +static void create_windows(mparm_T *parmp); +static void edit_buffers(mparm_T *parmp, char_u *cwd); +static void exe_pre_commands(mparm_T *parmp); +static void exe_commands(mparm_T *parmp); +static void source_startup_scripts(mparm_T *parmp); +static void main_start_gui(void); +static void check_swap_exists_action(void); +# ifdef FEAT_EVAL +static void set_progpath(char_u *argv0); +# endif +#endif + + +/* + * Different types of error messages. + */ +static char *(main_errors[]) = +{ + N_("Unknown option argument"), +#define ME_UNKNOWN_OPTION 0 + N_("Too many edit arguments"), +#define ME_TOO_MANY_ARGS 1 + N_("Argument missing after"), +#define ME_ARG_MISSING 2 + N_("Garbage after option argument"), +#define ME_GARBAGE 3 + N_("Too many \"+command\", \"-c command\" or \"--cmd command\" arguments"), +#define ME_EXTRA_CMD 4 + N_("Invalid argument for"), +#define ME_INVALID_ARG 5 +}; + +#ifndef PROTO // don't want a prototype for main() + +// Various parameters passed between main() and other functions. +static mparm_T params; + +#ifdef _IOLBF +static void *s_vbuf = NULL; // buffer for setvbuf() +#endif + +#ifndef NO_VIM_MAIN // skip this for unittests + +static char_u *start_dir = NULL; // current working dir on startup + +static int has_dash_c_arg = FALSE; + +# ifdef VIMDLL +__declspec(dllexport) +# endif + int +# ifdef MSWIN +VimMain +# else +main +# endif +(int argc, char **argv) +{ +#if defined(STARTUPTIME) || defined(CLEAN_RUNTIMEPATH) + int i; +#endif + + /* + * Do any system-specific initialisations. These can NOT use IObuff or + * NameBuff. Thus emsg2() cannot be called! + */ + mch_early_init(); + + // Source startup scripts. + source_startup_scripts(¶ms); + +#if 0 + /* + * Newer version of MzScheme (Racket) require earlier (trampolined) + * initialisation via scheme_main_setup. + */ + return mzscheme_main(); +#else + return vim_main2(); +#endif +} diff --git a/runtime/syntax/testdir/input/html_html b/runtime/syntax/testdir/input/html_html new file mode 100644 index 0000000..bfeca26 --- /dev/null +++ b/runtime/syntax/testdir/input/html_html @@ -0,0 +1,146 @@ +<!-- + HTML Syntax Test File + Maintainer: Doug Kearns <dougkearns@gmail.com> + Last Change: 2023 Nov 28 +--> + +<!-- HTML Elements --> +<a> +<abbr> +<address> +<area> +<article> +<aside> +<audio> +<b>...</b> +<base> +<bdi> +<bdo> +<blockquote> +<body> +<br> +<button> +<canvas> +<caption> +<cite> +<code> +<col> +<colgroup> +<data> +<datalist> +<dd> +<del>...</del> +<details> +<dfn> +<dialog> +<div> +<dl> +<dt> +<em>...</em> +<embed> +<fieldset> +<figcaption> +<figure> +<footer> +<form> +<h1>...</h1> +<h2>...</h2> +<h3>...</h3> +<h4>...</h4> +<h5>...</h5> +<h6>...</h6> +<head>...</head> +<header> +<hgroup> +<hr> +<html> +<i>...</i> +<iframe> +<img> +<input> +<ins> +<kbd> +<label> +<legend> +<li> +<link> +<main> +<map> +<mark> +<menu> +<meta> +<meter> +<nav> +<noscript> +<object> +<ol> +<optgroup> +<option> +<output> +<p> +<picture> +<pre>...</pre> +<progress> +<q> +<rp> +<rt> +<ruby> +<s>...</s> +<samp> +<script>...</script> +<search> +<section> +<select> +<slot> +<small> +<source> +<span> +<strong>...</strong> +<style>...</style> +<sub> +<summary> +<sup> +<table> +<tbody> +<td> +<template> +<textarea> +<tfoot> +<th> +<thead> +<time> +<title>...</title> +<tr> +<track> +<u>...</u> +<ul> +<var> +<video> +<wbr> +<xmp> + +<!-- Deprecated Elements --> +<acronym> +<big> +<center> +<dir> +<font> +<frame> +<frameset> +<marquee> +<menuitem> +<nobr> +<noframes> +<param> +<rb> +<rtc> +<strike>...</strike> +<tt> + +<!-- Note: these deprecated elements have never been matched --> +<image> +<noembed> +<plaintext> + +<!-- Experimental --> +<portal> diff --git a/runtime/syntax/testdir/input/modula2_iso.def b/runtime/syntax/testdir/input/modula2_iso.def new file mode 100644 index 0000000..b979ccf --- /dev/null +++ b/runtime/syntax/testdir/input/modula2_iso.def @@ -0,0 +1,114 @@ +(* Modula-2 ISO Test File for Vim Syntax Colouring *) + +(* -------------------------------------------------- + * THIS FILE IS LICENSED UNDER THE VIM LICENSE + * see https://github.com/vim/vim/blob/master/LICENSE + * -------------------------------------------------- *) + + +DEFINITION MODULE Foobar; (*!m2iso*) + +FROM SYSTEM IMPORT LOC, WORD, ADDRESS; + +CONST MaxFoo = 1.0; LF = CHR(10); + +TYPE Foo = POINTER TO Bar; + +(* predefined constants *) +FALSE NIL TRUE INTERRUPTIBLE UNINTERRUPTIBLE + +(* predefined types *) +BITSET BOOLEAN CHAR PROC CARDINAL INTEGER LONGINT REAL LONGREAL +COMPLEX LONGCOMPLEX PROTECTION + +(* predefined procedures *) +CAP DEC EXCL HALT INC INCL + +(* predefined functions *) +ABS CHR CMPLX FLOAT HIGH IM INT LENGTH LFLOAT MAX MIN ODD ORD RE SIZE TRUNC VAL + +(* predefined macros *) +NEW DISPOSE + +(* unsafe builtins *) +ADDRESS BYTE LOC WORD ADR CAST TSIZE SYSTEM +MAKEADR ADDADR SUBADR DIFADR ROTATE SHIFT + +(* non-standard language extensions *) +LONGCARD LONGBITSET + +(* user defined identifiers *) +foobar Foobar FooBar foo123 foo_bar + +(* string literals *) +str := "foo 'bar' baz"; +str := 'foo "bar" baz'; + +(* numeric literals *) +0FFFH, 1.23, 1.23e-45, 1000 + +(* octal literals *) +n := 0377B; ch := 0377C; + +(* pragmas *) +<*$foo*> + +(* block comments with emphasis *) +(* copyright (c) Jurrasic Inc. + author Fred Flintstone Sr. + license see LICENSE file. *) + +(* pre-conditions: foo bar baz bam boo doodle wah. + post-conditions: foodle babble bozo bim bam dang. + error-conditions: dada jingle jungle boggle dee boo. *) + +(* technical debt markers *) +(* TODO: ... *) +(* FIXME *) +(* DEPRECATED *) + +(* procedures *) +PROCEDURE NewFooWithBar ( VAR foo: Foo; bar : INTEGER ); +BEGIN + NEW(foo); + foo^.bar := bar; + RETURN +END SetBar; + +(* functions *) +PROCEDURE bar ( foo : Foo ) : INTEGER; +BEGIN + IF foo = NIL THEN + HALT + ELSE + RETURN foo^.bar + END (* IF *) +END bar; + +(* disabled code *) +?< +WHILE foo = bar DO + baz(bam, boo) +END (* WHILE *); +>? + +(* synonyms *) +@ & ~ + +(* illegal characters *) +` ! $ % \ ? _ + +(* illegal identifiers *) + +_bar _bar_baz _bar_baz__bam _bar_baz__bam_boo + +bar_ bar_baz_ bar_baz__bam_ bar_baz__bam_boo_ + +__bar __bar_baz __bar_baz__bam __bar_baz__bam_boo + +bar__ bar_baz__ bar_baz__bam__ bar_baz__bam_boo__ + +bar__baz __bar_baz__ __bar__baz__ __ + + +END Foobar. diff --git a/runtime/syntax/testdir/input/modula2_pim.def b/runtime/syntax/testdir/input/modula2_pim.def new file mode 100644 index 0000000..e008160 --- /dev/null +++ b/runtime/syntax/testdir/input/modula2_pim.def @@ -0,0 +1,111 @@ +(* Modula-2 PIM Test File for Vim Syntax Colouring *) + +(* -------------------------------------------------- + * THIS FILE IS LICENSED UNDER THE VIM LICENSE + * see https://github.com/vim/vim/blob/master/LICENSE + * -------------------------------------------------- *) + +DEFINITION MODULE Foobar; (*!m2pim*) + +FROM SYSTEM IMPORT WORD, ADDRESS; + +CONST MaxFoo = 1.0; LF = CHR(10); + +TYPE Foo = POINTER TO Bar; + +(* predefined constants *) +FALSE NIL TRUE + +(* predefined types *) +BITSET BOOLEAN CHAR PROC CARDINAL INTEGER LONGINT REAL LONGREAL + +(* predefined procedures *) +CAP DEC EXCL HALT INC INCL + +(* predefined functions *) +ABS CHR FLOAT HIGH MAX MIN ODD ORD SIZE TRUNC VAL + +(* predefined macros *) +NEW DISPOSE + +(* unsafe builtins *) +ADDRESS PROCESS WORD ADR TSIZE NEWPROCESS TRANSFER SYSTEM + +(* non-standard language extensions *) +BYTE LONGCARD LONGBITSET + +(* user defined identifiers *) +foobar Foobar FooBar foo123 foo_bar + +(* string literals *) +str := "foo 'bar' baz"; +str := 'foo "bar" baz'; + +(* numeric literals *) +0FFFH, 1.23, 1.23e-45, 1000 + +(* octal literals *) +n := 0377B; ch := 0377C; + +(* pragmas *) +(*$foo*) + +(* block comments with emphasis *) +(* copyright (c) Jurrasic Inc. + author Fred Flintstone Sr. + license see LICENSE file. *) + +(* pre-conditions: foo bar baz bam boo doodle wah. + post-conditions: foodle babble bozo bim bam dang. + error-conditions: dada jingle jungle boggle dee boo. *) + +(* technical debt markers *) +(* TODO: ... *) +(* FIXME *) +(* DEPRECATED *) + +(* procedures *) +PROCEDURE NewFooWithBar ( VAR foo: Foo; bar : INTEGER ); +BEGIN + NEW(foo); + foo^.bar := bar; + RETURN +END SetBar; + +(* functions *) +PROCEDURE bar ( foo : Foo ) : INTEGER; +BEGIN + IF foo = NIL THEN + HALT + ELSE + RETURN foo^.bar + END (* IF *) +END bar; + +(* disabled code *) +?< +WHILE foo = bar DO + baz(bam, boo) +END (* WHILE *); +>? + +(* synonyms *) +& ~ + +(* illegal characters *) +` ! @ $ % \ ? _ + +(* illegal identifiers *) + +_bar _bar_baz _bar_baz__bam _bar_baz__bam_boo + +bar_ bar_baz_ bar_baz__bam_ bar_baz__bam_boo_ + +__bar __bar_baz __bar_baz__bam __bar_baz__bam_boo + +bar__ bar_baz__ bar_baz__bam__ bar_baz__bam_boo__ + +bar__baz __bar_baz__ __bar__baz__ __ + + +END Foobar. diff --git a/runtime/syntax/testdir/input/modula2_r10.def b/runtime/syntax/testdir/input/modula2_r10.def new file mode 100644 index 0000000..0872d5d --- /dev/null +++ b/runtime/syntax/testdir/input/modula2_r10.def @@ -0,0 +1,146 @@ +(* Modula-2 R10 Test File for Vim Syntax Colouring *) + +(* -------------------------------------------------- + * THIS FILE IS LICENSED UNDER THE VIM LICENSE + * see https://github.com/vim/vim/blob/master/LICENSE + * -------------------------------------------------- *) + +DEFINITION MODULE Foobar; (*!m2r10*) + +IMPORT UNSAFE ALIAS BYTE, WORD, ADDRESS; + +CONST MaxFoo = 1.0; + +TYPE Foo = ALIAS OF Bar; + +(* predefined constants *) +NIL FALSE TRUE + +(* predefined types *) +BOOLEAN CHAR UNICHAR OCTET CARDINAL LONGCARD INTEGER LONGINT REAL LONGREAL + +(* predefined procedures *) +APPEND INSERT REMOVE SORT SORTNEW + +(* predefined functions *) +CHR ORD ODD ABS SGN MIN MAX LOG2 POW2 ENTIER PRED SUCC PTR CAPACITY COUNT LENGTH + +(* predefined macros *) +NOP TMIN TMAX TSIZE TLIMIT + +(* unsafe builtins *) +UNSAFE + +(* unsafe builtin types *) +BYTE WORD LONGWORD ADDRESS OCTETSEQ + +(* unsafe builtin procedures *) +ADD SUB DEC INC SETBIT HALT + +(* unsafe builtin functions *) +ADR CAST BIT SHL SHR BWNOT BWAND BWOR + +(* non-portable language extensions *) +ASSEMBLER ASM REG + +(* user defined identifiers *) +foobar Foobar FooBar foo_bar foo0 + + +(* string literals *) +str := "foo 'bar' baz"; +str := 'foo "bar" baz'; + +(* numeric literals *) +0b0110'0011'0110'0000, 0u0A, 0x0123, 0xCAFE'D00D +1'000'000.00, 1.23, 1.23e+10, 1.234'567'890e-1'000 + + +(* language defined pragmas *) +<*MSG=INFO:"foobar"*> <*ENCODING="UTF8"*> <*INLINE*> <*NOINLINE*> <*FFI="C"*> + +(* implementation defined pragmas *) +<*GM2.Foobar|W=Bazbam*> + + +(* single line comment *) +! foo bar baz bam boo + +(* block comments with emphasis *) +(* copyright (c) 2016 Modula-2 Foundation. + authors B.Kowarsch and R.Sutcliffe + license see LICENSE *) + +(* pre-conditions: foo bar baz bam boo doodle wah. + post-conditions: foodle babble bozo bim bam dang. + error-conditions: dada jingle jungle boggle dee boo. *) + +(* (* *) *) + +(* bindings *) +PROCEDURE [+] sum ( a, b : BCD ) : BCD; + +PROCEDURE [MOD] modulus ( n, m : INT64 ) : INT64; + +PROCEDURE [RETAIN] Retain ( foo : Foo ); + +PROCEDURE [LENGTH] length ( str : String ) : LONGCARD; + + +(* procedures *) +PROCEDURE NewFooWithBar ( VAR foo: Foo; bar : INTEGER ); +BEGIN + NEW(foo); + foo^.bar := bar; + RETURN +END NewFooWithBar; + +END END; + +(* functions *) +PROCEDURE bar ( foo : Foo ) : INTEGER; +BEGIN + IF foo = NIL THEN + UNSAFE.HALT + ELSE + RETURN foo^.bar + END (* IF *) +END bar; + + +(* technical debt *) +TO DO ( 1234, Weight.Major ) (* foo *) + "redesign foo", 2d; + "replace foo", 2d; + "test new foo", 1d +END (* TO DO *); + +PROCEDURE SetBaba <*DEPRECATED*> ( n : CARDINAL ); + + +(* disabled code *) +?< +WHILE foo = bar DO + baz(bam, boo) +END (* WHILE *); +>? + + +(* illegal characters *) +` ~ $ % ? _ + +(* illegal identifiers *) + +_bar _bar_baz _bar_baz__bam _bar_baz__bam_boo + +bar_ bar_baz_ bar_baz__bam_ bar_baz__bam_boo_ + +__bar __bar_baz __bar_baz__bam __bar_baz__bam_boo + +bar__ bar_baz__ bar_baz__bam__ bar_baz__bam_boo__ + +bar__baz __bar_baz__ __bar__baz__ __ + + +(* module end *) +END Foobar. diff --git a/runtime/syntax/testdir/input/sh_01.sh b/runtime/syntax/testdir/input/sh_01.sh new file mode 100644 index 0000000..bd27c99 --- /dev/null +++ b/runtime/syntax/testdir/input/sh_01.sh @@ -0,0 +1,4 @@ +#! /bin/dash +export `echo 'A=B'` +printenv A +echo a `#foo` b diff --git a/runtime/syntax/testdir/input/sh_02.sh b/runtime/syntax/testdir/input/sh_02.sh new file mode 100644 index 0000000..81d5613 --- /dev/null +++ b/runtime/syntax/testdir/input/sh_02.sh @@ -0,0 +1,30 @@ +#! /bin/ksh +# sh2 +# Jul 28, 2018: introduced shCommandSubBQ, which is *not* included in a shSubCommandList (so its not recursive) +ccc=`echo "test"` + ccc=`echo "test"` + +# comment +case $VAR in +# comment + x|y|z) echo xyz ;; +# comment + a|b|c) echo abc ;; +# comment +esac + +# Jul 26, 2018: why isn't `..` being terminated properly? +# comment +case "$aaa" in +# comment + bbb) ccc=`echo $ddd|cut -b4-` + echo "test" +# comment + ;; +# comment + esac +# comment + +echo $VAR abc +export $VAR abc +set $VAR abc diff --git a/runtime/syntax/testdir/input/sh_03.sh b/runtime/syntax/testdir/input/sh_03.sh new file mode 100644 index 0000000..8dd6dab --- /dev/null +++ b/runtime/syntax/testdir/input/sh_03.sh @@ -0,0 +1,33 @@ +#!/bin/ksh +# Test variable modifiers +# Variable=value +Variable='value' +Variable="value" +VariableA="pat1xxpat2" +VariableB="pat2xxpat1" +echo ${#} +echo ${#VariableA} +echo ${VariableA#pat1} +echo ${VariableA##pat1} +echo ${VariableB%pat1} +echo ${VariableB%%pat1} + +# This gets marked as an error +Variable=${VariableB:+${VariableC:=eng}} # :+ seems to work for ksh as well as bash +Variable=${VariableB:-${VariableC:-eng}} # :- is ksh and bash + +# This is OK +Variable='${VariableB:+${VariableC:=eng}}' +Variable='${VariableB:-${VariableC:-eng}}' +Variable="${VariableB:+${VariableC:=eng}}" # :+ seems to work for ksh as well as bash +Variable="${VariableB:-${VariableC:-eng}}" # :- is ksh and bash + +# These are OK +: ${VariableB:-${VariableC:-eng}} +: "${VariableB:-${VariableC:-eng}}" +: '${VariableB:-${VariableC:-eng}}' + +# Another test +Variable=${VariableB:-${VariableC:-${VariableD:-${VariableE:=eng}}}} + : ${VariableB:=${VariableC:-${VariableD:-${VariableE:=eng}}}} + diff --git a/runtime/syntax/testdir/input/sh_04.sh b/runtime/syntax/testdir/input/sh_04.sh new file mode 100644 index 0000000..e9ec5fe --- /dev/null +++ b/runtime/syntax/testdir/input/sh_04.sh @@ -0,0 +1,27 @@ +#!/bin/dash +# sh4 +Variable=${VariableB:-{VariableC}} +Variable=${VariableB:-${VariableC:-{Var3:=eng}}} + +# This gets marked as an error while its ok +Variable=${VariableB:-${VariableC:-{Var3:=eng}}} +Variable=${VariableB:=${VariableC:={Var3:=${Var4:-eng}}}} +Variable=${VariableB:=${VariableC:={Var3:=${Var4:-${Var5:-eng}}}}} +Variable=${VariableB:=${VariableC:={Var3:=${Var4:-${Var5:-$Var6}}}}} + +# These are OK +Variable="${VariableB:-${VariableC:-{Var3:=eng}}}" +Variable="${VariableB:=${VariableC:={Var3:=${Var4:-eng}}}}" + +# This gets marked as an error too +: ${VariableB:-${VariableC:-{Var3:=eng}}} +: ${VariableB:=${VariableC:={Var3:=${Var4:-eng}}}} + +# This is OK +: ${VariableB:-${VariableC:-eng}} +: "${VariableB:-${VariableC:-eng}}" + +# First line is OK except its missing a closing "}", +# so second line should have some error highlighting +Variable=${VariableB:=${VariableC:={Var3:=${Var4:-eng}}} +Variable=${VariableB:-${VariableC:-{Var3:=eng}} diff --git a/runtime/syntax/testdir/input/sh_05.sh b/runtime/syntax/testdir/input/sh_05.sh new file mode 100644 index 0000000..87381e1 --- /dev/null +++ b/runtime/syntax/testdir/input/sh_05.sh @@ -0,0 +1,373 @@ +#!/bin/dash -x +# sh5 +# Note that this is special for sh. ksh will be an extra file later. +# Note too, that sh and ksh allow ${var:-sub} as well as ${var-sub}! +# The ':' is optional! + +# This all should be OK +# Case 0a +[ -t 0 ] && date +Variable1=value1 +Variable2='value2' +Variable3="value3" +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 0b +[ -t 0 ] && echo "\ndate" +Variable1=$HOME +Variable2='$HOME' +Variable3="$HOME" +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 0c +[ -t 0 ] && echo "\ndate" +Variable1=$HOME$SHELL +Variable2=$HOME.$SHELL +Variable3=$HOME.$SHELL+$HOME-$SHELL/$HOME +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 0d +[ -t 0 ] && echo "\ndate" +Variable1=`date` +Variable2=`id -ng` +Variable3=`id -ng | wc -c` +echo "$Variable1" "$Variable2" "$Variable3" + +################################################################################ +# +# Case 1a with constants +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:=eng1} +Variable2=${VariableA:-eng2} +Variable3=${VariableA:?eng3} +Variable3=${VariableA:+eng3} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 1b with constants in single quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:='eng1'} +Variable2=${VariableA:-'eng2'} +Variable3=${VariableA:?'eng3'} +Variable3=${VariableA:+'eng3'} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 1c with constants in double quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:="eng1"} +Variable2=${VariableA:-"eng2"} +Variable3=${VariableA:?"eng3"} +Variable3=${VariableA:+"eng3"} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 1d: constants but missing colons +Variable1=${VariableA=eng1} +Variable2=${VariableA-eng2} +Variable3=${VariableA?eng3} +Variable3=${VariableA+eng3} +Variable1=${VariableA='eng1'} +Variable2=${VariableA-'eng2'} +Variable3=${VariableA?'eng3'} +Variable3=${VariableA+'eng3'} +Variable1=${VariableA="eng1"} +Variable2=${VariableA-"eng2"} +Variable3=${VariableA?"eng3"} +Variable3=${VariableA+"eng3"} + +# Case 2a with a variable +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:=$HOME} +Variable2=${VariableA:-$HOME} +Variable3=${VariableA:?$HOME} +Variable3=${VariableA:+$HOME} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2b with a variable in single quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:='$HOME'} +Variable2=${VariableA:-'$HOME'} +Variable3=${VariableA:?'$HOME'} +Variable3=${VariableA:+'$HOME'} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2c with a variable in double quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:="$HOME"} +Variable2=${VariableA:-"$HOME"} +Variable3=${VariableA:?"$HOME"} +Variable3=${VariableA:+"$HOME"} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3a with a command substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:=`date`} +Variable2=${VariableA:-`date`} +Variable3=${VariableA:?`date`} +Variable3=${VariableA:+`date`} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3b with a command + option substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:=`id -ng`} +Variable2=${VariableA:-`id -ng`} +Variable3=${VariableA:?`id -ng`} +Variable3=${VariableA:+`id -ng`} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3c with a command + pipe substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:=`id -ng | wc -c`} +Variable2=${VariableA:-`id -ng | wc -c`} +Variable3=${VariableA:?`id -ng | wc -c`} +Variable3=${VariableA:+`id -ng | wc -c`} +echo "$Variable1" "$Variable2" "$Variable3" + +################################################################################ +# +# The same with one nestet ${} level +# Case 1a with constants +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:=eng1}} +Variable2=${VariableA:-${VarB:-eng2}} +Variable3=${VariableA:-${VarB:?eng3}} +Variable3=${VariableA:-${VarB:+eng3}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 1b with constants in single quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:='eng1'}} +Variable2=${VariableA:-${VarB:-'eng2'}} +Variable3=${VariableA:-${VarB:?'eng3'}} +Variable3=${VariableA:-${VarB:+'eng3'}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 1c with constants in double quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:="eng1"}} +Variable2=${VariableA:-${VarB:-"eng2"}} +Variable3=${VariableA:-${VarB:?"eng3"}} +Variable3=${VariableA:-${VarB:+"eng3"}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2a with a variable +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:=$HOME}} +Variable2=${VariableA:-${VarB:-$HOME}} +Variable3=${VariableA:-${VarB:?$HOME}} +Variable3=${VariableA:-${VarB:+$HOME}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2b with a variable in single quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:='$HOME'}} +Variable2=${VariableA:-${VarB:-'$HOME'}} +Variable3=${VariableA:-${VarB:?'$HOME'}} +Variable3=${VariableA:-${VarB:+'$HOME'}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2c with a variable in double quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:="$HOME"}} +Variable2=${VariableA:-${VarB:-"$HOME"}} +Variable3=${VariableA:-${VarB:?"$HOME"}} +Variable3=${VariableA:-${VarB:+"$HOME"}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3a with a command substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:=`date`}} +Variable2=${VariableA:-${VarB:-`date`}} +Variable3=${VariableA:-${VarB:?`date`}} +Variable3=${VariableA:-${VarB:+`date`}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3b with a command + option substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:=`id -ng`}} +Variable2=${VariableA:-${VarB:-`id -ng`}} +Variable3=${VariableA:-${VarB:?`id -ng`}} +Variable3=${VariableA:-${VarB:+`id -ng`}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3c with a command + pipe substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:=`id -ng | wc -c`}} +Variable2=${VariableA:-${VarB:-`id -ng | wc -c`}} +Variable3=${VariableA:-${VarB:?`id -ng | wc -c`}} +Variable3=${VariableA:-${VarB:+`id -ng | wc -c`}} +echo "$Variable1" "$Variable2" "$Variable3" + +################################################################################ +# +# The same with two nestet ${} level +# Case 1a with constants +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:=eng1}}} +Variable2=${VariableA:-${VarB:-${VarC:-eng2}}} +Variable3=${VariableA:-${VarB:-${VarC:?eng3}}} +Variable3=${VariableA:-${VarB:-${VarC:+eng3}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 1b with constants in single quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:='eng1'}}} +Variable2=${VariableA:-${VarB:-${VarC:-'eng2'}}} +Variable3=${VariableA:-${VarB:-${VarC:?'eng3'}}} +Variable3=${VariableA:-${VarB:-${VarC:+'eng3'}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 1c with constants in double quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:="eng1"}}} +Variable2=${VariableA:-${VarB:-${VarC:-"eng2"}}} +Variable3=${VariableA:-${VarB:-${VarC:?"eng3"}}} +Variable3=${VariableA:-${VarB:-${VarC:+"eng3"}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2a with a variable +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:=$HOME}}} +Variable2=${VariableA:-${VarB:-${VarC:-$HOME}}} +Variable3=${VariableA:-${VarB:-${VarC:?$HOME}}} +Variable3=${VariableA:-${VarB:-${VarC:+$HOME}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2b with a variable in single quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:='$HOME'}}} +Variable2=${VariableA:-${VarB:-${VarC:-'$HOME'}}} +Variable3=${VariableA:-${VarB:-${VarC:?'$HOME'}}} +Variable3=${VariableA:-${VarB:-${VarC:+'$HOME'}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2c with a variable in double quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:="$HOME"}}} +Variable2=${VariableA:-${VarB:-${VarC:-"$HOME"}}} +Variable3=${VariableA:-${VarB:-${VarC:?"$HOME"}}} +Variable3=${VariableA:-${VarB:-${VarC:?"$HOME"}}} +Variable3=${VariableA:-${VarB:-${VarC:+"$HOME"}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3a with a command substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:=`date`}}} +Variable2=${VariableA:-${VarB:-${VarC:-`date`}}} +Variable3=${VariableA:-${VarB:-${VarC:?`date`}}} +Variable3=${VariableA:-${VarB:-${VarC:+`date`}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3b with a command + option substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:=`id -ng`}}} +Variable2=${VariableA:-${VarB:-${VarC:-`id -ng`}}} +Variable3=${VariableA:-${VarB:-${VarC:?`id -ng`}}} +Variable3=${VariableA:-${VarB:-${VarC:+`id -ng`}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3c with a command + pipe substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:=`id -ng | wc -c`}}} +Variable2=${VariableA:-${VarB:-${VarC:-`id -ng | wc -c`}}} +Variable3=${VariableA:-${VarB:-${VarC:?`id -ng | wc -c`}}} +Variable3=${VariableA:-${VarB:-${VarC:+`id -ng | wc -c`}}} +echo "$Variable1" "$Variable2" "$Variable3" + + +################################################################################ +# +# The same with three nestet ${} level +# Case 1a with constants +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:-${VarD:=eng1}}}} +Variable2=${VariableA:-${VarB:-${VarC:-${VarD:-eng2}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:?eng3}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:+eng3}}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 1b with constants in single quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:-${VarD:='eng1'}}}} +Variable2=${VariableA:-${VarB:-${VarC:-${VarD:-'eng2'}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:?'eng3'}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:+'eng3'}}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 1c with constants in double quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:-${VarD:="eng1"}}}} +Variable2=${VariableA:-${VarB:-${VarC:-${VarD:-"eng2"}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:?"eng3"}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:+"eng3"}}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2a with a variable +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:-${VarD:=$HOME}}}} +Variable2=${VariableA:-${VarB:-${VarC:-${VarD:-$HOME}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:?$HOME}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:+$HOME}}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2b with a variable in single quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:-${VarD:='$HOME'}}}} +Variable2=${VariableA:-${VarB:-${VarC:-${VarD:-'$HOME'}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:?'$HOME'}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:+'$HOME'}}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 2c with a variable in double quotes +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:-${VarD:="$HOME"}}}} +Variable2=${VariableA:-${VarB:-${VarC:-${VarD:-"$HOME"}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:?"$HOME"}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:+"$HOME"}}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3a with a command substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:-${VarD:=`date`}}}} +Variable2=${VariableA:-${VarB:-${VarC:-${VarD:-`date`}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:?`date`}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:+`date`}}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3b with a command + option substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:-${VarD:=`id -ng`}}}} +Variable2=${VariableA:-${VarB:-${VarC:-${VarD:-`id -ng`}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:?`id -ng`}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:+`id -ng`}}}} +echo "$Variable1" "$Variable2" "$Variable3" + +# Case 3c with a command + pipe substitution +[ -t 0 ] && echo "\ndate" +Variable1=${VariableA:-${VarB:-${VarC:-${VarD:=`id -ng | wc -c`}}}} +Variable2=${VariableA:-${VarB:-${VarC:-${VarD:-`id -ng | wc -c`}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:?`id -ng | wc -c`}}}} +Variable3=${VariableA:-${VarB:-${VarC:-${VarD:+`id -ng | wc -c`}}}} +echo "$Variable1" "$Variable2" "$Variable3" + + +################################################################################ +# +# This is also allowed: +Variable1=${VariableA-${VarB-${VarC-${VarD=`id -ng | wc -c`}}}} + +################################################################################ +# +# All cases with ${Var:?} which works for the sh: +Variable4=${Variable4:?} +Variable4=${Variable4:?OK} +Variable4=${Variable4:?`date`} +Variable4=${Variable4:?'an OK string'} +Variable4=${Variable4:?"an OK string"} +Variable4=${Variable4:?$HOME$SHELL} +Variable4=${Variable4:?$HOME:$SHELL} + +# All cases with ${Var:?} which works also for ksh: +Variable4=${Variable4:?This is OK} +Variable4=${Variable4:?This is OK, too: `date`} + +# What happens with ${#identifier[*]}: +Variable5=${#identifier[*]} diff --git a/runtime/syntax/testdir/input/sh_06.sh b/runtime/syntax/testdir/input/sh_06.sh new file mode 100644 index 0000000..cec6cc3 --- /dev/null +++ b/runtime/syntax/testdir/input/sh_06.sh @@ -0,0 +1,71 @@ +#!/bin/ksh +# Shall we debug this script? If so, remove the '#' before '#DebugScript=set' +DebugScript=set + +# Show that we are busy. +[ -t 0 ] && echo "Please wait ... \c" >`tty` + +################################################################################ +# +# Display some Help +# +Usage () { + +# does this comment work? +VariableName="${BasicConfigName}_*" + +# Echo some ksh special variables +echo "CDPATH="${CDPATH} + +# Get also a short description of the backuptype/method +eval BackupMethod=\$mess09${BackupType}B + +case $BackupType in + 3) DefaultDevice=$MountDevice ;; + 1|2) DefaultDevice=$TapeDrive ;; +esac + +# If we have more the 53 characters in the variables below split them up +# into several lines and add 3 tabs before them +for Variable in DefaultExclude DefaultFindOption DoNotBackupList +do + eval VarValue=\$$Variable + VarValue=`echo $VarValue | FoldS 53 | sed "2,\\$s/^/$Tab$Tab$Tab/"` + eval $Variable=\$VarValue +done + +echo " +Usage: $ScriptName [-Options] + +Options List: + -v The current version of '$ScriptName' + -h | -H | ? Display this list + +" + +} # End of Usage + + +################################################################################ +# +# Create a backup using fbackup/frecover +# +ExecuteFbackup () { # TESTING + +[ "$DebugScript" ] && set -x || set +x + +cd $cwd + +} # End of ExecuteFbackup + + +################################################################################ +# main ### main ### main ### main ### main ### main ### main ### main ### main # +################################################################################ +# +# Here is the heart of this script: +# +Usage + +# And exit +Exit $Result diff --git a/runtime/syntax/testdir/input/sh_07.sh b/runtime/syntax/testdir/input/sh_07.sh new file mode 100644 index 0000000..23219a0 --- /dev/null +++ b/runtime/syntax/testdir/input/sh_07.sh @@ -0,0 +1,93 @@ +#!/bin/dash +# Test file to test 'for do done' loops. +# You can start this script like: $0 {-ne -gt -le ...} (all numeric operators +# are allowed! + +# All this works and should be OK + +################################################################################ +# +# For loop without 'in list'. Uses $1 $2 ... This is a special case! +# This 'for Var, do, done' is a very handy solution AND no real replacement +# available! +# +Function1 () { + +echo "Function1: for loop inside a function:\t\c" +[ "$*" ] || echo "none\c" + +for Var +do + [ 1 $Var 2 ] && echo "OK \c" || echo "no \c" +done +echo + +} # End of Function1 + +################################################################################ +# +# For loop with 'in list' $* +# +Function2 () { + +echo "Function2: for loop inside a function:\t\c" +for Var in $* +do + [ 1 $Var 2 ] && echo "OK \c" || echo "no \c" +done ; echo + +} # End of Function2 + +################################################################################ +# +# For loop with 'in list' $@. Works the same way as $* +# +Function3 () { + +echo "Function3: for loop inside a function:\t\c" +for Var in $@ +do + [ 1 $Var 2 ] && echo "OK \c" || echo "no \c" +done ; echo + +} # End of Function3 + +################################################################################ +# +# For loop with 'in list' "$@". Special case. Works like "$1" "$2" ... +# +Function4 () { + +echo "Function4: for loop inside a function:\t\c" +for Var in "$@" +do + [ 1 $Var 2 ] && echo "OK \c" || echo "no \c" +done ; echo + +} # End of Function4 + + +################################################################################ +# main ### main ### main ### main ### main ### main ### main ### main ### main # +################################################################################ +# +# Here is the heart of this script: +# +echo "Processing the following command line arguments: ${*:-none}" +echo "Script: for loop outside a function:\t\c" +for Var +do + [ 1 $Var 2 ] && echo "OK \c" || echo "no \c" +done ; echo + +# Same as function calls +Function1 -eq -ne -gt -ge -le -lt +Function2 -eq -ne -gt -ge -le -lt +Function3 -eq -ne -gt -ge -le -lt +Function4 -eq -ne -gt -ge -le -lt '-ge 1 -a 2 -ge' + +# Now the same call like Function4 but with Function1 +Function1 -eq -ne -gt -ge -le -lt '-ge 1 -a 2 -ge' +Function1 + +exit $? diff --git a/runtime/syntax/testdir/input/sh_08.sh b/runtime/syntax/testdir/input/sh_08.sh new file mode 100644 index 0000000..2b80d43 --- /dev/null +++ b/runtime/syntax/testdir/input/sh_08.sh @@ -0,0 +1,82 @@ +#!/bin/ksh -p + +# Note that this is special test file for ksh. sh is an extra file. +# Note too, that this file contains ONLY things which works for ksh BUT NOT +# for sh + +# This all should be OK + +# Several keywords without any quotes! +# Case 1a. Several Constants +[ -t 0 ] && date +Variable1=${VariableA:-This is a Text} +Variable2=${VariableA:=This is a Text} +Variable3=${VariableA:?This is a Text} +echo "$Variable1" ; echo "$Variable2" ; echo "$Variable3" + +# Case 1b. Variable and Constant +[ -t 0 ] && echo "\n`date`" && unset VariableA +Variable1=${VariableA:-$HOME This is a Text} +Variable2=${VariableA:=$HOME This is a Text} +Variable3=${VariableA:?$HOME This is a Text} +echo "$Variable1" ; echo "$Variable2" ; echo "$Variable3" + +# Case 1c. Constant and Variable +[ -t 0 ] && echo "\n`date`" && unset VariableA +Variable1=${VariableA:-This is a Text in $HOME} +Variable2=${VariableA:=This is a Text in $HOME} +Variable3=${VariableA:+This is a Text in $HOME} #! :+ is bash-only, error here expected +Variable1=${VariableA:-This is a Text in $HOME too} +Variable2=${VariableA:=This is a Text in $HOME too} +Variable3=${VariableA:+This is a Text in $HOME too} +echo "$Variable1" ; echo "$Variable2" ; echo "$Variable3" + +# Case 1d. More Variables and Constants. Starting with a Variable. +[ -t 0 ] && echo "\n`date`" && unset VariableA +Variable1=${VariableA:-$SHELL} +Variable1=${VariableA:-$SHELL This is a Text in $HOME} +Variable2=${VariableA:=$SHELL This is a Text in $HOME} +Variable3=${VariableA:+$SHELL This is a Text in $HOME} +echo "$Variable1" ; echo "$Variable2" ; echo "$Variable3" + +# Case 1e. More Constants and Variables. Starting with a Constant. +[ -t 0 ] && echo "\n`date`" && unset VariableA +Variable1=${VariableA:-"This is a Text in $HOME $SHELL"} +Variable1=${VariableA:-This is a Text in $HOME $SHELL} +Variable2=${VariableA:=This is a Text in $HOME $SHELL} +Variable3=${VariableA:+This is a Text in $HOME $SHELL} +echo "$Variable1" ; echo "$Variable2" ; echo "$Variable3" + +# Case 1x. The same with ':' +[ -t 0 ] && echo "\n`date`" && unset VariableA +: ${VariableA:-This is a Text} +: ${VariableA:-$HOME This is a Text} +: ${VariableA:-This is a Text in $HOME} +: ${VariableA:-$SHELL This is a Text in $HOME} +: ${VariableA:-This is a Text in $HOME $SHELL} + +# Case 1y. The same with ':' and without the ':' in the parameter substitution +[ -t 0 ] && echo "\n`date`" && unset VariableA +: ${VariableA-This is a Text} +: ${VariableA-$HOME This is a Text} +: ${VariableA-This is a Text in $HOME} +: ${VariableA-$SHELL This is a Text in $HOME} +: ${VariableA-This is a Text in $HOME $SHELL} + +################################################################################ +# +# This are valid usages for ${Var:?} in ksh! +# +Variable4=${Variable4:?This is an Error Message} +Variable4=${Variable4:?This is an Error Message from `date`} + +: ${Variable4:?This is an Error Message} +: ${Variable4:?This is an Error Message from `date`} + +exit $? + +# Michael Soulier +if [ $# -ne 1 ]; then + echo whatever + exit 1 +fi diff --git a/runtime/syntax/testdir/input/sh_09.sh b/runtime/syntax/testdir/input/sh_09.sh new file mode 100644 index 0000000..e736e06 --- /dev/null +++ b/runtime/syntax/testdir/input/sh_09.sh @@ -0,0 +1,19 @@ +#!/bin/dash +# Test file for vim the check () subshells +( cd ; $pwd ) | wc -c +( cd $1 ; $pwd ) | wc -c +( cd ${1} ; $pwd ) | wc -c +( cd ; $pwd ) | wc -c +( cd ${1:-.} ; $pwd ) | sed -e 's!$!/!' -e 's!//*$!/!' +( cd ; $pwd ) | wc -c +( cd ${1:+.} ; $pwd ) | wc -c +( cd ; $pwd ) | wc -c +( cd ${1:=.} ; $pwd ) | wc -c +( cd ; $pwd ) | wc -c +( cd ${1:?} ; $pwd ) | wc -c +( cd ; $pwd ) | wc -c +( cd $HOME ; $pwd ) | wc -c +( cd ${HOME} ; $pwd ) | wc -c +( cd ${HOME} ) | wc -c +((n=1+2)) +let n=1+2 diff --git a/runtime/syntax/testdir/input/vim_ex_commands.vim b/runtime/syntax/testdir/input/vim_ex_commands.vim new file mode 100644 index 0000000..6826967 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_commands.vim @@ -0,0 +1,1191 @@ +" Ex commands + +" START NOT MATCHED +:@ +:@@ +:Next +:Print +:X +" END NOT MATCHED + +:help + :help +: help + : help + +:append + text +. +:abbreviate +:abclear +:aboveleft +:all +:amenu +:anoremenu +:args +:argadd +:argdedupe +:argdelete +:argedit +:argdo +:argglobal +:arglocal +:argument +:ascii +:autocmd +:augroup Foo +:augroup END +:aunmenu +:buffer +:bNext +:ball +:badd +:balt +:bdelete +:behave mswin +:behave xterm +:belowright +:bfirst +:blast +:bmodified +:bnext +:botright +:bprevious +:brewind +:break +:breakadd +:breakdel +:breaklist +:browse +:bufdo +:buffers +:bunload +:bwipeout +:change + text +. +:cNext +:cNfile +:cabbrev +:cabclear +:cabove +:caddbuffer +:caddexpr +:caddfile +:cafter +:call +:catch +:cbefore +:cbelow +:cbottom +:cbuffer +:cc +:cclose +:cd +:cdo +:cfdo +:center +:cexpr +:cfile +:cfirst +:cgetbuffer +:cgetexpr +:cgetfile +:changes +:chdir +:checkpath +:checktime +:chistory +:class +:clast +:clearjumps +:clist +:close +:cmap +:cmapclear +:cmenu +:cnext +:cnewer +:cnfile +:cnoremap +:cnoreabbrev +:cnoremenu +:copy +:colder +:colorscheme +:command +:comclear +:compiler +:continue +:confirm +:const +:copen +:cprevious +:cpfile +:cquit +:crewind +:cscope +:cstag +:cunmap +:cunabbrev +:cunmenu +:cwindow +:delete +:debug +:debuggreedy +:def +:defcompile +:defer +:delcommand +:delfunction +:delmarks +:diffupdate +:diffget +:diffoff +:diffpatch +:diffput +:diffsplit +:diffthis +:digraphs +:display +:disassemble +:djump +:dl +:dlist +:doautocmd +:doautoall +:dp +:drop +:dsearch +:dsplit +:edit +:earlier +:echo +:echoconsole +:echoerr +:echohl +:echomsg +:echon +:echowindow +:else +:elseif +:emenu +:endclass +:enddef +:endif +:endfor +:endfunction +:endtry +:endwhile +:enew +:eval +:ex +:execute +:exit +:export +:exusage +:file +:files +:filetype +:filter +:find +:final +:finally +:finish +:first +:fixdel +:fold +:foldclose +:folddoopen +:folddoclosed +:foldopen +:for +:function +:global/.../ +:goto +:grep +:grepadd +:gui +:gvim +:hardcopy +:help +:helpclose +:helpfind +:helpgrep +:helptags +:highlight +:hide +:history +:horizontal +:insert + text +. +:iabbrev +:iabclear +:if +:ijump +:ilist +:imap +:imapclear +:imenu +:import +:inoremap +:inoreabbrev +:inoremenu +:intro +:isearch +:isplit +:iunmap +:iunabbrev +:iunmenu +:join +:jumps +:k +:keepalt +:keepmarks +:keepjumps +:keeppatterns +:lNext +:lNfile +:list +:labove +:laddexpr +:laddbuffer +:laddfile +:lafter +:last +:language +:later +:lbefore +:lbelow +:lbottom +:lbuffer +:lcd +:lchdir +:lclose +:lcscope +:ldo +:lfdo +:left +:leftabove +:legacy +:let +:lexpr +:lfile +:lfirst +:lgetbuffer +:lgetexpr +:lgetfile +:lgrep +:lgrepadd +:lhelpgrep +:lhistory +:ll +:llast +:llist +:lmake +:lmap +:lmapclear +:lnext +:lnewer +:lnfile +:lnoremap +:loadkeymap +:loadview +:lockmarks +:lockvar +:lolder +:lopen +:lprevious +:lpfile +:lrewind +:ls +:ltag +:lunmap +:lua +:luado +:luafile +:lvimgrep +:lvimgrepadd +:lwindow +:move +:mark +:make +" requires trailing whitespace to distinguish from map() +:map +:mapclear +:marks +:match +:menu +:menutranslate +:messages +:mkexrc +:mksession +:mkspell +:mkvimrc +:mkview +:mode +:mzscheme +:mzfile +:nbclose +:nbkey +:nbstart +:next +:new +:nmap +:nmapclear +:nmenu +:nnoremap +:nnoremenu +:noautocmd +:noremap +:nohlsearch +:noreabbrev +:noremenu +:normal +:noswapfile +:number +:nunmap +:nunmenu +:oldfiles +:open +:omap +:omapclear +:omenu +:only +:onoremap +:onoremenu +:options +:ounmap +:ounmenu +:ownsyntax +:packadd +:packloadall +:pclose +:pedit +:perl +:print +:profdel +:profile +:promptfind +:promptrepl +:perldo +:pop +:popup +:ppop +:preserve +:previous +:psearch +:ptag +:ptNext +:ptfirst +:ptjump +:ptlast +:ptnext +:ptprevious +:ptrewind +:ptselect +:public +:put +:pwd +:py3 +:python3 +:py3do +:py3file +:python +:pydo +:pyfile +:pyx +:pythonx +:pyxdo +:pyxfile +:quit +:quitall +:qall +:read +:recover +:redo +:redir +:redraw +:redrawstatus +:redrawtabline +:registers +:resize +:retab +:return +:rewind +:right +:rightbelow +:ruby +:rubydo +:rubyfile +:rundo +:runtime +:rviminfo +:substitute +:sNext +:sandbox +:sargument +:sall +:saveas +:sbuffer +:sbNext +:sball +:sbfirst +:sblast +:sbmodified +:sbnext +:sbprevious +:sbrewind +:scriptnames +:scriptencoding +:scriptversion +:scscope +:set +:setfiletype +:setglobal +:setlocal +:sfind +:sfirst +:shell +:simalt +:sign +:silent +:sleep +:sleep! +:slast +:smagic +:smap +:smapclear +:smenu +:smile +:snext +:snomagic +:snoremap +:snoremenu +:sort +:source +:spelldump +:spellgood +:spellinfo +:spellrare +:spellrepall +:spellundo +:spellwrong +:split +:sprevious +:srewind +:stop +:stag +:startinsert +:startgreplace +:startreplace +:static +:stopinsert +:stjump +:stselect +:sunhide +:sunmap +:sunmenu +:suspend +:sview +:swapname +:syntax +:syntime +:syncbind +:t +:tNext +:tabNext +:tabclose +:tabdo +:tabedit +:tabfind +:tabfirst +:tablast +:tabmove +:tabnew +:tabnext +:tabonly +:tabprevious +:tabrewind +:tabs +:tab +:tag +:tags +:tcd +:tchdir +:tcl +:tcldo +:tclfile +:tearoff +:terminal +:tfirst +:throw +:tjump +:tlast +:tlmenu +:tlnoremenu +:tlunmenu +:tmapclear +:tmap +:tmenu +:tnext +:tnoremap +:topleft +:tprevious +:trewind +:try +:tselect +:tunmap +:tunmenu +:undo +:undojoin +:undolist +:unabbreviate +:unabbreviate +:unhide +:unlet +:unlockvar +:unmap +:unmenu +:unsilent +:update +:vglobal/.../ +:var +:version +:verbose +:vertical +:vim9cmd +:vim9script +:vimgrep +:vimgrepadd +:visual +:viusage +:view +:vmap +:vmapclear +:vmenu +:vnew +:vnoremap +:vnoremenu +:vsplit +:vunmap +:vunmenu +:windo +:write +:wNext +:wall +:while +:winsize +:wincmd +:winpos +:wnext +:wprevious +:wq +:wqall +:wundo +:wviminfo +:xit +:xall +:xmapclear +:xmap +:xmenu +:xrestore +:xnoremap +:xnoremenu +:xunmap +:xunmenu +:yank +:z + +call Foo()|help +call Foo() | help +call Foo() |help +call Foo()| help + +" FIXME +call Foo() | append + text +. +call Foo() | abbreviate +call Foo() | abclear +call Foo() | aboveleft +call Foo() | all +call Foo() | amenu +call Foo() | anoremenu +call Foo() | args +call Foo() | argadd +call Foo() | argdedupe +call Foo() | argdelete +call Foo() | argedit +call Foo() | argdo +call Foo() | argglobal +call Foo() | arglocal +call Foo() | argument +call Foo() | ascii +call Foo() | autocmd +call Foo() | augroup Foo | augroup END +call Foo() | aunmenu +call Foo() | buffer +call Foo() | bNext +call Foo() | ball +call Foo() | badd +call Foo() | balt +call Foo() | bdelete +call Foo() | behave mswin +call Foo() | behave xterm +call Foo() | belowright +call Foo() | bfirst +call Foo() | blast +call Foo() | bmodified +call Foo() | bnext +call Foo() | botright +call Foo() | bprevious +call Foo() | brewind +call Foo() | break +call Foo() | breakadd +call Foo() | breakdel +call Foo() | breaklist +call Foo() | browse +call Foo() | bufdo +call Foo() | buffers +call Foo() | bunload +call Foo() | bwipeout +" FIXME +call Foo() | change + text +. +call Foo() | cNext +call Foo() | cNfile +call Foo() | cabbrev +call Foo() | cabclear +call Foo() | cabove +call Foo() | caddbuffer +call Foo() | caddexpr +call Foo() | caddfile +call Foo() | cafter +call Foo() | call +call Foo() | catch +call Foo() | cbefore +call Foo() | cbelow +call Foo() | cbottom +call Foo() | cbuffer +call Foo() | cc +call Foo() | cclose +call Foo() | cd +call Foo() | cdo +call Foo() | cfdo +call Foo() | center +call Foo() | cexpr +call Foo() | cfile +call Foo() | cfirst +call Foo() | cgetbuffer +call Foo() | cgetexpr +call Foo() | cgetfile +call Foo() | changes +call Foo() | chdir +call Foo() | checkpath +call Foo() | checktime +call Foo() | chistory +call Foo() | class +call Foo() | clast +call Foo() | clearjumps +call Foo() | clist +call Foo() | close +call Foo() | cmap +call Foo() | cmapclear +call Foo() | cmenu +call Foo() | cnext +call Foo() | cnewer +call Foo() | cnfile +call Foo() | cnoremap +call Foo() | cnoreabbrev +call Foo() | cnoremenu +call Foo() | copy +call Foo() | colder +call Foo() | colorscheme +call Foo() | command +call Foo() | comclear +call Foo() | compiler +call Foo() | continue +call Foo() | confirm +call Foo() | const +call Foo() | copen +call Foo() | cprevious +call Foo() | cpfile +call Foo() | cquit +call Foo() | crewind +call Foo() | cscope +call Foo() | cstag +call Foo() | cunmap +call Foo() | cunabbrev +call Foo() | cunmenu +call Foo() | cwindow +call Foo() | delete +call Foo() | debug +call Foo() | debuggreedy +call Foo() | def +call Foo() | defcompile +call Foo() | defer +call Foo() | delcommand +call Foo() | delfunction +call Foo() | delmarks +call Foo() | diffupdate +call Foo() | diffget +call Foo() | diffoff +call Foo() | diffpatch +call Foo() | diffput +call Foo() | diffsplit +call Foo() | diffthis +call Foo() | digraphs +call Foo() | display +call Foo() | disassemble +call Foo() | djump +call Foo() | dl +call Foo() | dlist +call Foo() | doautocmd +call Foo() | doautoall +call Foo() | dp +call Foo() | drop +call Foo() | dsearch +call Foo() | dsplit +call Foo() | edit +call Foo() | earlier +call Foo() | echo +call Foo() | echoconsole +call Foo() | echoerr +call Foo() | echohl +call Foo() | echomsg +call Foo() | echon +call Foo() | echowindow +call Foo() | else +call Foo() | elseif +call Foo() | emenu +call Foo() | endclass +call Foo() | enddef +call Foo() | endif +call Foo() | endfor +call Foo() | endfunction +call Foo() | endtry +call Foo() | endwhile +call Foo() | enew +call Foo() | eval +call Foo() | ex +call Foo() | execute +call Foo() | exit +call Foo() | export +call Foo() | exusage +call Foo() | file +call Foo() | files +call Foo() | filetype +call Foo() | filter +call Foo() | find +call Foo() | final +call Foo() | finally +call Foo() | finish +call Foo() | first +call Foo() | fixdel +call Foo() | fold +call Foo() | foldclose +call Foo() | folddoopen +call Foo() | folddoclosed +call Foo() | foldopen +call Foo() | for +call Foo() | function +call Foo() | global/.../ +call Foo() | goto +call Foo() | grep +call Foo() | grepadd +call Foo() | gui +call Foo() | gvim +call Foo() | hardcopy +call Foo() | help +call Foo() | helpclose +call Foo() | helpfind +call Foo() | helpgrep +call Foo() | helptags +call Foo() | highlight +call Foo() | hide +call Foo() | history +call Foo() | horizontal +" FIXME +call Foo() | insert + text +. +call Foo() | iabbrev +call Foo() | iabclear +call Foo() | if +call Foo() | ijump +call Foo() | ilist +call Foo() | imap +call Foo() | imapclear +call Foo() | imenu +call Foo() | import +call Foo() | inoremap +call Foo() | inoreabbrev +call Foo() | inoremenu +call Foo() | intro +call Foo() | isearch +call Foo() | isplit +call Foo() | iunmap +call Foo() | iunabbrev +call Foo() | iunmenu +call Foo() | join +call Foo() | jumps +call Foo() | k +call Foo() | keepalt +call Foo() | keepmarks +call Foo() | keepjumps +call Foo() | keeppatterns +call Foo() | lNext +call Foo() | lNfile +call Foo() | list +call Foo() | labove +call Foo() | laddexpr +call Foo() | laddbuffer +call Foo() | laddfile +call Foo() | lafter +call Foo() | last +call Foo() | language +call Foo() | later +call Foo() | lbefore +call Foo() | lbelow +call Foo() | lbottom +call Foo() | lbuffer +call Foo() | lcd +call Foo() | lchdir +call Foo() | lclose +call Foo() | lcscope +call Foo() | ldo +call Foo() | lfdo +call Foo() | left +call Foo() | leftabove +call Foo() | legacy +call Foo() | let +call Foo() | lexpr +call Foo() | lfile +call Foo() | lfirst +call Foo() | lgetbuffer +call Foo() | lgetexpr +call Foo() | lgetfile +call Foo() | lgrep +call Foo() | lgrepadd +call Foo() | lhelpgrep +call Foo() | lhistory +call Foo() | ll +call Foo() | llast +call Foo() | llist +call Foo() | lmake +call Foo() | lmap +call Foo() | lmapclear +call Foo() | lnext +call Foo() | lnewer +call Foo() | lnfile +call Foo() | lnoremap +call Foo() | loadkeymap +call Foo() | loadview +call Foo() | lockmarks +call Foo() | lockvar +call Foo() | lolder +call Foo() | lopen +call Foo() | lprevious +call Foo() | lpfile +call Foo() | lrewind +call Foo() | ls +call Foo() | ltag +call Foo() | lunmap +call Foo() | lua +call Foo() | luado +call Foo() | luafile +call Foo() | lvimgrep +call Foo() | lvimgrepadd +call Foo() | lwindow +call Foo() | move +call Foo() | mark +call Foo() | make +" requires trailing whitespace to distinguish from map() +call Foo() | map +call Foo() | mapclear +call Foo() | marks +call Foo() | match +call Foo() | menu +call Foo() | menutranslate +call Foo() | messages +call Foo() | mkexrc +call Foo() | mksession +call Foo() | mkspell +call Foo() | mkvimrc +call Foo() | mkview +call Foo() | mode +call Foo() | mzscheme +call Foo() | mzfile +call Foo() | nbclose +call Foo() | nbkey +call Foo() | nbstart +call Foo() | next +call Foo() | new +call Foo() | nmap +call Foo() | nmapclear +call Foo() | nmenu +call Foo() | nnoremap +call Foo() | nnoremenu +call Foo() | noautocmd +call Foo() | noremap +call Foo() | nohlsearch +call Foo() | noreabbrev +call Foo() | noremenu +call Foo() | normal +call Foo() | noswapfile +call Foo() | number +call Foo() | nunmap +call Foo() | nunmenu +call Foo() | oldfiles +call Foo() | open +call Foo() | omap +call Foo() | omapclear +call Foo() | omenu +call Foo() | only +call Foo() | onoremap +call Foo() | onoremenu +call Foo() | options +call Foo() | ounmap +call Foo() | ounmenu +call Foo() | ownsyntax +call Foo() | packadd +call Foo() | packloadall +call Foo() | pclose +call Foo() | pedit +call Foo() | perl +call Foo() | print +call Foo() | profdel +call Foo() | profile +call Foo() | promptfind +call Foo() | promptrepl +call Foo() | perldo +call Foo() | pop +call Foo() | popup +call Foo() | ppop +call Foo() | preserve +call Foo() | previous +call Foo() | psearch +call Foo() | ptag +call Foo() | ptNext +call Foo() | ptfirst +call Foo() | ptjump +call Foo() | ptlast +call Foo() | ptnext +call Foo() | ptprevious +call Foo() | ptrewind +call Foo() | ptselect +call Foo() | public +call Foo() | put +call Foo() | pwd +call Foo() | py3 +call Foo() | python3 +call Foo() | py3do +call Foo() | py3file +call Foo() | python +call Foo() | pydo +call Foo() | pyfile +call Foo() | pyx +call Foo() | pythonx +call Foo() | pyxdo +call Foo() | pyxfile +call Foo() | quit +call Foo() | quitall +call Foo() | qall +call Foo() | read +call Foo() | recover +call Foo() | redo +call Foo() | redir +call Foo() | redraw +call Foo() | redrawstatus +call Foo() | redrawtabline +call Foo() | registers +call Foo() | resize +call Foo() | retab +call Foo() | return +call Foo() | rewind +call Foo() | right +call Foo() | rightbelow +call Foo() | ruby +call Foo() | rubydo +call Foo() | rubyfile +call Foo() | rundo +call Foo() | runtime +call Foo() | rviminfo +call Foo() | substitute +call Foo() | sNext +call Foo() | sandbox +call Foo() | sargument +call Foo() | sall +call Foo() | saveas +call Foo() | sbuffer +call Foo() | sbNext +call Foo() | sball +call Foo() | sbfirst +call Foo() | sblast +call Foo() | sbmodified +call Foo() | sbnext +call Foo() | sbprevious +call Foo() | sbrewind +call Foo() | scriptnames +call Foo() | scriptencoding +call Foo() | scriptversion +call Foo() | scscope +call Foo() | set +call Foo() | setfiletype +call Foo() | setglobal +call Foo() | setlocal +call Foo() | sfind +call Foo() | sfirst +call Foo() | shell +call Foo() | simalt +call Foo() | sign +call Foo() | silent +call Foo() | sleep +call Foo() | sleep! +call Foo() | slast +call Foo() | smagic +call Foo() | smap +call Foo() | smapclear +call Foo() | smenu +call Foo() | smile +call Foo() | snext +call Foo() | snomagic +call Foo() | snoremap +call Foo() | snoremenu +call Foo() | sort +call Foo() | source +call Foo() | spelldump +call Foo() | spellgood +call Foo() | spellinfo +call Foo() | spellrare +call Foo() | spellrepall +call Foo() | spellundo +call Foo() | spellwrong +call Foo() | split +call Foo() | sprevious +call Foo() | srewind +call Foo() | stop +call Foo() | stag +call Foo() | startinsert +call Foo() | startgreplace +call Foo() | startreplace +call Foo() | static +call Foo() | stopinsert +call Foo() | stjump +call Foo() | stselect +call Foo() | sunhide +call Foo() | sunmap +call Foo() | sunmenu +call Foo() | suspend +call Foo() | sview +call Foo() | swapname +call Foo() | syntax +call Foo() | syntime +call Foo() | syncbind +call Foo() | t +call Foo() | tNext +call Foo() | tabNext +call Foo() | tabclose +call Foo() | tabdo +call Foo() | tabedit +call Foo() | tabfind +call Foo() | tabfirst +call Foo() | tablast +call Foo() | tabmove +call Foo() | tabnew +call Foo() | tabnext +call Foo() | tabonly +call Foo() | tabprevious +call Foo() | tabrewind +call Foo() | tabs +call Foo() | tab +call Foo() | tag +call Foo() | tags +call Foo() | tcd +call Foo() | tchdir +call Foo() | tcl +call Foo() | tcldo +call Foo() | tclfile +call Foo() | tearoff +call Foo() | terminal +call Foo() | tfirst +call Foo() | throw +call Foo() | tjump +call Foo() | tlast +call Foo() | tlmenu +call Foo() | tlnoremenu +call Foo() | tlunmenu +call Foo() | tmapclear +call Foo() | tmap +call Foo() | tmenu +call Foo() | tnext +call Foo() | tnoremap +call Foo() | topleft +call Foo() | tprevious +call Foo() | trewind +call Foo() | try +call Foo() | tselect +call Foo() | tunmap +call Foo() | tunmenu +call Foo() | undo +call Foo() | undojoin +call Foo() | undolist +call Foo() | unabbreviate +call Foo() | unabbreviate +call Foo() | unhide +call Foo() | unlet +call Foo() | unlockvar +call Foo() | unmap +call Foo() | unmenu +call Foo() | unsilent +call Foo() | update +call Foo() | vglobal/.../ +call Foo() | var +call Foo() | version +call Foo() | verbose +call Foo() | vertical +call Foo() | vim9cmd +call Foo() | vim9script +call Foo() | vimgrep +call Foo() | vimgrepadd +call Foo() | visual +call Foo() | viusage +call Foo() | view +call Foo() | vmap +call Foo() | vmapclear +call Foo() | vmenu +call Foo() | vnew +call Foo() | vnoremap +call Foo() | vnoremenu +call Foo() | vsplit +call Foo() | vunmap +call Foo() | vunmenu +call Foo() | windo +call Foo() | write +call Foo() | wNext +call Foo() | wall +call Foo() | while +call Foo() | winsize +call Foo() | wincmd +call Foo() | winpos +call Foo() | wnext +call Foo() | wprevious +call Foo() | wq +call Foo() | wqall +call Foo() | wundo +call Foo() | wviminfo +call Foo() | xit +call Foo() | xall +call Foo() | xmapclear +call Foo() | xmap +call Foo() | xmenu +call Foo() | xrestore +call Foo() | xnoremap +call Foo() | xnoremenu +call Foo() | xunmap +call Foo() | xunmenu +call Foo() | yank +call Foo() | z diff --git a/runtime/syntax/testdir/input/vim_keymap.vim b/runtime/syntax/testdir/input/vim_keymap.vim new file mode 100644 index 0000000..983c822 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_keymap.vim @@ -0,0 +1,26 @@ +" Vim Keymap file for syntax testing + +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Last Changed: 2023 Nov 21 + +scriptencoding utf-8 + +let b:keymap_name = "syntax-test" + +loadkeymap + +" Line comment + + " Another line comment + +a A Basic mapping +'a á More than one char in first column + +" Special notation +<char-62> B Special notation allowed in LHS - decimal +c <char-0103> Special notation allowed in RHS - octal +<char-0x0064> <char-0x0044> Special notation allowed in LHS and RHS - hexadecimal + +" Vim-script comment characters +# <char-0x00a3> Line should not match as a Vim9-script comment +\" “ Line should not match as a legacy-script comment diff --git a/runtime/syntax/testdir/input/vim_syntax.vim b/runtime/syntax/testdir/input/vim_syntax.vim new file mode 100644 index 0000000..e8c112c --- /dev/null +++ b/runtime/syntax/testdir/input/vim_syntax.vim @@ -0,0 +1,75 @@ +" Vim :syntax highlighting + +syn keyword testKeyword + \ conceal + \ cchar=& + \ contained + \ containedin=testContainer + \ nextgroup=testNext,@testCluster + \ transparent + \ skipwhite + \ skipempty + \ skipnl + \ keyword1 + \ keyword2 + \ keyword3 + +syn match testMatch + \ "pattern" + \ conceal + \ cchar=& + \ contained + \ containedin=testContainer + \ nextgroup=testNext,@testCluster + \ transparent + \ skipwhite + \ skipempty + \ skipnl + \ contains=testContained1,testContained2 + \ fold + \ display + \ extend + \ excludenl + \ keepend + +syn region testRegion + \ start="start-pattern" + \ end="end-pattern" + \ skip="skip-pattern" + \ contained + \ conceal + \ cchar=& + \ contained + \ containedin=testContainer + \ nextgroup=testNext,@testCluster + \ transparent + \ skipwhite + \ skipempty + \ skipnl + \ contains=testContained1,testContained2 + \ oneline + \ fold + \ display + \ extend + \ concealends + \ excludenl + \ keepend + +syn cluster testCluster + \ contains=testContained1,testContained2,testContained3 + +syn cluster testCluster + \ add=testAdd + \ remove=testRemove + + +" check multiline group list +syn keyword testKeyword + \ nextgroup= + \ testNext , + \ testNext2 , + \ @testCluster + \ skipwhite + \ keyword4 + \ keyword5 + \ keyword6 diff --git a/runtime/syntax/testdir/input/vim_variables.vim b/runtime/syntax/testdir/input/vim_variables.vim new file mode 100644 index 0000000..6f77da9 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_variables.vim @@ -0,0 +1,138 @@ +" Vim variable highlighting + +" :let + +let foo = expr + +let foo[0] = expr + +let foo[1:2] = expr +let foo[:2] = expr +let foo[1:] = expr +let foo[:] = expr + +let foo += expr +let foo -= expr +let foo *= expr +let foo /= expr +let foo %= expr +let foo .= expr +let foo ..= expr + +let $FOO = expr +let $FOO .= expr + +let @f = expr +let @f .= expr + +let &foo = expr + +let &t_k1 = "\<Esc>[234;" + +let &foo .= expr + +let &foo += expr +let &foo -= expr + +let &l:foo = expr + +let &l:foo .= expr +let &l:foo += expr +let &l:foo -= expr + +let &g:foo = expr + +let &g:foo .= expr +let &g:foo += expr +let &g:foo -= expr + +let [foo, bar] = expr +let [foo, + \ bar] = expr + +let [foo, bar] .= expr +let [foo, bar] += expr +let [foo, bar] -= expr + +let [foo, bar; baz] = expr +let [foo, + \ bar; + \ baz] = expr + +let [foo, bar; baz] .= expr +let [foo, bar; baz] += expr +let [foo, bar; baz] -= expr + +let foo =<< END +... +END +let foo =<< trim END +... +END +let foo =<< eval END +... +END +let foo =<< trim eval END +... +END +let foo =<< eval trim END +... +END + +let foo +let foo bar + +" :unlet + +unlet foo +unlet foo bar +unlet foo + \ bar + +unlet! foo +unlet! foo bar +unlet! foo + \ bar + +unlet $FOO +unlet! $FOO + +unlet list[3] +unlet list[3:] +unlet dict['two'] +unlet dict.two + +" :const + +const foo = expr + +const [foo, bar] = expr + +const [foo, bar; baz] = expr + +const foo =<< END +... +END +const foo =<< trim END +... +END +const foo =<< eval END +... +END +const foo =<< trim eval END +... +END +const foo =<< eval trim END +... +END + +const foo +const foo bar + +" :for + +for foo in expr +endfor + +for [foo, bar] in expr +endfor |