Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mainmanc
Visitor

Syntax file for BRS

I threw together a syntax file for use with EditPlus (on the odd chance that someone might be using it :mrgreen: ), but it might also provide a base for other text editors. This just helps the editor add color highlighting based on BRS syntax. It mostly just looks pretty, but I find it helpful.

I've taken a few liberties for my own preferences. Adjust as needed. 😉
#TITLE=BrightScript
; BrightScript syntax file by mainmanc.

#DELIMITER=,(){}[]-+*%/="'~!&|<>?:;.$#
#QUOTATION1="
#LINECOMMENT='
#CASE=n
#KEYWORD=Reserved words
invalid
AND
OR
each
next
dim
else
end
type
false
endwhile
sub
exit
endfor
for
print
goto
if
NOT
then
to
tab
rnd
exitwhile
function
endfunction
pos
line_num
rem
return
step
stop
objfun
true
while
endsub
endif
as
in
#KEYWORD=Parameters
Integer
Float
Double
String
Object
Dynamic
Void
Interface
Boolean
#KEYWORD=Constants
pkg:/
tmp:/
file://
scale-to-fill
scale-to-fit
zoom-to-fill
photo-fit
rounded-square-generic
rounded-rect-16x9-generic
long-date
short-date
short-month
short-weekday
http.error
http.connect
bandwidth.minute
wait
CreateObject
;2.6
multiple-portrait-generic
;ENTRY POINTS
Main
RunUserInterface
RunScreenSaver
RunScreenSaverSettings
#KEYWORD=Functions
eval
tostr
toint
tofloat
box
run
;GLOBAL UTILITIES
sleep
GetInterface
UpTime
RebootSystem
ListDir
ReadAsciiFile
WriteAsciiFile
CopyFile
MatchFiles
DeleteFile
DeleteDirectory
CreateDirectory
FormatDrive
GetLastCompileError
GetLastRunRuntimeError
;GLOBAL STRING FUNCTIONS
UCase
LCase
Asc
Chr
Instr
Left
Len
Mid
Right
Str
String
Val
;GLOBAL MATH FUNCTIONS
Abs
Atn
Cos
Csng
Cdbl
Exp
Fix
Int
Log
Sgn
Sin
Sqr
Tan
;ifList
ResetIndex
AddTail
AddHead
RemoveIndex
GetIndex
RemoveTail
RemoveHead
GetTail
GetHead
Count
Clear
;ifEnum
Reset
Next
IsNext
IsEmpty
;ifMessagePort
GetMessage
WaitMessage
;ifInt
GetInt
SetInt
;ifIntOps
ToStr
;ifFloat
GetFloat
SetFloat
;ifString
GetString
SetString
;ifStringOps
SetString
AppendString
Len
GetEntityEncode
Tokenize
Trim
ToInt
ToFloat
Left
Right
Mid
Instr
;ifFunction
GetSub
SetSub
;ifBoolean
GetBoolean
SetBoolean
;ifAssociativeArray
AddReplace
Lookup
DoesExist
Delete
Clear
SetModeCaseSensitive
;ifArray
GetEntry
SetEntry
Peek
Pop
Push
Shift
Unshift
Delete
Count
Clear
Append
;ifByteArray
WriteFile
ReadFile
AppendFile
SetResize
ToHexString
FromHexString
ToBase64String
FromBase64String
ToAsciiString
FromAsciiString
GetSignedByte
IsLittleEndian
;ifXMLElement
GetBody
GetAttributes
GetName
GetText
GetChildElements
GetNamedElements
Parse
SetBody
AddBodyElement
AddElement
AddElementWithBody
AddAttribute
SetName
GenXML
Clear
GenXMLHeader
IsName
HasAttribute
;ifXMLList
GetAttributes
GetText
GetChildElements
GetNamedElements
GetNamedElementsCi
Simplify
;ifAppManager
SetTheme
SetThemeAttribute
ClearThemeAttribute
;2.6
GetUptime
;ifPosterScreen
SetContentList
GetContentList
SetListNames
SetListStyle
SetListDisplayMode
SetFocusedList
SetFocusedListItem
SetBreadcrumbText
SetBreadcrumbEnabled
ShowMessage
ClearMessage
SetAdURL
SetAdSelectable
setAdDisplayMode
Show
Close
SetTitle
;2.6
UseStableFocus
;ifHttpAgent
AddHeader
SetHeaders
SetCertificatesFile
InitClientCertificates
;ifSetMessagePort
SetMessagePort
;ifGetMessagePort
GetMessagePort
;ifSpringboardScreen
SetContent
SetDescriptionStyle
SetProgressIndicatorEnabled
SetProgressIndicator
AddThumbsUpDownButton
AddThumbsUpDownButtonWithTips
AddButton
AddRatingButton
SetStaticRatingEnabled
ClearButtons
SetBreadcrumbText
SetbreadcrumbEnabled
PrefetchPoster
AllowUpdates
CountButtons
AllowNavLeft
AllowNavRight
AllowNavRewind
AllowNavFastForward
SetPosterStyle
SetAdURL
SetAdSelectable
SetAdDisplayMode
Show
Close
SetTitle
;ifVideoScreen
SetContent
setPositionNotificationPeriod
SetPreviewMode
SetMacrovisionLevel
SetCGMS
Show
Close
;2.6
Pause
Resume
Seek
SetDestinationRect
;ifSlideShow
SetContentList
AddContent
ClearContent
CountButtons
SetNext
SetPeriod
SetTextOverlayHoldTime
SetTextOverlayIsVisible
AddButton
AddRatingButton
ClearButtons
SetUnderscan
SetDisplayMode
SetMaxUpscale
Show
Close
SetBorderColor
;ifSearchScreen
SetSearchTermHeaderText
SetSearchButtonText
SetClearButtonText
AddSearchTerm
SetSearchTerms
ClearSearchTerms
SetSearchButtonText
SetBreadcrumbText
SetBreadcrumbEnabled
Show
Close
SetTitle
;ifSearchHistory
Clear
Push
GetAsArray
;ifParagraphScreen
AddHeaderText
AddParagraph
AddButton
AddGraphic
Show
Close
SetTitle
;2.6
AddScaledGraphic
;ifMessageDialog
SetText
AddButton
ShowBusyAnimation
Show
Close
SetTitle
;ifOneLineDialog
SetTitle
ShowBusyAnimation
Show
Close
;ifCodeRegistrationScreen
AddHeaderText
AddParagraph
AddButton
AddFocalText
SetRegistrationCode
Show
Close
SetTitle
;ifKeyboardScreen
SetDisplayText
SetText
GetText
SetMaxLength
AddButton
SetSecureText
Show
Close
SetTitle
;ifPinEntryDialog
AddButton
Pin
SetNumPinEntryFields
Show
Close
SetTitle
;ifAudioPlayer
SetContentList
AddContent
ClearContent
Play
Stop
Pause
Resume
SetLoop
SetNext
;2.6
Seek
;ifMessagePort
GetMessage
WaitMessage
;ifDeviceInfo
GetModel
GetVersion
GetDeviceUniqueId
GetDisplayType
GetDisplayMode
GetDisplayAspectRatio
;2.6
GetDisplaySize
GetTimeZone
;ifDateTime
asSeconds
asDateString
asDateStringNoParam
getWeekday
getDayOfmonth
getLastDayOfMonth
getMonth
getYear
mark
fromSeconds
fromISO8601String
;2.6
getHours
getMinutes
getSeconds
getMilliseconds
toLocalTime
;ifEVPCipher
Setup
Reint
Process
Update
Final
;ifEVPDigest
Setup
Reinit
Process
Update
Final
;ifHMAC
Setup
Reinit
Process
Update
Final
;ifTimespan
Marl
TotalMilliseconds
TotalSeconds
GetSecondsToISO8601Date
;ifRegistry
GetSectionList
Delete
Flush
;ifRegistrySection
Read
Write
Delete
Exists
Flush
GetKeyList
;ifUrlTransfer
GetIdentity
SetUrl
SetPort
AddHeader
SetHeaders
GetToString
GetToFile
AsyncGetToString
AsyncGetToFile
Head
AsyncHead
PostFromString
PostFromFile
AsyncPostFromString
AsyncPostFromFile
SetUserAndPassword
SetMinimumTransferRate
GetFailureReason
SetCertificatesFile
InitClientCertificates
EnabledEncodings
Escape
Unescape
UrlEncode
GetUrl
EnableResume
EnablePeerVerification
EnableHostVerification
EnableFreshConnection
;ifUrlEvent
GetInt
GetResponseCode
GetFailureReason
GetString
GetSourceIdentity
GetResponseHeaders
GetTargetIpAddress
;ifImagecanvas - 2.6
AllowUpdates
SetLayer
swapLayers
SetRequireAllImagesToDraw
PurgeCachedImages
GetCanvasRect
ClearLayer
Clear
Show
Close
AddButton
;ifFontRegistry
Register
GetFamilies
Get
;ifFontMetrics
Size
;ifSystemLog
EnableType
;ifRegex
IsMatch
Match
Replace
ReplaceAll
Split
;ifPath
Change
IsValid
Split
;ifFileSystem
GetVolumeList
Find
FindRecurse
Match
Exists
Stat
GetDirectoryListing
GetVolumeInfo
CreateDirectory
Delete
CopyFile
Rename
;ifVideoPlayer
SetContentList
AddContent
ClearContent
Play
Stop
Pause
Resume
SetLoop
SetNext
Seek
SetPositionNotificationPeriod
SetMacrovisionLevel
SetCGMS
SetDestinationRect
;Event Object Methods
GetType
GetIndex
GetMessage
GetData
;2.6
GetInfo
#KEYWORD=Interface
ifList
ifEnum
ifMessagePort
ifInt
ifIntOps
ifFloat
ifString
ifStringOps
ifFunction
ifBoolean
ifAssociativeArray
ifArray
ifByteArray
ifXMLElement
ifXMLList
;PLATFORM INTERFACES
ifAppManager
ifPosterScreen
ifHttpAgent
ifSetMessagePort
ifGetMessagePort
ifMessagePort
ifSpringboardScreen
ifVideoScreen
ifSlideShow
ifSearchScreen
ifSearchHistory
ifParagraphScreen
ifMessageDialog
ifOneLineDialog
ifCodeRegistrationScreen
ifKeyboardScreen
ifPinEntryDialog
ifAudioPlayer
ifDeviceInfo
ifDateTime
ifEVPCipher
ifEVPDigest
ifHMAC
ifTimespan
ifRegistry
ifRegistrySection
ifUrlTransfer
ifUrlEvent
;2.6
ifImageCanvas
ifFontRegistry
ifFontMetrics
ifSystemLog
ifRegex
ifPath
ifFileSystem
ifVideoPlayer
#KEYWORD=Built-in objects
m
;CORE COMPONENTS AND INTERFACES
roArray
roAssociativeArray
roList
roBrSub
roByteArray
roMessagePort
roGlobal
roInt
roFloat
roString
roFunction
roBoolean
roInvalid
roXMLElement
roXMLList
;PLATFORM COMPONENTS
roAppManager
roMessagePort
roDeviceInfo
roUrlTransfer
roUrlEvent
roRegistry
roRegistrySection
roPinEntryDialog
roPosterScreen
roCodeRegistrationScreen
roParagraphScreen
roMessageDialog
roOneLineDialog
roVideoScreen
roKeyboardScreen
roSearchScreen
roSearchHistory
roSpringboardScreen
roSlideShow
roAudioPlayer
roTimespane
roDateTime
roEVPCipher
roEVPDigest
roPosterScreenEvent
;2.6
roImageCanvas
roFontRegistry
roSystemLog
roRegex
roPath
roFileSystem
roVideoPlayer
roFileSystemEvent
#KEYWORD=Events
isScreenClosed
isListFocused
isListSelected
isListItemSelected
isListItemFocused
isButtonPressed
isPlaybackPosition
isRemoteKeyPressed
isRequestSucceeded
isRequestFailed
isRequestInterrupted
isStatusMessage
isPaused
isResumed
isCleared
isFullResult
isPartialResult
isStreamStarted
isAdSelected
;2.6
isStorageDeviceAdded
isStorageDeviceInserted
isStorageDeviceRemoved
isStreamStarted
#KEYWORD=Attributes
;CONTENT META DATA
ContentType
Title
TitleSeason
Description
Watched
Live
Url
SDBifUrl
HDBifUrl
SDPosterUrl
HDPosterUrl
StreamBitrates
StreamUrls
StreamQualities
StreamContentIDs
StreamStickyHttpRedirects
StreamStartTimeOffset
StreamFormat
Length
BookmarkPosition
PlayStart
PlayDuration
ReleaseDate
Rating
StarRating
UserStarRating
ShortDescriptionLine1
ShortDescriptionLine2
EpisodeNumber
Actors
Director
Categories
HDBranded
IsHD
TextOverlayUL
TextOverlayUR
TextOverlayBody
Album
Artist
SourceRect
TargetRect
TargetTranslation
TargetRotation
CompositionMode
Text
TextAttrs
SubtitleUrl
Stream
Streams
;2.6
Color
Font
HAlign
VAlign
TextDirection
;THEME
OverhangSliceSD
OverhangPrimaryLogoSD
OverhangPrimaryLogoOffsetSD_X
OverhangPrimaryLogoOffsetSD_Y
OverhangSecondaryLogoSD
OverhangSecondaryLogoOffsetSD_X
OverhangSecondaryLogoOffsetSD_Y
OverhangSliceHD
OverhangPrimaryLogoHD
OverhangPrimaryLogoOffsetHD_X
OverhangPrimaryLogoOffsetHD_Y
OverhangSecondaryLogoHD
OverhangSecondaryLogoOffsetHD_X
OverhangSecondaryLogoOffsetHD_Y
OverhangLogoSD
OverhangLogoHD
OverhangOffsetHD_X
OverhangOffsetHD_Y
OverhangOffsetSD_X
OverhangOffsetSD_Y
ButtonMenuHighlightText
ButtonMenuNormalOverlayText
ButtonMenuNormalText
ButtonNormalColor
ButtonHighlightColor
BackgroundColor
ParagraphBodyText
ParagraphHeaderText
PosterScreenLine1Text
PosterScreenLine2Text
BreadcrumbTextLeft
BreadcrumbTextRight
BreadcrumbDelimiter
RegistrationCodeColor
RegistrationFocalColor
SpringboardTitleText
SpringboardActorColor
SpringboardSynopsisText
SpringboardGenreColor
SpringboardRuntimeColor
SpringboardDirectorLabelColor
SpringboardDirectorColor
SpringboardDirectorLabel
SpringboardArtistColor
SpringboardArtistLabelColor
SpringboardAlbumColor
SpringboardAlbumLabelColor
SpringboardArtistLabel
SpringboardAlbumLabel
EpisodeSynopsisText
FilterBannerSliceSD
FilterBannerActiveSD
FilterBannerInactiveSD
FilterBannerSliceHD
FilterBannerActiveHD
FilterBannerInactiveHD
FilterBannerActiveColor
FilterBannerInactiveColor
FilterBannerSideColor
;http.connect
Url
OrigUrl
Method
Status
TargetIp
HttpCode
Bandwidth
#


If you are adding this for use with EditPlus for Windows, then do the following:

  • Copy the code above

  • Create a new text file, and paste in code.

  • Save the file as "brs.stx"

  • In EditPlus, select Document-> Permanent Settings...

  • Then navigate to Files->Syntax and settings

  • Add a new file type of ".brs"

  • Click the "..." next to the "Syntax file:" field

  • Select the "brs.stx" file you saved

  • Click "Apply"

  • Click "OK", and restart EditPlus.


Any file with a .brs extension will be formatted. Enjoy the pretty colors. 😛

Cheers.
0 Kudos
2 REPLIES 2
malloys
Visitor

Re: Syntax file for BRS

mainmanc,

Awesome!
Thanks for doing this - the list seems pretty thorough.
Would you be OK with me leveraging this for my basic Eclipse plugin ( viewtopic.php?f=34&t=31199 )?

Cheers
0 Kudos
mainmanc
Visitor

Re: Syntax file for BRS

Of course! That's what it's there for. 😄

Cheers.
0 Kudos