diff --git a/godoc/spec.go b/godoc/spec.go index 6d6b9c23a2..9ec94278db 100644 --- a/godoc/spec.go +++ b/godoc/spec.go @@ -74,7 +74,7 @@ func (p *ebnfParser) parseTerm() bool { case scanner.Ident: p.parseIdentifier(false) - case scanner.String: + case scanner.String, scanner.RawString: p.next() const ellipsis = '…' // U+2026, the horizontal ellipsis character if p.tok == ellipsis { diff --git a/godoc/spec_test.go b/godoc/spec_test.go new file mode 100644 index 0000000000..c016516877 --- /dev/null +++ b/godoc/spec_test.go @@ -0,0 +1,22 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package godoc + +import ( + "bytes" + "strings" + "testing" +) + +func TestParseEBNFString(t *testing.T) { + var p ebnfParser + var buf bytes.Buffer + src := []byte("octal_byte_value = `\\` octal_digit octal_digit octal_digit .") + p.parse(&buf, src) + + if strings.Contains(buf.String(), "error") { + t.Error(buf.String()) + } +}