diff options
author | Alban Gruin <alban.gruin@gmail.com> | 2018-03-01 12:19:07 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-03-01 13:36:49 -0800 |
commit | 1dbf0c0ad6cabfc35aa1896b4d94f4ee811ba803 (patch) | |
tree | b987310dcd5bda9990ccb1c76dcd327a494048c1 /t/t4018/golang-complex-function | |
parent | Sixth batch for 2.17 (diff) | |
download | tgif-1dbf0c0ad6cabfc35aa1896b4d94f4ee811ba803.tar.xz |
userdiff: add built-in pattern for golang
This adds xfuncname and word_regex patterns for golang, a quite
popular programming language. It also includes test cases for the
xfuncname regex (t4018) and updated documentation.
The xfuncname regex finds functions, structs and interfaces. Although
the Go language prohibits the opening brace from being on its own
line, the regex does not makes it mandatory, to be able to match
`func` statements like this:
func foo(bar int,
baz int) {
}
This is covered by the test case t4018/golang-long-func.
The word_regex pattern finds identifiers, integers, floats, complex
numbers and operators, according to the go specification.
Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4018/golang-complex-function')
-rw-r--r-- | t/t4018/golang-complex-function | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t4018/golang-complex-function b/t/t4018/golang-complex-function new file mode 100644 index 0000000000..e057dcefed --- /dev/null +++ b/t/t4018/golang-complex-function @@ -0,0 +1,8 @@ +type Test struct { + a Type +} + +func (t *Test) RIGHT(a Type) (Type, error) { + t.a = a + return ChangeMe, nil +} |