Lexical Structure

Top  Previous  Next

Character set

CellScript uses 8-bit characters. Character values of 127 (0x7F) or greater can only be used in quoted strings.

White space and line breaks

The characters tab (0x09), vertical tab (0x0B), form feed (0x0C), and space (0x20) are considered white space.

 

The characters line feed (0x0A) and carriage return (0x0D) are considered line terminators.

Comments

A single-line comment starts with // and ends with the next line terminator. A multiline comment starts with /* and ends with */. Line terminators within a multiline comment are completely ignored by CellScript.

Identifiers

An identifier is a sequence of characters used for the name of a variable or function. It must start with a letter, a dollar sign ($), or an underscore (_). Subsequent characters may also be a decimal digit.

Literals

String Literals

A string literal is zero or more characters enclosed in single or double quotes. Characters may be represented by escape sequence:

 

Escape

Result character

Character code

\'

'

0x27

\"

"

0x22

\\

\

0x5C

\b

backspace

0x08

\f

form feed

0x0C

\n

line feed

0x0A

\r

carriage return

0x0D

\t

tab

0x09

\v

vertical tab

0x0B

\xNN

(N is hex digit)

0xNN

 

Numeric Literals

A decimal numeric literal is represented by one or more decimal digits with an optional decimal point. The value may be scaled by a power of 10 by appending an exponent in E-notation immediately after it (with no white space). For example, 1e6 or 2.45E-12.

 

A hexadecimal numeric literal begins with 0x or 0X, followed by 1 to 8 hexadecimal digits.

 

A leading zero is not allowed unless it is the only character, or it is immediately followed by a decimal point, exponential notation ("e" or "E"), or hexadecimal notation ("x" or "X").

Reserved words

CellScript reserved words

break

false

null

var

continue

for

return

while

do

function

true

 

else

if

typeof

 

 

Additional ECMAScript reserved words

These are reserved per ECMAScript 3.0 but not implemented in CellScript.

case

finally

switch

void

catch

in

this

with

default

instanceof

throw

 

delete

new

try