#include <limits.h>
#include <math.h>
#include "jscript.h"
#include "activscp.h"
#include "objsafe.h"
#include "engine.h"
#include "parser.h"
#include "parser.tab.h"
#include "wine/debug.h"
Go to the source code of this file.
|
| WINE_DEFAULT_DEBUG_CHANNEL (jscript) |
|
static int | lex_error (parser_ctx_t *ctx, HRESULT hres) |
|
BOOL | is_identifier_char (WCHAR c) |
|
static BOOL | is_identifier_first_char (WCHAR c) |
|
static int | check_keyword (parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval) |
|
static BOOL | is_endline (WCHAR c) |
|
static int | hex_to_int (WCHAR c) |
|
static int | check_keywords (parser_ctx_t *ctx, const WCHAR **lval) |
|
static BOOL | skip_html_comment (parser_ctx_t *ctx) |
|
static BOOL | skip_comment (parser_ctx_t *ctx) |
|
static BOOL | skip_spaces (parser_ctx_t *ctx) |
|
BOOL | unescape (WCHAR *str, size_t *len) |
|
static int | parse_identifier (parser_ctx_t *ctx, const WCHAR **ret) |
|
static int | parse_string_literal (parser_ctx_t *ctx, jsstr_t **ret, WCHAR endch) |
|
static literal_t * | new_double_literal (parser_ctx_t *ctx, DOUBLE d) |
|
literal_t * | new_boolean_literal (parser_ctx_t *ctx, BOOL bval) |
|
HRESULT | parse_decimal (const WCHAR **iter, const WCHAR *end, double *ret) |
|
static BOOL | parse_numeric_literal (parser_ctx_t *ctx, double *ret) |
|
static int | next_token (parser_ctx_t *ctx, void *lval) |
|
void | release_cc (cc_ctx_t *cc) |
|
static BOOL | new_cc_var (cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v) |
|
static cc_var_t * | find_cc_var (cc_ctx_t *cc, const WCHAR *name, unsigned name_len) |
|
static BOOL | init_cc (parser_ctx_t *ctx) |
|
static BOOL | parse_cc_identifier (parser_ctx_t *ctx, const WCHAR **ret, unsigned *ret_len) |
|
int | try_parse_ccval (parser_ctx_t *ctx, ccval_t *r) |
|
static int | skip_code (parser_ctx_t *ctx, BOOL exec_else) |
|
static int | cc_token (parser_ctx_t *ctx, void *lval) |
|
int | parser_lex (void *lval, parser_ctx_t *ctx) |
|
literal_t * | parse_regexp (parser_ctx_t *ctx) |
|
◆ cc_token()
Definition at line 1003 of file lex.c.
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;
#define JS_E_EXPECTED_ASSIGN
static cc_var_t * find_cc_var(cc_ctx_t *cc, const WCHAR *name, unsigned name_len)
BOOL is_identifier_char(WCHAR c)
literal_t * new_boolean_literal(parser_ctx_t *ctx, BOOL bval)
static literal_t * new_double_literal(parser_ctx_t *ctx, DOUBLE d)
#define JS_E_MISSING_LBRACKET
static int skip_code(parser_ctx_t *ctx, BOOL exec_else)
_In_ ULONG _In_ ULONG_PTR ident
static int lex_error(parser_ctx_t *ctx, HRESULT hres)
static INT ident_len(LPCTSTR p)
static BOOL init_cc(parser_ctx_t *ctx)
static BOOL parse_cc_identifier(parser_ctx_t *ctx, const WCHAR **ret, unsigned *ret_len)
static BOOL get_ccbool(ccval_t v)
static BOOL skip_spaces(parser_ctx_t *ctx)
BOOL parse_cc_expr(parser_ctx_t *) DECLSPEC_HIDDEN
static BOOL new_cc_var(cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v)
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
Referenced by parser_lex().
◆ check_keyword()
◆ check_keywords()
Definition at line 132 of file lex.c.
142 TRACE(
"ignoring keyword %s in incompatible mode\n",
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
static const struct @430 keywords[]
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
Referenced by next_token().
◆ find_cc_var()
◆ hex_to_int()
◆ init_cc()
Definition at line 860 of file lex.c.
885 ctx->script->cc =
cc;
static ccval_t ccval_bool(BOOL b)
#define JSCRIPT_MAJOR_VERSION
static void * heap_alloc(size_t len)
#define JSCRIPT_BUILD_VERSION
void release_cc(cc_ctx_t *cc)
static ccval_t ccval_num(double n)
static int lex_error(parser_ctx_t *ctx, HRESULT hres)
#define JSCRIPT_MINOR_VERSION
static BOOL new_cc_var(cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v)
Referenced by cc_token().
◆ is_endline()
◆ is_identifier_char()
◆ is_identifier_first_char()
static BOOL is_identifier_first_char |
( |
WCHAR |
c | ) |
|
|
static |
◆ lex_error()
◆ new_boolean_literal()
Definition at line 387 of file lex.c.
void * parser_alloc(parser_ctx_t *, size_t) DECLSPEC_HIDDEN
Referenced by cc_token().
◆ new_cc_var()
Definition at line 829 of file lex.c.
static void * heap_alloc(size_t len)
#define memcpy(s1, s2, n)
Referenced by cc_token(), and init_cc().
◆ new_double_literal()
◆ next_token()
Definition at line 546 of file lex.c.
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);
static int parse_string_literal(parser_ctx_t *ctx, jsstr_t **ret, WCHAR endch)
HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
static int parse_identifier(parser_ctx_t *ctx, const WCHAR **ret)
static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
static literal_t * new_double_literal(parser_ctx_t *ctx, DOUBLE d)
static int check_keywords(parser_ctx_t *ctx, const WCHAR **lval)
static BOOL skip_html_comment(parser_ctx_t *ctx)
static int lex_error(parser_ctx_t *ctx, HRESULT hres)
static BOOL skip_spaces(parser_ctx_t *ctx)
static BOOL skip_comment(parser_ctx_t *ctx)
Referenced by parser_lex().
◆ parse_cc_identifier()
Definition at line 889 of file lex.c.
891 if(*
ctx->ptr !=
'@') {
BOOL is_identifier_char(WCHAR c)
static JOBOBJECTINFOCLASS LPVOID DWORD LPDWORD ret_len
static int lex_error(parser_ctx_t *ctx, HRESULT hres)
static BOOL is_identifier_first_char(WCHAR c)
#define JS_E_EXPECTED_IDENTIFIER
Referenced by cc_token(), and try_parse_ccval().
◆ parse_decimal()
Definition at line 397 of file lex.c.
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");
static size_t double int int int * sign
BOOL is_identifier_char(WCHAR c)
float pow(float __x, int __y)
#define JS_E_MISSING_SEMICOLON
Referenced by next_token(), parse_json_value(), and parse_numeric_literal().
◆ parse_identifier()
Definition at line 321 of file lex.c.
BOOL is_identifier_char(WCHAR c)
#define memcpy(s1, s2, n)
void * parser_alloc(parser_ctx_t *, size_t) DECLSPEC_HIDDEN
Referenced by next_token().
◆ parse_numeric_literal()
Definition at line 473 of file lex.c.
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");
static int hex_to_int(WCHAR c)
BOOL is_identifier_char(WCHAR c)
GLdouble GLdouble GLdouble r
HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
#define JS_E_MISSING_SEMICOLON
static int lex_error(parser_ctx_t *ctx, HRESULT hres)
Referenced by next_token(), and try_parse_ccval().
◆ parse_regexp()
Definition at line 1115 of file lex.c.
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;
HRESULT parse_regexp_flags(const WCHAR *, DWORD, DWORD *) DECLSPEC_HIDDEN
jsstr_t * compiler_alloc_string_len(compiler_ctx_t *ctx, const WCHAR *str, unsigned len)
void * parser_alloc(parser_ctx_t *, size_t) DECLSPEC_HIDDEN
◆ parse_string_literal()
Definition at line 340 of file lex.c.
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;
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)
#define JS_E_UNTERMINATED_STRING
BOOL unescape(WCHAR *str, size_t *len)
void * parser_alloc(parser_ctx_t *, size_t) DECLSPEC_HIDDEN
Referenced by next_token().
◆ parser_lex()
Definition at line 1102 of file lex.c.
static int cc_token(parser_ctx_t *ctx, void *lval)
static int next_token(parser_ctx_t *ctx, void *lval)
◆ release_cc()
◆ skip_code()
Definition at line 948 of file lex.c.
#define JS_E_EXPECTED_CCEND
#define JS_E_MISSING_LBRACKET
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
static int lex_error(parser_ctx_t *ctx, HRESULT hres)
static BOOL get_ccbool(ccval_t v)
static BOOL skip_spaces(parser_ctx_t *ctx)
BOOL parse_cc_expr(parser_ctx_t *) DECLSPEC_HIDDEN
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
Referenced by cc_token().
◆ skip_comment()
Definition at line 174 of file lex.c.
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");
BOOL is_identifier_char(WCHAR c)
static BOOL is_endline(WCHAR c)
Referenced by next_token().
◆ skip_html_comment()
Definition at line 160 of file lex.c.
162 const WCHAR html_commentW[] = {
'<',
'!',
'-',
'-',0};
164 if(!
ctx->is_html ||
ctx->ptr+3 >=
ctx->end ||
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
static BOOL is_endline(WCHAR c)
Referenced by next_token().
◆ skip_spaces()
◆ try_parse_ccval()
Definition at line 907 of file lex.c.
922 if(*
ctx->ptr ==
'@') {
static cc_var_t * find_cc_var(cc_ctx_t *cc, const WCHAR *name, unsigned name_len)
GLdouble GLdouble GLdouble r
static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
static ccval_t ccval_bool(BOOL b)
static ccval_t ccval_num(double n)
_In_ ULONG _In_ ULONG_PTR ident
static INT ident_len(LPCTSTR p)
static BOOL parse_cc_identifier(parser_ctx_t *ctx, const WCHAR **ret, unsigned *ret_len)
static BOOL skip_spaces(parser_ctx_t *ctx)
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
◆ unescape()
Definition at line 227 of file lex.c.
303 c =
c*8 + (*
p++ -
'0');
305 c =
c*8 + (*
p++ -
'0');
static int hex_to_int(WCHAR c)
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
Referenced by parse_json_string(), parse_string_literal(), and PathCreateFromUrlW().
◆ WINE_DEFAULT_DEBUG_CHANNEL()
WINE_DEFAULT_DEBUG_CHANNEL |
( |
jscript |
| ) |
|
◆ keywords
◆ min_version
◆ no_nl
Definition at line 38 of file lex.c.
◆ token
Definition at line 37 of file lex.c.
◆ word
Definition at line 36 of file lex.c.
Referenced by __ffs(), __inword(), bitmap_isset(), bitmap_set(), bitmap_unset(), byte_till_end(), ccf_options(), ccf_search(), ccf_sortlist(), check_keyword(), check_keywords(), FileMonikerImpl_DecomposePath(), find_end_of_word(), gluCheckExtension(), ImmEscapeW(), main(), MyAppendUnicodeToString_(), MyInitUnicodeString(), rol32(), ror32(), RtlAppendUnicodeToString(), strip_quotes(), test_Sdb(), UDFCrc(), UDFDissectName(), UDFUnicodeCksum(), UDFUnicodeCksum150(), and XCOPY_ParseCommandLine().