Add BrightScript syntax, and add code to restore other proprietary syntaxes that may have been in place.
David Blume

David Blume commited on 2016-01-28 14:24:44
Showing 3 changed files, with 140 additions and 0 deletions.

... ...
@@ -0,0 +1 @@
1
+au BufNewFile,BufRead *.brs setf brs
... ...
@@ -0,0 +1,135 @@
1
+" Vim syntax file
2
+" Language:	Roku BrightScript
3
+" Maintainer:	Dylan Doxey <dylan.doxey@gmail.com>
4
+" Last Change:
5
+"   2011 February 3rd
6
+
7
+" This is a hackified copy of vb.vim.
8
+
9
+" For version 5.x: Clear all syntax items
10
+" For version 6.x: Quit when a syntax file was already loaded
11
+if version < 600
12
+	syntax clear
13
+elseif exists("b:current_syntax")
14
+	finish
15
+endif
16
+
17
+" BRS is case insensitive
18
+syn case ignore
19
+
20
+syn keyword brsConditional If Then ElseIf Else EndIf End
21
+
22
+syn keyword brsOperator And Or Not
23
+syn keyword brsBoolean  True False
24
+
25
+syn match brsOperator "("
26
+syn match brsOperator ")"
27
+syn match brsOperator "\."
28
+syn match brsOperator "\["
29
+syn match brsOperator "]"
30
+syn match brsOperator "\^"
31
+syn match brsOperator "–"
32
+syn match brsOperator "+"
33
+syn match brsOperator "*"
34
+syn match brsOperator "/"
35
+syn match brsOperator "<"
36
+syn match brsOperator ">"
37
+syn match brsOperator "<>"
38
+syn match brsOperator "="
39
+syn match brsOperator "<="
40
+syn match brsOperator ">="
41
+syn match brsOperator "@"
42
+
43
+syn match brsOperator "{"
44
+syn match brsOperator ":"
45
+syn match brsOperator "}"
46
+
47
+syn keyword brsFunction For Each In EndFor
48
+syn keyword brsFunction Function EndFunction
49
+syn keyword brsFunction As Dim Exit
50
+syn keyword brsFunction Line_Num Next ObjFun Pos
51
+syn keyword brsFunction Print
52
+syn keyword brsFunction Return Rnd Step
53
+syn keyword brsFunction Stop Tab To Type
54
+syn keyword brsFunction Sub EndSub
55
+syn keyword brsFunction While ExitWhile EndWhile
56
+syn keyword brsFunction Type Rnd Box Run Eval GetLastRunCompileError GetLastRunRuntimeError
57
+syn keyword brsFunction Sleep Wait CreateObject GetInterface UpTime RebootSystem strtoi
58
+syn keyword brsFunction ListDir ReadAsciiFile WriteAsciiFile CopyFile MatchFiles
59
+syn keyword brsFunction DeleteFile DeleteDirectory FormatDrive
60
+syn keyword brsFunction UCase LCase Asc Chr Instr Left Len Mid Right Str Val
61
+syn keyword brsFunction Abs Atn Cos Csng Cdbl Exp Fix Int Log Sgn Sin Sqr Tan
62
+syn keyword brsFunction ifList ifEnum roList ifMessagePort roInt roFloat roString
63
+syn keyword brsFunction roBoolean roFunction roInvalid
64
+syn keyword brsFunction ifInt ifIntOps ifFloat ifString ifStringOps ifFunction ifBoolean
65
+syn keyword brsFunction orAssociativeArray roArray roXMLElement roXMLList
66
+
67
+syn keyword brsTypes Array Interface
68
+syn keyword brsTypes Integer Float Double Boolean String Object Dynamic
69
+
70
+syn keyword brsConst Invalid
71
+
72
+syn keyword brsTodo contained	TODO
73
+
74
+syn keyword brsMethods isListItemSelected isScreenClosed isListFocused isListSelected isListItemFocused isButtonPressed isPlaybackPosition isRemoteKeyPressed isRequestSucceeded isRequestFailed isRequestInterrupted isStatusMessage isPaused isResumed isCleared isPartialResult isFullResult isAdSelected isStorageDeviceInserted isStorageDeviceRemoved isStreamStarted GetType GetIndex GetMessage GetData GetInfo
75
+
76
+" syn keyword brsStatement
77
+" syn keyword brsKeyword As
78
+" syn keyword brsDefine
79
+
80
+" Numbers
81
+syn match brsNumber "\<\d\+\>"
82
+syn match brsNumber "\<\d\+\.\d*\>"
83
+syn match brsNumber "\.\d\+\>"
84
+syn match  brsFloat		"[-+]\=\<\d\+[eE][\-+]\=\d\+"
85
+syn match  brsFloat		"[-+]\=\<\d\+\.\d*\([eE][\-+]\=\d\+\)\="
86
+syn match  brsFloat		"[-+]\=\<\.\d\+\([eE][\-+]\=\d\+\)\="
87
+
88
+" String and Character contstants
89
+syn region  brsString		start=+"+  end=+"\|$+
90
+syn region  brsComment		start="\(^\|\s\)REM \s*" end="$" contains=brsTodo
91
+syn region  brsComment		start="\(^\|\s\)\'"   end="$" contains=brsTodo
92
+syn match   brsLineNumber	"^\d\+\(\s\|$\)"
93
+syn match   brsTypeSpecifier  "[a-zA-Z0-9][\$%&!#]"ms=s+1
94
+syn match   brsTypeSpecifier  "#[a-zA-Z0-9]"me=e-1
95
+
96
+" Define the default highlighting.
97
+" For version 5.7 and earlier: only when not done already
98
+" For version 5.8 and later: only when an item doesn't have highlighting yet
99
+if version >= 508 || !exists("did_brs_syntax_inits")
100
+
101
+	if version < 508
102
+		let did_brs_syntax_inits = 1
103
+		command -nargs=+ HiLink hi link <args>
104
+	else
105
+		command -nargs=+ HiLink hi def link <args>
106
+	endif
107
+
108
+	HiLink brsBoolean		Boolean
109
+	HiLink brsLineNumber	Comment
110
+	HiLink brsComment		Comment
111
+	HiLink brsConditional	Conditional
112
+	HiLink brsConst			Constant
113
+	HiLink brsDefine		Constant
114
+	HiLink brsError			Error
115
+	HiLink brsFunction		Identifier
116
+	HiLink brsIdentifier	Identifier
117
+	HiLink brsNumber		Number
118
+	HiLink brsFloat			Float
119
+	HiLink brsMethods		PreProc
120
+	HiLink brsOperator		Operator
121
+	HiLink brsRepeat		Repeat
122
+	HiLink brsString		String
123
+	HiLink brsStatement		Statement
124
+	HiLink brsKeyword		Statement
125
+	HiLink brsEvents		Special
126
+	HiLink brsTodo			Todo
127
+	HiLink brsTypes			Type
128
+	HiLink brsTypeSpecifier	Type
129
+
130
+	delcommand HiLink
131
+endif
132
+
133
+let b:current_syntax = "brs"
134
+
135
+" vim: ts=8
... ...
@@ -58,6 +58,10 @@ if [ $DRY_RUN -eq 0 ]; then
58 58
         mv $HOME/.vim $backup_dir
59 59
     fi
60 60
     cp -r .vim $HOME
61
+    if [ -d $backup_dir/.vim ]; then
62
+	# Copy back some proprietary file types, if any.
63
+        cp -r -n $backup_dir/.vim $HOME
64
+    fi
61 65
 fi
62 66
 
63 67
 echo Your old dotfiles are backed up to $backup_dir
64 68