annotate runtime/syntax/dtrace.vim @ 8420:f6d21a33d489 v7.4.1501

commit https://github.com/vim/vim/commit/38fd4bb2842df7634823b99c655b3896a7a2e988 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 6 16:38:28 2016 +0100 patch 7.4.1501 Problem: Garbage collection with an option channel is not tested. Solution: Call garbagecollect() in the test.
author Christian Brabandt <cb@256bit.org>
date Sun, 06 Mar 2016 16:45:04 +0100
parents 82b5078be2dd
children 43efa4f5a8ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1621
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
1 " DTrace D script syntax file. To avoid confusion with the D programming
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
2 " language, I call this script dtrace.vim instead of d.vim.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
3 " Language: D script as described in "Solaris Dynamic Tracing Guide",
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
4 " http://docs.sun.com/app/docs/doc/817-6223
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
5 " Version: 1.5
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
6 " Last Change: 2008/04/05
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
7 " Maintainer: Nicolas Weber <nicolasweber@gmx.de>
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
8
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
9 " dtrace lexer and parser are at
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
10 " http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libdtrace/common/dt_lex.l
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
11 " http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libdtrace/common/dt_grammar.y
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
12
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
13 if version < 600
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
14 syntax clear
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
15 elseif exists("b:current_syntax")
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
16 finish
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
17 endif
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
18
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
19 " Read the C syntax to start with
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
20 if version < 600
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
21 so <sfile>:p:h/c.vim
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
22 else
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
23 runtime! syntax/c.vim
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
24 unlet b:current_syntax
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
25 endif
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
26
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
27 syn clear cCommentL " dtrace doesn't support // style comments
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
28
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
29 " First line may start with #!, also make sure a '-s' flag is somewhere in
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
30 " that line.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
31 syn match dtraceComment "\%^#!.*-s.*"
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
32
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
33 " Probe descriptors need explicit matches, so that keywords in probe
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
34 " descriptors don't show up as errors. Note that this regex detects probes
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
35 " as "something with three ':' in it". This works in practice, but it's not
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
36 " really correct. Also add special case code for BEGIN, END and ERROR, since
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
37 " they are common.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
38 " Be careful not to detect '/*some:::node*/\n/**/' as probe, as it's
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
39 " commented out.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
40 " XXX: This allows a probe description to end with ',', even if it's not
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
41 " followed by another probe.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
42 " XXX: This doesn't work if followed by a comment.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
43 let s:oneProbe = '\%(BEGIN\|END\|ERROR\|\S\{-}:\S\{-}:\S\{-}:\S\{-}\)\_s*'
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
44 exec 'syn match dtraceProbe "'.s:oneProbe.'\%(,\_s*'.s:oneProbe.'\)*\ze\_s\%({\|\/[^*]\|\%$\)"'
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
45
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
46 " Note: We have to be careful to not make this match /* */ comments.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
47 " Also be careful not to eat `c = a / b; b = a / 2;`. We use the same
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
48 " technique as the dtrace lexer: a predicate has to be followed by {, ;, or
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
49 " EOF. Also note that dtrace doesn't allow an empty predicate // (we do).
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
50 " This regex doesn't allow a divison operator in the predicate.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
51 " Make sure that this matches the empty predicate as well.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
52 " XXX: This doesn't work if followed by a comment.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
53 syn match dtracePredicate "/\*\@!\_[^/]*/\ze\_s*\%({\|;\|\%$\)"
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
54 "contains=ALLBUT,dtraceOption " this lets the region contain too much stuff
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
55
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
56 " Pragmas.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
57 " dtrace seems not to support whitespace before or after the '='. dtrace
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
58 " supports only one option per #pragma, and no continuations of #pragma over
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
59 " several lines with '\'.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
60 " Note that dtrace treats units (Hz etc) as case-insenstive, we allow only
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
61 " sane unit capitalization in this script (ie 'ns', 'us', 'ms', 's' have to be
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
62 " small, Hertz can be 'Hz' or 'hz')
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
63 " XXX: "cpu" is always highlighted as builtin var, not as option
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
64
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
65 " auto or manual: bufresize
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
66 syn match dtraceOption contained "bufresize=\%(auto\|manual\)\s*$"
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
67
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
68 " scalar: cpu jstackframes jstackstrsize nspec stackframes stackindent ustackframes
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
69 syn match dtraceOption contained "\%(cpu\|jstackframes\|jstackstrsize\|nspec\|stackframes\|stackindent\|ustackframes\)=\d\+\s*$"
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
70
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
71 " size: aggsize bufsize dynvarsize specsize strsize
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
72 " size defaults to something if no unit is given (ie., having no unit is ok)
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
73 syn match dtraceOption contained "\%(aggsize\|bufsize\|dynvarsize\|specsize\|strsize\)=\d\+\%(k\|m\|g\|t\|K\|M\|G\|T\)\=\s*$"
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
74
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
75 " time: aggrate cleanrate statusrate switchrate
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
76 " time defaults to hz if no unit is given
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
77 syn match dtraceOption contained "\%(aggrate\|cleanrate\|statusrate\|switchrate\)=\d\+\%(hz\|Hz\|ns\|us\|ms\|s\)\=\s*$"
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
78
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
79 " No type: defaultargs destructive flowindent grabanon quiet rawbytes
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
80 syn match dtraceOption contained "\%(defaultargs\|destructive\|flowindent\|grabanon\|quiet\|rawbytes\)\s*$"
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
81
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
82
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
83 " Turn reserved but unspecified keywords into errors
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
84 syn keyword dtraceReservedKeyword auto break case continue counter default do
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
85 syn keyword dtraceReservedKeyword else for goto if import probe provider
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
86 syn keyword dtraceReservedKeyword register restrict return static switch while
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
87
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
88 " Add dtrace-specific stuff
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
89 syn keyword dtraceOperator sizeof offsetof stringof xlate
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
90 syn keyword dtraceStatement self inline xlate this translator
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
91
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
92 " Builtin variables
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
93 syn keyword dtraceIdentifier arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
94 syn keyword dtraceIdentifier args caller chip cpu curcpu curlwpsinfo curpsinfo
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
95 syn keyword dtraceIdentifier curthread cwd epid errno execname gid id ipl lgrp
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
96 syn keyword dtraceIdentifier pid ppid probefunc probemod probename probeprov
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
97 syn keyword dtraceIdentifier pset root stackdepth tid timestamp uid uregs
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
98 syn keyword dtraceIdentifier vtimestamp walltimestamp
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
99 syn keyword dtraceIdentifier ustackdepth
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
100
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
101 " Macro Variables
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
102 syn match dtraceConstant "$[0-9]\+"
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
103 syn match dtraceConstant "$\(egid\|euid\|gid\|pgid\|ppid\)"
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
104 syn match dtraceConstant "$\(projid\|sid\|target\|taskid\|uid\)"
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
105
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
106 " Data Recording Actions
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
107 syn keyword dtraceFunction trace tracemem printf printa stack ustack jstack
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
108
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
109 " Process Destructive Actions
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
110 syn keyword dtraceFunction stop raise copyout copyoutstr system
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
111
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
112 " Kernel Destructive Actions
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
113 syn keyword dtraceFunction breakpoint panic chill
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
114
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
115 " Special Actions
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
116 syn keyword dtraceFunction speculate commit discard exit
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
117
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
118 " Subroutines
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
119 syn keyword dtraceFunction alloca basename bcopy cleanpath copyin copyinstr
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
120 syn keyword dtraceFunction copyinto dirname msgdsize msgsize mutex_owned
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
121 syn keyword dtraceFunction mutex_owner mutex_type_adaptive progenyof
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
122 syn keyword dtraceFunction rand rw_iswriter rw_write_held speculation
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
123 syn keyword dtraceFunction strjoin strlen
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
124
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
125 " Aggregating Functions
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
126 syn keyword dtraceAggregatingFunction count sum avg min max lquantize quantize
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
127
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
128 syn keyword dtraceType int8_t int16_t int32_t int64_t intptr_t
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
129 syn keyword dtraceType uint8_t uint16_t uint32_t uint64_t uintptr_t
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
130 syn keyword dtraceType string
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
131 syn keyword dtraceType pid_t id_t
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
132
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
133
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
134 " Define the default highlighting.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
135 " We use `hi def link` directly, this requires 5.8.
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
136 hi def link dtraceReservedKeyword Error
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
137 hi def link dtracePredicate String
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
138 hi def link dtraceProbe dtraceStatement
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
139 hi def link dtraceStatement Statement
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
140 hi def link dtraceConstant Constant
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
141 hi def link dtraceIdentifier Identifier
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
142 hi def link dtraceAggregatingFunction dtraceFunction
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
143 hi def link dtraceFunction Function
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
144 hi def link dtraceType Type
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
145 hi def link dtraceOperator Operator
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
146 hi def link dtraceComment Comment
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
147 hi def link dtraceNumber Number
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
148 hi def link dtraceOption Identifier
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
149
82b5078be2dd updated for version 7.2a
vimboss
parents:
diff changeset
150 let b:current_syntax = "dtrace"