Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
og-rek
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
og-rek
Commits
50a8c0f4
Commit
50a8c0f4
authored
Nov 23, 2013
by
Kamil Kisiel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up errors a bit.
parent
3f42399c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
18 deletions
+29
-18
ogórek.go
ogórek.go
+29
-18
No files found.
ogórek.go
View file @
50a8c0f4
...
...
@@ -78,10 +78,18 @@ const (
opLong4
=
'\x8b'
// push really big long
)
var
ErrNotImplemented
=
errors
.
New
(
"unimplemented opcode"
)
var
ErrUnknownOptocde
=
errors
.
New
(
"unknown opcode"
)
var
errNotImplemented
=
errors
.
New
(
"unimplemented opcode"
)
var
ErrInvalidPickleVersion
=
errors
.
New
(
"invalid pickle version"
)
type
OpcodeError
struct
{
Key
byte
Pos
int
}
func
(
e
OpcodeError
)
Error
()
string
{
return
fmt
.
Sprintf
(
"Unknown opcode %d (%c) at position %d: %q"
,
e
.
Key
,
e
.
Key
,
e
.
Pos
,
e
.
Key
)
}
// special marker
type
mark
struct
{}
...
...
@@ -204,10 +212,13 @@ func (d Decoder) Decode() (interface{}, error) {
}
default
:
return
nil
,
fmt
.
Errorf
(
"Unknown opcode %d (%c) at isns %d: %q"
,
key
,
key
,
insn
,
key
)
return
nil
,
OpcodeError
{
key
,
insn
}
}
if
err
!=
nil
{
if
err
==
errNotImplemented
{
return
nil
,
OpcodeError
{
key
,
insn
}
}
return
nil
,
err
}
}
...
...
@@ -246,7 +257,7 @@ func (d *Decoder) pop() interface{} {
// Discard the stack through to the topmost marker
func
(
d
*
Decoder
)
popMark
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
// Duplicate the top stack item
...
...
@@ -323,7 +334,7 @@ func (d *Decoder) loadLong() error {
// Push a 2-byte unsigned int
func
(
d
*
Decoder
)
loadBinInt2
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
// Push None
...
...
@@ -334,16 +345,16 @@ func (d *Decoder) loadNone() error {
// Push a persistent object id
func
(
d
*
Decoder
)
loadPersid
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
// Push a persistent object id from items on the stack
func
(
d
*
Decoder
)
loadBinPersid
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
reduce
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
decodeStringEscape
(
b
[]
byte
)
string
{
...
...
@@ -377,7 +388,7 @@ func (d *Decoder) loadString() error {
}
func
(
d
*
Decoder
)
loadBinString
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
loadShortBinString
()
error
{
...
...
@@ -418,7 +429,7 @@ func (d *Decoder) loadUnicode() error {
}
func
(
d
*
Decoder
)
loadBinUnicode
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
loadAppend
()
error
{
...
...
@@ -435,11 +446,11 @@ func (d *Decoder) loadAppend() error {
}
func
(
d
*
Decoder
)
build
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
global
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
loadDict
()
error
{
...
...
@@ -476,19 +487,19 @@ func (d *Decoder) loadAppends() error {
}
func
(
d
*
Decoder
)
get
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
binGet
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
inst
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
longBinGet
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
loadList
()
error
{
...
...
@@ -506,7 +517,7 @@ func (d *Decoder) loadTuple() error {
}
func
(
d
*
Decoder
)
obj
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
loadPut
()
error
{
...
...
@@ -525,7 +536,7 @@ func (d *Decoder) binPut() error {
}
func
(
d
*
Decoder
)
longBinPut
()
error
{
return
E
rrNotImplemented
return
e
rrNotImplemented
}
func
(
d
*
Decoder
)
loadSetItem
()
error
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment