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