aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build/script
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/build/script')
-rw-r--r--libbuild2/build/script/lexer+command-line.test.testscript36
-rw-r--r--libbuild2/build/script/lexer.cxx10
-rw-r--r--libbuild2/build/script/lexer.hxx6
-rw-r--r--libbuild2/build/script/parser+here-document.test.testscript102
-rw-r--r--libbuild2/build/script/parser+here-string.test.testscript24
-rw-r--r--libbuild2/build/script/parser+pipe-expr.test.testscript4
-rw-r--r--libbuild2/build/script/parser+redirect.test.testscript152
-rw-r--r--libbuild2/build/script/parser+regex.test.testscript87
-rw-r--r--libbuild2/build/script/parser.cxx6
9 files changed, 308 insertions, 119 deletions
diff --git a/libbuild2/build/script/lexer+command-line.test.testscript b/libbuild2/build/script/lexer+command-line.test.testscript
index 1777583..3eceae8 100644
--- a/libbuild2/build/script/lexer+command-line.test.testscript
+++ b/libbuild2/build/script/lexer+command-line.test.testscript
@@ -47,24 +47,36 @@ test.arguments = command-line
: str
:
- $* <"cmd <a 1>b" >>EOO
+ $* <"cmd <<<=a 1>>>?b" >>EOO
'cmd'
- <
+ <<<=
'a'
'1'
- >
+ >>>?
'b'
<newline>
EOO
: str-nn
:
- $* <"cmd <:a 1>:b" >>EOO
+ $* <"cmd <<<=:a 1>>>?:b" >>EOO
'cmd'
- <:
+ <<<=:
'a'
'1'
- >:
+ >>>?:
+ 'b'
+ <newline>
+ EOO
+
+ : str-nn-alias
+ :
+ $* <"cmd <<<:a 1>>>?:b" >>EOO
+ 'cmd'
+ <<<:
+ 'a'
+ '1'
+ >>>?:
'b'
<newline>
EOO
@@ -83,26 +95,26 @@ test.arguments = command-line
: doc-nn
:
- $* <"cmd <<:EOI 1>>:EOO" >>EOO
+ $* <"cmd <<:EOI 1>>?:EOO" >>EOO
'cmd'
<<:
'EOI'
'1'
- >>:
+ >>?:
'EOO'
<newline>
EOO
: file-cmp
:
- $* <"cmd <<<in >>>out 2>>>err" >>EOO
+ $* <"cmd <=in >?out 2>?err" >>EOO
'cmd'
- <<<
+ <=
'in'
- >>>
+ >?
'out'
'2'
- >>>
+ >?
'err'
<newline>
EOO
diff --git a/libbuild2/build/script/lexer.cxx b/libbuild2/build/script/lexer.cxx
index de93b6b..716d898 100644
--- a/libbuild2/build/script/lexer.cxx
+++ b/libbuild2/build/script/lexer.cxx
@@ -13,6 +13,14 @@ namespace build2
{
using type = token_type;
+ build2::script::redirect_aliases lexer::redirect_aliases {
+ type (type::in_file),
+ type (type::in_doc),
+ type (type::in_str),
+ type (type::out_file_ovr),
+ type (type::out_file_app),
+ nullopt};
+
void lexer::
mode (build2::lexer_mode m,
char ps,
@@ -192,7 +200,7 @@ namespace build2
m == lexer_mode::first_token ||
m == lexer_mode::second_token)
{
- if (optional<token> t = next_cmd_op (c, sep, m))
+ if (optional<token> t = next_cmd_op (c, sep))
return move (*t);
}
diff --git a/libbuild2/build/script/lexer.hxx b/libbuild2/build/script/lexer.hxx
index f755cea..7d919e5 100644
--- a/libbuild2/build/script/lexer.hxx
+++ b/libbuild2/build/script/lexer.hxx
@@ -48,7 +48,8 @@ namespace build2
const char* escapes = nullptr)
: base_lexer (is, name, line,
nullptr /* escapes */,
- false /* set_mode */)
+ false /* set_mode */,
+ redirect_aliases)
{
mode (m, '\0', escapes);
}
@@ -62,6 +63,9 @@ namespace build2
virtual token
next () override;
+ public:
+ static redirect_aliases_type redirect_aliases;
+
private:
token
next_line ();
diff --git a/libbuild2/build/script/parser+here-document.test.testscript b/libbuild2/build/script/parser+here-document.test.testscript
index 8ea6373..f56a5e1 100644
--- a/libbuild2/build/script/parser+here-document.test.testscript
+++ b/libbuild2/build/script/parser+here-document.test.testscript
@@ -6,49 +6,85 @@
{
: missing-newline
:
+ $* <'cmd <<=' 2>>EOE != 0
+ buildfile:11:8: error: expected here-document end marker
+ EOE
+
+ : missing-newline-alias
+ :
$* <'cmd <<' 2>>EOE != 0
buildfile:11:7: error: expected here-document end marker
EOE
: missing-exit
:
+ $* <'cmd <<= != 0' 2>>EOE != 0
+ buildfile:11:9: error: expected here-document end marker
+ EOE
+
+ : missing-exit-alias
+ :
$* <'cmd << != 0' 2>>EOE != 0
buildfile:11:8: error: expected here-document end marker
EOE
: missing-empty
:
+ $* <'cmd <<=""' 2>>EOE != 0
+ buildfile:11:8: error: expected here-document end marker
+ EOE
+
+ : missing-empty-alias
+ :
$* <'cmd <<""' 2>>EOE != 0
buildfile:11:7: error: expected here-document end marker
EOE
: unseparated-expansion
:
+ $* <'cmd <<=FOO$foo' 2>>EOE != 0
+ buildfile:11:11: error: here-document end marker must be literal
+ EOE
+
+ : unseparated-expansion-alias
+ :
$* <'cmd <<FOO$foo' 2>>EOE != 0
buildfile:11:10: error: here-document end marker must be literal
EOE
: quoted-single-partial
:
- $* <"cmd <<F'O'O" 2>>EOE != 0
- buildfile:11:7: error: partially-quoted here-document end marker
+ $* <"cmd <<=F'O'O" 2>>EOE != 0
+ buildfile:11:8: error: partially-quoted here-document end marker
EOE
: quoted-double-partial
:
- $* <'cmd <<"FO"O' 2>>EOE != 0
- buildfile:11:7: error: partially-quoted here-document end marker
+ $* <'cmd <<="FO"O' 2>>EOE != 0
+ buildfile:11:8: error: partially-quoted here-document end marker
EOE
: quoted-mixed
:
- $* <"cmd <<\"FO\"'O'" 2>>EOE != 0
- buildfile:11:7: error: partially-quoted here-document end marker
+ $* <"cmd <<=\"FO\"'O'" 2>>EOE != 0
+ buildfile:11:8: error: partially-quoted here-document end marker
EOE
: unseparated
:
$* <<EOI >>EOO
+ cmd <<=EOF!=0
+ foo
+ EOF
+ EOI
+ cmd <<=EOF != 0
+ foo
+ EOF
+ EOO
+
+ : unseparated-alias
+ :
+ $* <<EOI >>EOO
cmd <<EOF!=0
foo
EOF
@@ -61,6 +97,18 @@
: quoted-single
:
$* <<EOI >>EOO
+ cmd <<='EOF'
+ foo
+ EOF
+ EOI
+ cmd <<=EOF
+ foo
+ EOF
+ EOO
+
+ : quoted-single-alias
+ :
+ $* <<EOI >>EOO
cmd <<'EOF'
foo
EOF
@@ -73,6 +121,18 @@
: quoted-double
:
$* <<EOI >>EOO
+ cmd <<="EOF"
+ foo
+ EOF
+ EOI
+ cmd <<=EOF
+ foo
+ EOF
+ EOO
+
+ : quoted-double-alias
+ :
+ $* <<EOI >>EOO
cmd <<"EOF"
foo
EOF
@@ -89,13 +149,13 @@
: basic
:
$* <<EOI >>EOO
- cmd <<EOF
+ cmd <<=EOF
foo
bar
baz
EOF
EOI
- cmd <<EOF
+ cmd <<=EOF
foo
bar
baz
@@ -105,14 +165,14 @@
: blank
:
$* <<EOI >>EOO
- cmd <<EOF
+ cmd <<=EOF
foo
bar
EOF
EOI
- cmd <<EOF
+ cmd <<=EOF
foo
@@ -123,11 +183,11 @@
: non-ws-prefix
:
$* <<EOI >>EOO
- cmd <<EOF
+ cmd <<=EOF
x EOF
EOF
EOI
- cmd <<EOF
+ cmd <<=EOF
x EOF
EOF
EOO
@@ -137,11 +197,11 @@
:
$* <<EOI >>EOO
x = foo bar
- cmd <<"EOF"
+ cmd <<="EOF"
$x
EOF
EOI
- cmd <<EOF
+ cmd <<=EOF
foo bar
EOF
EOO
@@ -151,11 +211,11 @@
:
$* <<EOI >>EOO
x = foo
- cmd <<"EOF"
+ cmd <<="EOF"
$x bar $x
EOF
EOI
- cmd <<EOF
+ cmd <<=EOF
foo bar foo
EOF
EOO
@@ -163,7 +223,7 @@
: unindented
:
$* <<EOI 2>>EOE != 0
- cmd <<EOF
+ cmd <<=EOF
bar
EOF
EOI
@@ -174,7 +234,7 @@
: blank
:
$* <<EOI >>EOO
-cmd <<EOF
+cmd <<=EOF
foo
@@ -182,7 +242,7 @@ bar
EOF
EOI
-cmd <<EOF
+cmd <<=EOF
foo
@@ -196,14 +256,14 @@ EOO
: Note: they are still recognized in eval contexts.
:
$* <<EOI >>EOO
-cmd <<"EOF"
+cmd <<="EOF"
'single'
"double"
b'o't"h"
('single' "double")
EOF
EOI
-cmd <<EOF
+cmd <<=EOF
'single'
"double"
b'o't"h"
diff --git a/libbuild2/build/script/parser+here-string.test.testscript b/libbuild2/build/script/parser+here-string.test.testscript
index 8ca1499..f857c57 100644
--- a/libbuild2/build/script/parser+here-string.test.testscript
+++ b/libbuild2/build/script/parser+here-string.test.testscript
@@ -4,15 +4,31 @@
: empty
:
$* <<EOI >>EOO
-cmd <""
+cmd <<<=""
EOI
-cmd <''
+cmd <<<=''
EOO
: empty-nn
:
$* <<EOI >>EOO
-cmd <:""
+cmd <<<=:""
EOI
-cmd <:''
+cmd <<<=:''
+EOO
+
+: empty-alias
+:
+$* <<EOI >>EOO
+cmd <<<""
+EOI
+cmd <<<''
+EOO
+
+: empty-nn-alias
+:
+$* <<EOI >>EOO
+cmd <<<:""
+EOI
+cmd <<<:''
EOO
diff --git a/libbuild2/build/script/parser+pipe-expr.test.testscript b/libbuild2/build/script/parser+pipe-expr.test.testscript
index 3dd6b1b..a6ca12e 100644
--- a/libbuild2/build/script/parser+pipe-expr.test.testscript
+++ b/libbuild2/build/script/parser+pipe-expr.test.testscript
@@ -36,7 +36,7 @@ EOO
: here-doc
:
$* <<EOI >>EOO
-cmd1 <<EOI1 | cmd2 >>EOO2 && cmd3 <<EOI3 2>&1 | cmd4 2>>EOE4 >>EOO4
+cmd1 <<=EOI1 | cmd2 >>?EOO2 && cmd3 <<=EOI3 2>&1 | cmd4 2>>?EOE4 >>?EOO4
input
one
EOI1
@@ -53,7 +53,7 @@ output
four
EOO4
EOI
-cmd1 <<EOI1 | cmd2 >>EOO2 && cmd3 <<EOI3 2>&1 | cmd4 >>EOO4 2>>EOE4
+cmd1 <<=EOI1 | cmd2 >>?EOO2 && cmd3 <<=EOI3 2>&1 | cmd4 >>?EOO4 2>>?EOE4
input
one
EOI1
diff --git a/libbuild2/build/script/parser+redirect.test.testscript b/libbuild2/build/script/parser+redirect.test.testscript
index 641381e..82c04ea 100644
--- a/libbuild2/build/script/parser+redirect.test.testscript
+++ b/libbuild2/build/script/parser+redirect.test.testscript
@@ -21,9 +21,9 @@
: portable-path
:
$* <<EOI >>EOO
- cmd </foo >/bar 2>/baz
+ cmd <<<=/foo >>>?/bar 2>>>?/baz
EOI
- cmd </foo >/bar 2>/baz
+ cmd <<<=/foo >>>?/bar 2>>>?/baz
EOO
}
@@ -33,9 +33,9 @@
: portable-path
:
$* <<EOI >>EOO
- cmd >/~%foo% 2>/~%bar%
+ cmd >>>?/~%foo% 2>>>?/~%bar%
EOI
- cmd >/~%foo% 2>/~%bar%
+ cmd >>>?/~%foo% 2>>>?/~%bar%
EOO
}
}
@@ -49,7 +49,7 @@
: portable-path
:
$* <<EOI >>EOO
- cmd <</EOI_ >/EOO_ 2>/EOE_
+ cmd <<=/EOI_ >>?/EOO_ 2>>?/EOE_
foo
EOI_
bar
@@ -57,7 +57,7 @@
baz
EOE_
EOI
- cmd <</EOI_ >/EOO_ 2>/EOE_
+ cmd <<=/EOI_ >>?/EOO_ 2>>?/EOE_
foo
EOI_
bar
@@ -72,11 +72,35 @@
: in-out
:
$* <<EOI >>EOO
- cmd <<:/EOF >>:/EOF
+ cmd <<=:/EOF >>?:/EOF
foo
EOF
EOI
- cmd <<:/EOF >>:/EOF
+ cmd <<=:/EOF >>?:/EOF
+ foo
+ EOF
+ EOO
+
+ : in-alias-out
+ :
+ $* <<EOI >>EOO
+ cmd <<:/EOF >>?:/EOF
+ foo
+ EOF
+ EOI
+ cmd <<:/EOF >>?:/EOF
+ foo
+ EOF
+ EOO
+
+ : out-in-alias
+ :
+ $* <<EOI >>EOO
+ cmd >>?:/EOF <<:/EOF
+ foo
+ EOF
+ EOI
+ cmd <<:/EOF >>?:/EOF
foo
EOF
EOO
@@ -87,21 +111,21 @@
: modifiers
:
$* <<EOI 2>>EOE != 0
- cmd <<:/EOF >>:EOF
+ cmd <<=:/EOF >>?:EOF
foo
EOF
EOI
- buildfile:11:16: error: different modifiers for shared here-document 'EOF'
+ buildfile:11:18: error: different modifiers for shared here-document 'EOF'
EOE
: quoting
:
$* <<EOI 2>>EOE != 0
- cmd <<EOF >>"EOF"
+ cmd <<=EOF >>?"EOF"
foo
EOF
EOI
- buildfile:11:13: error: different quoting for shared here-document 'EOF'
+ buildfile:11:15: error: different quoting for shared here-document 'EOF'
EOE
}
}
@@ -113,13 +137,13 @@
: portable-path
:
$* <<EOI >>EOO
- cmd >/~%EOF% 2>/~%EOE%
+ cmd >>?/~%EOF% 2>>?/~%EOE%
foo
EOF
bar
EOE
EOI
- cmd >/~%EOF% 2>/~%EOE%
+ cmd >>?/~%EOF% 2>>?/~%EOE%
foo
EOF
bar
@@ -132,11 +156,11 @@
: in-out
:
$* <<EOI >>EOO
- cmd >>~/EOF/ 2>>~/EOF/
+ cmd >>?~/EOF/ 2>>?~/EOF/
foo
EOF
EOI
- cmd >>~/EOF/ 2>>~/EOF/
+ cmd >>?~/EOF/ 2>>?~/EOF/
foo
EOF
EOO
@@ -147,21 +171,21 @@
: introducers
:
$* <<EOI 2>>EOE != 0
- cmd >>~/EOF/ 2>>~%EOF%
+ cmd >>?~/EOF/ 2>>?~%EOF%
foo
EOF
EOI
- buildfile:11:18: error: different introducers for shared here-document regex 'EOF'
+ buildfile:11:20: error: different introducers for shared here-document regex 'EOF'
EOE
: flags
:
$* <<EOI 2>>EOE != 0
- cmd >>~/EOF/ 2>>~/EOF/i
+ cmd >>?~/EOF/ 2>>?~/EOF/i
foo
EOF
EOI
- buildfile:11:18: error: different global flags for shared here-document regex 'EOF'
+ buildfile:11:20: error: different global flags for shared here-document regex 'EOF'
EOE
}
}
@@ -179,23 +203,23 @@
: string
:
$* <<EOI >>EOO
- cmd >>EOF >bar
+ cmd >>?EOF >>>?bar
foo
EOF
EOI
- cmd >bar
+ cmd >>>?bar
EOO
: regex
:
$* <<EOI >>EOO
- cmd >>FOO >>~/BAR/
+ cmd >>?FOO >>?~/BAR/
foo
FOO
bar
BAR
EOI
- cmd >>~/BAR/
+ cmd >>?~/BAR/
bar
BAR
EOO
@@ -215,11 +239,11 @@
: different-modifiers
:
$* <<EOI 2>>EOE != 0
- cmd >>EOF >>/EOF
+ cmd >>?EOF >>?/EOF
foo
EOF
EOI
- buildfile:11:14: error: different modifiers for shared here-document 'EOF'
+ buildfile:11:16: error: different modifiers for shared here-document 'EOF'
EOE
}
}
@@ -260,9 +284,9 @@
: cmp
:
$* <<EOI >>EOO
- cmd 0<<<a 1>>>b 2>>>c
+ cmd 0<=a 1>?b 2>?c
EOI
- cmd <<<a >>>b 2>>>c
+ cmd <=a >?b 2>?c
EOO
: write
@@ -276,9 +300,9 @@
: quote
:
$* <<EOI >>EOO
- cmd 0<<<"a f" 1>="b f" 2>+"c f"
+ cmd 0<="a f" 1>="b f" 2>+"c f"
EOI
- cmd <<<'a f' >='b f' 2>+'c f'
+ cmd <='a f' >='b f' 2>+'c f'
EOO
: in
@@ -287,17 +311,37 @@
: missed
:
$* <<EOI 2>>EOE !=0
- cmd <<<
+ cmd <=
EOI
- buildfile:11:8: error: missing stdin file
+ buildfile:11:7: error: missing stdin file
EOE
: empty
:
$* <<EOI 2>>EOE !=0
- cmd <<<""
+ cmd <=""
EOI
- buildfile:11:8: error: empty stdin redirect path
+ buildfile:11:7: error: empty stdin redirect path
+ EOE
+ }
+
+ : in-alias
+ :
+ {
+ : missed
+ :
+ $* <<EOI 2>>EOE !=0
+ cmd <
+ EOI
+ buildfile:11:6: error: missing stdin file
+ EOE
+
+ : empty
+ :
+ $* <<EOI 2>>EOE !=0
+ cmd <""
+ EOI
+ buildfile:11:6: error: empty stdin redirect path
EOE
}
@@ -321,6 +365,26 @@
EOE
}
+ : out-alias
+ :
+ {
+ : missed
+ :
+ $* <<EOI 2>>EOE !=0
+ cmd >
+ EOI
+ buildfile:11:6: error: missing stdout file
+ EOE
+
+ : empty
+ :
+ $* <<EOI 2>>EOE !=0
+ cmd >""
+ EOI
+ buildfile:11:6: error: empty stdout redirect path
+ EOE
+ }
+
: err
:
{
@@ -340,6 +404,26 @@
buildfile:11:8: error: empty stderr redirect path
EOE
}
+
+ : err-alias
+ :
+ {
+ : missed
+ :
+ $* <<EOI 2>>EOE !=0
+ cmd 2>
+ EOI
+ buildfile:11:7: error: missing stderr file
+ EOE
+
+ : empty
+ :
+ $* <<EOI 2>>EOE !=0
+ cmd 2>""
+ EOI
+ buildfile:11:7: error: empty stderr redirect path
+ EOE
+ }
}
: merge
diff --git a/libbuild2/build/script/parser+regex.test.testscript b/libbuild2/build/script/parser+regex.test.testscript
index 4a47e73..625bfdf 100644
--- a/libbuild2/build/script/parser+regex.test.testscript
+++ b/libbuild2/build/script/parser+regex.test.testscript
@@ -9,61 +9,61 @@
{
: missed
:
- $* <'cmd >~' 2>>EOE != 0
- buildfile:11:7: error: missing stdout here-string regex
+ $* <'cmd >>>?~' 2>>EOE != 0
+ buildfile:11:10: error: missing stdout here-string regex
EOE
: no-introducer
:
- $* <'cmd >~""' 2>>EOE != 0
- buildfile:11:7: error: no introducer character in stdout regex redirect
+ $* <'cmd >>>?~""' 2>>EOE != 0
+ buildfile:11:10: error: no introducer character in stdout regex redirect
EOE
: no-term-introducer
:
- $* <'cmd >~/' 2>>EOE != 0
- buildfile:11:7: error: no closing introducer character in stdout regex redirect
+ $* <'cmd >>>?~/' 2>>EOE != 0
+ buildfile:11:10: error: no closing introducer character in stdout regex redirect
EOE
: portable-path-introducer
:
- $* <'cmd >/~/foo/' 2>>EOE != 0
- buildfile:11:8: error: portable path modifier and '/' introducer in stdout regex redirect
+ $* <'cmd >>>?/~/foo/' 2>>EOE != 0
+ buildfile:11:11: error: portable path modifier and '/' introducer in stdout regex redirect
EOE
: empty
:
- $* <'cmd >~//' 2>>EOE != 0
- buildfile:11:7: error: stdout regex redirect is empty
+ $* <'cmd >>>?~//' 2>>EOE != 0
+ buildfile:11:10: error: stdout regex redirect is empty
EOE
: no-flags
:
- $* <'cmd >~/fo*/' >'cmd >~/fo*/'
+ $* <'cmd >>>?~/fo*/' >'cmd >>>?~/fo*/'
: idot
:
- $* <'cmd >~/fo*/d' >'cmd >~/fo*/d'
+ $* <'cmd >>>?~/fo*/d' >'cmd >>>?~/fo*/d'
: icase
:
- $* <'cmd >~/fo*/i' >'cmd >~/fo*/i'
+ $* <'cmd >>>?~/fo*/i' >'cmd >>>?~/fo*/i'
: invalid-flags1
:
- $* <'cmd >~/foo/z' 2>>EOE != 0
- buildfile:11:7: error: junk at the end of stdout regex redirect
+ $* <'cmd >>>?~/foo/z' 2>>EOE != 0
+ buildfile:11:10: error: junk at the end of stdout regex redirect
EOE
: invalid-flags2
:
- $* <'cmd >~/foo/iz' 2>>EOE != 0
- buildfile:11:7: error: junk at the end of stdout regex redirect
+ $* <'cmd >>>?~/foo/iz' 2>>EOE != 0
+ buildfile:11:10: error: junk at the end of stdout regex redirect
EOE
: no-newline
:
- $* <'cmd >:~/fo*/' >'cmd >:~/fo*/'
+ $* <'cmd >>>?:~/fo*/' >'cmd >>>?:~/fo*/'
}
: stderr
@@ -71,8 +71,8 @@
{
: missed
:
- $* <'cmd 2>~' 2>>EOE != 0
- buildfile:11:8: error: missing stderr here-string regex
+ $* <'cmd 2>>>?~' 2>>EOE != 0
+ buildfile:11:11: error: missing stderr here-string regex
EOE
: no-introducer
@@ -81,15 +81,15 @@
: All we need is to make sure that the proper description is passed to
: the parse_regex() function.
:
- $* <'cmd 2>~""' 2>>EOE != 0
- buildfile:11:8: error: no introducer character in stderr regex redirect
+ $* <'cmd 2>>>?~""' 2>>EOE != 0
+ buildfile:11:11: error: no introducer character in stderr regex redirect
EOE
}
: modifier-last
:
- $* <'cmd >~/x' 2>>EOE != 0
- buildfile:11:7: error: no closing introducer character in stdout regex redirect
+ $* <'cmd >>>?~/x' 2>>EOE != 0
+ buildfile:11:10: error: no closing introducer character in stdout regex redirect
EOE
}
@@ -101,14 +101,14 @@
{
: missed
:
- $* <'cmd >>~' 2>>EOE != 0
- buildfile:11:8: error: expected here-document regex end marker
+ $* <'cmd >>?~' 2>>EOE != 0
+ buildfile:11:9: error: expected here-document regex end marker
EOE
: portable-path-introducer
:
$* <<EOI 2>>EOE != 0
- cmd >>/~/EOO/
+ cmd >>?/~/EOO/
foo
EOO
EOI
@@ -118,7 +118,7 @@
: unterminated-line-char
:
$* <<EOI 2>>EOE != 0
- cmd >>~/EOO/
+ cmd >>?~/EOO/
/
EOO
EOI
@@ -128,7 +128,7 @@
: empty
:
$* <<EOI 2>>EOE != 0
- cmd >>:~/EOO/
+ cmd >>?:~/EOO/
EOO
EOI
buildfile:12:1: error: empty here-document regex
@@ -137,7 +137,7 @@
: no-flags
:
$* <<EOI >>EOO
- cmd 2>>~/EOE/
+ cmd 2>>?~/EOE/
foo
/?
/foo/
@@ -149,7 +149,7 @@
//*
EOE
EOI
- cmd 2>>~/EOE/
+ cmd 2>>?~/EOE/
foo
/?
/foo/
@@ -162,15 +162,18 @@
EOE
EOO
- : no-newline
+ : no-newline-str
+ :
+ $* <'cmd >>>?:~/fo*/' >'cmd >>>?:~/fo*/'
+
+ : no-newline-doc
:
- $* <'cmd >:~/fo*/' >'cmd >:~/fo*/'
$* <<EOI >>EOO
- cmd 2>>:~/EOE/
+ cmd 2>>?:~/EOE/
foo
EOE
EOI
- cmd 2>>:~/EOE/
+ cmd 2>>?:~/EOE/
foo
EOE
EOO
@@ -181,11 +184,11 @@
: idot
:
$* <<EOI >>EOO
- cmd 2>>~/EOE/d
+ cmd 2>>?~/EOE/d
foo
EOE
EOI
- cmd 2>>~/EOE/d
+ cmd 2>>?~/EOE/d
foo
EOE
EOO
@@ -193,11 +196,11 @@
: icase
:
$* <<EOI >>EOO
- cmd 2>>~/EOE/i
+ cmd 2>>?~/EOE/i
foo
EOE
EOI
- cmd 2>>~/EOE/i
+ cmd 2>>?~/EOE/i
foo
EOE
EOO
@@ -209,14 +212,14 @@
{
: missed
:
- $* <'cmd 2>>~' 2>>EOE != 0
- buildfile:11:9: error: expected here-document regex end marker
+ $* <'cmd 2>>?~' 2>>EOE != 0
+ buildfile:11:10: error: expected here-document regex end marker
EOE
}
: modifier-last
:
- $* <'cmd >>~:/FOO/' 2>>EOE != 0
+ $* <'cmd >>?~:/FOO/' 2>>EOE != 0
buildfile:11:5: error: no closing introducer character in here-document regex end marker
EOE
}
diff --git a/libbuild2/build/script/parser.cxx b/libbuild2/build/script/parser.cxx
index 86019ba..60000c2 100644
--- a/libbuild2/build/script/parser.cxx
+++ b/libbuild2/build/script/parser.cxx
@@ -141,7 +141,7 @@ namespace build2
pair<command_expr, here_docs> p;
if (lt != line_type::cmd_else && lt != line_type::cmd_end)
- p = parse_command_expr (t, tt);
+ p = parse_command_expr (t, tt, lexer::redirect_aliases);
if (tt != type::newline)
fail (t) << "expected newline instead of " << t;
@@ -232,7 +232,9 @@ namespace build2
//
assert (!pre_parse_);
- pair<command_expr, here_docs> p (parse_command_expr (t, tt));
+ pair<command_expr, here_docs> p (
+ parse_command_expr (t, tt, lexer::redirect_aliases));
+
assert (tt == type::newline);
parse_here_documents (t, tt, p);