29 #include "parser.tab.h" 41 {
L"break", kBREAK,
TRUE},
44 {
L"continue", kCONTINUE,
TRUE},
45 {
L"default", kDEFAULT},
50 {
L"finally", kFINALLY},
52 {
L"function", kFUNCTION},
56 {
L"instanceof", kINSTANCEOF},
59 {
L"return", kRETURN,
TRUE},
96 while(p1 < ctx->
end && *p2) {
115 return c ==
'\n' ||
c ==
'\r' ||
c == 0x2028 ||
c == 0x2029;
120 if(
'0' <=
c &&
c <=
'9')
123 if(
'a' <=
c &&
c <=
'f')
126 if(
'A' <=
c &&
c <=
'F')
142 TRACE(
"ignoring keyword %s in incompatible mode\n",
162 const WCHAR html_commentW[] = {
'<',
'!',
'-',
'-',0};
164 if(!
ctx->is_html ||
ctx->ptr+3 >=
ctx->end ||
176 if(
ctx->ptr+1 >=
ctx->end)
179 if(*
ctx->ptr !=
'/') {
180 if(*
ctx->ptr ==
'@' &&
ctx->ptr+2 <
ctx->end &&
ctx->ptr[1] ==
'*' &&
ctx->ptr[2] ==
'/') {
188 switch(
ctx->ptr[1]) {
193 while(
ctx->ptr+1 <
ctx->end && (
ctx->ptr[0] !=
'*' ||
ctx->ptr[1] !=
'/'))
196 if(
ctx->ptr[0] ==
'*' &&
ctx->ptr[1] ==
'/') {
199 WARN(
"unexpected end of file (missing end of comment)\n");
224 return ctx->ptr !=
ctx->end;
303 c =
c*8 + (*
p++ -
'0');
305 c =
c*8 + (*
p++ -
'0');
347 while(
ctx->ptr <
ctx->end && *
ctx->ptr != endch) {
348 if(*
ctx->ptr++ ==
'\\') {
350 needs_unescape =
TRUE;
366 WARN(
"unescape failed\n");
375 return tStringLiteral;
404 hlp =
d*10 + *(
ptr++) -
'0';
421 hlp =
d*10 + *(
ptr++) -
'0';
438 }
else if(*
ptr ==
'-') {
442 WARN(
"Expected exponent part\n");
448 WARN(
"unexpected end of file\n");
464 WARN(
"wrong char after zero\n");
477 if(*
ctx->ptr ==
'0') {
480 if(*
ctx->ptr ==
'x' || *
ctx->ptr ==
'X') {
483 if(++
ctx->ptr ==
ctx->end) {
484 ERR(
"unexpected end of file\n");
494 WARN(
"unexpected identifier char\n");
521 WARN(
"wrong char after octal literal: '%c'\n", *
ctx->ptr);
531 WARN(
"wrong char after zero\n");
553 if(
ctx->implicit_nl_semicolon) {
574 return tNumericLiteral;
603 return tNumericLiteral;
609 if(++
ctx->ptr ==
ctx->end) {
620 if(++
ctx->ptr <
ctx->end && *
ctx->ptr ==
'=') {
633 if(++
ctx->ptr ==
ctx->end) {
644 if(++
ctx->ptr <
ctx->end) {
645 if(*
ctx->ptr ==
'=') {
650 if(*
ctx->ptr ==
'>') {
651 if(++
ctx->ptr <
ctx->end && *
ctx->ptr ==
'=') {
688 if(
ctx->is_html &&
ctx->nl &&
ctx->ptr <
ctx->end && *
ctx->ptr ==
'>') {
702 if(++
ctx->ptr <
ctx->end && *
ctx->ptr ==
'=') {
710 if(++
ctx->ptr <
ctx->end && *
ctx->ptr ==
'=') {
718 if(++
ctx->ptr <
ctx->end) {
732 if(++
ctx->ptr <
ctx->end) {
746 if(++
ctx->ptr <
ctx->end && *
ctx->ptr ==
'=') {
754 if(++
ctx->ptr <
ctx->end && *
ctx->ptr ==
'=') {
755 if(++
ctx->ptr <
ctx->end && *
ctx->ptr ==
'=') {
766 if(++
ctx->ptr <
ctx->end && *
ctx->ptr ==
'=') {
767 if(++
ctx->ptr <
ctx->end && *
ctx->ptr ==
'=') {
778 if(++
ctx->ptr <
ctx->end) {
779 if(*
ctx->ptr ==
'=') {
788 if(++
ctx->ptr <
ctx->end && *
ctx->ptr ==
':') {
806 WARN(
"unexpected char '%c' %d\n", *
ctx->ptr, *
ctx->ptr);
821 for(iter =
cc->vars; iter; iter =
next) {
852 for(iter =
cc->vars; iter; iter = iter->
next) {
885 ctx->script->cc =
cc;
891 if(*
ctx->ptr !=
'@') {
922 if(*
ctx->ptr ==
'@') {
1005 unsigned id_len = 0;
1032 WARN(
"parsing CC expression failed\n");
1067 if(!
ctx->cc_if_depth)
1074 if(!
ctx->cc_if_depth)
1081 if(!
ctx->script->cc)
1093 if(!
var ||
var->val.is_num) {
1095 return tNumericLiteral;
1099 return tBooleanLiteral;
1117 const WCHAR *re, *flags_ptr;
1125 while(*--
ctx->ptr !=
'/');
1129 while(
ctx->ptr <
ctx->end) {
1130 if(*
ctx->ptr ==
'\\') {
1131 if(++
ctx->ptr ==
ctx->end)
1134 if(*
ctx->ptr ==
'\n')
1136 if(*
ctx->ptr ==
']')
1139 if(*
ctx->ptr ==
'/')
1142 if(*
ctx->ptr ==
'[')
1148 if(
ctx->ptr ==
ctx->end || *
ctx->ptr !=
'/') {
1149 WARN(
"pre-parsing failed\n");
1153 re_len =
ctx->ptr-re;
1155 flags_ptr = ++
ctx->ptr;
static size_t double int int int * sign
HRESULT parse_regexp_flags(const WCHAR *, DWORD, DWORD *) DECLSPEC_HIDDEN
#define JS_E_EXPECTED_ASSIGN
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
static int parse_string_literal(parser_ctx_t *ctx, jsstr_t **ret, WCHAR endch)
static int hex_to_int(WCHAR c)
static cc_var_t * find_cc_var(cc_ctx_t *cc, const WCHAR *name, unsigned name_len)
BOOL is_identifier_char(WCHAR c)
GLdouble GLdouble GLdouble r
#define JS_E_EXPECTED_CCEND
HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
static int parse_identifier(parser_ctx_t *ctx, const WCHAR **ret)
int try_parse_ccval(parser_ctx_t *ctx, ccval_t *r)
static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
literal_t * new_boolean_literal(parser_ctx_t *ctx, BOOL bval)
static ccval_t ccval_bool(BOOL b)
#define JSCRIPT_MAJOR_VERSION
static literal_t * new_double_literal(parser_ctx_t *ctx, DOUBLE d)
static void * heap_alloc(size_t len)
#define JSCRIPT_BUILD_VERSION
void release_cc(cc_ctx_t *cc)
float pow(float __x, int __y)
static ccval_t ccval_num(double n)
#define JS_E_MISSING_LBRACKET
static int skip_code(parser_ctx_t *ctx, BOOL exec_else)
static int cc_token(parser_ctx_t *ctx, void *lval)
literal_t * parse_regexp(parser_ctx_t *ctx)
_In_ ULONG _In_ ULONG_PTR ident
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
static int check_keywords(parser_ctx_t *ctx, const WCHAR **lval)
static BOOL skip_html_comment(parser_ctx_t *ctx)
static JOBOBJECTINFOCLASS LPVOID DWORD LPDWORD ret_len
#define SCRIPTLANGUAGEVERSION_ES5
#define JS_E_MISSING_SEMICOLON
static int lex_error(parser_ctx_t *ctx, HRESULT hres)
#define memcpy(s1, s2, n)
jsstr_t * compiler_alloc_string_len(compiler_ctx_t *ctx, const WCHAR *str, unsigned len)
static INT ident_len(LPCTSTR p)
static BOOL is_endline(WCHAR c)
static BOOL init_cc(parser_ctx_t *ctx)
static BOOL parse_cc_identifier(parser_ctx_t *ctx, const WCHAR **ret, unsigned *ret_len)
#define JS_E_UNTERMINATED_STRING
static BOOL is_identifier_first_char(WCHAR c)
static unsigned __int64 next
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define JSCRIPT_MINOR_VERSION
static int next_token(parser_ctx_t *ctx, void *lval)
int parser_lex(void *lval, parser_ctx_t *ctx)
static BOOL get_ccbool(ccval_t v)
static BOOL skip_spaces(parser_ctx_t *ctx)
BOOL unescape(WCHAR *str, size_t *len)
void * parser_alloc(parser_ctx_t *, size_t) DECLSPEC_HIDDEN
static BOOL skip_comment(parser_ctx_t *ctx)
BOOL parse_cc_expr(parser_ctx_t *) DECLSPEC_HIDDEN
#define JS_E_EXPECTED_IDENTIFIER
static BOOL new_cc_var(cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v)
static const struct @430 keywords[]
WINE_DEFAULT_DEBUG_CHANNEL(jscript)
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
static BOOL heap_free(void *mem)