1 | #ifndef js_lex_h |
2 | #define js_lex_h |
3 | |
4 | enum |
5 | { |
6 | TK_IDENTIFIER = 256, |
7 | TK_NUMBER, |
8 | TK_STRING, |
9 | TK_REGEXP, |
10 | |
11 | /* multi-character punctuators */ |
12 | TK_LE, |
13 | TK_GE, |
14 | TK_EQ, |
15 | TK_NE, |
16 | TK_STRICTEQ, |
17 | TK_STRICTNE, |
18 | TK_SHL, |
19 | TK_SHR, |
20 | TK_USHR, |
21 | TK_AND, |
22 | TK_OR, |
23 | TK_ADD_ASS, |
24 | TK_SUB_ASS, |
25 | TK_MUL_ASS, |
26 | TK_DIV_ASS, |
27 | TK_MOD_ASS, |
28 | TK_SHL_ASS, |
29 | TK_SHR_ASS, |
30 | TK_USHR_ASS, |
31 | TK_AND_ASS, |
32 | TK_OR_ASS, |
33 | TK_XOR_ASS, |
34 | TK_INC, |
35 | TK_DEC, |
36 | |
37 | /* keywords */ |
38 | TK_BREAK, |
39 | TK_CASE, |
40 | TK_CATCH, |
41 | TK_CONTINUE, |
42 | TK_DEBUGGER, |
43 | TK_DEFAULT, |
44 | TK_DELETE, |
45 | TK_DO, |
46 | TK_ELSE, |
47 | TK_FALSE, |
48 | TK_FINALLY, |
49 | TK_FOR, |
50 | TK_FUNCTION, |
51 | TK_IF, |
52 | TK_IN, |
53 | TK_INSTANCEOF, |
54 | TK_NEW, |
55 | TK_NULL, |
56 | TK_RETURN, |
57 | TK_SWITCH, |
58 | TK_THIS, |
59 | TK_THROW, |
60 | TK_TRUE, |
61 | TK_TRY, |
62 | TK_TYPEOF, |
63 | TK_VAR, |
64 | TK_VOID, |
65 | TK_WHILE, |
66 | TK_WITH, |
67 | }; |
68 | |
69 | int jsY_iswhite(int c); |
70 | int jsY_isnewline(int c); |
71 | int jsY_ishex(int c); |
72 | int jsY_tohex(int c); |
73 | |
74 | const char *jsY_tokenstring(int token); |
75 | int jsY_findword(const char *s, const char **list, int num); |
76 | |
77 | void jsY_initlex(js_State *J, const char *filename, const char *source); |
78 | int jsY_lex(js_State *J); |
79 | int jsY_lexjson(js_State *J); |
80 | |
81 | #endif |
82 | |