7
|
1 " Vim syntax file
|
|
2 " Language: Expect
|
|
3 " Maintainer: Ralph Jennings <knowbudy@oro.net>
|
3557
|
4 " Last Change: 2012 Jun 01
|
|
5 " (Dominique Pelle added @Spell)
|
7
|
6
|
|
7 " For version 5.x: Clear all syntax items
|
|
8 " For version 6.x: Quit when a syntax file was already loaded
|
|
9 if version < 600
|
|
10 syntax clear
|
|
11 elseif exists("b:current_syntax")
|
|
12 finish
|
|
13 endif
|
|
14
|
|
15 " Reserved Expect variable prefixes.
|
|
16 syn match expectVariables "\$exp[a-zA-Z0-9_]*\|\$inter[a-zA-Z0-9_]*"
|
|
17 syn match expectVariables "\$spawn[a-zA-Z0-9_]*\|\$timeout[a-zA-Z0-9_]*"
|
|
18
|
|
19 " Normal Expect variables.
|
|
20 syn match expectVariables "\$env([^)]*)"
|
|
21 syn match expectVariables "\$any_spawn_id\|\$argc\|\$argv\d*"
|
|
22 syn match expectVariables "\$user_spawn_id\|\$spawn_id\|\$timeout"
|
|
23
|
|
24 " Expect variable arrays.
|
|
25 syn match expectVariables "\$\(expect\|interact\)_out([^)]*)" contains=expectOutVar
|
|
26
|
|
27 " User defined variables.
|
|
28 syn match expectVariables "\$[a-zA-Z_][a-zA-Z0-9_]*"
|
|
29
|
|
30 " Reserved Expect command prefixes.
|
|
31 syn match expectCommand "exp_[a-zA-Z0-9_]*"
|
|
32
|
|
33 " Normal Expect commands.
|
|
34 syn keyword expectStatement close debug disconnect
|
|
35 syn keyword expectStatement exit exp_continue exp_internal exp_open
|
|
36 syn keyword expectStatement exp_pid exp_version
|
|
37 syn keyword expectStatement fork inter_return interpreter
|
|
38 syn keyword expectStatement log_file log_user match_max overlay
|
|
39 syn keyword expectStatement parity remove_nulls return
|
|
40 syn keyword expectStatement send send_error send_log send_user
|
|
41 syn keyword expectStatement sleep spawn strace stty system
|
|
42 syn keyword expectStatement timestamp trace trap wait
|
|
43
|
|
44 " Tcl commands recognized and used by Expect.
|
|
45 syn keyword expectCommand proc
|
|
46 syn keyword expectConditional if else
|
|
47 syn keyword expectRepeat while for foreach
|
|
48
|
|
49 " Expect commands with special arguments.
|
|
50 syn keyword expectStatement expect expect_after expect_background nextgroup=expectExpectOpts
|
|
51 syn keyword expectStatement expect_before expect_user interact nextgroup=expectExpectOpts
|
|
52
|
|
53 syn match expectSpecial contained "\\."
|
|
54
|
|
55 " Options for "expect", "expect_after", "expect_background",
|
|
56 " "expect_before", "expect_user", and "interact".
|
|
57 syn keyword expectExpectOpts default eof full_buffer null return timeout
|
|
58
|
|
59 syn keyword expectOutVar contained spawn_id seconds seconds_total
|
|
60 syn keyword expectOutVar contained string start end buffer
|
|
61
|
|
62 " Numbers (Tcl style).
|
|
63 syn case ignore
|
|
64 syn match expectNumber "\<\d\+\(u\=l\=\|lu\|f\)\>"
|
|
65 "floating point number, with dot, optional exponent
|
|
66 syn match expectNumber "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"
|
|
67 "floating point number, starting with a dot, optional exponent
|
|
68 syn match expectNumber "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
|
|
69 "floating point number, without dot, with exponent
|
|
70 syn match expectNumber "\<\d\+e[-+]\=\d\+[fl]\=\>"
|
|
71 "hex number
|
|
72 syn match expectNumber "0x[0-9a-f]\+\(u\=l\=\|lu\)\>"
|
|
73 "syn match expectIdentifier "\<[a-z_][a-z0-9_]*\>"
|
|
74 syn case match
|
|
75
|
3557
|
76 syn region expectString start=+"+ end=+"+ contains=@Spell,expectVariables,expectSpecial
|
7
|
77
|
|
78 " Are these really comments in Expect? (I never use it, so I'm just guessing).
|
|
79 syn keyword expectTodo contained TODO
|
3557
|
80 syn match expectComment "#.*$" contains=@Spell,expectTodo
|
|
81 syn match expectSharpBang "\%^#!.*"
|
7
|
82
|
|
83 " Define the default highlighting.
|
|
84 " For version 5.7 and earlier: only when not done already
|
|
85 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
86 if version >= 508 || !exists("did_expect_syntax_inits")
|
|
87 if version < 508
|
|
88 let did_expect_syntax_inits = 1
|
|
89 command -nargs=+ HiLink hi link <args>
|
|
90 else
|
|
91 command -nargs=+ HiLink hi def link <args>
|
|
92 endif
|
|
93
|
3557
|
94 HiLink expectSharpBang PreProc
|
7
|
95 HiLink expectVariables Special
|
|
96 HiLink expectCommand Function
|
|
97 HiLink expectStatement Statement
|
|
98 HiLink expectConditional Conditional
|
|
99 HiLink expectRepeat Repeat
|
|
100 HiLink expectExpectOpts Keyword
|
|
101 HiLink expectOutVar Special
|
|
102 HiLink expectSpecial Special
|
|
103 HiLink expectNumber Number
|
|
104
|
|
105 HiLink expectString String
|
|
106
|
|
107 HiLink expectComment Comment
|
|
108 HiLink expectTodo Todo
|
|
109 "HiLink expectIdentifier Identifier
|
|
110
|
|
111 delcommand HiLink
|
|
112 endif
|
|
113
|
|
114 let b:current_syntax = "expect"
|
|
115
|
|
116 " vim: ts=8
|