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. |
Bram Moolenaar | cb80aa2 | 2020-10-26 21:12:46 +0100 | [diff] [blame] | 4 | " Maintainer: Dominique Stéphan (dominique@mggen.com) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 5 | " URL: http://www.mggen.com/vim/syntax/robots.zip |
| 6 | " Last change: 2001 May 09 |
| 7 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 8 | " quit when a syntax file was already loaded |
| 9 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 10 | finish |
| 11 | endif |
| 12 | |
| 13 | |
| 14 | " shut case off |
| 15 | syn case ignore |
| 16 | |
| 17 | " Comment |
| 18 | syn match robotsComment "#.*$" contains=robotsUrl,robotsMail,robotsString |
| 19 | |
| 20 | " Star * (means all spiders) |
| 21 | syn match robotsStar "\*" |
| 22 | |
| 23 | " : |
| 24 | syn match robotsDelimiter ":" |
| 25 | |
| 26 | |
| 27 | " The keywords |
| 28 | " User-agent |
| 29 | syn match robotsAgent "^[Uu][Ss][Ee][Rr]\-[Aa][Gg][Ee][Nn][Tt]" |
| 30 | " Disallow |
| 31 | syn match robotsDisallow "^[Dd][Ii][Ss][Aa][Ll][Ll][Oo][Ww]" |
| 32 | |
| 33 | " Disallow: or User-Agent: and the rest of the line before an eventual comment |
| 34 | 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 |
| 35 | |
| 36 | " Some frequent things in comments |
| 37 | syn match robotsUrl "http[s]\=://\S*" |
| 38 | syn match robotsMail "\S*@\S*" |
| 39 | syn region robotsString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ |
| 40 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 41 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 42 | hi def link robotsComment Comment |
| 43 | hi def link robotsAgent Type |
| 44 | hi def link robotsDisallow Statement |
| 45 | hi def link robotsLine Special |
| 46 | hi def link robotsStar Operator |
| 47 | hi def link robotsDelimiter Delimiter |
| 48 | hi def link robotsUrl String |
| 49 | hi def link robotsMail String |
| 50 | hi def link robotsString String |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 51 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 52 | |
| 53 | |
| 54 | let b:current_syntax = "robots" |
| 55 | |
| 56 | " vim: ts=8 sw=2 |
| 57 | |