Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
299b50a0
Commit
299b50a0
authored
Jun 21, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support serpent lang
parent
931ae0f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
script.go
ethutil/script.go
+22
-10
No files found.
ethutil/script.go
View file @
299b50a0
...
@@ -3,23 +3,35 @@ package ethutil
...
@@ -3,23 +3,35 @@ package ethutil
import
(
import
(
"fmt"
"fmt"
"github.com/obscuren/mutan"
"github.com/obscuren/mutan"
"github.com/obscuren/serpent-go"
"strings"
"strings"
)
)
// General compile function
// General compile function
func
Compile
(
script
string
)
([]
byte
,
error
)
{
func
Compile
(
script
string
)
(
ret
[]
byte
,
err
error
)
{
byteCode
,
errors
:=
mutan
.
Compile
(
strings
.
NewReader
(
script
),
false
)
c
:=
strings
.
Split
(
script
,
"
\n
"
)[
0
]
if
len
(
errors
)
>
0
{
var
errs
string
if
c
==
"#!serpent"
{
for
_
,
er
:=
range
errors
{
byteCode
,
err
:=
serpent
.
Compile
(
script
)
if
er
!=
nil
{
if
err
!=
nil
{
errs
+=
er
.
Error
()
return
nil
,
err
}
return
byteCode
,
nil
}
else
{
byteCode
,
errors
:=
mutan
.
Compile
(
strings
.
NewReader
(
script
),
false
)
if
len
(
errors
)
>
0
{
var
errs
string
for
_
,
er
:=
range
errors
{
if
er
!=
nil
{
errs
+=
er
.
Error
()
}
}
}
return
nil
,
fmt
.
Errorf
(
"%v"
,
errs
)
}
}
return
nil
,
fmt
.
Errorf
(
"%v"
,
errs
)
}
return
byteCode
,
nil
return
byteCode
,
nil
}
}
}
func
CompileScript
(
script
string
)
([]
byte
,
[]
byte
,
error
)
{
func
CompileScript
(
script
string
)
([]
byte
,
[]
byte
,
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