aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/sqlvm/cmd
diff options
context:
space:
mode:
authorTing-Wei Lan <tingwei.lan@cobinhood.com>2019-01-28 18:03:53 +0800
committerJhih-Ming Huang <jm.huang@cobinhood.com>2019-05-06 10:44:03 +0800
commit27464515201f163bd74580d729ff03bbae2d84c9 (patch)
tree58527922cd42bf94e6cdeee23f66a6ac7cbcb547 /core/vm/sqlvm/cmd
parentf73b9db5523ec173d738f96a5127061ad8b37164 (diff)
downloaddexon-27464515201f163bd74580d729ff03bbae2d84c9.tar
dexon-27464515201f163bd74580d729ff03bbae2d84c9.tar.gz
dexon-27464515201f163bd74580d729ff03bbae2d84c9.tar.bz2
dexon-27464515201f163bd74580d729ff03bbae2d84c9.tar.lz
dexon-27464515201f163bd74580d729ff03bbae2d84c9.tar.xz
dexon-27464515201f163bd74580d729ff03bbae2d84c9.tar.zst
dexon-27464515201f163bd74580d729ff03bbae2d84c9.zip
core: vm: sqlvm: process non-UTF-8 input and escape sequences
Our parser is able to process queries with invalid UTF-8, provided that it is compatible with ASCII. Since doing so requires encoding the input before passing to pigeon, Parse* functions generated by pigeon are unexported because they should not be used directly. Escape sequences in string literals and identifiers are now recognized. In addition to escape sequences supported by solidity, we support \U similar to the one supported by Go to allow users to specify non-BMP Unicode code point without using multiple \x escapes. AST printer is modified to quote non-printable characters in strings to prevent control characters from messing up the terminal.
Diffstat (limited to 'core/vm/sqlvm/cmd')
-rw-r--r--core/vm/sqlvm/cmd/ast-printer/main.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/vm/sqlvm/cmd/ast-printer/main.go b/core/vm/sqlvm/cmd/ast-printer/main.go
index 9cdcc6dd6..7b4251fa1 100644
--- a/core/vm/sqlvm/cmd/ast-printer/main.go
+++ b/core/vm/sqlvm/cmd/ast-printer/main.go
@@ -14,10 +14,11 @@ func main() {
flag.Parse()
- n, err := parser.ParseString(flag.Arg(0))
+ n, err := parser.Parse([]byte(flag.Arg(0)))
fmt.Printf("detail: %t\n", detail)
- fmt.Printf("err:\n%+v\n", err)
if err == nil {
ast.PrintAST(n, "", detail)
+ } else {
+ fmt.Printf("err:\n%+v\n", err)
}
}