"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/langDefs/fish.lang" (12 May 2020, 3682 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 
    2 Description="Fish"
    3 
    4 Categories = {"script", "shell"}
    5 
    6 Identifiers=[[ [a-zA-Z_][\w\-]*(?!\/) ]]
    7 
    8 Keywords={
    9     {
   10         Id=1,
   11         List={
   12             "and", "begin", "break", "breakpoint", "case", "else", "end",
   13             "for", "function", "if", "not", "or", "return", "switch", "test",
   14             "while"
   15         },
   16     },
   17     {
   18         Id=2,
   19         List={
   20             "abbr", "alias", "argparse", "bg", "bind", "block", "builtin",
   21             "cd", "cdh", "command", "commandline", "complete", "contains",
   22             "count", "dirh", "dirs", "disown", "echo", "emit", "eval", "exec",
   23             "exit", "false", "fg", "fish", "fish_breakpoint_prompt",
   24             "fish_config", "fish_indent", "fish_key_reader",
   25             "fish_mode_prompt", "fish_opt", "fish_prompt",
   26             "fish_right_prompt", "fish_update_completions", "fish_vi_mode",
   27             "funced", "funcsave", "functions", "help", "history", "isatty",
   28             "jobs", "math", "nextd", "open", "popd", "prevd", "printf",
   29             "prompt_pwd", "psub", "pushd", "pwd", "random", "read",
   30             "realpath", "set", "set_color", "source", "status", "string",
   31             "suspend", "trap", "true", "type", "ulimit", "umask", "vared",
   32             "wait"
   33         },
   34     },
   35     {
   36         Id=3,
   37         List={
   38             "ls", "cat", "tac", "rev", "cp", "mv", "rm", "rmdir", "chmod",
   39             "chattr", "ln", "find", "xargs", "expr", "date", "zdump", "time",
   40             "touch", "at", "batch", "cal", "sleep", "usleep", "hwclock",
   41             "clock", "sort", "tsort", "diff", "patch", "diff3", "sdiff",
   42             "cmp", "comm", "uniq", "expand", "unexpand", "cat", "paste",
   43             "join", "head", "tail", "grep", "egrep", "zgrep", "look", "sed",
   44             "awk", "wc", "tr", "fold", "fmt", "ptx", "col", "column", "colrm",
   45             "nl", "pr", "gettext", "iconv", "recode", "groff", "lex", "yacc",
   46             "tar", "shar", "ar", "cpio", "gzip", "bzip2", "compress",
   47             "uncompress", "zip", "unzip", "sq", "file", "which", "whereis",
   48             "whatis", "vdir", "shred", "locate", "slocate", "strings",
   49             "basename", "dirname", "split", "sum", "cksum", "md5sum",
   50             "sha1sum", "uuencode", "uudecode", "crypt", "make", "install",
   51             "more", "less", "host", "vrfy", "nslookup", "dig", "traceroute",
   52             "ping", "whois", "finger", "ftp", "uucp", "telnet", "rlogin",
   53             "rsh", "rcp", "ssh", "write", "mail", "vacation", "tput", "reset",
   54             "clear", "script", "factor", "bc", "dc", "jot", "seq", "yes",
   55             "banner", "printenv", "lp", "tee", "mkfifo", "pathchk", "dd",
   56             "od", "hexdump", "m4"
   57         },
   58     },
   59 
   60     {
   61         Id=4,
   62         Regex=[[ \$[\w\#]+ ]],
   63     },
   64     {
   65         Id=2,
   66         Regex=[[ \-\-?[\w\-]+ ]],
   67     }
   68 }
   69 
   70 -- hereDoc opening delimiter, see OnStateChange to handle end of string
   71 Strings={
   72     Delimiter=[[<<[\-]?\s*["']?\s*[A-Za-z_]+["']?|"|`|']],
   73 }
   74 
   75 IgnoreCase=false
   76 
   77 Comments={
   78     {
   79         Block=false,
   80         Delimiter= { [[#]] },
   81     },
   82 }
   83 
   84 Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-]]
   85 
   86 function OnStateChange(oldState, newState, token)
   87     if oldState==HL_STRING and token==hereDoc then
   88         hereDoc = nil
   89         return HL_STRING_END
   90     end
   91 
   92     if  (string.sub(token,1,1) =="$" )  and oldState==HL_STRING and newState==HL_KEYWORD then
   93         return HL_INTERPOLATION
   94     end
   95 
   96     if hereDoc~=nil then
   97         return HL_STRING
   98     end
   99 
  100     --recognize hereDoc multine strings
  101     if oldState==HL_STANDARD and newState==HL_STRING  then
  102         hereDoc = string.match(token, "<<%-?%s*%'?([%-%a%d_]+)" )
  103     end
  104 
  105     return newState
  106 end