Skip to content

Commit 589c6c9

Browse files
authored
Merge pull request #4 from schultyy/enable-multi-statements
Enable multi-statements with semicolons
2 parents 014c844 + dbeb33a commit 589c6c9

File tree

12 files changed

+132
-101
lines changed

12 files changed

+132
-101
lines changed

Cargo.lock

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ opentelemetry-semantic-conventions = "0.29.0"
3232
pest = "2.8.0"
3333
pest_derive = "2.8.0"
3434
tabled = "0.18.0"
35+
anyhow = "1.0.97"

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ Standalone service just printing values:
4747
```
4848
service payments {
4949
method charge {
50-
print "Processing payment for order %s" with ["12345", "67890"]
51-
sleep 500ms
50+
print "Processing payment for order %s" with ["12345", "67890"];
51+
sleep 500ms;
5252
}
5353
5454
loop {
55-
call charge
55+
call charge;
5656
}
5757
}
5858
```
@@ -62,12 +62,12 @@ Standalone service printing values to stderr:
6262
```
6363
service payments {
6464
method charge {
65-
stderr "Processing payment for order %s" with ["12345", "67890"]
66-
sleep 500ms
65+
stderr "Processing payment for order %s" with ["12345", "67890"];
66+
sleep 500ms;
6767
}
6868
6969
loop {
70-
call charge
70+
call charge;
7171
}
7272
}
7373
```
@@ -77,8 +77,8 @@ Service accepting requests from other services:
7777
```
7878
service payments {
7979
method charge {
80-
print "Processing payment for order %s" with ["12345", "67890"]
81-
sleep 500ms
80+
print "Processing payment for order %s" with ["12345", "67890"];
81+
sleep 500ms;
8282
}
8383
}
8484
```
@@ -88,19 +88,19 @@ Call another service:
8888
```
8989
service products {
9090
method get_products {
91-
print "Fetching product orders %s" with ["12345", "67890"]
92-
sleep 500ms
91+
print "Fetching product orders %s" with ["12345", "67890"];
92+
sleep 500ms;
9393
}
9494
}
9595
9696
service frontend {
9797
method main_page {
98-
print "Main page"
99-
call products.get_products
98+
print "Main page";
99+
call products.get_products;
100100
}
101101
102102
loop {
103-
call main_page
103+
call main_page;
104104
}
105105
}
106106
```
@@ -110,49 +110,49 @@ service frontend {
110110
```
111111
service products {
112112
method get_products {
113-
print "Fetching product orders %s" with ["12345", "67890"]
114-
sleep 500ms
113+
print "Fetching product orders %s" with ["12345", "67890"];
114+
sleep 500ms;
115115
}
116116
}
117117
118118
service features {
119119
method is_enabled {
120-
print "Check if feature is enabled %s" with ["login", "upload", "create"]
121-
sleep 1000ms
120+
print "Check if feature is enabled %s" with ["login", "upload", "create"];
121+
sleep 1000ms;
122122
}
123123
}
124124
125125
service frontend {
126126
method login {
127-
print "Main page"
128-
call features.is_enabled
127+
print "Main page";
128+
call features.is_enabled;
129129
}
130130
131131
loop {
132-
call login
132+
call login;
133133
}
134134
}
135135
136136
service analytics {
137137
method main_page {
138-
print "Main page"
139-
call products.get_products
138+
print "Main page";
139+
call products.get_products;
140140
}
141141
142142
loop {
143-
call main_page
143+
call main_page;
144144
}
145145
}
146146
147147
148148
service frontend_b {
149149
method main_page {
150-
print "Main page"
151-
call products.get_products
150+
print "Main page";
151+
call products.get_products;
152152
}
153153
154154
loop {
155-
call main_page
155+
call main_page;
156156
}
157157
}
158158
```
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
service products {
22
method get_products {
3-
print "Fetching product orders %s" with ["12345", "67890"]
4-
sleep 500ms
3+
print "Fetching product orders %s" with ["12345", "67890"];
4+
sleep 500ms;
55
}
66
}
77

88
service features {
99
method is_enabled {
10-
print "Check if feature is enabled %s" with ["login", "upload", "create"]
11-
sleep 1000ms
10+
print "Check if feature is enabled %s" with ["login", "upload", "create"];
11+
sleep 1000ms;
1212
}
1313
}
1414

1515
service frontend {
1616
method login {
17-
print "Main page"
18-
call features.is_enabled
17+
print "Main page";
18+
call features.is_enabled;
1919
}
2020

2121
loop {
22-
call login
22+
call login;
2323
}
2424
}
2525

2626
service analytics {
2727
method main_page {
28-
print "Main page"
29-
call products.get_products
28+
print "Main page";
29+
call products.get_products;
3030
}
3131

3232
loop {
33-
call main_page
33+
call main_page;
3434
}
3535
}
3636

3737

3838
service frontend_b {
3939
method main_page {
40-
print "Main page"
41-
call products.get_products
40+
print "Main page";
41+
call products.get_products;
4242
}
4343

4444
loop {
45-
call main_page
45+
call main_page;
4646
}
4747
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
service payments {
22
method charge {
3-
print "Processing payment for order %s" with ["12345", "67890"]
4-
sleep 500ms
5-
stderr "Processing payment for order %s" with ["BANANAS AND APPLES"]
3+
print "Processing payment for order %s" with ["12345", "67890"];
4+
sleep 500ms;
5+
stderr "Processing payment for order %s" with ["BANANAS AND APPLES"];
66
}
77

88
loop {
9-
call charge
9+
call charge;
1010
}
1111
}

src/code_gen/mod.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ mod tests {
156156
"
157157
service frontend {
158158
method main_page {
159-
print \"Main page\"
159+
print \"Main page\";
160160
}
161161
}
162162
"
@@ -167,8 +167,8 @@ mod tests {
167167
"
168168
service frontend {
169169
method main_page {
170-
print \"Main page\"
171-
sleep 1000ms
170+
print \"Main page\";
171+
sleep 1000ms;
172172
}
173173
}
174174
"
@@ -179,12 +179,12 @@ mod tests {
179179
"
180180
service frontend {
181181
method main_page {
182-
print \"Main page\"
183-
sleep 1000ms
182+
print \"Main page\";
183+
sleep 1000ms;
184184
}
185185
186186
loop {
187-
call main_page
187+
call main_page;
188188
}
189189
}
190190
"
@@ -195,8 +195,8 @@ mod tests {
195195
"
196196
service products {
197197
method get_products {
198-
print \"Fetching product orders %s\" with [\"12345\", \"67890\"]
199-
sleep 500ms
198+
print \"Fetching product orders %s\" with [\"12345\", \"67890\"];
199+
sleep 500ms;
200200
}
201201
}
202202
"
@@ -207,8 +207,8 @@ mod tests {
207207
"
208208
service products {
209209
method get_products {
210-
stderr \"Fetching product orders %s\" with [\"12345\", \"67890\"]
211-
sleep 500ms
210+
stderr \"Fetching product orders %s\" with [\"12345\", \"67890\"];
211+
sleep 500ms;
212212
}
213213
}
214214
"
@@ -219,8 +219,8 @@ mod tests {
219219
"
220220
service products {
221221
method get_products {
222-
print \"Fetching product orders %s\" with []
223-
sleep 500ms
222+
print \"Fetching product orders %s\" with [];
223+
sleep 500ms;
224224
}
225225
}
226226
"
@@ -231,8 +231,8 @@ mod tests {
231231
"
232232
service products {
233233
method get_products {
234-
stderr \"Fetching product orders %s\" with []
235-
sleep 500ms
234+
stderr \"Fetching product orders %s\" with [];
235+
sleep 500ms;
236236
}
237237
}
238238
"
@@ -243,18 +243,18 @@ mod tests {
243243
"
244244
service products {
245245
method get_products {
246-
print \"Fetching product orders %s\" with [\"12345\", \"67890\"]
247-
sleep 500ms
246+
print \"Fetching product orders %s\" with [\"12345\", \"67890\"];
247+
sleep 500ms;
248248
}
249249
}
250250
251251
service frontend {
252252
method main_page {
253-
call products.get_products
253+
call products.get_products;
254254
}
255255
256256
loop {
257-
call main_page
257+
call main_page;
258258
}
259259
}
260260
"
@@ -265,14 +265,14 @@ mod tests {
265265
"
266266
service products {
267267
method get_products {
268-
print \"Fetching product orders %s\" with [\"12345\", \"67890\"]
269-
sleep 500ms
268+
print \"Fetching product orders %s\" with [\"12345\", \"67890\"];
269+
sleep 500ms;
270270
}
271271
}
272272
273273
service frontend {
274274
method main_page {
275-
call products.get_products
275+
call products.get_products;
276276
}
277277
}
278278
"

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct Args {
4040
}
4141

4242
#[tokio::main]
43-
async fn main() -> Result<(), Box<dyn std::error::Error>> {
43+
async fn main() -> anyhow::Result<()> {
4444
let args = Args::parse();
4545
let mut logger_provider = None;
4646

@@ -72,7 +72,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
7272
Ok(())
7373
}
7474

75-
fn print_code(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
75+
fn print_code(args: &Args) -> anyhow::Result<()> {
7676
let file_path = args.file_path.clone();
7777
let file_content = fs::read_to_string(&file_path)?;
7878
let ast = parser::parse(&file_content)?;
@@ -85,7 +85,7 @@ fn print_code(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
8585
Ok(())
8686
}
8787

88-
async fn execute_code(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
88+
async fn execute_code(args: &Args) -> anyhow::Result<()> {
8989
let file_path = args.file_path.clone();
9090
let file_content = fs::read_to_string(&file_path)?;
9191
let ast = parser::parse(&file_content)?;

src/otel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use tracing_subscriber::prelude::*;
1010
pub fn setup_otlp(
1111
endpoint: &str,
1212
service_name: &str,
13-
) -> Result<SdkLoggerProvider, Box<dyn std::error::Error>> {
13+
) -> Result<SdkLoggerProvider, opentelemetry_otlp::ExporterBuildError> {
1414
let mut metadata = MetadataMap::new();
1515
metadata.insert(SERVICE_NAME, service_name.parse().unwrap());
1616
let exporter = LogExporter::builder()

0 commit comments

Comments
 (0)