zig-pug 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +27 -0
  2. package/binding.gyp +16 -10
  3. package/index.mjs +192 -0
  4. package/package.json +12 -3
  5. package/prebuilts/darwin-arm64/libzig-pug.a +0 -0
  6. package/prebuilts/darwin-x64/libzig-pug.a +0 -0
  7. package/prebuilts/linux-arm64/libzig-pug.a +0 -0
  8. package/prebuilts/linux-x64/libzig-pug.a +0 -0
  9. package/prebuilts/win32-x64/zig-pug.lib +0 -0
  10. package/vendor/mujs/COPYING +0 -16
  11. package/vendor/mujs/README +0 -50
  12. package/vendor/mujs/astnames.h +0 -92
  13. package/vendor/mujs/jsarray.c +0 -832
  14. package/vendor/mujs/jsboolean.c +0 -38
  15. package/vendor/mujs/jsbuiltin.c +0 -249
  16. package/vendor/mujs/jscompile.c +0 -1428
  17. package/vendor/mujs/jsdate.c +0 -861
  18. package/vendor/mujs/jsdtoa.c +0 -749
  19. package/vendor/mujs/jserror.c +0 -139
  20. package/vendor/mujs/jsfunction.c +0 -231
  21. package/vendor/mujs/jsgc.c +0 -284
  22. package/vendor/mujs/jsi.h +0 -870
  23. package/vendor/mujs/jsintern.c +0 -137
  24. package/vendor/mujs/jslex.c +0 -878
  25. package/vendor/mujs/jsmath.c +0 -194
  26. package/vendor/mujs/jsnumber.c +0 -198
  27. package/vendor/mujs/jsobject.c +0 -560
  28. package/vendor/mujs/json.c +0 -422
  29. package/vendor/mujs/jsparse.c +0 -1065
  30. package/vendor/mujs/jsproperty.c +0 -341
  31. package/vendor/mujs/jsregexp.c +0 -232
  32. package/vendor/mujs/jsrepr.c +0 -285
  33. package/vendor/mujs/jsrun.c +0 -2096
  34. package/vendor/mujs/jsstate.c +0 -334
  35. package/vendor/mujs/jsstring.c +0 -852
  36. package/vendor/mujs/jsvalue.c +0 -708
  37. package/vendor/mujs/libmujs.a +0 -0
  38. package/vendor/mujs/main.c +0 -396
  39. package/vendor/mujs/mujs.h +0 -253
  40. package/vendor/mujs/one.c +0 -25
  41. package/vendor/mujs/opnames.h +0 -85
  42. package/vendor/mujs/pp.c +0 -980
  43. package/vendor/mujs/regexp.c +0 -1277
  44. package/vendor/mujs/regexp.h +0 -46
  45. package/vendor/mujs/utf.c +0 -305
  46. package/vendor/mujs/utf.h +0 -52
  47. package/vendor/mujs/utfdata.h +0 -2209
@@ -1,46 +0,0 @@
1
- #ifndef regexp_h
2
- #define regexp_h
3
-
4
- #define regcompx js_regcompx
5
- #define regfreex js_regfreex
6
- #define regcomp js_regcomp
7
- #define regexec js_regexec
8
- #define regfree js_regfree
9
-
10
- typedef struct Reprog Reprog;
11
- typedef struct Resub Resub;
12
-
13
- Reprog *regcompx(void *(*alloc)(void *ctx, void *p, int n), void *ctx,
14
- const char *pattern, int cflags, const char **errorp);
15
- void regfreex(void *(*alloc)(void *ctx, void *p, int n), void *ctx,
16
- Reprog *prog);
17
-
18
- Reprog *regcomp(const char *pattern, int cflags, const char **errorp);
19
- int regexec(Reprog *prog, const char *string, Resub *sub, int eflags);
20
- void regfree(Reprog *prog);
21
-
22
- enum {
23
- /* regcomp flags */
24
- REG_ICASE = 1,
25
- REG_NEWLINE = 2,
26
-
27
- /* regexec flags */
28
- REG_NOTBOL = 4,
29
- };
30
-
31
- /* If you redefine REG_MAXSUB, you must make sure both the calling
32
- * code and the regexp.c compilation unit use the same value!
33
- */
34
- #ifndef REG_MAXSUB
35
- #define REG_MAXSUB 16
36
- #endif
37
-
38
- struct Resub {
39
- int nsub;
40
- struct {
41
- const char *sp;
42
- const char *ep;
43
- } sub[REG_MAXSUB];
44
- };
45
-
46
- #endif
package/vendor/mujs/utf.c DELETED
@@ -1,305 +0,0 @@
1
- /*
2
- * The authors of this software are Rob Pike and Ken Thompson.
3
- * Copyright (c) 2002 by Lucent Technologies.
4
- * Permission to use, copy, modify, and distribute this software for any
5
- * purpose without fee is hereby granted, provided that this entire notice
6
- * is included in all copies of any software which is or includes a copy
7
- * or modification of this software and in all copies of the supporting
8
- * documentation for such software.
9
- * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
10
- * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
11
- * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
12
- * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
13
- */
14
- #include <stdlib.h>
15
- #include <string.h>
16
-
17
- #include "utf.h"
18
- #include "utfdata.h"
19
-
20
- #define nelem(a) (int)(sizeof (a) / sizeof (a)[0])
21
-
22
- typedef unsigned char uchar;
23
-
24
- enum
25
- {
26
- Bit1 = 7,
27
- Bitx = 6,
28
- Bit2 = 5,
29
- Bit3 = 4,
30
- Bit4 = 3,
31
- Bit5 = 2,
32
-
33
- T1 = ((1<<(Bit1+1))-1) ^ 0xFF, /* 0000 0000 */
34
- Tx = ((1<<(Bitx+1))-1) ^ 0xFF, /* 1000 0000 */
35
- T2 = ((1<<(Bit2+1))-1) ^ 0xFF, /* 1100 0000 */
36
- T3 = ((1<<(Bit3+1))-1) ^ 0xFF, /* 1110 0000 */
37
- T4 = ((1<<(Bit4+1))-1) ^ 0xFF, /* 1111 0000 */
38
- T5 = ((1<<(Bit5+1))-1) ^ 0xFF, /* 1111 1000 */
39
-
40
- Rune1 = (1<<(Bit1+0*Bitx))-1, /* 0000 0000 0000 0000 0111 1111 */
41
- Rune2 = (1<<(Bit2+1*Bitx))-1, /* 0000 0000 0000 0111 1111 1111 */
42
- Rune3 = (1<<(Bit3+2*Bitx))-1, /* 0000 0000 1111 1111 1111 1111 */
43
- Rune4 = (1<<(Bit4+3*Bitx))-1, /* 0001 1111 1111 1111 1111 1111 */
44
-
45
- Maskx = (1<<Bitx)-1, /* 0011 1111 */
46
- Testx = Maskx ^ 0xFF, /* 1100 0000 */
47
-
48
- Bad = Runeerror
49
- };
50
-
51
- int
52
- chartorune(Rune *rune, const char *str)
53
- {
54
- int c, c1, c2, c3;
55
- int l;
56
-
57
- /* overlong null character */
58
- if((uchar)str[0] == 0xc0 && (uchar)str[1] == 0x80) {
59
- *rune = 0;
60
- return 2;
61
- }
62
-
63
- /*
64
- * one character sequence
65
- * 00000-0007F => T1
66
- */
67
- c = *(uchar*)str;
68
- if(c < Tx) {
69
- *rune = c;
70
- return 1;
71
- }
72
-
73
- /*
74
- * two character sequence
75
- * 0080-07FF => T2 Tx
76
- */
77
- c1 = *(uchar*)(str+1) ^ Tx;
78
- if(c1 & Testx)
79
- goto bad;
80
- if(c < T3) {
81
- if(c < T2)
82
- goto bad;
83
- l = ((c << Bitx) | c1) & Rune2;
84
- if(l <= Rune1)
85
- goto bad;
86
- *rune = l;
87
- return 2;
88
- }
89
-
90
- /*
91
- * three character sequence
92
- * 0800-FFFF => T3 Tx Tx
93
- */
94
- c2 = *(uchar*)(str+2) ^ Tx;
95
- if(c2 & Testx)
96
- goto bad;
97
- if(c < T4) {
98
- l = ((((c << Bitx) | c1) << Bitx) | c2) & Rune3;
99
- if(l <= Rune2)
100
- goto bad;
101
- *rune = l;
102
- return 3;
103
- }
104
-
105
- /*
106
- * four character sequence
107
- * 10000-10FFFF => T4 Tx Tx Tx
108
- */
109
- if(UTFmax >= 4) {
110
- c3 = *(uchar*)(str+3) ^ Tx;
111
- if(c3 & Testx)
112
- goto bad;
113
- if(c < T5) {
114
- l = ((((((c << Bitx) | c1) << Bitx) | c2) << Bitx) | c3) & Rune4;
115
- if(l <= Rune3)
116
- goto bad;
117
- if(l > Runemax)
118
- goto bad;
119
- *rune = l;
120
- return 4;
121
- }
122
- }
123
-
124
- /*
125
- * bad decoding
126
- */
127
- bad:
128
- *rune = Bad;
129
- return 1;
130
- }
131
-
132
- int
133
- runetochar(char *str, const Rune *rune)
134
- {
135
- int c = *rune;
136
-
137
- /* overlong null character */
138
- if (c == 0) {
139
- str[0] = (char)0xc0;
140
- str[1] = (char)0x80;
141
- return 2;
142
- }
143
-
144
- /*
145
- * one character sequence
146
- * 00000-0007F => 00-7F
147
- */
148
- if(c <= Rune1) {
149
- str[0] = c;
150
- return 1;
151
- }
152
-
153
- /*
154
- * two character sequence
155
- * 00080-007FF => T2 Tx
156
- */
157
- if(c <= Rune2) {
158
- str[0] = T2 | (c >> 1*Bitx);
159
- str[1] = Tx | (c & Maskx);
160
- return 2;
161
- }
162
-
163
- /*
164
- * three character sequence
165
- * 00800-0FFFF => T3 Tx Tx
166
- */
167
- if(c > Runemax)
168
- c = Runeerror;
169
- if(c <= Rune3) {
170
- str[0] = T3 | (c >> 2*Bitx);
171
- str[1] = Tx | ((c >> 1*Bitx) & Maskx);
172
- str[2] = Tx | (c & Maskx);
173
- return 3;
174
- }
175
-
176
- /*
177
- * four character sequence
178
- * 010000-1FFFFF => T4 Tx Tx Tx
179
- */
180
- str[0] = T4 | (c >> 3*Bitx);
181
- str[1] = Tx | ((c >> 2*Bitx) & Maskx);
182
- str[2] = Tx | ((c >> 1*Bitx) & Maskx);
183
- str[3] = Tx | (c & Maskx);
184
- return 4;
185
- }
186
-
187
- int
188
- runelen(int c)
189
- {
190
- Rune rune;
191
- char str[10];
192
-
193
- rune = c;
194
- return runetochar(str, &rune);
195
- }
196
-
197
- static const Rune *
198
- ucd_bsearch(Rune c, const Rune *t, int n, int ne)
199
- {
200
- const Rune *p;
201
- int m;
202
-
203
- while(n > 1) {
204
- m = n/2;
205
- p = t + m*ne;
206
- if(c >= p[0]) {
207
- t = p;
208
- n = n-m;
209
- } else
210
- n = m;
211
- }
212
- if(n && c >= t[0])
213
- return t;
214
- return 0;
215
- }
216
-
217
- Rune
218
- tolowerrune(Rune c)
219
- {
220
- const Rune *p;
221
-
222
- p = ucd_bsearch(c, ucd_tolower2, nelem(ucd_tolower2)/3, 3);
223
- if(p && c >= p[0] && c <= p[1])
224
- return c + p[2];
225
- p = ucd_bsearch(c, ucd_tolower1, nelem(ucd_tolower1)/2, 2);
226
- if(p && c == p[0])
227
- return c + p[1];
228
- return c;
229
- }
230
-
231
- Rune
232
- toupperrune(Rune c)
233
- {
234
- const Rune *p;
235
-
236
- p = ucd_bsearch(c, ucd_toupper2, nelem(ucd_toupper2)/3, 3);
237
- if(p && c >= p[0] && c <= p[1])
238
- return c + p[2];
239
- p = ucd_bsearch(c, ucd_toupper1, nelem(ucd_toupper1)/2, 2);
240
- if(p && c == p[0])
241
- return c + p[1];
242
- return c;
243
- }
244
-
245
- int
246
- islowerrune(Rune c)
247
- {
248
- const Rune *p;
249
-
250
- p = ucd_bsearch(c, ucd_toupper2, nelem(ucd_toupper2)/3, 3);
251
- if(p && c >= p[0] && c <= p[1])
252
- return 1;
253
- p = ucd_bsearch(c, ucd_toupper1, nelem(ucd_toupper1)/2, 2);
254
- if(p && c == p[0])
255
- return 1;
256
- return 0;
257
- }
258
-
259
- int
260
- isupperrune(Rune c)
261
- {
262
- const Rune *p;
263
-
264
- p = ucd_bsearch(c, ucd_tolower2, nelem(ucd_tolower2)/3, 3);
265
- if(p && c >= p[0] && c <= p[1])
266
- return 1;
267
- p = ucd_bsearch(c, ucd_tolower1, nelem(ucd_tolower1)/2, 2);
268
- if(p && c == p[0])
269
- return 1;
270
- return 0;
271
- }
272
-
273
- int
274
- isalpharune(Rune c)
275
- {
276
- const Rune *p;
277
-
278
- p = ucd_bsearch(c, ucd_alpha2, nelem(ucd_alpha2)/2, 2);
279
- if(p && c >= p[0] && c <= p[1])
280
- return 1;
281
- p = ucd_bsearch(c, ucd_alpha1, nelem(ucd_alpha1), 1);
282
- if(p && c == p[0])
283
- return 1;
284
- return 0;
285
- }
286
-
287
- const Rune *
288
- tolowerrune_full(Rune c)
289
- {
290
- const Rune *p;
291
- p = ucd_bsearch(c, ucd_tolower_full, nelem(ucd_tolower_full)/4, 4);
292
- if(p && c == p[0])
293
- return p + 1;
294
- return NULL;
295
- }
296
-
297
- const Rune *
298
- toupperrune_full(Rune c)
299
- {
300
- const Rune *p;
301
- p = ucd_bsearch(c, ucd_toupper_full, nelem(ucd_toupper_full)/5, 5);
302
- if(p && c == p[0])
303
- return p + 1;
304
- return NULL;
305
- }
package/vendor/mujs/utf.h DELETED
@@ -1,52 +0,0 @@
1
- /*
2
- * The authors of this software are Rob Pike and Ken Thompson.
3
- * Copyright (c) 2002 by Lucent Technologies.
4
- * Permission to use, copy, modify, and distribute this software for any
5
- * purpose without fee is hereby granted, provided that this entire notice
6
- * is included in all copies of any software which is or includes a copy
7
- * or modification of this software and in all copies of the supporting
8
- * documentation for such software.
9
- * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
10
- * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
11
- * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
12
- * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
13
- */
14
- #ifndef js_utf_h
15
- #define js_utf_h
16
-
17
- typedef int Rune; /* 32 bits */
18
-
19
- #define chartorune jsU_chartorune
20
- #define runetochar jsU_runetochar
21
- #define runelen jsU_runelen
22
-
23
- #define isalpharune jsU_isalpharune
24
- #define islowerrune jsU_islowerrune
25
- #define isupperrune jsU_isupperrune
26
- #define tolowerrune jsU_tolowerrune
27
- #define toupperrune jsU_toupperrune
28
- #define tolowerrune_full jsU_tolowerrune_full
29
- #define toupperrune_full jsU_toupperrune_full
30
-
31
- enum
32
- {
33
- UTFmax = 4, /* maximum bytes per rune */
34
- Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
35
- Runeself = 0x80, /* rune and UTF sequences are the same (<) */
36
- Runeerror = 0xFFFD, /* decoding error in UTF */
37
- Runemax = 0x10FFFF, /* maximum rune value */
38
- };
39
-
40
- int chartorune(Rune *rune, const char *str);
41
- int runetochar(char *str, const Rune *rune);
42
- int runelen(int c);
43
-
44
- int isalpharune(Rune c);
45
- int islowerrune(Rune c);
46
- int isupperrune(Rune c);
47
- Rune tolowerrune(Rune c);
48
- Rune toupperrune(Rune c);
49
- const Rune* tolowerrune_full(Rune c);
50
- const Rune* toupperrune_full(Rune c);
51
-
52
- #endif