diff options
| author | Baozeng Ding <baozeng.dbz@alibaba-inc.com> | 2016-08-08 21:32:48 +0800 |
|---|---|---|
| committer | Baozeng Ding <baozeng.dbz@alibaba-inc.com> | 2016-08-10 13:43:15 +0800 |
| commit | 7db2edcb3364ef5415e992a18c02c73bba6cdd29 (patch) | |
| tree | cec8efa9f607da32d04b57f31da78b61e9e52ac4 /sysgen/parser.go | |
| parent | 39350d876d19ab0937511d969844fb9a559dfd8d (diff) | |
sys/sysgen/prog: support ranged int
This commit supports inclusive ranged int, like foo int32[-10~10], which will
generate random integer between -10 and 10. In future we will support more than
one range, like int32[0, -5~10, 50, 100~200]
Diffstat (limited to 'sysgen/parser.go')
| -rw-r--r-- | sysgen/parser.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sysgen/parser.go b/sysgen/parser.go index 7d322eec4..c0feca7ac 100644 --- a/sysgen/parser.go +++ b/sysgen/parser.go @@ -1,4 +1,4 @@ -// Copyright 2015 syzkaller project authors. All rights reserved. +// Copyright 2015/2016 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. package main @@ -81,7 +81,8 @@ func (p *Parser) Ident() string { (p.s[p.i] >= 'a' && p.s[p.i] <= 'z' || p.s[p.i] >= 'A' && p.s[p.i] <= 'Z' || p.s[p.i] >= '0' && p.s[p.i] <= '9' || - p.s[p.i] == '_' || p.s[p.i] == '$') { // $ is for n-way syscalls (like ptrace$peek) + p.s[p.i] == '_' || p.s[p.i] == '$' || // $ is for n-way syscalls (like ptrace$peek) + p.s[p.i] == '-' || p.s[p.i] == '~') { // ~ is for ranged int (like int32[-3~10]) p.i++ } if start == p.i { |
