This part of the document describes the syntax and semantics of the language.
Identifiers start with a alphabetic character or '_' followed by any number of alphabetic characters, '_' or digits ([0-9]). Squirrel is a case sensitive language, this means that the lowercase and uppercase representation of the same alphabetic character are considered different characters. For instance "foo", "Foo" and "fOo" will be treated as 3 distinct identifiers.
The following words are reserved words by the language and cannot be used as identifiers:
Keywords are covered in detail later in this document.
Squirrel recognizes the following operators:
Squirrel accepts integer numbers, floating point numbers and strings literals.
|34||Integer number(base 10)|
|0xFF00A120||Integer number(base 16)|
|0753||Integer number(base 8)|
|1.52||Floating point number|
|1.e2||Floating point number|
|1.e-2||Floating point number|
|"I'm a string"||String|
|@"I'm a verbatim string"||String|
|@" I'm a multiline verbatim string "||String|
IntegerLiteral := [1-9][0-9]* | '0x' [0-9A-Fa-f]+ | ''' [.]+ ''' | 0[0-7]+ FloatLiteral := [0-9]+ '.' [0-9]+ FloatLiteral := [0-9]+ '.' 'e'|'E' '+'|'-' [0-9]+ StringLiteral:= '"'[.]* '"' VerbatimStringLiteral:= '@''"'[.]* '"'
The /* (slash, asterisk) characters, followed by any sequence of characters (including new lines), followed by the */ characters. This syntax is the same as ANSI C.
/* this is a multiline comment. this lines will be ignored by the compiler */
The // (two slashes) characters, followed by any sequence of characters. A new line not immediately preceded by a backslash terminates this form of comment. It is commonly called a “single-line comment.”
//this is a single line comment. this line will be ignored by the compiler
The character # is an alternative syntax for single line comment.
#this is also a single line comment.
This to facilitate the use of squirrel in UNIX-style shell scripts.