File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,14 @@ where
124
124
* Predicate := TermArg => Integer (0 = false, >0 = true)
125
125
* DefElse := Nothing | <0xa1 PkgLength TermList>
126
126
*/
127
+
128
+ let maybe_else_opcode = |input, context| match opcode ( opcode:: DEF_ELSE_OP ) . parse ( input, context) {
129
+ Err ( ( x, y, Propagate :: Err ( AmlError :: UnexpectedEndOfStream ) ) ) => {
130
+ Err ( ( x, y, Propagate :: Err ( AmlError :: WrongParser ) ) )
131
+ }
132
+ r => r,
133
+ } ;
134
+
127
135
opcode ( opcode:: DEF_IF_ELSE_OP )
128
136
. then ( comment_scope (
129
137
DebugVerbosity :: Scopes ,
@@ -135,11 +143,11 @@ where
135
143
. map ( move |then_branch| Ok ( ( predicate_arg. as_bool ( ) ?, then_branch) ) )
136
144
} )
137
145
. then ( choice ! (
138
- opcode ( opcode :: DEF_ELSE_OP )
146
+ maybe_else_opcode
139
147
. then( comment_scope(
140
148
DebugVerbosity :: AllScopes ,
141
149
"DefElse" ,
142
- pkg_length( ) . feed( |length| take_to_end_of_pkglength( length) )
150
+ pkg_length( ) . feed( |length| take_to_end_of_pkglength( length) ) ,
143
151
) )
144
152
. map( |( ( ) , else_branch) : ( ( ) , & [ u8 ] ) | Ok ( else_branch) ) ,
145
153
// TODO: can this be `id().map(&[])`?
You can’t perform that action at this time.
0 commit comments