예제 #1
0
/**
 * Give a parse error.
 *
 * @param  string			The error
 * @return ?boolean		Always NULL (NULL: exit)
 */
function js_parser_error($message)
{
    global $JS_LEX_TOKENS, $JS_PARSE_POSITION;
    list($pos, $line, $_, $i) = js_pos_to_line_details($JS_PARSE_POSITION);
    return js_die_error('PARSER', $pos, $line, $message, $i);
}
예제 #2
0
/**
 * Log a warning when lexing/parsing/checking.
 *
 * @param  string			The system causing the error
 * @param  string			The warning
 * @param  integer		The global position
 * @param  boolean		Whether the position is a string offset (as opposed to a token position)
 */
function js_log_warning($system, $warning, $i = -1, $absolute = false)
{
    global $JS_TEXT;
    if ($i == -1 && isset($GLOBALS['i'])) {
        $i = $GLOBALS['i'];
    }
    list($pos, $line, , $i) = js_pos_to_line_details($i, $absolute);
    $error = array('JS ERROR (' . $system . '): ' . $warning, $pos, $line, $i);
    global $JS_ERRORS;
    $JS_ERRORS[] = $error;
}