Mercurial > vim
annotate runtime/syntax/datascript.vim @ 17861:0a5c615cd949 v8.1.1927
patch 8.1.1927: code for dealing with script files is spread out
Commit: https://github.com/vim/vim/commit/307c5a5bb77c3728dfab06c30e9f786309c63f74
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 25 15:41:00 2019 +0200
patch 8.1.1927: code for dealing with script files is spread out
Problem: Code for dealing with script files is spread out.
Solution: Move the code to scriptfile.c. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/4861)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 25 Aug 2019 15:45:04 +0200 |
parents | 43efa4f5a8ea |
children |
rev | line source |
---|---|
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
1 " Vim syntax file |
7013 | 2 " Language: DataScript |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
3 " Maintainer: Dominique Pelle <dominique.pelle@gmail.com> |
7013 | 4 " Last Change: 2015 Jul 30 |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
5 " |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
6 " DataScript is a formal language for modelling binary datatypes, |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
7 " bitstreams or file formats. For more information, see: |
7013 | 8 " |
9 " http://dstools.sourceforge.net/DataScriptLanguageOverview.html | |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
10 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7013
diff
changeset
|
11 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7013
diff
changeset
|
12 if exists("b:current_syntax") |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
13 finish |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
14 endif |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2467
diff
changeset
|
15 let s:keepcpo= &cpo |
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2467
diff
changeset
|
16 set cpo&vim |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
17 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
18 syn keyword dsPackage import package |
5763 | 19 syn keyword dsType bit bool string |
20 syn keyword dsType int int8 int16 int32 int64 | |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
21 syn keyword dsType uint8 uint16 uint32 uint64 |
7013 | 22 syn keyword dsType varint16 varint32 varint64 |
23 syn keyword dsType varuint16 varuint32 varuint64 | |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
24 syn keyword dsType leint16 leint32 leint64 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
25 syn keyword dsType leuint16 leuint32 leuint64 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
26 syn keyword dsEndian little big |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
27 syn keyword dsAlign align |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
28 syn keyword dsLabel case default |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
29 syn keyword dsConditional if condition |
5763 | 30 syn keyword dsBoolean true false |
31 syn keyword dsCompound union choice on enum bitmask subtype explicit | |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
32 syn keyword dsKeyword function return |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
33 syn keyword dsOperator sizeof bitsizeof lengthof is sum forall in |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
34 syn keyword dsStorageClass const |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
35 syn keyword dsTodo contained TODO FIXME XXX |
5763 | 36 syn keyword dsSql sql sql_table sql_database sql_pragma sql_index |
7013 | 37 syn keyword dsSql sql_integer sql_metadata sql_key sql_virtual |
38 syn keyword dsSql using reference_key foreign_key to | |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
39 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
40 " dsCommentGroup allows adding matches for special things in comments. |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
41 syn cluster dsCommentGroup contains=dsTodo |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
42 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
43 syn match dsOffset display "^\s*[a-zA-Z_:\.][a-zA-Z0-9_:\.]*\s*:" |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
44 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
45 syn match dsNumber display "\<\d\+\>" |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
46 syn match dsNumberHex display "\<0[xX]\x\+\>" |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
47 syn match dsNumberBin display "\<[01]\+[bB]\>" contains=dsBinaryB |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
48 syn match dsBinaryB display contained "[bB]\>" |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
49 syn match dsOctal display "\<0\o\+\>" contains=dsOctalZero |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
50 syn match dsOctalZero display contained "\<0" |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
51 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
52 syn match dsOctalError display "\<0\o*[89]\d*\>" |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
53 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
54 syn match dsCommentError display "\*/" |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
55 syn match dsCommentStartError display "/\*"me=e-1 contained |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
56 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
57 syn region dsCommentL |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
58 \ start="//" skip="\\$" end="$" keepend |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
59 \ contains=@dsCommentGroup,@Spell |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
60 syn region dsComment |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
61 \ matchgroup=dsCommentStart start="/\*" end="\*/" |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
62 \ contains=@dsCommentGroup,dsCommentStartError,@Spell extend |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
63 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
64 syn region dsString |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
65 \ start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
66 |
7013 | 67 syn sync ccomment dsComment |
68 | |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
69 " Define the default highlighting. |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
70 hi def link dsType Type |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
71 hi def link dsEndian StorageClass |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
72 hi def link dsStorageClass StorageClass |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
73 hi def link dsAlign Label |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
74 hi def link dsLabel Label |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
75 hi def link dsOffset Label |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
76 hi def link dsSql PreProc |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
77 hi def link dsCompound Structure |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
78 hi def link dsConditional Conditional |
5763 | 79 hi def link dsBoolean Boolean |
2467
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
80 hi def link dsKeyword Statement |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
81 hi def link dsString String |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
82 hi def link dsNumber Number |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
83 hi def link dsNumberBin Number |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
84 hi def link dsBinaryB Special |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
85 hi def link dsOctal Number |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
86 hi def link dsOctalZero Special |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
87 hi def link dsOctalError Error |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
88 hi def link dsNumberHex Number |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
89 hi def link dsTodo Todo |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
90 hi def link dsOperator Operator |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
91 hi def link dsPackage Include |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
92 hi def link dsCommentError Error |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
93 hi def link dsCommentStartError Error |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
94 hi def link dsCommentStart dsComment |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
95 hi def link dsCommentL dsComment |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
96 hi def link cCommentL dsComment |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
97 hi def link dsComment Comment |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
98 |
9c8d603fd4d1
Add Datascript syntax file. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
99 let b:current_syntax = "datascript" |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2467
diff
changeset
|
100 |
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2467
diff
changeset
|
101 let &cpo = s:keepcpo |
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2467
diff
changeset
|
102 unlet s:keepcpo |