OP_0 can be an OP but also an empty string, figure this out contextually in parser

This commit is contained in:
Lex Berezhny 2019-03-18 18:13:49 -04:00
parent 61a254f580
commit 80b65ae7e7

View file

@ -158,6 +158,8 @@ class Parser:
while self.token_index < len(self.tokens) and self.opcode_index < len(self.opcodes): while self.token_index < len(self.tokens) and self.opcode_index < len(self.opcodes):
token = self.tokens[self.token_index] token = self.tokens[self.token_index]
opcode = self.opcodes[self.opcode_index] opcode = self.opcodes[self.opcode_index]
if token.value == 0 and isinstance(opcode, PUSH_SINGLE):
token = DataToken(b'')
if isinstance(token, DataToken): if isinstance(token, DataToken):
if isinstance(opcode, (PUSH_SINGLE, PUSH_INTEGER, PUSH_SUBSCRIPT)): if isinstance(opcode, (PUSH_SINGLE, PUSH_INTEGER, PUSH_SUBSCRIPT)):
self.push_single(opcode, token.value) self.push_single(opcode, token.value)