@@ -98,7 +98,7 @@ int jsY_findword(const char *s, const char **list, int num)
98
98
return -1 ;
99
99
}
100
100
101
- static inline int findkeyword (js_State * J , const char * s )
101
+ static inline int jsY_findkeyword (js_State * J , const char * s )
102
102
{
103
103
int i = jsY_findword (s , keywords , nelem (keywords ));
104
104
if (i >= 0 ) {
@@ -109,44 +109,41 @@ static inline int findkeyword(js_State *J, const char *s)
109
109
return TK_IDENTIFIER ;
110
110
}
111
111
112
- static inline int iswhite (int c )
112
+ int jsY_iswhite (int c )
113
113
{
114
114
return c == 0x9 || c == 0xB || c == 0xC || c == 0x20 || c == 0xA0 || c == 0xFEFF ;
115
115
}
116
116
117
- static inline int isnewline ( c )
117
+ int jsY_isnewline ( int c )
118
118
{
119
119
return c == 0xA || c == 0xD || c == 0x2028 || c == 0x2029 ;
120
120
}
121
121
122
- static inline int isidentifierstart (int c )
122
+ static inline int jsY_isidentifierstart (int c )
123
123
{
124
124
return (c >= 'a' && c <= 'z' ) || (c >= 'A' && c <= 'Z' ) || c == '$' || c == '_' || isalpharune (c );
125
125
}
126
126
127
- static inline int isidentifierpart (int c )
127
+ static inline int jsY_isidentifierpart (int c )
128
128
{
129
- return (c >= '0' && c <= '9' ) || isidentifierstart (c );
129
+ return (c >= '0' && c <= '9' ) || jsY_isidentifierstart (c );
130
130
}
131
131
132
- static inline int isdec (int c )
132
+ static inline int jsY_isdec (int c )
133
133
{
134
134
return (c >= '0' && c <= '9' );
135
135
}
136
136
137
- static inline int ishex (int c )
137
+ int jsY_ishex (int c )
138
138
{
139
139
return (c >= '0' && c <= '9' ) || (c >= 'a' && c <= 'f' ) || (c >= 'A' && c <= 'F' );
140
140
}
141
141
142
- static inline int tohex (int c )
142
+ int jsY_tohex (int c )
143
143
{
144
- if (c >= '0' && c <= '9' )
145
- return c - '0' ;
146
- if (c >= 'a' && c <= 'f' )
147
- return c - 'a' + 0xA ;
148
- if (c >= 'A' && c <= 'F' )
149
- return c - 'A' + 0xA ;
144
+ if (c >= '0' && c <= '9' ) return c - '0' ;
145
+ if (c >= 'a' && c <= 'f' ) return c - 'a' + 0xA ;
146
+ if (c >= 'A' && c <= 'F' ) return c - 'A' + 0xA ;
150
147
return 0 ;
151
148
}
152
149
@@ -162,22 +159,22 @@ static void jsY_next(js_State *J)
162
159
/* consume CR LF as one unit */
163
160
if (c == '\r' && * J -> source == '\n' )
164
161
++ J -> source ;
165
- if (isnewline (c )) {
162
+ if (jsY_isnewline (c )) {
166
163
J -> line ++ ;
167
164
c = '\n' ;
168
165
}
169
166
J -> lexchar = c ;
170
167
}
171
168
172
- static void unescape (js_State * J )
169
+ static void jsY_unescape (js_State * J )
173
170
{
174
171
if (ACCEPT ('\\' )) {
175
172
if (ACCEPT ('u' )) {
176
173
int x = 0 ;
177
- if (!ishex (PEEK )) goto error ; x |= tohex (PEEK ) << 12 ; NEXT ();
178
- if (!ishex (PEEK )) goto error ; x |= tohex (PEEK ) << 8 ; NEXT ();
179
- if (!ishex (PEEK )) goto error ; x |= tohex (PEEK ) << 4 ; NEXT ();
180
- if (!ishex (PEEK )) goto error ; x |= tohex (PEEK );
174
+ if (!jsY_ishex (PEEK )) goto error ; x |= jsY_tohex (PEEK ) << 12 ; NEXT ();
175
+ if (!jsY_ishex (PEEK )) goto error ; x |= jsY_tohex (PEEK ) << 8 ; NEXT ();
176
+ if (!jsY_ishex (PEEK )) goto error ; x |= jsY_tohex (PEEK ) << 4 ; NEXT ();
177
+ if (!jsY_ishex (PEEK )) goto error ; x |= jsY_tohex (PEEK );
181
178
J -> lexchar = x ;
182
179
return ;
183
180
}
@@ -235,10 +232,10 @@ static inline int lexcomment(js_State *J)
235
232
static inline double lexhex (js_State * J )
236
233
{
237
234
double n = 0 ;
238
- if (!ishex (PEEK ))
235
+ if (!jsY_ishex (PEEK ))
239
236
jsY_error (J , "malformed hexadecimal number" );
240
- while (ishex (PEEK )) {
241
- n = n * 16 + tohex (PEEK );
237
+ while (jsY_ishex (PEEK )) {
238
+ n = n * 16 + jsY_tohex (PEEK );
242
239
NEXT ();
243
240
}
244
241
return n ;
@@ -247,9 +244,9 @@ static inline double lexhex(js_State *J)
247
244
static inline double lexinteger (js_State * J )
248
245
{
249
246
double n = 0 ;
250
- if (!isdec (PEEK ))
247
+ if (!jsY_isdec (PEEK ))
251
248
jsY_error (J , "malformed number" );
252
- while (isdec (PEEK )) {
249
+ while (jsY_isdec (PEEK )) {
253
250
n = n * 10 + (PEEK - '0' );
254
251
NEXT ();
255
252
}
@@ -260,7 +257,7 @@ static inline double lexfraction(js_State *J)
260
257
{
261
258
double n = 0 ;
262
259
double d = 1 ;
263
- while (isdec (PEEK )) {
260
+ while (jsY_isdec (PEEK )) {
264
261
n = n * 10 + (PEEK - '0' );
265
262
d = d * 10 ;
266
263
NEXT ();
@@ -290,13 +287,13 @@ static inline int lexnumber(js_State *J)
290
287
J -> number = lexhex (J );
291
288
return TK_NUMBER ;
292
289
}
293
- if (isdec (PEEK ))
290
+ if (jsY_isdec (PEEK ))
294
291
jsY_error (J , "number with leading zero" );
295
292
n = 0 ;
296
293
if (ACCEPT ('.' ))
297
294
n += lexfraction (J );
298
295
} else if (ACCEPT ('.' )) {
299
- if (!isdec (PEEK ))
296
+ if (!jsY_isdec (PEEK ))
300
297
return '.' ;
301
298
n = lexfraction (J );
302
299
} else {
@@ -311,7 +308,7 @@ static inline int lexnumber(js_State *J)
311
308
else if (e > 0 )
312
309
n *= pow (10 , e );
313
310
314
- if (isidentifierstart (PEEK ))
311
+ if (jsY_isidentifierstart (PEEK ))
315
312
jsY_error (J , "number with letter suffix" );
316
313
317
314
J -> number = n ;
@@ -330,16 +327,16 @@ static inline int lexescape(js_State *J)
330
327
switch (PEEK ) {
331
328
case 'u' :
332
329
NEXT ();
333
- if (!ishex (PEEK )) return 1 ; else { x |= tohex (PEEK ) << 12 ; NEXT (); }
334
- if (!ishex (PEEK )) return 1 ; else { x |= tohex (PEEK ) << 8 ; NEXT (); }
335
- if (!ishex (PEEK )) return 1 ; else { x |= tohex (PEEK ) << 4 ; NEXT (); }
336
- if (!ishex (PEEK )) return 1 ; else { x |= tohex (PEEK ); NEXT (); }
330
+ if (!jsY_ishex (PEEK )) return 1 ; else { x |= jsY_tohex (PEEK ) << 12 ; NEXT (); }
331
+ if (!jsY_ishex (PEEK )) return 1 ; else { x |= jsY_tohex (PEEK ) << 8 ; NEXT (); }
332
+ if (!jsY_ishex (PEEK )) return 1 ; else { x |= jsY_tohex (PEEK ) << 4 ; NEXT (); }
333
+ if (!jsY_ishex (PEEK )) return 1 ; else { x |= jsY_tohex (PEEK ); NEXT (); }
337
334
textpush (J , x );
338
335
break ;
339
336
case 'x' :
340
337
NEXT ();
341
- if (!ishex (PEEK )) return 1 ; else { x |= tohex (PEEK ) << 4 ; NEXT (); }
342
- if (!ishex (PEEK )) return 1 ; else { x |= tohex (PEEK ); NEXT (); }
338
+ if (!jsY_ishex (PEEK )) return 1 ; else { x |= jsY_tohex (PEEK ) << 4 ; NEXT (); }
339
+ if (!jsY_ishex (PEEK )) return 1 ; else { x |= jsY_tohex (PEEK ); NEXT (); }
343
340
textpush (J , x );
344
341
break ;
345
342
case '0' : textpush (J , 0 ); NEXT (); break ;
@@ -436,7 +433,7 @@ static int lexregexp(js_State *J)
436
433
/* regexp flags */
437
434
g = i = m = 0 ;
438
435
439
- while (isidentifierpart (PEEK )) {
436
+ while (jsY_isidentifierpart (PEEK )) {
440
437
if (ACCEPT ('g' )) ++ g ;
441
438
else if (ACCEPT ('i' )) ++ i ;
442
439
else if (ACCEPT ('m' )) ++ m ;
@@ -475,7 +472,7 @@ static int jsY_lexx(js_State *J)
475
472
while (1 ) {
476
473
J -> lexline = J -> line ; /* save location of beginning of token */
477
474
478
- while (iswhite (PEEK ))
475
+ while (jsY_iswhite (PEEK ))
479
476
NEXT ();
480
477
481
478
if (ACCEPT ('\n' )) {
@@ -626,22 +623,22 @@ static int jsY_lexx(js_State *J)
626
623
}
627
624
628
625
/* Handle \uXXXX escapes in identifiers */
629
- unescape (J );
630
- if (isidentifierstart (PEEK )) {
626
+ jsY_unescape (J );
627
+ if (jsY_isidentifierstart (PEEK )) {
631
628
textinit (J );
632
629
textpush (J , PEEK );
633
630
634
631
NEXT ();
635
- unescape (J );
636
- while (isidentifierpart (PEEK )) {
632
+ jsY_unescape (J );
633
+ while (jsY_isidentifierpart (PEEK )) {
637
634
textpush (J , PEEK );
638
635
NEXT ();
639
- unescape (J );
636
+ jsY_unescape (J );
640
637
}
641
638
642
639
textend (J );
643
640
644
- return findkeyword (J , J -> lexbuf .text );
641
+ return jsY_findkeyword (J , J -> lexbuf .text );
645
642
}
646
643
647
644
if (PEEK >= 0x20 && PEEK <= 0x7E )
@@ -669,7 +666,7 @@ int jsY_lexjson(js_State *J)
669
666
while (1 ) {
670
667
J -> lexline = J -> line ; /* save location of beginning of token */
671
668
672
- while (iswhite (PEEK ) || PEEK == '\n' )
669
+ while (jsY_iswhite (PEEK ) || PEEK == '\n' )
673
670
NEXT ();
674
671
675
672
if (PEEK >= '0' && PEEK <= '9' ) {
0 commit comments