def reduce_BCONST(self, bytes_tok): val = bytes_tok.val match = lexutils.VALID_BYTES_RE.match(val) if not match: raise EdgeQLSyntaxError(f"invalid bytes literal", context=bytes_tok.context) if match.group('err_esc'): raise EdgeQLSyntaxError( f"invalid bytes literal: invalid escape sequence " f"'{match.group('err_esc')}'", context=bytes_tok.context) if match.group('err'): raise EdgeQLSyntaxError( f"invalid bytes literal: character '{match.group('err')}' " f"is outside of the ASCII range", context=bytes_tok.context) self.val = qlast.BytesConstant(value=match.group('body'), quote=match.group('BQ'))
def reduce_BCONST(self, bytes_tok): self.val = qlast.BytesConstant(value=bytes_tok.clean_value)