Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: "Robots.txt" files |
| 3 | " Robots.txt files indicate to WWW robots which parts of a web site should not be accessed. |
| 4 | " Maintainer: Dominique Stéphan (dominique@mggen.com) |
| 5 | " URL: http://www.mggen.com/vim/syntax/robots.zip |
| 6 | " Last change: 2001 May 09 |
| 7 | |
| 8 | " For version 5.x: Clear all syntax items |
| 9 | " For version 6.x: Quit when a syntax file was already loaded |
| 10 | if version < 600 |
| 11 | syntax clear |
| 12 | elseif exists("b:current_syntax") |
| 13 | finish |
| 14 | endif |
| 15 | |
| 16 | |
| 17 | " shut case off |
| 18 | syn case ignore |
| 19 | |
| 20 | " Comment |
| 21 | syn match robotsComment "#.*$" contains=robotsUrl,robotsMail,robotsString |
| 22 | |
| 23 | " Star * (means all spiders) |
| 24 | syn match robotsStar "\*" |
| 25 | |
| 26 | " : |
| 27 | syn match robotsDelimiter ":" |
| 28 | |
| 29 | |
| 30 | " The keywords |
| 31 | " User-agent |
| 32 | syn match robotsAgent "^[Uu][Ss][Ee][Rr]\-[Aa][Gg][Ee][Nn][Tt]" |
| 33 | " Disallow |
| 34 | syn match robotsDisallow "^[Dd][Ii][Ss][Aa][Ll][Ll][Oo][Ww]" |
| 35 | |
| 36 | " Disallow: or User-Agent: and the rest of the line before an eventual comment |
| 37 | synt match robotsLine "\(^[Uu][Ss][Ee][Rr]\-[Aa][Gg][Ee][Nn][Tt]\|^[Dd][Ii][Ss][Aa][Ll][Ll][Oo][Ww]\):[^#]*" contains=robotsAgent,robotsDisallow,robotsStar,robotsDelimiter |
| 38 | |
| 39 | " Some frequent things in comments |
| 40 | syn match robotsUrl "http[s]\=://\S*" |
| 41 | syn match robotsMail "\S*@\S*" |
| 42 | syn region robotsString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ |
| 43 | |
| 44 | if version >= 508 || !exists("did_robos_syntax_inits") |
| 45 | if version < 508 |
| 46 | let did_robots_syntax_inits = 1 |
| 47 | command -nargs=+ HiLink hi link <args> |
| 48 | else |
| 49 | command -nargs=+ HiLink hi def link <args> |
| 50 | endif |
| 51 | |
| 52 | HiLink robotsComment Comment |
| 53 | HiLink robotsAgent Type |
| 54 | HiLink robotsDisallow Statement |
| 55 | HiLink robotsLine Special |
| 56 | HiLink robotsStar Operator |
| 57 | HiLink robotsDelimiter Delimiter |
| 58 | HiLink robotsUrl String |
| 59 | HiLink robotsMail String |
| 60 | HiLink robotsString String |
| 61 | |
| 62 | delcommand HiLink |
| 63 | endif |
| 64 | |
| 65 | |
| 66 | let b:current_syntax = "robots" |
| 67 | |
| 68 | " vim: ts=8 sw=2 |
| 69 | |