LEFT | RIGHT |
(no file at all) | |
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 // This file contains the infrastructure to create an | 5 // This file contains the infrastructure to create an |
6 // identifier and full-text index for a set of Go files. | 6 // identifier and full-text index for a set of Go files. |
7 // | 7 // |
8 // Algorithm for identifier index: | 8 // Algorithm for identifier index: |
9 // - traverse all .go files of the file tree specified by root | 9 // - traverse all .go files of the file tree specified by root |
10 // - for each identifier (word) encountered, collect all occurrences (spots) | 10 // - for each identifier (word) encountered, collect all occurrences (spots) |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 // Design note: Using an explicit white list of permitted files for indexing | 650 // Design note: Using an explicit white list of permitted files for indexing |
651 // makes sure that the important files are included and massively reduces the | 651 // makes sure that the important files are included and massively reduces the |
652 // number of files to index. The advantage over a blacklist is that unexpected | 652 // number of files to index. The advantage over a blacklist is that unexpected |
653 // (non-blacklisted) files won't suddenly explode the index. | 653 // (non-blacklisted) files won't suddenly explode the index. |
654 | 654 |
655 // Files are whitelisted if they have a file name or extension | 655 // Files are whitelisted if they have a file name or extension |
656 // present as key in whitelisted. | 656 // present as key in whitelisted. |
657 var whitelisted = map[string]bool{ | 657 var whitelisted = map[string]bool{ |
658 ".bash": true, | 658 ".bash": true, |
659 ".c": true, | 659 ".c": true, |
| 660 ".cc": true, |
| 661 ".cpp": true, |
| 662 ".cxx": true, |
660 ".css": true, | 663 ".css": true, |
661 ".go": true, | 664 ".go": true, |
662 ".goc": true, | 665 ".goc": true, |
663 ".h": true, | 666 ".h": true, |
| 667 ".hh": true, |
| 668 ".hpp": true, |
| 669 ".hxx": true, |
664 ".html": true, | 670 ".html": true, |
665 ".js": true, | 671 ".js": true, |
666 ".out": true, | 672 ".out": true, |
667 ".py": true, | 673 ".py": true, |
668 ".s": true, | 674 ".s": true, |
669 ".sh": true, | 675 ".sh": true, |
670 ".txt": true, | 676 ".txt": true, |
671 ".xml": true, | 677 ".xml": true, |
672 "AUTHORS": true, | 678 "AUTHORS": true, |
673 "CONTRIBUTORS": true, | 679 "CONTRIBUTORS": true, |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 if m.filename != last { | 1070 if m.filename != last { |
1065 addLines() | 1071 addLines() |
1066 last = m.filename | 1072 last = m.filename |
1067 } | 1073 } |
1068 lines = append(lines, m.line) | 1074 lines = append(lines, m.line) |
1069 } | 1075 } |
1070 addLines() | 1076 addLines() |
1071 | 1077 |
1072 return | 1078 return |
1073 } | 1079 } |
LEFT | RIGHT |