Class: Rouge::Lexers::Brightscript

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/brightscript.rb

Constant Summary

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

Token::Tokens::Num, Token::Tokens::Str

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

Class Method Summary collapse

Methods inherited from RegexLexer

append, #delegate, get_state, #get_state, #goto, #group, #groups, #in_state?, #pop!, prepend, #push, #recurse, replace_state, #reset!, #reset_stack, #stack, start, start_procs, #state, state, #state?, state_definitions, states, #step, #stream_tokens, #token

Methods inherited from Rouge::Lexer

aliases, all, #as_bool, #as_lexer, #as_list, #as_string, #as_token, assert_utf8!, #bool_option, #continue_lex, continue_lex, debug_enabled?, demo, demo_file, desc, detect?, detectable?, disable_debug!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, lex, #lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option, #with

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.builtinsObject

Scene graph components configured as builtins. See BrightScript component documentation e.g. developer.roku.com/en-ca/docs/references/brightscript/components/roappinfo.md

[View source]

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/rouge/lexers/brightscript.rb', line 63

def self.builtins
  @builtins ||= Set.new %w(
    roAppendFile roAppInfo roAppManager roArray roAssociativeArray
    roAudioGuide roAudioMetadata roAudioPlayer roAudioPlayerEvent
    roAudioResourceroBitmap roBoolean roBoolean roBrightPackage roBrSub
    roButton roByteArray roCaptionRenderer roCaptionRendererEvent
    roCecInterface roCECStatusEvent roChannelStore roChannelStoreEvent
    roClockWidget roCodeRegistrationScreen
    roCodeRegistrationScreenEventroCompositor roControlDown roControlPort
    roControlPort roControlUp roCreateFile roDatagramReceiver
    roDatagramSender roDataGramSocket roDateTime roDeviceInfo
    roDeviceInfoEvent roDoubleroEVPCipher roEVPDigest roFileSystem
    roFileSystemEvent roFloat roFont roFontMetrics roFontRegistry
    roFunction roGlobal roGpio roGridScreen roGridScreenEvent
    roHdmiHotPlugEventroHdmiStatus roHdmiStatusEvent roHMAC roHttpAgent
    roImageCanvas roImageCanvasEvent roImageMetadata roImagePlayer
    roImageWidgetroInput roInputEvent roInt roInt roInvalid roInvalid
    roIRRemote roKeyboard roKeyboardPress roKeyboardScreen
    roKeyboardScreenEventroList roListScreen roListScreenEvent
    roLocalization roLongInteger roMessageDialog roMessageDialogEvent
    roMessagePort roMicrophone roMicrophoneEvent roNetworkConfiguration
    roOneLineDialog roOneLineDialogEventroParagraphScreen
    roParagraphScreenEvent roPath roPinEntryDialog roPinEntryDialogEvent
    roPinentryScreen roPosterScreen roPosterScreenEventroProgramGuide
    roQuadravoxButton roReadFile roRectangleroRegexroRegion roRegistry
    roRegistrySection roResourceManager roRSA roRssArticle roRssParser
    roScreen roSearchHistory roSearchScreen roSearchScreenEvent
    roSerialPort roSGNode roSGNodeEvent roSGScreenroSGScreenEvent
    roSlideShowroSlideShowEvent roSNS5 roSocketAddress roSocketEvent
    roSpringboardScreen roSpringboardScreenEventroSprite roStorageInfo
    roStreamSocket roStringroSystemLogroSystemLogEvent roSystemTime
    roTextFieldroTextScreen roTextScreenEvent roTextToSpeech
    roTextToSpeechEvent roTextureManager roTextureRequest
    roTextureRequestEventroTextWidget roTimer roTimespan roTouchScreen
    roTunerroTunerEvent roUniversalControlEvent roUrlEvent roUrlTransfer
    roVideoEvent roVideoInput roVideoMode roVideoPlayer roVideoPlayerEvent
    roVideoScreen roVideoScreenEventroWriteFile roXMLElement roXMLList
  )
end

.keyword_reservedObject

[View source]

29
30
31
32
33
34
35
36
37
# File 'lib/rouge/lexers/brightscript.rb', line 29

def self.keyword_reserved
  @keyword_reserved ||= Set.new %w(
    BOX CREATEOBJECT DIM EACH ELSE ELSEIF END ENDFUNCTION ENDIF ENDSUB
    ENDWHILE EVAL EXIT EXITWHILE FALSE FOR FUNCTION GETGLOBALAA
    GETLASTRUNCOMPILEERROR GETLASTRUNRUNTIMEERROR GOTO IF IN INVALID LET
    LINE_NUM M NEXT OBJFUN POS PRINT REM RETURN RUN STEP STOP SUB TAB TO
    TRUE TYPE WHILE
  )
end

.keyword_reserved_unsupportedObject

These keywords are present in BrightScript, but not supported in standard .brs files

[View source]

40
41
42
43
44
# File 'lib/rouge/lexers/brightscript.rb', line 40

def self.keyword_reserved_unsupported
  @keyword_reserved_unsupported ||= Set.new %w(
    CLASS CONST IMPORT LIBRARY NAMESPACE PRIVATE PROTECTED PUBLIC
  )
end

.keyword_typeObject

[View source]

47
48
49
50
51
52
# File 'lib/rouge/lexers/brightscript.rb', line 47

def self.keyword_type
  @keyword_type ||= Set.new %w(
    BOOLEAN DIM DOUBLE DYNAMIC FLOAT FUNCTION INTEGER INTERFACE INVALID
    LONGINTEGER OBJECT STRING VOID
  )
end

.name_builtinObject

[View source]

16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rouge/lexers/brightscript.rb', line 16

def self.name_builtin
  @name_builtin ||= Set.new %w(
    ABS ASC ATN CDBL CHR CINT CONTROL COPYFILE COS CREATEDIRECTORY CSNG
    DELETEDIRECTORY DELETEFILE EXP FINDMEMBERFUNCTION FINDNODE FIX
    FORMATDRIVEFORMATJSON GETINTERFACE INSTR INT LCASE LEFT LEN LISTDIR
    LOG MATCHFILES MID MOVEFILE OBSERVEFIELD PARSEJSON PARSEXML
    READASCIIFILE REBOOTSYSTEM RIGHT RND RUNGARBAGECOLLECTOR SGN SIN
    SLEEP SQR STR STRI STRING STRINGI STRTOI SUBSTITUTE TANTEXTTOP TEXT
    TRUCASE UPTIME VALVISIBLE VISIBLE WAIT
  )
end

.operator_wordObject

[View source]

55
56
57
58
59
# File 'lib/rouge/lexers/brightscript.rb', line 55

def self.operator_word
  @operator_word ||= Set.new %w(
    AND AS MOD NOT OR THEN
  )
end