arg.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package knowledge
  2. var Args = map[string]int{
  3. "(*encoding/json.Decoder).Decode.v": 0,
  4. "(*encoding/json.Encoder).Encode.v": 0,
  5. "(*encoding/xml.Decoder).Decode.v": 0,
  6. "(*encoding/xml.Encoder).Encode.v": 0,
  7. "(*sync.Pool).Put.x": 0,
  8. "(*text/template.Template).Parse.text": 0,
  9. "(io.Seeker).Seek.offset": 0,
  10. "(time.Time).Sub.u": 0,
  11. "append.elems": 1,
  12. "append.slice": 0,
  13. "bytes.Equal.a": 0,
  14. "bytes.Equal.b": 1,
  15. "encoding/binary.Write.data": 2,
  16. "errors.New.text": 0,
  17. "fmt.Fprintf.format": 1,
  18. "fmt.Printf.format": 0,
  19. "fmt.Sprintf.a[0]": 1,
  20. "fmt.Sprintf.format": 0,
  21. "json.Marshal.v": 0,
  22. "json.Unmarshal.v": 1,
  23. "len.v": 0,
  24. "make.size[0]": 1,
  25. "make.size[1]": 2,
  26. "make.t": 0,
  27. "net/url.Parse.rawurl": 0,
  28. "os.OpenFile.flag": 1,
  29. "os/exec.Command.name": 0,
  30. "os/signal.Notify.c": 0,
  31. "regexp.Compile.expr": 0,
  32. "runtime.SetFinalizer.finalizer": 1,
  33. "runtime.SetFinalizer.obj": 0,
  34. "sort.Sort.data": 0,
  35. "strconv.AppendFloat.bitSize": 4,
  36. "strconv.AppendFloat.fmt": 2,
  37. "strconv.AppendInt.base": 2,
  38. "strconv.AppendUint.base": 2,
  39. "strconv.FormatComplex.bitSize": 3,
  40. "strconv.FormatComplex.fmt": 1,
  41. "strconv.FormatFloat.bitSize": 3,
  42. "strconv.FormatFloat.fmt": 1,
  43. "strconv.FormatInt.base": 1,
  44. "strconv.FormatUint.base": 1,
  45. "strconv.ParseComplex.bitSize": 1,
  46. "strconv.ParseFloat.bitSize": 1,
  47. "strconv.ParseInt.base": 1,
  48. "strconv.ParseInt.bitSize": 2,
  49. "strconv.ParseUint.base": 1,
  50. "strconv.ParseUint.bitSize": 2,
  51. "time.Parse.layout": 0,
  52. "time.Sleep.d": 0,
  53. "xml.Marshal.v": 0,
  54. "xml.Unmarshal.v": 1,
  55. }
  56. // Arg turns the name of an argument into an argument index.
  57. // Indices are zero-based and method receivers do not count as arguments.
  58. //
  59. // Arg refers to a manually compiled mapping (see the Args variable.)
  60. // Modify the knowledge package to add new arguments.
  61. func Arg(name string) int {
  62. n, ok := Args[name]
  63. if !ok {
  64. panic("unknown argument " + name)
  65. }
  66. return n
  67. }