ebnf: support raw string tokens as used by EBNF in the Go spec

The EBNF in the Go specification uses raw strings for tokens that
contain double quotes or backslashes. This change adds support
for raw string tokens to the ebnf package, so that go_spec.html
is validated successfully.

This change also re-enables the ebnflint test, which validates the
Go spec.

Fixes golang/go#37290

Change-Id: Idbcbecd1af1632c296a8f5f2ceceec20af288d32
GitHub-Last-Rev: 537e1f364d541293ca41369bb4efa623a2ae0b93
GitHub-Pull-Request: golang/exp#10
Reviewed-on: https://go-review.googlesource.com/c/exp/+/220017
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/ebnf/ebnf_test.go b/ebnf/ebnf_test.go
index 8cfd6b9..8219986 100644
--- a/ebnf/ebnf_test.go
+++ b/ebnf/ebnf_test.go
@@ -30,6 +30,8 @@
 	 La = "a" .
 	 Ti = ti .
 	 ti = "b" .`,
+
+	"Program = `\"` .",
 }
 
 var badGrammars = []string{
diff --git a/ebnf/parser.go b/ebnf/parser.go
index 7a7e3cc..fd676bc 100644
--- a/ebnf/parser.go
+++ b/ebnf/parser.go
@@ -60,7 +60,7 @@
 func (p *parser) parseToken() *Token {
 	pos := p.pos
 	value := ""
-	if p.tok == scanner.String {
+	if p.tok == scanner.String || p.tok == scanner.RawString {
 		value, _ = strconv.Unquote(p.lit)
 		// Unquote may fail with an error, but only if the scanner found
 		// an illegal string in the first place. In this case the error
@@ -80,7 +80,7 @@
 	case scanner.Ident:
 		x = p.parseIdentifier()
 
-	case scanner.String:
+	case scanner.String, scanner.RawString:
 		tok := p.parseToken()
 		x = tok
 		const ellipsis = '…' // U+2026, the horizontal ellipsis character
diff --git a/ebnflint/ebnflint_test.go b/ebnflint/ebnflint_test.go
index 700fbc1..875dbc1 100644
--- a/ebnflint/ebnflint_test.go
+++ b/ebnflint/ebnflint_test.go
@@ -2,9 +2,6 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Doesn't work from Go 1.11 on, so...
-// +build !go1.11
-
 package main
 
 import (