"Fossies" - the Fresh Open Source Software Archive

Member "sift-0.9.0/filetypes.go" (22 Oct 2016, 2300 Bytes) of package /linux/privat/sift-0.9.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Go source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "filetypes.go": 0.8.0_vs_0.9.0.

    1 // sift
    2 // Copyright (C) 2014-2016 Sven Taute
    3 //
    4 // This program is free software: you can redistribute it and/or modify
    5 // it under the terms of the GNU General Public License as published by
    6 // the Free Software Foundation, version 3 of the License.
    7 //
    8 // This program is distributed in the hope that it will be useful,
    9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
   10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11 // GNU General Public License for more details.
   12 //
   13 // You should have received a copy of the GNU General Public License
   14 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
   15 
   16 package main
   17 
   18 import (
   19     "regexp"
   20 )
   21 
   22 func init() {
   23     global.fileTypesMap = map[string]FileType{
   24         "go": FileType{
   25             Patterns: []string{"*.go"},
   26         },
   27         "cc": FileType{
   28             Patterns: []string{"*.c", "*.h", "*.xs"},
   29         },
   30         "cpp": FileType{
   31             Patterns: []string{"*.cpp", "*.cc", "*.cxx", "*.m", "*.hpp", "*.hh", "*.h", "*.hxx"},
   32         },
   33         "html": FileType{
   34             Patterns: []string{"*.htm", "*.html", "*.shtml", "*.xhtml"},
   35         },
   36         "groovy": FileType{
   37             Patterns: []string{"*.groovy", "*.gtmpl", "*.gpp", "*.grunit", "*.gradle"},
   38         },
   39         "java": FileType{
   40             Patterns: []string{"*.java", "*.properties"},
   41         },
   42         "jsp": FileType{
   43             Patterns: []string{"*.jsp", "*.jspx", "*.jhtm", "*.jhtml"},
   44         },
   45         "perl": FileType{
   46             Patterns:     []string{"*.pl", "*.pm", "*.pod", "*.t"},
   47             ShebangRegex: regexp.MustCompile(`^#!.*\bperl\b`),
   48         },
   49         "php": FileType{
   50             Patterns:     []string{"*.php", "*.phpt", "*.php3", "*.php4", "*.php5", "*.phtml"},
   51             ShebangRegex: regexp.MustCompile(`^#!.*\bphp\b`),
   52         },
   53         "ruby": FileType{
   54             Patterns:     []string{"*.rb", "*.rhtml", "*.rjs", "*.rxml", "*.erb", "*.rake", "*.spec", "Rakefile"},
   55             ShebangRegex: regexp.MustCompile(`^#!.*\bruby\b`),
   56         },
   57         "python": FileType{
   58             Patterns:     []string{"*.py", "*.pyw", "*.pyx", "SConstruct"},
   59             ShebangRegex: regexp.MustCompile(`^#!.*\bpython[0-9.]*\b`),
   60         },
   61         "shell": FileType{
   62             Patterns:     []string{"*.sh", "*.bash", "*.csh", "*.tcsh", "*.ksh", "*.zsh"},
   63             ShebangRegex: regexp.MustCompile(`^#!.*\b(?:ba|t?c|k|z)?sh\b`),
   64         },
   65         "xml": FileType{
   66             Patterns:     []string{"*.xml", "*.dtd", "*.xsl", "*.xslt", "*.ent"},
   67             ShebangRegex: regexp.MustCompile(`<\?xml`),
   68         },
   69     }
   70 }