Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
duk_lexer.h File Reference

Go to the source code of this file.

Data Structures

struct  duk_token
 
struct  duk_re_token
 
struct  duk_lexer_point
 
struct  duk_lexer_codepoint
 
struct  duk_lexer_ctx
 

Macros

#define DUK_LEXER_INITCTX(ctx)   duk_lexer_initctx((ctx))
 
#define DUK_LEXER_SETPOINT(ctx, pt)   duk_lexer_setpoint((ctx), (pt))
 
#define DUK_LEXER_GETPOINT(ctx, pt)
 
#define DUK_LEXER_WINDOW_SIZE   6
 
#define DUK_TOK_MINVAL   0
 
#define DUK_TOK_EOF   0
 
#define DUK_TOK_IDENTIFIER   1
 
#define DUK_TOK_START_RESERVED   2
 
#define DUK_TOK_BREAK   2
 
#define DUK_TOK_CASE   3
 
#define DUK_TOK_CATCH   4
 
#define DUK_TOK_CONTINUE   5
 
#define DUK_TOK_DEBUGGER   6
 
#define DUK_TOK_DEFAULT   7
 
#define DUK_TOK_DELETE   8
 
#define DUK_TOK_DO   9
 
#define DUK_TOK_ELSE   10
 
#define DUK_TOK_FINALLY   11
 
#define DUK_TOK_FOR   12
 
#define DUK_TOK_FUNCTION   13
 
#define DUK_TOK_IF   14
 
#define DUK_TOK_IN   15
 
#define DUK_TOK_INSTANCEOF   16
 
#define DUK_TOK_NEW   17
 
#define DUK_TOK_RETURN   18
 
#define DUK_TOK_SWITCH   19
 
#define DUK_TOK_THIS   20
 
#define DUK_TOK_THROW   21
 
#define DUK_TOK_TRY   22
 
#define DUK_TOK_TYPEOF   23
 
#define DUK_TOK_VAR   24
 
#define DUK_TOK_CONST   25
 
#define DUK_TOK_VOID   26
 
#define DUK_TOK_WHILE   27
 
#define DUK_TOK_WITH   28
 
#define DUK_TOK_CLASS   29
 
#define DUK_TOK_ENUM   30
 
#define DUK_TOK_EXPORT   31
 
#define DUK_TOK_EXTENDS   32
 
#define DUK_TOK_IMPORT   33
 
#define DUK_TOK_SUPER   34
 
#define DUK_TOK_NULL   35
 
#define DUK_TOK_TRUE   36
 
#define DUK_TOK_FALSE   37
 
#define DUK_TOK_START_STRICT_RESERVED   38 /* inclusive */
 
#define DUK_TOK_IMPLEMENTS   38
 
#define DUK_TOK_INTERFACE   39
 
#define DUK_TOK_LET   40
 
#define DUK_TOK_PACKAGE   41
 
#define DUK_TOK_PRIVATE   42
 
#define DUK_TOK_PROTECTED   43
 
#define DUK_TOK_PUBLIC   44
 
#define DUK_TOK_STATIC   45
 
#define DUK_TOK_YIELD   46
 
#define DUK_TOK_END_RESERVED   47 /* exclusive */
 
#define DUK_TOK_GET   47
 
#define DUK_TOK_SET   48
 
#define DUK_TOK_LCURLY   49
 
#define DUK_TOK_RCURLY   50
 
#define DUK_TOK_LBRACKET   51
 
#define DUK_TOK_RBRACKET   52
 
#define DUK_TOK_LPAREN   53
 
#define DUK_TOK_RPAREN   54
 
#define DUK_TOK_PERIOD   55
 
#define DUK_TOK_SEMICOLON   56
 
#define DUK_TOK_COMMA   57
 
#define DUK_TOK_LT   58
 
#define DUK_TOK_GT   59
 
#define DUK_TOK_LE   60
 
#define DUK_TOK_GE   61
 
#define DUK_TOK_EQ   62
 
#define DUK_TOK_NEQ   63
 
#define DUK_TOK_SEQ   64
 
#define DUK_TOK_SNEQ   65
 
#define DUK_TOK_ADD   66
 
#define DUK_TOK_SUB   67
 
#define DUK_TOK_MUL   68
 
#define DUK_TOK_DIV   69
 
#define DUK_TOK_MOD   70
 
#define DUK_TOK_INCREMENT   71
 
#define DUK_TOK_DECREMENT   72
 
#define DUK_TOK_ALSHIFT   73 /* named "arithmetic" because result is signed */
 
#define DUK_TOK_ARSHIFT   74
 
#define DUK_TOK_RSHIFT   75
 
#define DUK_TOK_BAND   76
 
#define DUK_TOK_BOR   77
 
#define DUK_TOK_BXOR   78
 
#define DUK_TOK_LNOT   79
 
#define DUK_TOK_BNOT   80
 
#define DUK_TOK_LAND   81
 
#define DUK_TOK_LOR   82
 
#define DUK_TOK_QUESTION   83
 
#define DUK_TOK_COLON   84
 
#define DUK_TOK_EQUALSIGN   85
 
#define DUK_TOK_ADD_EQ   86
 
#define DUK_TOK_SUB_EQ   87
 
#define DUK_TOK_MUL_EQ   88
 
#define DUK_TOK_DIV_EQ   89
 
#define DUK_TOK_MOD_EQ   90
 
#define DUK_TOK_ALSHIFT_EQ   91
 
#define DUK_TOK_ARSHIFT_EQ   92
 
#define DUK_TOK_RSHIFT_EQ   93
 
#define DUK_TOK_BAND_EQ   94
 
#define DUK_TOK_BOR_EQ   95
 
#define DUK_TOK_BXOR_EQ   96
 
#define DUK_TOK_NUMBER   97
 
#define DUK_TOK_STRING   98
 
#define DUK_TOK_REGEXP   99
 
#define DUK_TOK_MAXVAL   99 /* inclusive */
 
#define DUK_STRIDX_TO_TOK(x)   ((x) - DUK_STRIDX_START_RESERVED + DUK_TOK_START_RESERVED)
 
#define DUK_RETOK_EOF   0
 
#define DUK_RETOK_DISJUNCTION   1
 
#define DUK_RETOK_QUANTIFIER   2
 
#define DUK_RETOK_ASSERT_START   3
 
#define DUK_RETOK_ASSERT_END   4
 
#define DUK_RETOK_ASSERT_WORD_BOUNDARY   5
 
#define DUK_RETOK_ASSERT_NOT_WORD_BOUNDARY   6
 
#define DUK_RETOK_ASSERT_START_POS_LOOKAHEAD   7
 
#define DUK_RETOK_ASSERT_START_NEG_LOOKAHEAD   8
 
#define DUK_RETOK_ATOM_PERIOD   9
 
#define DUK_RETOK_ATOM_CHAR   10
 
#define DUK_RETOK_ATOM_DIGIT   11
 
#define DUK_RETOK_ATOM_NOT_DIGIT   12
 
#define DUK_RETOK_ATOM_WHITE   13
 
#define DUK_RETOK_ATOM_NOT_WHITE   14
 
#define DUK_RETOK_ATOM_WORD_CHAR   15
 
#define DUK_RETOK_ATOM_NOT_WORD_CHAR   16
 
#define DUK_RETOK_ATOM_BACKREFERENCE   17
 
#define DUK_RETOK_ATOM_START_CAPTURE_GROUP   18
 
#define DUK_RETOK_ATOM_START_NONCAPTURE_GROUP   19
 
#define DUK_RETOK_ATOM_START_CHARCLASS   20
 
#define DUK_RETOK_ATOM_START_CHARCLASS_INVERTED   21
 
#define DUK_RETOK_ATOM_END_GROUP   22
 
#define DUK_LEXER_TEMP_BUF_LIMIT   256
 
#define DUK_RE_QUANTIFIER_INFINITE   ((duk_uint32_t) 0xffffffffUL)
 

Typedefs

typedef void(* duk_re_range_callback) (void *user, duk_codepoint_t r1, duk_codepoint_t r2, duk_bool_t direct)
 

Functions

DUK_INTERNAL_DECL void duk_lexer_initctx (duk_lexer_ctx *lex_ctx)
 
DUK_INTERNAL_DECL void duk_lexer_setpoint (duk_lexer_ctx *lex_ctx, duk_lexer_point *pt)
 
DUK_INTERNAL_DECL void duk_lexer_parse_js_input_element (duk_lexer_ctx *lex_ctx, duk_token *out_token, duk_bool_t strict_mode, duk_bool_t regexp_mode)
 

Macro Definition Documentation

◆ DUK_LEXER_GETPOINT

#define DUK_LEXER_GETPOINT ( ctx,
pt )
Value:
do { (pt)->offset = (ctx)->window[0].offset; \
(pt)->line = (ctx)->window[0].line; } while (0)

Definition at line 33 of file duktape-1.8.0/src-separate/duk_lexer.h.

33#define DUK_LEXER_GETPOINT(ctx,pt) do { (pt)->offset = (ctx)->window[0].offset; \
34 (pt)->line = (ctx)->window[0].line; } while (0)

◆ DUK_LEXER_INITCTX

#define DUK_LEXER_INITCTX ( ctx)    duk_lexer_initctx((ctx))

Definition at line 29 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_LEXER_SETPOINT

#define DUK_LEXER_SETPOINT ( ctx,
pt )   duk_lexer_setpoint((ctx), (pt))

Definition at line 31 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_LEXER_TEMP_BUF_LIMIT

#define DUK_LEXER_TEMP_BUF_LIMIT   256

Definition at line 345 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_LEXER_WINDOW_SIZE

#define DUK_LEXER_WINDOW_SIZE   6

Definition at line 37 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RE_QUANTIFIER_INFINITE

#define DUK_RE_QUANTIFIER_INFINITE   ((duk_uint32_t) 0xffffffffUL)

Definition at line 364 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ASSERT_END

#define DUK_RETOK_ASSERT_END   4

Definition at line 324 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ASSERT_NOT_WORD_BOUNDARY

#define DUK_RETOK_ASSERT_NOT_WORD_BOUNDARY   6

Definition at line 326 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ASSERT_START

#define DUK_RETOK_ASSERT_START   3

Definition at line 323 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ASSERT_START_NEG_LOOKAHEAD

#define DUK_RETOK_ASSERT_START_NEG_LOOKAHEAD   8

Definition at line 328 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ASSERT_START_POS_LOOKAHEAD

#define DUK_RETOK_ASSERT_START_POS_LOOKAHEAD   7

Definition at line 327 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ASSERT_WORD_BOUNDARY

#define DUK_RETOK_ASSERT_WORD_BOUNDARY   5

Definition at line 325 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_BACKREFERENCE

#define DUK_RETOK_ATOM_BACKREFERENCE   17

Definition at line 337 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_CHAR

#define DUK_RETOK_ATOM_CHAR   10

Definition at line 330 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_DIGIT

#define DUK_RETOK_ATOM_DIGIT   11

Definition at line 331 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_END_GROUP

#define DUK_RETOK_ATOM_END_GROUP   22

Definition at line 342 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_NOT_DIGIT

#define DUK_RETOK_ATOM_NOT_DIGIT   12

Definition at line 332 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_NOT_WHITE

#define DUK_RETOK_ATOM_NOT_WHITE   14

Definition at line 334 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_NOT_WORD_CHAR

#define DUK_RETOK_ATOM_NOT_WORD_CHAR   16

Definition at line 336 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_PERIOD

#define DUK_RETOK_ATOM_PERIOD   9

Definition at line 329 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_START_CAPTURE_GROUP

#define DUK_RETOK_ATOM_START_CAPTURE_GROUP   18

Definition at line 338 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_START_CHARCLASS

#define DUK_RETOK_ATOM_START_CHARCLASS   20

Definition at line 340 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_START_CHARCLASS_INVERTED

#define DUK_RETOK_ATOM_START_CHARCLASS_INVERTED   21

Definition at line 341 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_START_NONCAPTURE_GROUP

#define DUK_RETOK_ATOM_START_NONCAPTURE_GROUP   19

Definition at line 339 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_WHITE

#define DUK_RETOK_ATOM_WHITE   13

Definition at line 333 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_ATOM_WORD_CHAR

#define DUK_RETOK_ATOM_WORD_CHAR   15

Definition at line 335 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_DISJUNCTION

#define DUK_RETOK_DISJUNCTION   1

Definition at line 321 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_EOF

#define DUK_RETOK_EOF   0

Definition at line 320 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_RETOK_QUANTIFIER

#define DUK_RETOK_QUANTIFIER   2

Definition at line 322 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_STRIDX_TO_TOK

#define DUK_STRIDX_TO_TOK ( x)    ((x) - DUK_STRIDX_START_RESERVED + DUK_TOK_START_RESERVED)

Definition at line 175 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_ADD

#define DUK_TOK_ADD   66

Definition at line 133 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_ADD_EQ

#define DUK_TOK_ADD_EQ   86

Definition at line 153 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_ALSHIFT

#define DUK_TOK_ALSHIFT   73 /* named "arithmetic" because result is signed */

Definition at line 140 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_ALSHIFT_EQ

#define DUK_TOK_ALSHIFT_EQ   91

Definition at line 158 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_ARSHIFT

#define DUK_TOK_ARSHIFT   74

Definition at line 141 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_ARSHIFT_EQ

#define DUK_TOK_ARSHIFT_EQ   92

Definition at line 159 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_BAND

#define DUK_TOK_BAND   76

Definition at line 143 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_BAND_EQ

#define DUK_TOK_BAND_EQ   94

Definition at line 161 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_BNOT

#define DUK_TOK_BNOT   80

Definition at line 147 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_BOR

#define DUK_TOK_BOR   77

Definition at line 144 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_BOR_EQ

#define DUK_TOK_BOR_EQ   95

Definition at line 162 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_BREAK

#define DUK_TOK_BREAK   2

Definition at line 52 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_BXOR

#define DUK_TOK_BXOR   78

Definition at line 145 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_BXOR_EQ

#define DUK_TOK_BXOR_EQ   96

Definition at line 163 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_CASE

#define DUK_TOK_CASE   3

Definition at line 53 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_CATCH

#define DUK_TOK_CATCH   4

Definition at line 54 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_CLASS

#define DUK_TOK_CLASS   29

Definition at line 81 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_COLON

#define DUK_TOK_COLON   84

Definition at line 151 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_COMMA

#define DUK_TOK_COMMA   57

Definition at line 124 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_CONST

#define DUK_TOK_CONST   25

Definition at line 75 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_CONTINUE

#define DUK_TOK_CONTINUE   5

Definition at line 55 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_DEBUGGER

#define DUK_TOK_DEBUGGER   6

Definition at line 56 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_DECREMENT

#define DUK_TOK_DECREMENT   72

Definition at line 139 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_DEFAULT

#define DUK_TOK_DEFAULT   7

Definition at line 57 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_DELETE

#define DUK_TOK_DELETE   8

Definition at line 58 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_DIV

#define DUK_TOK_DIV   69

Definition at line 136 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_DIV_EQ

#define DUK_TOK_DIV_EQ   89

Definition at line 156 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_DO

#define DUK_TOK_DO   9

Definition at line 59 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_ELSE

#define DUK_TOK_ELSE   10

Definition at line 60 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_END_RESERVED

#define DUK_TOK_END_RESERVED   47 /* exclusive */

Definition at line 107 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_ENUM

#define DUK_TOK_ENUM   30

Definition at line 82 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_EOF

#define DUK_TOK_EOF   0

Definition at line 45 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_EQ

#define DUK_TOK_EQ   62

Definition at line 129 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_EQUALSIGN

#define DUK_TOK_EQUALSIGN   85

Definition at line 152 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_EXPORT

#define DUK_TOK_EXPORT   31

Definition at line 83 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_EXTENDS

#define DUK_TOK_EXTENDS   32

Definition at line 84 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_FALSE

#define DUK_TOK_FALSE   37

Definition at line 93 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_FINALLY

#define DUK_TOK_FINALLY   11

Definition at line 61 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_FOR

#define DUK_TOK_FOR   12

Definition at line 62 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_FUNCTION

#define DUK_TOK_FUNCTION   13

Definition at line 63 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_GE

#define DUK_TOK_GE   61

Definition at line 128 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_GET

#define DUK_TOK_GET   47

Definition at line 112 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_GT

#define DUK_TOK_GT   59

Definition at line 126 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_IDENTIFIER

#define DUK_TOK_IDENTIFIER   1

Definition at line 48 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_IF

#define DUK_TOK_IF   14

Definition at line 64 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_IMPLEMENTS

#define DUK_TOK_IMPLEMENTS   38

Definition at line 97 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_IMPORT

#define DUK_TOK_IMPORT   33

Definition at line 85 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_IN

#define DUK_TOK_IN   15

Definition at line 65 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_INCREMENT

#define DUK_TOK_INCREMENT   71

Definition at line 138 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_INSTANCEOF

#define DUK_TOK_INSTANCEOF   16

Definition at line 66 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_INTERFACE

#define DUK_TOK_INTERFACE   39

Definition at line 98 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_LAND

#define DUK_TOK_LAND   81

Definition at line 148 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_LBRACKET

#define DUK_TOK_LBRACKET   51

Definition at line 118 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_LCURLY

#define DUK_TOK_LCURLY   49

Definition at line 116 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_LE

#define DUK_TOK_LE   60

Definition at line 127 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_LET

#define DUK_TOK_LET   40

Definition at line 99 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_LNOT

#define DUK_TOK_LNOT   79

Definition at line 146 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_LOR

#define DUK_TOK_LOR   82

Definition at line 149 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_LPAREN

#define DUK_TOK_LPAREN   53

Definition at line 120 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_LT

#define DUK_TOK_LT   58

Definition at line 125 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_MAXVAL

#define DUK_TOK_MAXVAL   99 /* inclusive */

Definition at line 172 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_MINVAL

#define DUK_TOK_MINVAL   0

Definition at line 42 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_MOD

#define DUK_TOK_MOD   70

Definition at line 137 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_MOD_EQ

#define DUK_TOK_MOD_EQ   90

Definition at line 157 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_MUL

#define DUK_TOK_MUL   68

Definition at line 135 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_MUL_EQ

#define DUK_TOK_MUL_EQ   88

Definition at line 155 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_NEQ

#define DUK_TOK_NEQ   63

Definition at line 130 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_NEW

#define DUK_TOK_NEW   17

Definition at line 67 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_NULL

#define DUK_TOK_NULL   35

Definition at line 91 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_NUMBER

#define DUK_TOK_NUMBER   97

Definition at line 168 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_PACKAGE

#define DUK_TOK_PACKAGE   41

Definition at line 100 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_PERIOD

#define DUK_TOK_PERIOD   55

Definition at line 122 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_PRIVATE

#define DUK_TOK_PRIVATE   42

Definition at line 101 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_PROTECTED

#define DUK_TOK_PROTECTED   43

Definition at line 102 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_PUBLIC

#define DUK_TOK_PUBLIC   44

Definition at line 103 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_QUESTION

#define DUK_TOK_QUESTION   83

Definition at line 150 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_RBRACKET

#define DUK_TOK_RBRACKET   52

Definition at line 119 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_RCURLY

#define DUK_TOK_RCURLY   50

Definition at line 117 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_REGEXP

#define DUK_TOK_REGEXP   99

Definition at line 170 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_RETURN

#define DUK_TOK_RETURN   18

Definition at line 68 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_RPAREN

#define DUK_TOK_RPAREN   54

Definition at line 121 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_RSHIFT

#define DUK_TOK_RSHIFT   75

Definition at line 142 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_RSHIFT_EQ

#define DUK_TOK_RSHIFT_EQ   93

Definition at line 160 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_SEMICOLON

#define DUK_TOK_SEMICOLON   56

Definition at line 123 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_SEQ

#define DUK_TOK_SEQ   64

Definition at line 131 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_SET

#define DUK_TOK_SET   48

Definition at line 113 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_SNEQ

#define DUK_TOK_SNEQ   65

Definition at line 132 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_START_RESERVED

#define DUK_TOK_START_RESERVED   2

Definition at line 51 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_START_STRICT_RESERVED

#define DUK_TOK_START_STRICT_RESERVED   38 /* inclusive */

Definition at line 96 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_STATIC

#define DUK_TOK_STATIC   45

Definition at line 104 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_STRING

#define DUK_TOK_STRING   98

Definition at line 169 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_SUB

#define DUK_TOK_SUB   67

Definition at line 134 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_SUB_EQ

#define DUK_TOK_SUB_EQ   87

Definition at line 154 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_SUPER

#define DUK_TOK_SUPER   34

Definition at line 86 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_SWITCH

#define DUK_TOK_SWITCH   19

Definition at line 69 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_THIS

#define DUK_TOK_THIS   20

Definition at line 70 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_THROW

#define DUK_TOK_THROW   21

Definition at line 71 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_TRUE

#define DUK_TOK_TRUE   36

Definition at line 92 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_TRY

#define DUK_TOK_TRY   22

Definition at line 72 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_TYPEOF

#define DUK_TOK_TYPEOF   23

Definition at line 73 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_VAR

#define DUK_TOK_VAR   24

Definition at line 74 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_VOID

#define DUK_TOK_VOID   26

Definition at line 76 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_WHILE

#define DUK_TOK_WHILE   27

Definition at line 77 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_WITH

#define DUK_TOK_WITH   28

Definition at line 78 of file duktape-1.8.0/src-separate/duk_lexer.h.

◆ DUK_TOK_YIELD

#define DUK_TOK_YIELD   46

Definition at line 105 of file duktape-1.8.0/src-separate/duk_lexer.h.

Typedef Documentation

◆ duk_re_range_callback

typedef void(* duk_re_range_callback) (void *user, duk_codepoint_t r1, duk_codepoint_t r2, duk_bool_t direct)

Definition at line 8 of file duktape-1.8.0/src-separate/duk_lexer.h.

Function Documentation

◆ duk_lexer_initctx()

DUK_INTERNAL_DECL void duk_lexer_initctx ( duk_lexer_ctx * lex_ctx)

Definition at line 73480 of file duktape-1.5.2/src-noline/duktape.c.

73484 {
73485 duk_context *ctx = (duk_context *) lex_ctx->thr;
73486
73487 DUK_ASSERT(valstack_idx == lex_ctx->slot1_idx || valstack_idx == lex_ctx->slot2_idx);
73488
73489 DUK_BW_PUSH_AS_STRING(lex_ctx->thr, &lex_ctx->bw);
73490 duk_replace(ctx, valstack_idx);
73491}
73492
DUK_EXTERNAL void duk_replace(duk_context *ctx, duk_idx_t to_index)
#define DUK_BW_PUSH_AS_STRING(thr, bw_ctx)

References duk_lexer_ctx::buf, duk_lexer_ctx::bw, DUK_ASSERT, DUK_BW_PUSH_AS_STRING, DUK_MEMZERO, duk_replace(), duk_lexer_ctx::input, NULL, duk_lexer_ctx::slot1_idx, duk_lexer_ctx::slot2_idx, duk_lexer_ctx::thr, and duk_lexer_ctx::window.

◆ duk_lexer_parse_js_input_element()

DUK_INTERNAL_DECL void duk_lexer_parse_js_input_element ( duk_lexer_ctx * lex_ctx,
duk_token * out_token,
duk_bool_t strict_mode,
duk_bool_t regexp_mode )

Definition at line 73618 of file duktape-1.5.2/src-noline/duktape.c.

73638 {
73639 duk_codepoint_t x; /* temporary, must be signed and 32-bit to hold Unicode code points */
73640 duk_small_uint_t advtok = 0; /* (advance << 8) + token_type, updated at function end,
73641 * init is unnecessary but suppresses "may be used uninitialized" warnings.
73642 */
73643 duk_bool_t got_lineterm = 0; /* got lineterm preceding non-whitespace, non-lineterm token */
73644
73645 if (++lex_ctx->token_count >= lex_ctx->token_limit) {
73646 DUK_ERROR_RANGE(lex_ctx->thr, "token limit");
73647 return; /* unreachable */
73648 }
73649
73650 out_token->t = DUK_TOK_EOF;
73651 out_token->t_nores = -1; /* marker: copy t if not changed */
73652#if 0 /* not necessary to init, disabled for faster parsing */
73653 out_token->num = DUK_DOUBLE_NAN;
73654 out_token->str1 = NULL;
73655 out_token->str2 = NULL;
73656#endif
73657 out_token->num_escapes = 0;
73658 /* out_token->lineterm set by caller */
73659
73660 /* This would be nice, but parsing is faster without resetting the
73661 * value slots. The only side effect is that references to temporary
73662 * string values may linger until lexing is finished; they're then
73663 * freed normally.
73664 */
73665#if 0
73666 duk_to_undefined((duk_context *) lex_ctx->thr, lex_ctx->slot1_idx);
73667 duk_to_undefined((duk_context *) lex_ctx->thr, lex_ctx->slot2_idx);
73668#endif
73669
73670 /* 'advtok' indicates how much to advance and which token id to assign
73671 * at the end. This shared functionality minimizes code size. All
73672 * code paths are required to set 'advtok' to some value, so no default
73673 * init value is used. Code paths calling DUK_ERROR() never return so
73674 * they don't need to set advtok.
73675 */
73676
73677 /*
73678 * Matching order:
73679 *
73680 * Punctuator first chars, also covers comments, regexps
73681 * LineTerminator
73682 * Identifier or reserved word, also covers null/true/false literals
73683 * NumericLiteral
73684 * StringLiteral
73685 * EOF
73686 *
73687 * The order does not matter as long as the longest match is
73688 * always correctly identified. There are order dependencies
73689 * in the clauses, so it's not trivial to convert to a switch.
73690 */
73691
73692 restart_lineupdate:
73693 out_token->start_line = lex_ctx->window[0].line;
73694
73695 restart:
73696 out_token->start_offset = lex_ctx->window[0].offset;
73697
73698 x = DUK__L0();
73699
73700 switch (x) {
73701 case DUK_ASC_SPACE:
73702 case DUK_ASC_HT: /* fast paths for space and tab */
73703 DUK__ADVANCECHARS(lex_ctx, 1);
73704 goto restart;
73705 case DUK_ASC_LF: /* LF line terminator; CR LF and Unicode lineterms are handled in slow path */
73706 DUK__ADVANCECHARS(lex_ctx, 1);
73707 got_lineterm = 1;
73708 goto restart_lineupdate;
73709 case DUK_ASC_SLASH: /* '/' */
73710 if (DUK__L1() == '/') {
73711 /*
73712 * E5 Section 7.4, allow SourceCharacter (which is any 16-bit
73713 * code point).
73714 */
73715
73716 /* DUK__ADVANCECHARS(lex_ctx, 2) would be correct here, but it unnecessary */
73717 for (;;) {
73718 x = DUK__L0();
73719 if (x < 0 || duk_unicode_is_line_terminator(x)) {
73720 break;
73721 }
73722 DUK__ADVANCECHARS(lex_ctx, 1);
73723 }
73724 goto restart; /* line terminator will be handled on next round */
73725 } else if (DUK__L1() == '*') {
73726 /*
73727 * E5 Section 7.4. If the multi-line comment contains a newline,
73728 * it is treated like a single line terminator for automatic
73729 * semicolon insertion.
73730 */
73731
73732 duk_bool_t last_asterisk = 0;
73733 DUK__ADVANCECHARS(lex_ctx, 2);
73734 for (;;) {
73735 x = DUK__L0();
73736 if (x < 0) {
73737 DUK_ERROR_SYNTAX(lex_ctx->thr, "eof in multiline comment");
73738 }
73739 DUK__ADVANCECHARS(lex_ctx, 1);
73740 if (last_asterisk && x == '/') {
73741 break;
73742 }
73744 got_lineterm = 1;
73745 }
73746 last_asterisk = (x == '*');
73747 }
73748 goto restart_lineupdate;
73749 } else if (regexp_mode) {
73750#if defined(DUK_USE_REGEXP_SUPPORT)
73751 /*
73752 * "/" followed by something in regexp mode. See E5 Section 7.8.5.
73753 *
73754 * RegExp parsing is a bit complex. First, the regexp body is delimited
73755 * by forward slashes, but the body may also contain forward slashes as
73756 * part of an escape sequence or inside a character class (delimited by
73757 * square brackets). A mini state machine is used to implement these.
73758 *
73759 * Further, an early (parse time) error must be thrown if the regexp
73760 * would cause a run-time error when used in the expression new RegExp(...).
73761 * Parsing here simply extracts the (candidate) regexp, and also accepts
73762 * invalid regular expressions (which are delimited properly). The caller
73763 * (compiler) must perform final validation and regexp compilation.
73764 *
73765 * RegExp first char may not be '/' (single line comment) or '*' (multi-
73766 * line comment). These have already been checked above, so there is no
73767 * need below for special handling of the first regexp character as in
73768 * the E5 productions.
73769 *
73770 * About unicode escapes within regexp literals:
73771 *
73772 * E5 Section 7.8.5 grammar does NOT accept \uHHHH escapes.
73773 * However, Section 6 states that regexps accept the escapes,
73774 * see paragraph starting with "In string literals...".
73775 * The regexp grammar, which sees the decoded regexp literal
73776 * (after lexical parsing) DOES have a \uHHHH unicode escape.
73777 * So, for instance:
73778 *
73779 * /\u1234/
73780 *
73781 * should first be parsed by the lexical grammar as:
73782 *
73783 * '\' 'u' RegularExpressionBackslashSequence
73784 * '1' RegularExpressionNonTerminator
73785 * '2' RegularExpressionNonTerminator
73786 * '3' RegularExpressionNonTerminator
73787 * '4' RegularExpressionNonTerminator
73788 *
73789 * and the escape itself is then parsed by the regexp engine.
73790 * This is the current implementation.
73791 *
73792 * Minor spec inconsistency:
73793 *
73794 * E5 Section 7.8.5 RegularExpressionBackslashSequence is:
73795 *
73796 * \ RegularExpressionNonTerminator
73797 *
73798 * while Section A.1 RegularExpressionBackslashSequence is:
73799 *
73800 * \ NonTerminator
73801 *
73802 * The latter is not normative and a typo.
73803 *
73804 */
73805
73806 /* first, parse regexp body roughly */
73807
73808 duk_small_int_t state = 0; /* 0=base, 1=esc, 2=class, 3=class+esc */
73809
73810 DUK__INITBUFFER(lex_ctx);
73811 for (;;) {
73812 DUK__ADVANCECHARS(lex_ctx, 1); /* skip opening slash on first loop */
73813 x = DUK__L0();
73814 if (x < 0 || duk_unicode_is_line_terminator(x)) {
73815 DUK_ERROR_SYNTAX(lex_ctx->thr, "eof or line terminator in regexp");
73816 }
73817 x = DUK__L0(); /* re-read to avoid spill / fetch */
73818 if (state == 0) {
73819 if (x == '/') {
73820 DUK__ADVANCECHARS(lex_ctx, 1); /* eat closing slash */
73821 break;
73822 } else if (x == '\\') {
73823 state = 1;
73824 } else if (x == '[') {
73825 state = 2;
73826 }
73827 } else if (state == 1) {
73828 state = 0;
73829 } else if (state == 2) {
73830 if (x == ']') {
73831 state = 0;
73832 } else if (x == '\\') {
73833 state = 3;
73834 }
73835 } else { /* state == 3 */
73836 state = 2;
73837 }
73838 DUK__APPENDBUFFER(lex_ctx, x);
73839 }
73840 duk__internbuffer(lex_ctx, lex_ctx->slot1_idx);
73841 out_token->str1 = duk_get_hstring((duk_context *) lex_ctx->thr, lex_ctx->slot1_idx);
73842
73843 /* second, parse flags */
73844
73845 DUK__INITBUFFER(lex_ctx);
73846 for (;;) {
73847 x = DUK__L0();
73849 break;
73850 }
73851 x = DUK__L0(); /* re-read to avoid spill / fetch */
73852 DUK__APPENDBUFFER(lex_ctx, x);
73853 DUK__ADVANCECHARS(lex_ctx, 1);
73854 }
73855 duk__internbuffer(lex_ctx, lex_ctx->slot2_idx);
73856 out_token->str2 = duk_get_hstring((duk_context *) lex_ctx->thr, lex_ctx->slot2_idx);
73857
73858 DUK__INITBUFFER(lex_ctx); /* free some memory */
73859
73860 /* validation of the regexp is caller's responsibility */
73861
73862 advtok = DUK__ADVTOK(0, DUK_TOK_REGEXP);
73863#else
73864 DUK_ERROR_SYNTAX(lex_ctx->thr, "regexp support disabled");
73865#endif
73866 } else if (DUK__L1() == '=') {
73867 /* "/=" and not in regexp mode */
73868 advtok = DUK__ADVTOK(2, DUK_TOK_DIV_EQ);
73869 } else {
73870 /* "/" and not in regexp mode */
73871 advtok = DUK__ADVTOK(1, DUK_TOK_DIV);
73872 }
73873 break;
73874 case DUK_ASC_LCURLY: /* '{' */
73875 advtok = DUK__ADVTOK(1, DUK_TOK_LCURLY);
73876 break;
73877 case DUK_ASC_RCURLY: /* '}' */
73878 advtok = DUK__ADVTOK(1, DUK_TOK_RCURLY);
73879 break;
73880 case DUK_ASC_LPAREN: /* '(' */
73881 advtok = DUK__ADVTOK(1, DUK_TOK_LPAREN);
73882 break;
73883 case DUK_ASC_RPAREN: /* ')' */
73884 advtok = DUK__ADVTOK(1, DUK_TOK_RPAREN);
73885 break;
73886 case DUK_ASC_LBRACKET: /* '[' */
73887 advtok = DUK__ADVTOK(1, DUK_TOK_LBRACKET);
73888 break;
73889 case DUK_ASC_RBRACKET: /* ']' */
73890 advtok = DUK__ADVTOK(1, DUK_TOK_RBRACKET);
73891 break;
73892 case DUK_ASC_PERIOD: /* '.' */
73893 if (DUK__ISDIGIT(DUK__L1())) {
73894 /* Period followed by a digit can only start DecimalLiteral
73895 * (handled in slow path). We could jump straight into the
73896 * DecimalLiteral handling but should avoid goto to inside
73897 * a block.
73898 */
73899 goto slow_path;
73900 }
73901 advtok = DUK__ADVTOK(1, DUK_TOK_PERIOD);
73902 break;
73903 case DUK_ASC_SEMICOLON: /* ';' */
73904 advtok = DUK__ADVTOK(1, DUK_TOK_SEMICOLON);
73905 break;
73906 case DUK_ASC_COMMA: /* ',' */
73907 advtok = DUK__ADVTOK(1, DUK_TOK_COMMA);
73908 break;
73909 case DUK_ASC_LANGLE: /* '<' */
73910 if (DUK__L1() == '<' && DUK__L2() == '=') {
73911 advtok = DUK__ADVTOK(3, DUK_TOK_ALSHIFT_EQ);
73912 } else if (DUK__L1() == '=') {
73913 advtok = DUK__ADVTOK(2, DUK_TOK_LE);
73914 } else if (DUK__L1() == '<') {
73915 advtok = DUK__ADVTOK(2, DUK_TOK_ALSHIFT);
73916 } else {
73917 advtok = DUK__ADVTOK(1, DUK_TOK_LT);
73918 }
73919 break;
73920 case DUK_ASC_RANGLE: /* '>' */
73921 if (DUK__L1() == '>' && DUK__L2() == '>' && DUK__L3() == '=') {
73922 advtok = DUK__ADVTOK(4, DUK_TOK_RSHIFT_EQ);
73923 } else if (DUK__L1() == '>' && DUK__L2() == '>') {
73924 advtok = DUK__ADVTOK(3, DUK_TOK_RSHIFT);
73925 } else if (DUK__L1() == '>' && DUK__L2() == '=') {
73926 advtok = DUK__ADVTOK(3, DUK_TOK_ARSHIFT_EQ);
73927 } else if (DUK__L1() == '=') {
73928 advtok = DUK__ADVTOK(2, DUK_TOK_GE);
73929 } else if (DUK__L1() == '>') {
73930 advtok = DUK__ADVTOK(2, DUK_TOK_ARSHIFT);
73931 } else {
73932 advtok = DUK__ADVTOK(1, DUK_TOK_GT);
73933 }
73934 break;
73935 case DUK_ASC_EQUALS: /* '=' */
73936 if (DUK__L1() == '=' && DUK__L2() == '=') {
73937 advtok = DUK__ADVTOK(3, DUK_TOK_SEQ);
73938 } else if (DUK__L1() == '=') {
73939 advtok = DUK__ADVTOK(2, DUK_TOK_EQ);
73940 } else {
73941 advtok = DUK__ADVTOK(1, DUK_TOK_EQUALSIGN);
73942 }
73943 break;
73944 case DUK_ASC_EXCLAMATION: /* '!' */
73945 if (DUK__L1() == '=' && DUK__L2() == '=') {
73946 advtok = DUK__ADVTOK(3, DUK_TOK_SNEQ);
73947 } else if (DUK__L1() == '=') {
73948 advtok = DUK__ADVTOK(2, DUK_TOK_NEQ);
73949 } else {
73950 advtok = DUK__ADVTOK(1, DUK_TOK_LNOT);
73951 }
73952 break;
73953 case DUK_ASC_PLUS: /* '+' */
73954 if (DUK__L1() == '+') {
73955 advtok = DUK__ADVTOK(2, DUK_TOK_INCREMENT);
73956 } else if (DUK__L1() == '=') {
73957 advtok = DUK__ADVTOK(2, DUK_TOK_ADD_EQ);
73958 } else {
73959 advtok = DUK__ADVTOK(1, DUK_TOK_ADD);
73960 }
73961 break;
73962 case DUK_ASC_MINUS: /* '-' */
73963 if (DUK__L1() == '-') {
73964 advtok = DUK__ADVTOK(2, DUK_TOK_DECREMENT);
73965 } else if (DUK__L1() == '=') {
73966 advtok = DUK__ADVTOK(2, DUK_TOK_SUB_EQ);
73967 } else {
73968 advtok = DUK__ADVTOK(1, DUK_TOK_SUB);
73969 }
73970 break;
73971 case DUK_ASC_STAR: /* '*' */
73972 if (DUK__L1() == '=') {
73973 advtok = DUK__ADVTOK(2, DUK_TOK_MUL_EQ);
73974 } else {
73975 advtok = DUK__ADVTOK(1, DUK_TOK_MUL);
73976 }
73977 break;
73978 case DUK_ASC_PERCENT: /* '%' */
73979 if (DUK__L1() == '=') {
73980 advtok = DUK__ADVTOK(2, DUK_TOK_MOD_EQ);
73981 } else {
73982 advtok = DUK__ADVTOK(1, DUK_TOK_MOD);
73983 }
73984 break;
73985 case DUK_ASC_AMP: /* '&' */
73986 if (DUK__L1() == '&') {
73987 advtok = DUK__ADVTOK(2, DUK_TOK_LAND);
73988 } else if (DUK__L1() == '=') {
73989 advtok = DUK__ADVTOK(2, DUK_TOK_BAND_EQ);
73990 } else {
73991 advtok = DUK__ADVTOK(1, DUK_TOK_BAND);
73992 }
73993 break;
73994 case DUK_ASC_PIPE: /* '|' */
73995 if (DUK__L1() == '|') {
73996 advtok = DUK__ADVTOK(2, DUK_TOK_LOR);
73997 } else if (DUK__L1() == '=') {
73998 advtok = DUK__ADVTOK(2, DUK_TOK_BOR_EQ);
73999 } else {
74000 advtok = DUK__ADVTOK(1, DUK_TOK_BOR);
74001 }
74002 break;
74003 case DUK_ASC_CARET: /* '^' */
74004 if (DUK__L1() == '=') {
74005 advtok = DUK__ADVTOK(2, DUK_TOK_BXOR_EQ);
74006 } else {
74007 advtok = DUK__ADVTOK(1, DUK_TOK_BXOR);
74008 }
74009 break;
74010 case DUK_ASC_TILDE: /* '~' */
74011 advtok = DUK__ADVTOK(1, DUK_TOK_BNOT);
74012 break;
74013 case DUK_ASC_QUESTION: /* '?' */
74014 advtok = DUK__ADVTOK(1, DUK_TOK_QUESTION);
74015 break;
74016 case DUK_ASC_COLON: /* ':' */
74017 advtok = DUK__ADVTOK(1, DUK_TOK_COLON);
74018 break;
74019 case DUK_ASC_DOUBLEQUOTE: /* '"' */
74020 case DUK_ASC_SINGLEQUOTE: { /* '\'' */
74021 duk_small_int_t quote = x; /* Note: duk_uint8_t type yields larger code */
74022 duk_small_int_t adv;
74023
74024 DUK__INITBUFFER(lex_ctx);
74025 for (;;) {
74026 DUK__ADVANCECHARS(lex_ctx, 1); /* eat opening quote on first loop */
74027 x = DUK__L0();
74028 if (x < 0 || duk_unicode_is_line_terminator(x)) {
74029 DUK_ERROR_SYNTAX(lex_ctx->thr, "eof or line terminator in string literal");
74030 }
74031 if (x == quote) {
74032 DUK__ADVANCECHARS(lex_ctx, 1); /* eat closing quote */
74033 break;
74034 }
74035 if (x == '\\') {
74036 /* DUK__L0 -> '\' char
74037 * DUK__L1 ... DUK__L5 -> more lookup
74038 */
74039
74040 x = DUK__L1();
74041
74042 /* How much to advance before next loop; note that next loop
74043 * will advance by 1 anyway, so -1 from the total escape
74044 * length (e.g. len('\uXXXX') - 1 = 6 - 1). As a default,
74045 * 1 is good.
74046 */
74047 adv = 2 - 1; /* note: long live range */
74048
74049 if (x < 0) {
74050 DUK_ERROR_SYNTAX(lex_ctx->thr, "eof or line terminator in string literal");
74051 }
74053 /* line continuation */
74054 if (x == 0x000d && DUK__L2() == 0x000a) {
74055 /* CR LF again a special case */
74056 adv = 3 - 1;
74057 }
74058 } else if (x == '\'') {
74059 DUK__APPENDBUFFER(lex_ctx, 0x0027);
74060 } else if (x == '"') {
74061 DUK__APPENDBUFFER(lex_ctx, 0x0022);
74062 } else if (x == '\\') {
74063 DUK__APPENDBUFFER(lex_ctx, 0x005c);
74064 } else if (x == 'b') {
74065 DUK__APPENDBUFFER(lex_ctx, 0x0008);
74066 } else if (x == 'f') {
74067 DUK__APPENDBUFFER(lex_ctx, 0x000c);
74068 } else if (x == 'n') {
74069 DUK__APPENDBUFFER(lex_ctx, 0x000a);
74070 } else if (x == 'r') {
74071 DUK__APPENDBUFFER(lex_ctx, 0x000d);
74072 } else if (x == 't') {
74073 DUK__APPENDBUFFER(lex_ctx, 0x0009);
74074 } else if (x == 'v') {
74075 DUK__APPENDBUFFER(lex_ctx, 0x000b);
74076 } else if (x == 'x') {
74077 adv = 4 - 1;
74079 } else if (x == 'u') {
74080 adv = 6 - 1;
74082 } else if (DUK__ISDIGIT(x)) {
74083 duk_codepoint_t ch = 0; /* initialized to avoid warnings of unused var */
74084
74085 /*
74086 * Octal escape or zero escape:
74087 * \0 (lookahead not DecimalDigit)
74088 * \1 ... \7 (lookahead not DecimalDigit)
74089 * \ZeroToThree OctalDigit (lookahead not DecimalDigit)
74090 * \FourToSeven OctalDigit (no lookahead restrictions)
74091 * \ZeroToThree OctalDigit OctalDigit (no lookahead restrictions)
74092 *
74093 * Zero escape is part of the standard syntax. Octal escapes are
74094 * defined in E5 Section B.1.2, and are only allowed in non-strict mode.
74095 * Any other productions starting with a decimal digit are invalid.
74096 */
74097
74098 if (x == '0' && !DUK__ISDIGIT(DUK__L2())) {
74099 /* Zero escape (also allowed in non-strict mode) */
74100 ch = 0;
74101 /* adv = 2 - 1 default OK */
74102#if defined(DUK_USE_OCTAL_SUPPORT)
74103 } else if (strict_mode) {
74104 /* No other escape beginning with a digit in strict mode */
74105 DUK_ERROR_SYNTAX(lex_ctx->thr, "invalid escape in string literal");
74106 } else if (DUK__ISDIGIT03(x) && DUK__ISOCTDIGIT(DUK__L2()) && DUK__ISOCTDIGIT(DUK__L3())) {
74107 /* Three digit octal escape, digits validated. */
74108 adv = 4 - 1;
74109 ch = (duk__hexval(lex_ctx, x) << 6) +
74110 (duk__hexval(lex_ctx, DUK__L2()) << 3) +
74111 duk__hexval(lex_ctx, DUK__L3());
74112 } else if (((DUK__ISDIGIT03(x) && !DUK__ISDIGIT(DUK__L3())) || DUK__ISDIGIT47(x)) &&
74114 /* Two digit octal escape, digits validated.
74115 *
74116 * The if-condition is a bit tricky. We could catch e.g.
74117 * '\039' in the three-digit escape and fail it there (by
74118 * validating the digits), but we want to avoid extra
74119 * additional validation code.
74120 */
74121 adv = 3 - 1;
74122 ch = (duk__hexval(lex_ctx, x) << 3) +
74123 duk__hexval(lex_ctx, DUK__L2());
74124 } else if (DUK__ISDIGIT(x) && !DUK__ISDIGIT(DUK__L2())) {
74125 /* One digit octal escape, digit validated. */
74126 /* adv = 2 default OK */
74127 ch = duk__hexval(lex_ctx, x);
74128#else
74129 /* fall through to error */
74130#endif
74131 } else {
74132 DUK_ERROR_SYNTAX(lex_ctx->thr, "invalid escape in string literal");
74133 }
74134
74135 DUK__APPENDBUFFER(lex_ctx, ch);
74136 } else {
74137 /* escaped NonEscapeCharacter */
74138 DUK__APPENDBUFFER(lex_ctx, x);
74139 }
74140 DUK__ADVANCECHARS(lex_ctx, adv);
74141
74142 /* Track number of escapes; count not really needed but directive
74143 * prologues need to detect whether there were any escapes or line
74144 * continuations or not.
74145 */
74146 out_token->num_escapes++;
74147 } else {
74148 /* part of string */
74149 DUK__APPENDBUFFER(lex_ctx, x);
74150 }
74151 }
74152
74153 duk__internbuffer(lex_ctx, lex_ctx->slot1_idx);
74154 out_token->str1 = duk_get_hstring((duk_context *) lex_ctx->thr, lex_ctx->slot1_idx);
74155
74156 DUK__INITBUFFER(lex_ctx); /* free some memory */
74157
74158 advtok = DUK__ADVTOK(0, DUK_TOK_STRING);
74159 break;
74160 }
74161 default:
74162 goto slow_path;
74163 } /* switch */
74164
74165 goto skip_slow_path;
74166
74167 slow_path:
74169 if (x == 0x000d && DUK__L1() == 0x000a) {
74170 /*
74171 * E5 Section 7.3: CR LF is detected as a single line terminator for
74172 * line numbers. Here we also detect it as a single line terminator
74173 * token.
74174 */
74175 DUK__ADVANCECHARS(lex_ctx, 2);
74176 } else {
74177 DUK__ADVANCECHARS(lex_ctx, 1);
74178 }
74179 got_lineterm = 1;
74180 goto restart_lineupdate;
74181 } else if (duk_unicode_is_identifier_start(x) || x == '\\') {
74182 /*
74183 * Parse an identifier and then check whether it is:
74184 * - reserved word (keyword or other reserved word)
74185 * - "null" (NullLiteral)
74186 * - "true" (BooleanLiteral)
74187 * - "false" (BooleanLiteral)
74188 * - anything else => identifier
74189 *
74190 * This does not follow the E5 productions cleanly, but is
74191 * useful and compact.
74192 *
74193 * Note that identifiers may contain Unicode escapes,
74194 * see E5 Sections 6 and 7.6. They must be decoded first,
74195 * and the result checked against allowed characters.
74196 * The above if-clause accepts an identifier start and an
74197 * '\' character -- no other token can begin with a '\'.
74198 *
74199 * Note that "get" and "set" are not reserved words in E5
74200 * specification so they are recognized as plain identifiers
74201 * (the tokens DUK_TOK_GET and DUK_TOK_SET are actually not
74202 * used now). The compiler needs to work around this.
74203 *
74204 * Strictly speaking, following Ecmascript longest match
74205 * specification, an invalid escape for the first character
74206 * should cause a syntax error. However, an invalid escape
74207 * for IdentifierParts should just terminate the identifier
74208 * early (longest match), and let the next tokenization
74209 * fail. For instance Rhino croaks with 'foo\z' when
74210 * parsing the identifier. This has little practical impact.
74211 */
74212
74213 duk_small_int_t i, i_end;
74214 duk_bool_t first = 1;
74215 duk_hstring *str;
74216
74217 DUK__INITBUFFER(lex_ctx);
74218 for (;;) {
74219 /* re-lookup first char on first loop */
74220 if (DUK__L0() == '\\') {
74221 duk_codepoint_t ch;
74222 if (DUK__L1() != 'u') {
74223 DUK_ERROR_SYNTAX(lex_ctx->thr, "invalid unicode escape in identifier");
74224 }
74225
74226 ch = duk__decode_uniesc_from_window(lex_ctx, 2);
74227
74228 /* IdentifierStart is stricter than IdentifierPart, so if the first
74229 * character is escaped, must have a stricter check here.
74230 */
74232 DUK_ERROR_SYNTAX(lex_ctx->thr, "invalid unicode escape in identifier");
74233 }
74234 DUK__APPENDBUFFER(lex_ctx, ch);
74235 DUK__ADVANCECHARS(lex_ctx, 6);
74236
74237 /* Track number of escapes: necessary for proper keyword
74238 * detection.
74239 */
74240 out_token->num_escapes++;
74241 } else {
74242 /* Note: first character is checked against this. But because
74243 * IdentifierPart includes all IdentifierStart characters, and
74244 * the first character (if unescaped) has already been checked
74245 * in the if condition, this is OK.
74246 */
74248 break;
74249 }
74250 DUK__APPENDBUFFER(lex_ctx, DUK__L0());
74251 DUK__ADVANCECHARS(lex_ctx, 1);
74252 }
74253 first = 0;
74254 }
74255
74256 duk__internbuffer(lex_ctx, lex_ctx->slot1_idx);
74257 out_token->str1 = duk_get_hstring((duk_context *) lex_ctx->thr, lex_ctx->slot1_idx);
74258 str = out_token->str1;
74259 DUK_ASSERT(str != NULL);
74260 out_token->t_nores = DUK_TOK_IDENTIFIER;
74261
74262 DUK__INITBUFFER(lex_ctx); /* free some memory */
74263
74264 /*
74265 * Interned identifier is compared against reserved words, which are
74266 * currently interned into the heap context. See genbuiltins.py.
74267 *
74268 * Note that an escape in the identifier disables recognition of
74269 * keywords; e.g. "\u0069f = 1;" is a valid statement (assigns to
74270 * identifier named "if"). This is not necessarily compliant,
74271 * see test-dec-escaped-char-in-keyword.js.
74272 *
74273 * Note: "get" and "set" are awkward. They are not officially
74274 * ReservedWords (and indeed e.g. "var set = 1;" is valid), and
74275 * must come out as DUK_TOK_IDENTIFIER. The compiler needs to
74276 * work around this a bit.
74277 */
74278
74279 /* XXX: optimize by adding the token numbers directly into the
74280 * always interned duk_hstring objects (there should be enough
74281 * flag bits free for that)?
74282 */
74283
74285
74286 advtok = DUK__ADVTOK(0, DUK_TOK_IDENTIFIER);
74287 if (out_token->num_escapes == 0) {
74288 for (i = DUK_STRIDX_START_RESERVED; i < i_end; i++) {
74289 DUK_ASSERT(i >= 0 && i < DUK_HEAP_NUM_STRINGS);
74290 if (DUK_HTHREAD_GET_STRING(lex_ctx->thr, i) == str) {
74291 advtok = DUK__ADVTOK(0, DUK_STRIDX_TO_TOK(i));
74292 break;
74293 }
74294 }
74295 }
74296 } else if (DUK__ISDIGIT(x) || (x == '.')) {
74297 /* Note: decimal number may start with a period, but must be followed by a digit */
74298
74299 /*
74300 * DecimalLiteral, HexIntegerLiteral, OctalIntegerLiteral
74301 * "pre-parsing", followed by an actual, accurate parser step.
74302 *
74303 * Note: the leading sign character ('+' or '-') is -not- part of
74304 * the production in E5 grammar, and that the a DecimalLiteral
74305 * starting with a '0' must be followed by a non-digit. Leading
74306 * zeroes are syntax errors and must be checked for.
74307 *
74308 * XXX: the two step parsing process is quite awkward, it would
74309 * be more straightforward to allow numconv to parse the longest
74310 * valid prefix (it already does that, it only needs to indicate
74311 * where the input ended). However, the lexer decodes characters
74312 * using a lookup window, so this is not a trivial change.
74313 */
74314
74315 /* XXX: because of the final check below (that the literal is not
74316 * followed by a digit), this could maybe be simplified, if we bail
74317 * out early from a leading zero (and if there are no periods etc).
74318 * Maybe too complex.
74319 */
74320
74321 duk_double_t val;
74322 duk_bool_t int_only = 0;
74323 duk_bool_t allow_hex = 0;
74324 duk_small_int_t state; /* 0=before period/exp,
74325 * 1=after period, before exp
74326 * 2=after exp, allow '+' or '-'
74327 * 3=after exp and exp sign
74328 */
74329 duk_small_uint_t s2n_flags;
74331
74332 DUK__INITBUFFER(lex_ctx);
74333 y = DUK__L1();
74334 if (x == '0' && (y == 'x' || y == 'X')) {
74335 DUK__APPENDBUFFER(lex_ctx, x);
74336 DUK__APPENDBUFFER(lex_ctx, y);
74337 DUK__ADVANCECHARS(lex_ctx, 2);
74338 int_only = 1;
74339 allow_hex = 1;
74340#if defined(DUK_USE_OCTAL_SUPPORT)
74341 } else if (!strict_mode && x == '0' && DUK__ISDIGIT(y)) {
74342 /* Note: if DecimalLiteral starts with a '0', it can only be
74343 * followed by a period or an exponent indicator which starts
74344 * with 'e' or 'E'. Hence the if-check above ensures that
74345 * OctalIntegerLiteral is the only valid NumericLiteral
74346 * alternative at this point (even if y is, say, '9').
74347 */
74348
74349 DUK__APPENDBUFFER(lex_ctx, x);
74350 DUK__ADVANCECHARS(lex_ctx, 1);
74351 int_only = 1;
74352#endif
74353 }
74354
74355 state = 0;
74356 for (;;) {
74357 x = DUK__L0(); /* re-lookup curr char on first round */
74358 if (DUK__ISDIGIT(x)) {
74359 /* Note: intentionally allow leading zeroes here, as the
74360 * actual parser will check for them.
74361 */
74362 if (state == 2) {
74363 state = 3;
74364 }
74365 } else if (allow_hex && DUK__ISHEXDIGIT(x)) {
74366 /* Note: 'e' and 'E' are also accepted here. */
74367 ;
74368 } else if (x == '.') {
74369 if (state >= 1 || int_only) {
74370 break;
74371 } else {
74372 state = 1;
74373 }
74374 } else if (x == 'e' || x == 'E') {
74375 if (state >= 2 || int_only) {
74376 break;
74377 } else {
74378 state = 2;
74379 }
74380 } else if (x == '-' || x == '+') {
74381 if (state != 2) {
74382 break;
74383 } else {
74384 state = 3;
74385 }
74386 } else {
74387 break;
74388 }
74389 DUK__APPENDBUFFER(lex_ctx, x);
74390 DUK__ADVANCECHARS(lex_ctx, 1);
74391 }
74392
74393 /* XXX: better coercion */
74394 duk__internbuffer(lex_ctx, lex_ctx->slot1_idx);
74395
74396 s2n_flags = DUK_S2N_FLAG_ALLOW_EXP |
74400#if defined(DUK_USE_OCTAL_SUPPORT)
74401 (strict_mode ? 0 : DUK_S2N_FLAG_ALLOW_AUTO_OCT_INT) |
74402#endif
74404
74405 duk_dup((duk_context *) lex_ctx->thr, lex_ctx->slot1_idx);
74406 duk_numconv_parse((duk_context *) lex_ctx->thr, 10 /*radix*/, s2n_flags);
74407 val = duk_to_number((duk_context *) lex_ctx->thr, -1);
74408 if (DUK_ISNAN(val)) {
74409 DUK_ERROR_SYNTAX(lex_ctx->thr, "invalid numeric literal");
74410 }
74411 duk_replace((duk_context *) lex_ctx->thr, lex_ctx->slot1_idx); /* could also just pop? */
74412
74413 DUK__INITBUFFER(lex_ctx); /* free some memory */
74414
74415 /* Section 7.8.3 (note): NumericLiteral must be followed by something other than
74416 * IdentifierStart or DecimalDigit.
74417 */
74418
74420 DUK_ERROR_SYNTAX(lex_ctx->thr, "invalid numeric literal");
74421 }
74422
74423 out_token->num = val;
74424 advtok = DUK__ADVTOK(0, DUK_TOK_NUMBER);
74425 } else if (duk_unicode_is_whitespace(DUK__LOOKUP(lex_ctx, 0))) {
74426 DUK__ADVANCECHARS(lex_ctx, 1);
74427 goto restart;
74428 } else if (x < 0) {
74429 advtok = DUK__ADVTOK(0, DUK_TOK_EOF);
74430 } else {
74431 DUK_ERROR_SYNTAX(lex_ctx->thr, "invalid token");
74432 }
74433 skip_slow_path:
74434
74435 /*
74436 * Shared exit path
74437 */
74438
unsigned int duk_small_uint_t
duk_small_int_t duk_bool_t
#define DUK__ISHEXDIGIT(x)
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_identifier_part(duk_codepoint_t cp)
#define DUK_ERROR_RANGE(thr, msg)
#define DUK_S2N_FLAG_ALLOW_FRAC
#define DUK__ADVTOK(advbytes, tok)
DUK_LOCAL duk_codepoint_t duk__hexval(duk_lexer_ctx *lex_ctx, duk_codepoint_t x)
DUK_EXTERNAL void duk_to_undefined(duk_context *ctx, duk_idx_t index)
#define DUK__INITBUFFER(lex_ctx)
#define DUK_S2N_FLAG_ALLOW_EMPTY_FRAC
#define DUK_STRIDX_START_RESERVED
#define DUK__ISOCTDIGIT(x)
#define DUK_ERROR_SYNTAX(thr, msg)
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_whitespace(duk_codepoint_t cp)
#define DUK__ADVANCECHARS(lex_ctx, count)
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_identifier_start(duk_codepoint_t cp)
#define DUK_S2N_FLAG_ALLOW_NAKED_FRAC
DUK_EXTERNAL duk_double_t duk_to_number(duk_context *ctx, duk_idx_t index)
#define DUK_S2N_FLAG_ALLOW_AUTO_OCT_INT
#define DUK_S2N_FLAG_ALLOW_AUTO_HEX_INT
DUK_EXTERNAL void duk_dup(duk_context *ctx, duk_idx_t from_index)
DUK_LOCAL void duk__internbuffer(duk_lexer_ctx *lex_ctx, duk_idx_t valstack_idx)
#define DUK_STRIDX_START_STRICT_RESERVED
#define DUK__ISDIGIT03(x)
#define DUK_HTHREAD_GET_STRING(thr, idx)
#define DUK__ISDIGIT47(x)
DUK_LOCAL duk_codepoint_t duk__decode_uniesc_from_window(duk_lexer_ctx *lex_ctx, duk_small_int_t lookup_offset)
#define DUK_STRIDX_TO_TOK(x)
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_line_terminator(duk_codepoint_t cp)
#define DUK__LOOKUP(lex_ctx, index)
DUK_INTERNAL_DECL void duk_numconv_parse(duk_context *ctx, duk_small_int_t radix, duk_small_uint_t flags)
#define DUK_STRIDX_END_RESERVED
DUK_LOCAL duk_codepoint_t duk__decode_hexesc_from_window(duk_lexer_ctx *lex_ctx, duk_small_int_t lookup_offset)
DUK_INTERNAL_DECL duk_hstring * duk_get_hstring(duk_context *ctx, duk_idx_t index)
#define DUK_S2N_FLAG_ALLOW_EXP
#define DUK__APPENDBUFFER(lex_ctx, x)
#define NULL
Definition gmacros.h:924

References duk_token::allow_auto_semi, DUK__ADVANCEBYTES, DUK__ADVANCECHARS, DUK__ADVTOK, DUK__APPENDBUFFER, duk__decode_hexesc_from_window(), duk__decode_uniesc_from_window(), duk__hexval(), DUK__INITBUFFER, duk__internbuffer(), DUK__ISDIGIT, DUK__ISDIGIT03, DUK__ISDIGIT47, DUK__ISHEXDIGIT, DUK__ISOCTDIGIT, DUK__L0, DUK__L1, DUK__L2, DUK__L3, DUK__LOOKUP, DUK_ASC_AMP, DUK_ASC_CARET, DUK_ASC_COLON, DUK_ASC_COMMA, DUK_ASC_DOUBLEQUOTE, DUK_ASC_EQUALS, DUK_ASC_EXCLAMATION, DUK_ASC_HT, DUK_ASC_LANGLE, DUK_ASC_LBRACKET, DUK_ASC_LCURLY, DUK_ASC_LF, DUK_ASC_LPAREN, DUK_ASC_MINUS, DUK_ASC_PERCENT, DUK_ASC_PERIOD, DUK_ASC_PIPE, DUK_ASC_PLUS, DUK_ASC_QUESTION, DUK_ASC_RANGLE, DUK_ASC_RBRACKET, DUK_ASC_RCURLY, DUK_ASC_RPAREN, DUK_ASC_SEMICOLON, DUK_ASC_SINGLEQUOTE, DUK_ASC_SLASH, DUK_ASC_SPACE, DUK_ASC_STAR, DUK_ASC_TILDE, DUK_ASSERT, DUK_DOUBLE_NAN, duk_dup(), DUK_ERROR_RANGE, DUK_ERROR_SYNTAX, duk_get_hstring(), DUK_HEAP_NUM_STRINGS, DUK_HTHREAD_GET_STRING, DUK_ISNAN, duk_numconv_parse(), duk_replace(), DUK_S2N_FLAG_ALLOW_AUTO_HEX_INT, DUK_S2N_FLAG_ALLOW_AUTO_OCT_INT, DUK_S2N_FLAG_ALLOW_EMPTY_FRAC, DUK_S2N_FLAG_ALLOW_EXP, DUK_S2N_FLAG_ALLOW_FRAC, DUK_S2N_FLAG_ALLOW_NAKED_FRAC, DUK_STRIDX_END_RESERVED, DUK_STRIDX_START_RESERVED, DUK_STRIDX_START_STRICT_RESERVED, DUK_STRIDX_TO_TOK, duk_to_number(), duk_to_undefined(), DUK_TOK_ADD, DUK_TOK_ADD_EQ, DUK_TOK_ALSHIFT, DUK_TOK_ALSHIFT_EQ, DUK_TOK_ARSHIFT, DUK_TOK_ARSHIFT_EQ, DUK_TOK_BAND, DUK_TOK_BAND_EQ, DUK_TOK_BNOT, DUK_TOK_BOR, DUK_TOK_BOR_EQ, DUK_TOK_BXOR, DUK_TOK_BXOR_EQ, DUK_TOK_COLON, DUK_TOK_COMMA, DUK_TOK_DECREMENT, DUK_TOK_DIV, DUK_TOK_DIV_EQ, DUK_TOK_EOF, DUK_TOK_EQ, DUK_TOK_EQUALSIGN, DUK_TOK_GE, DUK_TOK_GT, DUK_TOK_IDENTIFIER, DUK_TOK_INCREMENT, DUK_TOK_LAND, DUK_TOK_LBRACKET, DUK_TOK_LCURLY, DUK_TOK_LE, DUK_TOK_LNOT, DUK_TOK_LOR, DUK_TOK_LPAREN, DUK_TOK_LT, DUK_TOK_MOD, DUK_TOK_MOD_EQ, DUK_TOK_MUL, DUK_TOK_MUL_EQ, DUK_TOK_NEQ, DUK_TOK_NUMBER, DUK_TOK_PERIOD, DUK_TOK_QUESTION, DUK_TOK_RBRACKET, DUK_TOK_RCURLY, DUK_TOK_REGEXP, DUK_TOK_RPAREN, DUK_TOK_RSHIFT, DUK_TOK_RSHIFT_EQ, DUK_TOK_SEMICOLON, DUK_TOK_SEQ, DUK_TOK_SNEQ, DUK_TOK_STRING, DUK_TOK_SUB, DUK_TOK_SUB_EQ, duk_unicode_is_identifier_part(), duk_unicode_is_identifier_start(), duk_unicode_is_line_terminator(), duk_unicode_is_whitespace(), duk_lexer_codepoint::line, duk_token::lineterm, NULL, duk_token::num, duk_token::num_escapes, duk_lexer_codepoint::offset, duk_lexer_ctx::slot1_idx, duk_lexer_ctx::slot2_idx, duk_token::start_line, duk_token::start_offset, duk_token::str1, duk_token::str2, duk_token::t, duk_token::t_nores, duk_lexer_ctx::thr, duk_lexer_ctx::token_count, duk_lexer_ctx::token_limit, and duk_lexer_ctx::window.

Referenced by duk__advance_helper().

◆ duk_lexer_setpoint()