ReactOS  0.4.13-dev-259-g5ca9c9c
parse.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _expression_t
 
struct  bool_expression_t
 
struct  int_expression_t
 
struct  double_expression_t
 
struct  string_expression_t
 
struct  unary_expression_t
 
struct  binary_expression_t
 
struct  member_expression_t
 
struct  _statement_t
 
struct  call_statement_t
 
struct  assign_statement_t
 
struct  _dim_list_t
 
struct  _dim_decl_t
 
struct  _dim_statement_t
 
struct  _arg_decl_t
 
struct  _function_decl_t
 
struct  function_statement_t
 
struct  _class_decl_t
 
struct  _elseif_decl_t
 
struct  if_statement_t
 
struct  while_statement_t
 
struct  forto_statement_t
 
struct  foreach_statement_t
 
struct  onerror_statement_t
 
struct  _const_decl_t
 
struct  const_statement_t
 
struct  _case_clausule_t
 
struct  select_statement_t
 
struct  parser_ctx_t
 

Typedefs

typedef struct _expression_t expression_t
 
typedef struct _statement_t statement_t
 
typedef struct _dim_list_t dim_list_t
 
typedef struct _dim_decl_t dim_decl_t
 
typedef struct _dim_statement_t dim_statement_t
 
typedef struct _arg_decl_t arg_decl_t
 
typedef struct _function_decl_t function_decl_t
 
typedef struct _class_decl_t class_decl_t
 
typedef struct _elseif_decl_t elseif_decl_t
 
typedef struct _const_decl_t const_decl_t
 
typedef struct _case_clausule_t case_clausule_t
 

Enumerations

enum  expression_type_t {
  EXPR_COMMA, EXPR_OR, EXPR_AND, EXPR_BOR,
  EXPR_BXOR, EXPR_BAND, EXPR_INSTANCEOF, EXPR_IN,
  EXPR_ADD, EXPR_SUB, EXPR_MUL, EXPR_DIV,
  EXPR_MOD, EXPR_DELETE, EXPR_VOID, EXPR_TYPEOF,
  EXPR_MINUS, EXPR_PLUS, EXPR_POSTINC, EXPR_POSTDEC,
  EXPR_PREINC, EXPR_PREDEC, EXPR_EQ, EXPR_EQEQ,
  EXPR_NOTEQ, EXPR_NOTEQEQ, EXPR_LESS, EXPR_LESSEQ,
  EXPR_GREATER, EXPR_GREATEREQ, EXPR_BITNEG, EXPR_LOGNEG,
  EXPR_LSHIFT, EXPR_RSHIFT, EXPR_RRSHIFT, EXPR_ASSIGN,
  EXPR_ASSIGNLSHIFT, EXPR_ASSIGNRSHIFT, EXPR_ASSIGNRRSHIFT, EXPR_ASSIGNADD,
  EXPR_ASSIGNSUB, EXPR_ASSIGNMUL, EXPR_ASSIGNDIV, EXPR_ASSIGNMOD,
  EXPR_ASSIGNAND, EXPR_ASSIGNOR, EXPR_ASSIGNXOR, EXPR_COND,
  EXPR_ARRAY, EXPR_MEMBER, EXPR_NEW, EXPR_CALL,
  EXPR_THIS, EXPR_FUNC, EXPR_IDENT, EXPR_ARRAYLIT,
  EXPR_PROPVAL, EXPR_LITERAL, EXPR_ADD, EXPR_AND,
  EXPR_BOOL, EXPR_BRACKETS, EXPR_CONCAT, EXPR_DIV,
  EXPR_DOUBLE, EXPR_EMPTY, EXPR_EQUAL, EXPR_EQV,
  EXPR_EXP, EXPR_GT, EXPR_GTEQ, EXPR_IDIV,
  EXPR_IMP, EXPR_IS, EXPR_LT, EXPR_LTEQ,
  EXPR_ME, EXPR_MEMBER, EXPR_MOD, EXPR_MUL,
  EXPR_NEG, EXPR_NEQUAL, EXPR_NEW, EXPR_NOARG,
  EXPR_NOT, EXPR_NOTHING, EXPR_NULL, EXPR_OR,
  EXPR_STRING, EXPR_SUB, EXPR_ULONG, EXPR_USHORT,
  EXPR_XOR
}
 
enum  statement_type_t {
  STAT_BLOCK, STAT_BREAK, STAT_CONTINUE, STAT_EMPTY,
  STAT_EXPR, STAT_FOR, STAT_FORIN, STAT_IF,
  STAT_LABEL, STAT_RETURN, STAT_SWITCH, STAT_THROW,
  STAT_TRY, STAT_VAR, STAT_WHILE, STAT_WITH,
  STAT_ASSIGN, STAT_CALL, STAT_CONST, STAT_DIM,
  STAT_DOUNTIL, STAT_DOWHILE, STAT_EXITDO, STAT_EXITFOR,
  STAT_EXITFUNC, STAT_EXITPROP, STAT_EXITSUB, STAT_FOREACH,
  STAT_FORTO, STAT_FUNC, STAT_IF, STAT_ONERROR,
  STAT_SELECT, STAT_SET, STAT_STOP, STAT_UNTIL,
  STAT_WHILE, STAT_WHILELOOP
}
 

Functions

HRESULT parse_script (parser_ctx_t *, const WCHAR *, const WCHAR *) DECLSPEC_HIDDEN
 
void parser_release (parser_ctx_t *) DECLSPEC_HIDDEN
 
int parser_lex (void *, parser_ctx_t *) DECLSPEC_HIDDEN
 
voidparser_alloc (parser_ctx_t *, size_t) DECLSPEC_HIDDEN
 

Typedef Documentation

◆ arg_decl_t

◆ case_clausule_t

◆ class_decl_t

◆ const_decl_t

◆ dim_decl_t

◆ dim_list_t

◆ dim_statement_t

◆ elseif_decl_t

◆ expression_t

◆ function_decl_t

◆ statement_t

Enumeration Type Documentation

◆ expression_type_t

Enumerator
EXPR_COMMA 
EXPR_OR 
EXPR_AND 
EXPR_BOR 
EXPR_BXOR 
EXPR_BAND 
EXPR_INSTANCEOF 
EXPR_IN 
EXPR_ADD 
EXPR_SUB 
EXPR_MUL 
EXPR_DIV 
EXPR_MOD 
EXPR_DELETE 
EXPR_VOID 
EXPR_TYPEOF 
EXPR_MINUS 
EXPR_PLUS 
EXPR_POSTINC 
EXPR_POSTDEC 
EXPR_PREINC 
EXPR_PREDEC 
EXPR_EQ 
EXPR_EQEQ 
EXPR_NOTEQ 
EXPR_NOTEQEQ 
EXPR_LESS 
EXPR_LESSEQ 
EXPR_GREATER 
EXPR_GREATEREQ 
EXPR_BITNEG 
EXPR_LOGNEG 
EXPR_LSHIFT 
EXPR_RSHIFT 
EXPR_RRSHIFT 
EXPR_ASSIGN 
EXPR_ASSIGNLSHIFT 
EXPR_ASSIGNRSHIFT 
EXPR_ASSIGNRRSHIFT 
EXPR_ASSIGNADD 
EXPR_ASSIGNSUB 
EXPR_ASSIGNMUL 
EXPR_ASSIGNDIV 
EXPR_ASSIGNMOD 
EXPR_ASSIGNAND 
EXPR_ASSIGNOR 
EXPR_ASSIGNXOR 
EXPR_COND 
EXPR_ARRAY 
EXPR_MEMBER 
EXPR_NEW 
EXPR_CALL 
EXPR_THIS 
EXPR_FUNC 
EXPR_IDENT 
EXPR_ARRAYLIT 
EXPR_PROPVAL 
EXPR_LITERAL 
EXPR_ADD 
EXPR_AND 
EXPR_BOOL 
EXPR_BRACKETS 
EXPR_CONCAT 
EXPR_DIV 
EXPR_DOUBLE 
EXPR_EMPTY 
EXPR_EQUAL 
EXPR_EQV 
EXPR_EXP 
EXPR_GT 
EXPR_GTEQ 
EXPR_IDIV 
EXPR_IMP 
EXPR_IS 
EXPR_LT 
EXPR_LTEQ 
EXPR_ME 
EXPR_MEMBER 
EXPR_MOD 
EXPR_MUL 
EXPR_NEG 
EXPR_NEQUAL 
EXPR_NEW 
EXPR_NOARG 
EXPR_NOT 
EXPR_NOTHING 
EXPR_NULL 
EXPR_OR 
EXPR_STRING 
EXPR_SUB 
EXPR_ULONG 
EXPR_USHORT 
EXPR_XOR 

Definition at line 21 of file parse.h.

21  {
22  EXPR_ADD,
23  EXPR_AND,
24  EXPR_BOOL,
27  EXPR_DIV,
29  EXPR_EMPTY,
30  EXPR_EQUAL,
31  EXPR_EQV,
32  EXPR_EXP,
33  EXPR_GT,
34  EXPR_GTEQ,
35  EXPR_IDIV,
36  EXPR_IMP,
37  EXPR_IS,
38  EXPR_LT,
39  EXPR_LTEQ,
40  EXPR_ME,
42  EXPR_MOD,
43  EXPR_MUL,
44  EXPR_NEG,
46  EXPR_NEW,
47  EXPR_NOARG, /* not a real expression */
48  EXPR_NOT,
50  EXPR_NULL,
51  EXPR_OR,
53  EXPR_SUB,
54  EXPR_ULONG,
56  EXPR_XOR
Definition: parse.h:56
Definition: parse.h:40
Definition: parse.h:32
Definition: parse.h:51
Definition: parse.h:22
Definition: parse.h:36
Definition: parse.h:46
Definition: parse.h:31
Definition: parse.h:27
Definition: parse.h:53
Definition: parse.h:38
Definition: parse.h:44
Definition: parse.h:43
Definition: parse.h:37
Definition: parse.h:33
Definition: parse.h:42
Definition: parse.h:23
Definition: parse.h:48
expression_type_t
Definition: parse.h:21

◆ statement_type_t

Enumerator
STAT_BLOCK 
STAT_BREAK 
STAT_CONTINUE 
STAT_EMPTY 
STAT_EXPR 
STAT_FOR 
STAT_FORIN 
STAT_IF 
STAT_LABEL 
STAT_RETURN 
STAT_SWITCH 
STAT_THROW 
STAT_TRY 
STAT_VAR 
STAT_WHILE 
STAT_WITH 
STAT_ASSIGN 
STAT_CALL 
STAT_CONST 
STAT_DIM 
STAT_DOUNTIL 
STAT_DOWHILE 
STAT_EXITDO 
STAT_EXITFOR 
STAT_EXITFUNC 
STAT_EXITPROP 
STAT_EXITSUB 
STAT_FOREACH 
STAT_FORTO 
STAT_FUNC 
STAT_IF 
STAT_ONERROR 
STAT_SELECT 
STAT_SET 
STAT_STOP 
STAT_UNTIL 
STAT_WHILE 
STAT_WHILELOOP 

Definition at line 102 of file parse.h.

102  {
103  STAT_ASSIGN,
104  STAT_CALL,
105  STAT_CONST,
106  STAT_DIM,
107  STAT_DOUNTIL,
108  STAT_DOWHILE,
109  STAT_EXITDO,
110  STAT_EXITFOR,
113  STAT_EXITSUB,
114  STAT_FOREACH,
115  STAT_FORTO,
116  STAT_FUNC,
117  STAT_IF,
118  STAT_ONERROR,
119  STAT_SELECT,
120  STAT_SET,
121  STAT_STOP,
122  STAT_UNTIL,
123  STAT_WHILE,
Definition: parse.h:117
statement_type_t
Definition: parse.h:102

Function Documentation

◆ parse_script()

HRESULT parse_script ( parser_ctx_t ,
const WCHAR ,
const WCHAR  
)

Definition at line 3415 of file parser.tab.c.

3416 {
3417  static const WCHAR html_delimiterW[] = {'<','/','s','c','r','i','p','t','>',0};
3418 
3419  ctx->code = ctx->ptr = code;
3420  ctx->end = ctx->code + strlenW(ctx->code);
3421 
3422  heap_pool_init(&ctx->heap);
3423 
3424  ctx->parse_complete = FALSE;
3425  ctx->hres = S_OK;
3426 
3427  ctx->last_token = tNL;
3428  ctx->last_nl = 0;
3429  ctx->stats = ctx->stats_tail = NULL;
3430  ctx->class_decls = NULL;
3431  ctx->option_explicit = FALSE;
3432  ctx->is_html = delimiter && !strcmpiW(delimiter, html_delimiterW);
3433 
3434  parser_parse(ctx);
3435 
3436  if(FAILED(ctx->hres))
3437  return ctx->hres;
3438  if(!ctx->parse_complete) {
3439  FIXME("parser failed around %s\n", debugstr_w(ctx->code+20 > ctx->ptr ? ctx->code : ctx->ptr-20));
3440  return E_FAIL;
3441  }
3442 
3443  return S_OK;
3444 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define E_FAIL
Definition: ddrawi.h:102
int parser_parse(parser_ctx_t *ctx)
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
const char * delimiter
Definition: string.c:1523
__wchar_t WCHAR
Definition: xmlstorage.h:180
int code
Definition: i386-dis.c:3591
void heap_pool_init(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:69
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define S_OK
Definition: intsafe.h:59

Referenced by compile_script().

◆ parser_alloc()

void* parser_alloc ( parser_ctx_t ,
size_t   
)

Definition at line 3405 of file parser.tab.c.

3406 {
3407  void *ret;
3408 
3409  ret = heap_pool_alloc(&ctx->heap, size);
3410  if(!ret)
3411  ctx->hres = E_OUTOFMEMORY;
3412  return ret;
3413 }
void * heap_pool_alloc(heap_pool_t *, DWORD) __WINE_ALLOC_SIZE(2) DECLSPEC_HIDDEN
Definition: jsutils.c:75
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLsizeiptr size
Definition: glext.h:5919
int ret

Referenced by new_argument(), new_argument_decl(), new_array_element(), new_case_clausule(), new_catch_block(), new_class_decl(), new_const_decl(), new_dim(), new_dim_decl(), new_elseif_decl(), new_expression(), new_function_decl(), new_null_literal(), new_parameter(), new_property_definition(), new_source_elements(), new_statement(), new_string_literal(), and new_variable_declaration().

◆ parser_lex()

int parser_lex ( void ,
parser_ctx_t  
)

Definition at line 1142 of file lex.c.

1143 {
1144  int ret;
1145 
1146  ctx->nl = ctx->ptr == ctx->begin;
1147 
1148  do {
1149  ret = next_token(ctx, lval);
1150  } while(ret == '@' && !(ret = cc_token(ctx, lval)));
1151 
1152  return ret;
1153 }
static int cc_token(parser_ctx_t *ctx, void *lval)
Definition: lex.c:1040
int ret
static int next_token(parser_ctx_t *ctx, void *lval)
Definition: lex.c:575

◆ parser_release()

void parser_release ( parser_ctx_t )

Definition at line 4330 of file parser.tab.c.

4331 {
4332  script_release(ctx->script);
4333  heap_pool_free(&ctx->heap);
4334  heap_free(ctx);
4335 }
void script_release(script_ctx_t *ctx)
Definition: jscript.c:67
void heap_pool_free(heap_pool_t *) DECLSPEC_HIDDEN
Definition: jsutils.c:167
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by script_parse().