-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsl_parser.h
More file actions
31 lines (27 loc) · 938 Bytes
/
Copy pathsl_parser.h
File metadata and controls
31 lines (27 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef SL_PARSER_H
#define SL_PARSER_H
#include "php_scriptlite.h"
typedef enum _sl_parse_status {
SL_PARSE_STATUS_OK = 0,
SL_PARSE_STATUS_UNSUPPORTED = 1,
SL_PARSE_STATUS_ERROR = 2
} sl_parse_status;
/*
* Parse JS source with the native C parser and emit an AST node tree compatible
* with the compiler.
*
* On success:
* - returns SL_PARSE_STATUS_OK
* - initializes program_out with a Program-like AST node object
*
* On failure:
* - returns SL_PARSE_STATUS_UNSUPPORTED for syntax/features the native parser
* deliberately does not cover yet
* - returns SL_PARSE_STATUS_ERROR for malformed input in covered grammar
* - leaves program_out as IS_UNDEF
*
* This function does not throw; callers can transparently fall back to the PHP
* parser to preserve full language compatibility.
*/
sl_parse_status sl_native_parse_source(zend_string *source, zval *program_out);
#endif /* SL_PARSER_H */