@@ -52,6 +52,7 @@ const grammar = {
5252 bsdoc : {
5353 patterns : [
5454 { include : '#bsdoc_param_and_type' } ,
55+ { include : '#bsdoc_return_and_type' } ,
5556 { include : '#bsdoc_generic' }
5657 ]
5758 } ,
@@ -88,6 +89,25 @@ const grammar = {
8889 match :
8990 "(?i:\\s*(rem|'+)\\s*(@)(param|type)\\s+(?:(\\{)\\s*([^\\}]+)\\s*(\\}))?\\s*([a-z0-9_.]+)?(.*))"
9091 } ,
92+ bsdoc_return_and_type : {
93+ captures : {
94+ 1 : { name : 'comment.line.apostrophe.brs' } ,
95+ 2 : {
96+ name : 'punctuation.definition.block.tag.bsdoc storage.type.class.bsdoc'
97+ } ,
98+ 3 : {
99+ name : 'punctuation.definition.block.tag.bsdoc storage.type.class.bsdoc'
100+ } ,
101+ 4 : { name : 'punctuation.definition.bracket.curly.begin.bsdoc' } ,
102+ 5 : {
103+ name : ' comment.block.documentation.brs entity.name.type.instance.bsdoc'
104+ } ,
105+ 6 : { name : 'punctuation.definition.bracket.curly.end.bsdoc' } ,
106+ 7 : { name : 'comment.block.documentation.brs' }
107+ } ,
108+ match :
109+ "(?i:\\s*(rem|'+)\\s*(@)(return|returns)\\s+(?:(\\{)\\s*([^\\}]+)\\s*(\\}))?\\s*([a-z0-9_.]+.*)?)"
110+ } ,
91111 class_declaration : {
92112 captures : {
93113 1 : { name : 'keyword.other.class.brs' } ,
@@ -179,7 +199,6 @@ const grammar = {
179199 { include : '#try_catch' } ,
180200 { include : '#non_identifier_keywords' } ,
181201 { include : '#operators' } ,
182- { include : '#support_functions' } ,
183202 { include : '#variables_and_params' } ,
184203 { include : '#annotation' }
185204 ]
@@ -196,15 +215,20 @@ const grammar = {
196215 patterns : [
197216 { include : '#comment' } ,
198217 { include : '#annotation' } ,
199- {
200- begin : '(?i)\\s*\\b([a-z0-9_]+)(?:[ \\t]*(=))?' ,
201- beginCaptures : {
202- 1 : { name : 'variable.object.enummember.brs' } ,
203- 2 : { name : 'keyword.operator.assignment.brs' }
204- } ,
205- end : '\r?\n' ,
206- patterns : [ { include : '#primitive_literal_expression' } ]
207- }
218+ { include : '#enum_field' }
219+ ]
220+ } ,
221+ enum_field : {
222+ begin : '(?i)\\s*\\b([a-z0-9_]+)(?:[ \\t]*(=))?' ,
223+ beginCaptures : {
224+ 1 : { name : 'variable.object.enummember.brs' } ,
225+ 2 : { name : 'keyword.operator.assignment.brs' }
226+ } ,
227+ end : '\r?\n' ,
228+ patterns : [
229+ { include : '#primitive_literal_expression' } ,
230+ { include : '#comment' } ,
231+ { include : '#annotation' }
208232 ]
209233 } ,
210234 field : {
@@ -554,40 +578,6 @@ const grammar = {
554578 match :
555579 '(?i:\\b(boolean|integer|longinteger|float|double|string|object|function|sub|interface|dynamic|brsub|dim|const)\\b)'
556580 } ,
557- support_builtin_functions : {
558- match :
559- '(?i:\\b(GetLastRun(RuntimeError|CompileError)|Rnd|Box|Type|objfun|pos|eval)\\b)' ,
560- name : 'support.function.brs'
561- } ,
562- support_component_functions : {
563- match :
564- '(?i:\\b(R(ight|e(set(Index)?|ad(B(yte(IfAvailable)?|lock)|File|Line)?|move(Head|Tail|Index)))|Ge(nXML(Header)?|t(Res(ource|ponse(Headers|Code))|X|M(i(nute|llisecond)|o(nth|de(l)?)|essage)|B(yte(sPerBlock|Array)|o(o(tVersion(Number)?|lean)|dy))|S(t(orageCardInfo|a(ndards|tusByte)|ring(Count)?)|i(zeInMegabytes|gnedByte)|ource(Host|Identity|Port)|ub|ec(tionList|ond)|afe(X|Height|Y|Width))|H(o(stName|ur)|e(ight|ad))|Y(ear)?|N(extArticle|ame(dElements)?)|C(hildElements|ontrols|urrent(Standard|Con(trolValue|fig)|Input))|T(i(tle|me(Server|Zone))|o(String|File)|ext|ail)|I(n(t|dex|puts)|dentity)|ZoneDateTime|D(e(scription|vice(BootCount|Name|U(niqueId|ptime)))|a(y(OfWeek)?|ta))|U(se(dInMegabytes|rData)|tcDateTime)|Ent(ityEncode|ry)|V(ersion(Number)?|alue)|KeyList|F(ileSystemType|loat|a(ilureReason|mily)|reeInMegabytes)|W(holeState|idth)|LocalDateTime|Attributes))|M(id|D5|ap(StereoOutput(Aux)?|DigitalOutput))|Boolean|S(h(ift|ow)|canWiFi|t((Clear|Display)?|art|r(i(ng)?)?)|implify|ubtract(Milliseconds|Seconds)|e(nd(RawMessage|B(yte|lock)|Line)?|t(R(ollOverRegion|e(s(ize|olution)|c(tangle|eiveEol)))|X|M(i(n(imumTransferRate|ute)|llisecond)|o(nth|de(CaseSensitive)?)|ultiscreenBezel)|B(yteEventPort|o(olean|dy)|a(ckground(Bitmap|Color)|udRate))|S(t(andard|ring)|ub|e(ndEol|cond)|afeTextRegion)|H(o(stName|ur)|eight)|Y(ear)?|Name|C(hannelVolumes(Aux)?|ontrolValue|ursor(Bitmap|Pos(ition)?))|Time(Server|Zone)?|I(n(t|put)|P4(Gateway|Broadcast|Netmask|Address))|OutputState|D(HCP|omain|e(stination|fault(Mode|Transistion))|a(y(OfWeek)?|te(Time)?))|U(ser(Data|AndPassword)|tcDateTime|rl)|P(o(werSaveMode|rt)|assword|roxy)|E(ntry|cho|ol)|V(iewMode|olume(Aux)?)|F(o(nt|r(egroundColor|groundColor))|l(oat|ashRate))|W(holeState|i(dth|Fi(Passphrase|ESSID)))|L(ineEventPort|o(calDateTime|opMode)|auguage)|Audio(Mode(Aux)?|Stream(Aux)?|Output(Aux)?))|ek(Relative|ToEnd|Absolute)))|H(ide|ead|asAttribute)|N(ormalize|ext)|C(hr|ount|urrentPosition|l(s|ear(Region|Events)?))|T(o(Base64String|HexString|kenize|AsciiString)|estInter(netConnectivity|face)|rim)|I(s(MousePresent|N(ext|ame)|InputActive|Empty|Valid|LittleEndianCPU)|n(str|te(ger)|valid))|Object|D(ynamic|isplay(Preload|File(Ex)?)|o(uble|esExist)|elete)|U(n(shift|pack)|Case)|P(o(st(Message|From(String|File))|p(String(s)?)?)|ush(String)?|eek|lay(StaticImage|File)?|arse(String|File)?|reloadFile(Ex)?)|E(nable(R(ollover|egion)|Cursor|Input|Output)|xists)|Void|F(indIndex|unction|l(oat|ush)|rom(Base64String|HexString|AsciiString))|W(hile|aitMessage|rite(File)?)|L(ookup|e(n|ft))|A(s(ync(GetTo(String|File)|Head|PostFrom(String|File)|Flush)|c)?|tEof|dd(Re(ctangle(Region|_region)|place)|Milliseconds|BodyElement|Seconds|Head(er)?|CircleRegion|Tail|DNSServer|E(vent|lement(WithBody)?)|Attribute)|pp(end(String|File)?|ly))|ToStr)\\b)' ,
565- name : 'support.function.component.brs'
566- } ,
567- support_functions : {
568- patterns : [
569- { include : '#support_builtin_functions' } ,
570- { include : '#support_global_functions' } ,
571- { include : '#support_global_string_functions' } ,
572- { include : '#support_global_math_functions' } ,
573- { include : '#support_component_functions' }
574- ]
575- } ,
576- support_global_functions : {
577- match :
578- '(?i:\\b(Re(adAsciiFile|bootSystem)|GetInterface|MatchFiles|Sleep|C(opyFile|reate(Directory|Object))|Delete(Directory|File)|UpTime|FormatDrive|ListDir|W(ait|riteAsciiFile))\\b)' ,
579- name : 'support.function.brs'
580- } ,
581- support_global_math_functions : {
582- match :
583- '(?i:\\b(S(in|qr|gn)|C(sng|dbl|os)|Tan|Int|Exp|Fix|Log|A(tn|bs))\\b)' ,
584- name : 'support.function.brs'
585- } ,
586- support_global_string_functions : {
587- match :
588- '(?i:\\b(Right|Mid|Str(i(ng(i)?)?)?|Chr|Instr|UCase|Val|Asc|L(Case|e(n|ft)))\\b)' ,
589- name : 'support.function.brs'
590- } ,
591581 template_string : {
592582 begin : '(`)' ,
593583 beginCaptures : { 1 : { name : 'string.template.brs' } } ,
0 commit comments