LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 // This file contains the mechanism to "linkify" html source | 7 // This file contains the mechanism to "linkify" html source |
8 // text containing EBNF sections (as found in go_spec.html). | 8 // text containing EBNF sections (as found in go_spec.html). |
9 // The result is the input source text with the EBNF sections | 9 // The result is the input source text with the EBNF sections |
10 // modified such that identifiers are linked to the respective | 10 // modified such that identifiers are linked to the respective |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 // j: end of EBNF text (or end of source) | 163 // j: end of EBNF text (or end of source) |
164 j := bytes.Index(src[i:], closeTag) // close marker | 164 j := bytes.Index(src[i:], closeTag) // close marker |
165 if j < 0 { | 165 if j < 0 { |
166 j = len(src) - i | 166 j = len(src) - i |
167 } | 167 } |
168 j += i | 168 j += i |
169 | 169 |
170 // write text before EBNF | 170 // write text before EBNF |
171 out.Write(src[0:i]) | 171 out.Write(src[0:i]) |
172 » » // parse and write EBNF | 172 » » // process EBNF |
173 var p ebnfParser | 173 var p ebnfParser |
174 p.parse(out, src[i:j]) | 174 p.parse(out, src[i:j]) |
175 | 175 |
176 // advance | 176 // advance |
177 src = src[j:] | 177 src = src[j:] |
178 } | 178 } |
179 } | 179 } |
LEFT | RIGHT |