lib/parser/statements/ExpressionStatement.js
function parseSingularExpression(data) {
    // A hash signifies a pointer
    if (data[0] === '#') {
        var pointerId = data.substring(1);
        if (isNaN(parseInt(pointerId))) return new SyntaxError('Unexpected hash');
        return new statements.PointerStatement(pointerId);
    }

    var isString = data.indexOf('"') !== -1;

    // If there is any quote, its either a string or syntax error
    if (isString) {
        if (data[0] !== '"' || data[data.length - 1] !== '"') return new SyntaxError('Unexpected quote');
        var stringContent = data.slice(1, data.length - 1);
        return new statements.StringStatement(stringContent);
    }

    // If it is not not a number, it must be a number (see my logic?)
    var numberValue = parseFloat(data);
    if (!isNaN(numberValue)) {
        return new statements.NumberStatement(numberValue);
    }

    // Otherwise, it must be a variable
    // TODO: validate variable name (this should actually go in the variable constructor..)
    return new statements.VariableStatement(data);
}
function parseSingularExpression(data) {
    // A hash signifies a pointer
    if (data[0] === '#') {
        var pointerId = data.substring(1);
        if (isNaN(parseInt(pointerId))) return new SyntaxError('Unexpected hash');
        return new statements.PointerStatement(pointerId);
    }

    var isString = data.indexOf('"') !== -1;

    // If there is any quote, its either a string or syntax error
    if (isString) {
        if (data[0] !== '"' || data[data.length - 1] !== '"') return new SyntaxError('Unexpected quote');
        var stringContent = data.slice(1, data.length - 1);
        return new statements.StringStatement(stringContent);
    }

    // If it is not not a number, it must be a number (see my logic?)
    var numberValue = parseFloat(data);
    if (!isNaN(numberValue)) {
        return new statements.NumberStatement(numberValue);
    }

    // Otherwise, it must be a variable
    // TODO: validate variable name (this should actually go in the variable constructor..)
    return new statements.VariableStatement(data);
}
function parseSingularExpression ( data ) { // A hash signifies a pointer if ( data [ 0 ] === '#' ) { var pointerId = data . substring ( 1 ) ; if ( isNaN ( parseInt ( pointerId ) ) ) return new SyntaxError ( 'Unexpected hash' ) ; return new statements . PointerStatement ( pointerId ) ; } var isString = data . indexOf ( '"' ) !== - 1 ; // If there is any quote, its either a string or syntax error if ( isString ) { if ( data [ 0 ] !== '"' || data [ data . length - 1 ] !== '"' ) return new SyntaxError ( 'Unexpected quote' ) ; var stringContent = data . slice ( 1 , data . length - 1 ) ; return new statements . StringStatement ( stringContent ) ; } // If it is not not a number, it must be a number (see my logic?) var numberValue = parseFloat ( data ) ; if ( ! isNaN ( numberValue ) ) { return new statements . NumberStatement ( numberValue ) ; } // Otherwise, it must be a variable // TODO: validate variable name (this should actually go in the variable constructor..) return new statements . VariableStatement ( data ) ; }
Parses a single expression (one without any operators) and returns a variable, string, or number

@param {String} data The expression data
@returns {SyntaxError|exports.StringStatement|exports.NumberStatement|exports.VariableStatement|exports.PointerStatement}
@private
Parses a single expression ( one without any operators ) and returns a variable string or number