Parsing for block and tx

This commit is contained in:
obscuren
2014-01-03 13:40:38 +01:00
parent 055407c835
commit 9581faf5fd
3 changed files with 8 additions and 5 deletions

View File

@ -11,8 +11,11 @@ import (
// Op codes
var OpCodes = map[string]string{
"STOP": "0",
"PSH": "30", // 0x30
/*
"PUSH": "48", // 0x30
"POP": "49", // 0x31
"LOAD": "54", // 0x36
/* OLD VM OPCODES
"ADD": "16", // 0x10
"SUB": "17", // 0x11
"MUL": "18", // 0x12
@ -57,7 +60,7 @@ var OpCodes = map[string]string{
func CompileInstr(s string) (string, error) {
tokens := strings.Split(s, " ")
if OpCodes[tokens[0]] == "" {
return "", errors.New(fmt.Sprintf("OP not found: %s", tokens[0]))
return s, errors.New(fmt.Sprintf("OP not found: %s", tokens[0]))
}
code := OpCodes[tokens[0]] // Replace op codes with the proper numerical equivalent