Identifiers
Identifiers are described by the following lexical definitions:
identifier ::= (letter | "_" | "$")
(letter | digit | "_" | "$")*
(letter | digit | "_" | "$" | "!" | "?")?
letter ::= lowercase | uppercase
lowercase ::= "a"..."z"
uppercase ::= "A"..."Z"
digit ::= "0"..."9"
Unlike PHP, Fep identifiers may contain $
and have !
or ?
at the end of them. This is to allow Fep users to write functions that signal that they are a predicates or mutators via their identifiers.
For example:
def isShort?( str ) { return str.length <= 3; }
isShort? "moo"; // returns true
isShort? "meow"; // returns false
def makeLowerCase!( ref str ) { return str = str.toUpper(); }
var str = "moo";
makeLowerCase! str ;
println str;
// Prints "MOO"