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;
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void * parser_alloc(parser_ctx_t *ctx, DWORD size)
static ccval_t ccval_bool(BOOL b)
BOOL parse_cc_expr(parser_ctx_t *) DECLSPEC_HIDDEN
static ccval_t ccval_num(double n)
static BOOL get_ccbool(ccval_t v)
#define JSCRIPT_MAJOR_VERSION
#define JSCRIPT_BUILD_VERSION
#define JSCRIPT_MINOR_VERSION
double pow(double x, double y)
GLdouble GLdouble GLdouble r
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
jsstr_t * compiler_alloc_string_len(compiler_ctx_t *ctx, const WCHAR *str, unsigned len)
literal_t * parse_regexp(parser_ctx_t *ctx)
static literal_t * new_double_literal(parser_ctx_t *ctx, DOUBLE d)
static BOOL skip_spaces(parser_ctx_t *ctx)
static int check_keywords(parser_ctx_t *ctx, const WCHAR **lval)
HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
static BOOL is_endline(WCHAR c)
static cc_var_t * find_cc_var(cc_ctx_t *cc, const WCHAR *name, unsigned name_len)
BOOL unescape(WCHAR *str, size_t *len)
static BOOL init_cc(parser_ctx_t *ctx)
static BOOL parse_cc_identifier(parser_ctx_t *ctx, const WCHAR **ret, unsigned *ret_len)
static int parse_string_literal(parser_ctx_t *ctx, jsstr_t **ret, WCHAR endch)
static BOOL new_cc_var(cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v)
static int cc_token(parser_ctx_t *ctx, void *lval)
static int lex_error(parser_ctx_t *ctx, HRESULT hres)
static BOOL is_identifier_first_char(WCHAR c)
int try_parse_ccval(parser_ctx_t *ctx, ccval_t *r)
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
static const struct @443 keywords[]
static int skip_code(parser_ctx_t *ctx, BOOL exec_else)
literal_t * new_boolean_literal(parser_ctx_t *ctx, BOOL bval)
static int next_token(parser_ctx_t *ctx, void *lval)
void release_cc(cc_ctx_t *cc)
BOOL is_identifier_char(WCHAR c)
static BOOL skip_comment(parser_ctx_t *ctx)
static int parse_identifier(parser_ctx_t *ctx, const WCHAR **ret)
static BOOL skip_html_comment(parser_ctx_t *ctx)
static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
static int hex_to_int(WCHAR c)
#define JS_E_EXPECTED_CCEND
#define JS_E_EXPECTED_IDENTIFIER
#define JS_E_UNTERMINATED_STRING
#define JS_E_EXPECTED_ASSIGN
#define SCRIPTLANGUAGEVERSION_ES5
HRESULT parse_regexp_flags(const WCHAR *, DWORD, DWORD *) DECLSPEC_HIDDEN
#define JS_E_MISSING_SEMICOLON
#define JS_E_MISSING_LBRACKET
#define memcpy(s1, s2, n)
static JOBOBJECTINFOCLASS LPVOID DWORD LPDWORD ret_len
static unsigned __int64 next
static INT ident_len(LPCTSTR p)
_In_ ULONG _In_ ULONG_PTR ident