File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
- use bitcoin:: blockdata:: opcodes:: Opcode ;
1
+ use bitcoin:: { blockdata:: opcodes:: Opcode , opcodes :: OP_RESERVED } ;
2
2
use proc_macro2:: {
3
3
Delimiter , Span , TokenStream ,
4
4
TokenTree :: { self , * } ,
@@ -49,7 +49,12 @@ pub fn parse(tokens: TokenStream) -> Vec<(Syntax, Span)> {
49
49
syntax. push ( match ( & token, token_str. as_ref ( ) ) {
50
50
// Wrap for loops such that they return a Vec<ScriptBuf>
51
51
( Ident ( _) , ident_str) if ident_str == "for" => parse_for_loop ( token, & mut tokens) ,
52
+ // Wrap if-else statements such that they return a Vec<ScriptBuf>
52
53
( Ident ( _) , ident_str) if ident_str == "if" => parse_if ( token, & mut tokens) ,
54
+ // Replace DEBUG with OP_RESERVED
55
+ ( Ident ( _) , ident_str) if ident_str == "DEBUG" => {
56
+ ( Syntax :: Opcode ( OP_RESERVED ) , token. span ( ) )
57
+ }
53
58
54
59
// identifier, look up opcode
55
60
( Ident ( _) , _) => {
@@ -112,8 +117,7 @@ where
112
117
} ) ;
113
118
114
119
match tokens. peek ( ) {
115
- Some ( else_token) if else_token. to_string ( ) . as_str ( ) == "else" =>
116
- continue ,
120
+ Some ( else_token) if else_token. to_string ( ) . as_str ( ) == "else" => continue ,
117
121
_ => break ,
118
122
}
119
123
}
You can’t perform that action at this time.
0 commit comments