diff options
| author | Yuval Adam <_@yuv.al> | 2018-03-11 20:27:41 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2018-03-11 20:27:45 +0200 |
| commit | 983eeeeccf8e8e5bd93b03e7db59248a726ab49e (patch) | |
| tree | c71ebad9ad498b1fd9c0956432ec177fc0bb0df6 | |
| parent | 9957900e184ab32f6aec70f3fc16f4db799a43fd (diff) | |
Add basic support for color parsing, placeholder only for now (no spec)
| -rw-r--r-- | viewstate/parse.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/viewstate/parse.py b/viewstate/parse.py index b77ba34..7055ab6 100644 --- a/viewstate/parse.py +++ b/viewstate/parse.py @@ -39,6 +39,12 @@ def parse_enum(b): final = 'Enum: {}, val: {}'.format(enum, val) return final, remain +def parse_color(b): + # No specification for color parsing, we're assuming it's just two bytes + # One example we have is that `\n\x91\x01` is parsed as `Color: Color [Salmon]` + # Originally reported in https://github.com/yuvadm/viewstate/issues/2 + return 'Color: unknown', b[2:] + def parse_pair(b): first, remain = parse(b) second, remain = parse(remain) @@ -125,6 +131,8 @@ def parse(b): return parse_string(b[1:]) elif b[0] == 0x10: return parse_triplet(b[1:]) + elif b[0] == 0x0a: + return parse_color(b[1:]) elif b[0] == 0x0b: return parse_enum(b[1:]) elif b[0] == 0x0f: @@ -134,6 +142,7 @@ def parse(b): elif b[0] == 0x15: return parse_str_array(b[1:]) elif b[0] == 0x16: + print('parse array', b[:20]) return parse_array(b[1:]) elif b[0] == 0x18: return parse_dict(b[1:]) |
