Skip to content

Commit 7a34271

Browse files
committed
Fix: Ignore non-brace groups in parse_for_loop
1 parent 9cab80a commit 7a34271

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/parse.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use bitcoin::blockdata::opcodes::Opcode;
22
use proc_macro2::{
3+
Delimiter,
34
Span, TokenStream,
45
TokenTree::{self, *},
56
};
@@ -99,7 +100,7 @@ where
99100

100101
while let Some(for_token) = tokens.next() {
101102
match for_token {
102-
Group(block) => {
103+
Group(block) if block.delimiter() == Delimiter::Brace => {
103104
let inner_block = block.stream();
104105
escape.extend(quote! {
105106
{

tests/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn test_for_loop() {
9191
define_pushable!();
9292
let script = bitcoin_script! {
9393
for i in 0..3 {
94-
for k in 0..3 {
94+
for k in 0..(3 as u32) {
9595
OP_ADD
9696
{ i }
9797
{ k }

0 commit comments

Comments
 (0)