Skip to content

Commit

Permalink
Merge 12bec83 into 5f142d7
Browse files Browse the repository at this point in the history
  • Loading branch information
Licenser committed Feb 2, 2021
2 parents 5f142d7 + 12bec83 commit c0c2229
Show file tree
Hide file tree
Showing 85 changed files with 594 additions and 729 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Install deps
run: sudo apt-get -qy update && sudo apt-get install -y libssl1.0-dev libssl1.0
run: sudo apt-get -qy update && sudo apt-get install -y libssl-dev libssl1.1
- uses: actions-rs/toolchain@v1
with:
override: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/eqc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1.0.0
- uses: gleam-lang/setup-erlang@v1.0.0
- uses: gleam-lang/setup-erlang@v1.1.2
with:
otp-version: 22.1
- name: Install deps
run: sudo apt-get -qy update && sudo apt-get install -y libssl1.0-dev libssl1.0
run: sudo apt-get -qy update && sudo apt-get install -y libssl-dev libssl1.1
- name: Install yaml2json
run: go get github.com/bronze1man/yaml2json
- name: install EQC
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v1
- name: Install deps
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get -qy update && sudo apt-get install -y libssl1.0-dev libssl1.0
run: sudo apt-get -qy update && sudo apt-get install -y libssl-dev libssl1.1
- uses: actions-rs/toolchain@v1
with:
override: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install deps [Linux]
run: sudo apt-get -qy update && sudo apt-get install -y libssl1.0-dev libssl1.0
run: sudo apt-get -qy update && sudo apt-get install -y libssl-dev libssl1.1
- uses: actions-rs/toolchain@v1
with:
override: true
Expand All @@ -24,7 +24,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install deps
run: sudo apt-get -qy update && sudo apt-get install -y libssl1.0-dev libssl1.0
run: sudo apt-get -qy update && sudo apt-get install -y libssl-dev libssl1.1
- uses: actions-rs/toolchain@v1
with:
override: true
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Latest

### Breaking Changes

* String interpolation is now done via `#{..}` instead of `{}`. `{` no longer needs to be escaped, but `\#{` needs an escape for literal `#{`.

### New features

* Default to thin-lto for all builds (prior this was only done in docker)
Expand All @@ -11,6 +15,8 @@
* Statically link openssl
* elastic sink now supports linked transports [#715](https://github.com/tremor-rs/tremor-runtime/pull/715)

### Fixes
* rewrite string interpolation to fix [#726](https://github.com/tremor-rs/tremor-runtime/issues/726)
## 0.9.4

### New features
Expand Down
2 changes: 1 addition & 1 deletion tests/queries/state/query.trickle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ script
let state.count = state.count + 1
end;

{ "e": event, "{args.name}": state.count }
{ "e": event, "#{args.name}": state.count }
end;

create script seq1 from countable with name = "s1" end;
Expand Down
6 changes: 6 additions & 0 deletions tests/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ test_cases!(
// TODO
// const_in_const_lookup,
// INSERT
string_interpolation_nested,
string_interpolation_escaped_hash,
string_interpolation_escaped,
string_interpolation_simple,
string_interpolation_tailing,
string_interpolation_regexp,
binary_binary,
binary_binary_string,
binary_string_binary,
Expand Down
4 changes: 2 additions & 2 deletions tests/script_errors/heredoc_interpolation_extractor/error.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Error:
1 | let heredoc = """
2 | { | }
| ^^^ It looks like you forgot to terminate an extractor with a closing '|'
2 | #{ | }
| ^^^ It looks like you forgot to terminate an extractor with a closing '|'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
let heredoc = """
{ | }
#{ | }
""";
4 changes: 2 additions & 2 deletions tests/script_errors/heredoc_interpolation_ident/error.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Error:
1 | """
2 | before { `ident unfinished } after
| ^^^^^^^^^^^^^^^^^^^^^^^^^ It looks like you forgot to terminate an ident with a closing '`'
2 | before #{ `ident unfinished } after
| ^^^^^^^^^^^^^^^^^^^^^^^^^ It looks like you forgot to terminate an ident with a closing '`'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""
before { `ident unfinished } after
before #{ `ident unfinished } after
"""
4 changes: 2 additions & 2 deletions tests/script_errors/heredoc_interpolation_multiline/error.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Error:
1 | """
2 | { "
| ^ It looks like you forgot to terminate a string with a closing '"'
2 | #{ "
| ^ It looks like you forgot to terminate a string with a closing '"'
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
{ "
#{ "

}
"""
6 changes: 3 additions & 3 deletions tests/script_errors/lexer_heredoc_interpolation/error.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Error:
1 | """
2 | {
| ^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '{' ? Escape it as '\{' or '{{'.
2 | #{
| ^^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '#{' ? Escape it as '\#{'.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""
{
#{
6 changes: 3 additions & 3 deletions tests/script_errors/lexer_heredoc_interpolation2/error.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Error:
1 | """
2 | {"""
| ^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '{' ? Escape it as '\{' or '{{'.
2 | #{"""
| ^^^^^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '#{' ? Escape it as '\#{'.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""
{"""
#{"""
6 changes: 3 additions & 3 deletions tests/script_errors/lexer_heredoc_interpolation3/error.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Error:
2 | let x = """
3 | {""";
| ^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '{' ? Escape it as '\{' or '{{'.
3 | #{""";
| ^^^^^^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '#{' ? Escape it as '\#{'.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
use std::string;
let x = """
{""";
#{""";
6 changes: 3 additions & 3 deletions tests/script_errors/lexer_string_interpolation/error.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Error:
1 | "{"
| ^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '{' ? Escape it as '\{' or '{{'.
1 | "#{"
| ^^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '#{' ? Escape it as '\#{'.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"{"
"#{"
6 changes: 3 additions & 3 deletions tests/script_errors/lexer_string_interpolation2/error.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Error:
1 | let x = "before { { {}";
| ^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '{' ? Escape it as '\{' or '{{'.
1 | let x = "before #{ { {}";
| ^^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '#{' ? Escape it as '\#{'.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
let x = "before { { {}";
let x = "before #{ { {}";

4 changes: 2 additions & 2 deletions tests/script_errors/lexer_string_interpolation3/error.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Error:
1 | use std::string;
2 | let e = "\u0065 { `unterminated_ident } \u0076 {2} \u0080";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It looks like you forgot to terminate an ident with a closing '`'
2 | let e = "\u0065 #{ `unterminated_ident } \u0076 #{2} \u0080";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It looks like you forgot to terminate an ident with a closing '`'
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
use std::string;
let e = "\u0065 { `unterminated_ident } \u0076 {2} \u0080";
let e = "\u0065 #{ `unterminated_ident } \u0076 #{2} \u0080";
6 changes: 3 additions & 3 deletions tests/script_errors/string_interpolation_eof/error.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Error:
1 | let si = "before {
| ^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '{' ? Escape it as '\{' or '{{'.
1 | let si = "before #{
| ^^ It looks like you forgot to terminate a string interpolation with a closing '}'
| NOTE: Did you mean to write a literal '#{' ? Escape it as '\#{'.
2 changes: 1 addition & 1 deletion tests/script_errors/string_interpolation_eof/script.tremor
Original file line number Diff line number Diff line change
@@ -1 +1 @@
let si = "before {
let si = "before #{
4 changes: 2 additions & 2 deletions tests/script_errors/string_interpolation_escape/error.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Error:
1 | let escape = " { "\z" } ";
| ^^ An unexpected escape code 'z' was found
1 | let escape = " #{ "\z" } ";
| ^^ An unexpected escape code 'z' was found
Original file line number Diff line number Diff line change
@@ -1 +1 @@
let escape = " { "\z" } ";
let escape = " #{ "\z" } ";
4 changes: 2 additions & 2 deletions tests/script_errors/string_interpolation_extractor/error.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Error:
1 | " { | } "
| ^^^^^ It looks like you forgot to terminate an extractor with a closing '|'
1 | " #{ | } "
| ^^^^^ It looks like you forgot to terminate an extractor with a closing '|'
Original file line number Diff line number Diff line change
@@ -1 +1 @@
" { | } "
" #{ | } "
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Error:
1 | " { " \u666G " } "
| ^^^^^^ An invalid UTF8 escape sequence was found
1 | " #{ " \u666G " } "
| ^^^^^^ An invalid UTF8 escape sequence was found
Original file line number Diff line number Diff line change
@@ -1 +1 @@
" { " \u666G " } "
" #{ " \u666G " } "
2 changes: 1 addition & 1 deletion tests/scripts/const_of_const/script.tremor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const a = "snot";
const b = ( a + " badger" );

"{b}: {event}!"
"#{b}: #{event}!"
2 changes: 1 addition & 1 deletion tests/scripts/fn_extractors/script.tremor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::type;
fn snottify(s) of
case ("badger") => "snot badger, hell yea!"
case (~ json||) => let s.snot = true, s
case (s) when type::is_string(s) => "snot {s}"
case (s) when type::is_string(s) => "snot #{s}"
default => "snot caller, you can't snottify that!"
end;

Expand Down
6 changes: 3 additions & 3 deletions tests/scripts/fn_nest2_abs_fib/script.tremor
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
mod b with
fn snot(n) with
"cake {n}"
"cake #{n}"
end;
end;

mod a with
mod b with
fn snot(n) with "snot {n}" end
fn snot(n) with "snot #{n}" end
end;
fn badger(n) with "{b::snot(n)} badger {n}" end
fn badger(n) with "#{b::snot(n)} badger #{n}" end
end;

[a::badger(event), b::snot(event)]
4 changes: 2 additions & 2 deletions tests/scripts/fn_nest2_fib/script.tremor
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mod a with
mod b with
fn snot(n) with "snot {n}" end
fn snot(n) with "snot #{n}" end
end;
fn badger(n) with "{b::snot(n)} badger {n}" end
fn badger(n) with "#{b::snot(n)} badger #{n}" end
end;

a::badger(event)
2 changes: 1 addition & 1 deletion tests/scripts/heredoc_interpolation/script.tremor
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""
{event.class} {event.answer}
#{event.class} #{event.answer}
"""
2 changes: 1 addition & 1 deletion tests/scripts/heredoc_interpolation_quotes/script.tremor
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""
"{event}" => {"tremolo"}
"#{event}" => #{"tremolo"}
"""
Binary file modified tests/scripts/heredoc_quoted_curly/out.xz
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/scripts/heredoc_quoted_curly/script.tremor
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""
\{event\} = {{event}} = {event}
\#{event} = \#{event} = #{event}
"""
4 changes: 2 additions & 2 deletions tests/scripts/heredoc_regression/script.tremor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# gives bad output: "Hello, snot! Your name is:\n! Your name is:\n snot\n"
"""
Hello, {event}! Your name is:
{event}
Hello, #{event}! Your name is:
#{event}
"""
2 changes: 1 addition & 1 deletion tests/scripts/heredoc_usefn_interpolation/script.tremor
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ use tremor::system;
re::replace(
"1\\d+",
"""
{event.class} {event.answer} { string::format("{}", "foo") } { system::nanotime() }
#{event.class} #{event.answer} #{ string::format("{}", "foo") } #{ system::nanotime() }
"""
, "<nanotime>")
5 changes: 5 additions & 0 deletions tests/scripts/new.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ git add ${TARGET}

sed -e '/^ \/\/ INSERT/a\
'"${NAME}," ${BASEDIR}/../script.rs > ${BASEDIR}/tmp && mv ${BASEDIR}/tmp ${BASEDIR}/../script.rs

for f in ${TARGET}/*
do
echo "$f"
done
2 changes: 1 addition & 1 deletion tests/scripts/pp_alias0/script.tremor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use foo as foo;

match event of
case {} => "snot {foo::snot}"
case {} => "snot #{foo::snot}"
default => "ko"
end;
2 changes: 1 addition & 1 deletion tests/scripts/pp_alias1/script.tremor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use foo :: bar as bar;

match event of
case {} => "snot {bar::snot}"
case {} => "snot #{bar::snot}"
default => "ko"
end;
2 changes: 1 addition & 1 deletion tests/scripts/pp_alias2/script.tremor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use foo::bar::baz as baz;

match event of
case {} => "snot {baz::snot}"
case {} => "snot #{baz::snot}"
default => "ko"
end;
2 changes: 1 addition & 1 deletion tests/scripts/pp_alias3/script.tremor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use foo:: bar ::baz :: mork as bork ;

match event of
case {} => "snot {bork::snot}"
case {} => "snot #{bork::snot}"
default => "ko"
end;
2 changes: 1 addition & 1 deletion tests/scripts/pp_inline_nest1/script.tremor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use foo;

match event of
case {} => "snot {foo::bar::snot}"
case {} => "snot #{foo::bar::snot}"
default => "ko"
end;
Loading

0 comments on commit c0c2229

Please sign in to comment.