mksyntaxgo 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. set -e
  3. out=$GOROOT/src/regexp/syntax/doc.go
  4. cp syntax.txt $out
  5. sam -d $out <<'!'
  6. ,x g/NOT SUPPORTED/d
  7. /^Unicode character class/,$d
  8. ,s/[«»]//g
  9. ,x g/^Possessive repetitions:/d
  10. ,x g/\\C/d
  11. ,x g/Flag syntax/d
  12. ,s/.=(true|false)/flag &/g
  13. ,s/^Flags:/ Flag syntax is xyz (set) or -xyz (clear) or xy-z (set xy, clear z). The flags are:\n/
  14. ,s/\n\n\n+/\n\n/g
  15. ,x/(^.* .*\n)+/ | awk -F' ' '{printf(" %-14s %s\n", $1, $2)}'
  16. 1,2c
  17. // Copyright 2012 The Go Authors. All rights reserved.
  18. // Use of this source code is governed by a BSD-style
  19. // license that can be found in the LICENSE file.
  20. // DO NOT EDIT. This file is generated by mksyntaxgo from the RE2 distribution.
  21. /*
  22. Package syntax parses regular expressions into parse trees and compiles
  23. parse trees into programs. Most clients of regular expressions will use the
  24. facilities of package regexp (such as Compile and Match) instead of this package.
  25. Syntax
  26. The regular expression syntax understood by this package when parsing with the Perl flag is as follows.
  27. Parts of the syntax can be disabled by passing alternate flags to Parse.
  28. .
  29. $a
  30. Unicode character classes are those in unicode.Categories and unicode.Scripts.
  31. */
  32. package syntax
  33. .
  34. w
  35. q
  36. !