Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
EnTerr
Level 11

List of Reserved Words in BrS - where is it?

Reading the RTFM -
"3.1 Identifiers" wrote:
* may not use a "reserved word" as the name (see appendix for list of reserved words).

Where is said list of language reserved words? Seems as if it ended on the cutting room floor during the conversion to wiki - but i have vague memory of seeing that list somewhere in the days of yore.

As a bonus question, why EndFor and ExitFor are not reserved words whereas EndWhile, ExitWhile, EndIf, ElseIf, EndSub/EndFunction are?

ps. as commentary, there are a a few programming languages in which there are no reserved words (like PL/1 and Fortran, if i recollect), so something like this (it assigns to variable IF the bigger of two values THEN and ELSE)
IF = IF THEN > ELSE THEN THEN ELSE ELSE FI
can be a valid statement and meaning is determined by context. But in most languages that is not the case, BASIC included (which bright script is dialect of).
0 Kudos
5 Replies
RokuJoel
Roku Employee
Roku Employee

Re: List of Reserved Words in BrS - where is it?

From the old Brightscript Reference 3.0 PDF, this seems to have been left out of the on-line version:

Appendix C - Reserved Words
END, LET, PRINT, IF, ELSE, ENDIF, THEN, GOTO, FOR, TO, STEP,
NEXT, RETURN, DIM, NOT, AND, OR, TAB, STOP, OBJFUN, TYPE,
TRUE, FALSE, CREATEOBJECT, WHILE, ENDWHILE, EXITWHILE, EACH, EXIT,
INVALID, ENDFUNCTION, ENDSUB, ELSEIF, REM, LINE_NUM, SUB, FUNCTION


From the BrightsSign Brightscript Manual 2.0

58
Reserved Words
INVALID FOR POS
AND PRINT LINE_NUM
OR GOTO REM
EACH IF RETURN
NEXT NOT STEP
DIM THEN STOP
ELSE TO TAB
END TAB OBJFUN
TYPE RND TRUE
FALSE CREATEOBJECT WHILE
ENDWHILE EXITWHILE ENDSUB
SUB FUNCTION EACH
EXIT ENDFUNCTION ENDIF
0 Kudos
EnTerr
Level 11

Re: List of Reserved Words in BrS - where is it?

"RokuJoel" wrote:
From the old Brightscript Reference 3.0 PDF, this seems to have been left out of the on-line version:

Wow, thanks for instant response!
Kindly requesting a current list to be included in the wiki?
0 Kudos
RokuRobB
Roku Employee
Roku Employee

Re: List of Reserved Words in BrS - where is it?

The BrightScript reserved word list is now on the Wiki in the BrightScript Language Reference, section 10. http://sdkdocs.roku.com/display/sdkdoc/ ... ervedWords

Thanks for pointing out that this was missing.
0 Kudos
EnTerr
Level 11

Re: List of Reserved Words in BrS - where is it?

"RokuRobB" wrote:
The BrightScript reserved word list is now on the Wiki in the BrightScript Language Reference, section 10. http://sdkdocs.roku.com/display/sdkdoc/ ... ervedWords

Thanks for pointing out that this was missing.

Thank you for fixing the omission. Couple of things to correct in that list:
  • NULL is not a reserved word (should be removed)

  • POS is a reserved word (should be added)


[spoiler=sorted list of reserved words - AFAIK:k3yd2eks]
AND
CREATEOBJECT
DIM
EACH
ELSE
ELSEIF
END
ENDFUNCTION
ENDIF
ENDSUB
ENDWHILE
EXIT
EXITWHILE
FALSE
FOR
FUNCTION
GOTO
IF
INVALID
LET
LINE_NUM
NEXT
NOT
OBJFUN
OR
POS
PRINT
REM
RETURN
STEP
STOP
SUB
TAB
THEN
TO
TRUE
TYPE
WHILE
[/spoiler:k3yd2eks]
0 Kudos
EnTerr
Level 11

Re: List of Reserved Words in BrS - where is it?

Good news, the list of BrS reserved words has been corrected (3rd time is a charm). In addition to the words i listed above, the following also turn out to be reserved words:
  • Box

  • Eval

  • GetGlobalAA

  • GetLastRunCompileError

  • GetLastRunRuntimeError

  • Run
That is, in addition to statements, the names of all section 6.0: Runtime Functions are reserved words too (meaning cannot have variables named e.g. "box" or "run" or "type").

Please pass along my gratitude to the person that ultimately was able to give a correct list of keywords.
0 Kudos