Lexical
The Lexical analyzer for Adaptive Framework is responsible for tokenizing Adaptive Scripts, Templates and Expressions as inputs for the parser. In this section, we will cover comments and whitespace, identifiers, keywords, operators, and literals.
Comments
    
        Adaptive Script supports both Inline and Block comments. Inline comments start with
        // and continue to the end of the line. Block comments start with 
        /* and end with */.
    
The following are examples of both types of comments:
// This is an inline comment
/* 
    This is a block comment.
    It can wrap multiple lines.
*/Whitespace
Whitespace are character sequences that are ignored by the lexical analyzer and serve the purpose of making code more readable. The following is a list of whitespace characters:
- TAB character
 - Vertical Tab
 - Line Feed
 - Form Feed
 - Carriage Return
 - Zero Width No-Break Space
 - Space Separator
 - (Comments)
 
Identifiers
Identifiers are sequences of characters that are used to identify a variable name, category, function name, method name, parameter name, qualifier name variable reference, interface name, type variable name, or object property name.
Identifiers have no length limit and are case-sensitive.
Identifier ::= IdentifierStart IdentifierContinue*
IdentifierStart ::= ID_START | '$' | '_'
IdentifierContinue ::= ID_CONTINUE | '$' | ZWNJ | ZWJID_STARTis any codepoint withID_STARTflagID_CONTINUEis any codepoint withID_CONTINUEflagZWNJis the Zero-width Non-Joiner (0x200c)ZWJis the Zero-width Joiner (0x200d)
Reserved Names
When declaring a variable name, you may use any identifier with the exception of the following reserved names:
false       INF         Infinity    NaN      null    
true        undefined   break       case     catch
const       continue    do          else     finally
for         foreach     function    if       let
return      switch      throw       try      void
while       as          async       await    class
export      extends     from        import   interface
instanceof  super       this        type     typeof
var         withLiterals
Literals are constant that can be used as a values inside expressions. There are three types of literals:
- List Literal
 - Object Literal
 - Scalar Literal
 
    
        A List Literal is a sequence of literals, separated by , and enclosed in [ and ].
    
[ 1, 2, 3 ]
    
        An Object Literal is a sequence of Identifier : Literal pairs, separated by , and enclosed by { and }.
    
{ 
    "a": 1, 
    "b": true 
}A Scalar Literal may be one of: Double, Integer, String, true, false or null.
3.14
42
"a string"
true 
false
nullOperators
The following tokens are used in expressions:
+     -     *     /     %     **   
+=    -=    *=    /=    %=    **=
!     &&    ||    
<     >     <=    >=   
==   ===    !=    !==
?     :     ++    --