@port-labs/jq-node-bindings 0.0.1

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 (131) hide show
  1. package/.editorconfig +5 -0
  2. package/.jshintignore +1 -0
  3. package/.jshintrc +23 -0
  4. package/binding.gyp +56 -0
  5. package/configure +26 -0
  6. package/deps/jq/.gitattributes +2 -0
  7. package/deps/jq/.travis.yml +53 -0
  8. package/deps/jq/AUTHORS +73 -0
  9. package/deps/jq/COPYING +70 -0
  10. package/deps/jq/ChangeLog +1349 -0
  11. package/deps/jq/Makefile.am +198 -0
  12. package/deps/jq/NEWS +88 -0
  13. package/deps/jq/README.md +64 -0
  14. package/deps/jq/builtin.c +1684 -0
  15. package/deps/jq/builtin.h +10 -0
  16. package/deps/jq/bytecode.c +161 -0
  17. package/deps/jq/bytecode.h +92 -0
  18. package/deps/jq/compile-ios.sh +102 -0
  19. package/deps/jq/compile.c +1210 -0
  20. package/deps/jq/compile.h +101 -0
  21. package/deps/jq/config/m4/check-math-func.m4 +4 -0
  22. package/deps/jq/config/m4/find-func-no-libs.m4 +8 -0
  23. package/deps/jq/config/m4/find-func-no-libs2.m4 +62 -0
  24. package/deps/jq/config/m4/find-func.m4 +9 -0
  25. package/deps/jq/config/m4/misc.m4 +3 -0
  26. package/deps/jq/configure.ac +221 -0
  27. package/deps/jq/docs/Gemfile +7 -0
  28. package/deps/jq/docs/Gemfile.lock +63 -0
  29. package/deps/jq/docs/README.md +25 -0
  30. package/deps/jq/docs/Rakefile +145 -0
  31. package/deps/jq/docs/content/1.tutorial/default.yml +327 -0
  32. package/deps/jq/docs/content/2.download/default.yml +117 -0
  33. package/deps/jq/docs/content/3.manual/manual.yml +2878 -0
  34. package/deps/jq/docs/content/3.manual/v1.3/manual.yml +1270 -0
  35. package/deps/jq/docs/content/3.manual/v1.4/manual.yml +1672 -0
  36. package/deps/jq/docs/content/index/index.yml +51 -0
  37. package/deps/jq/docs/default_manpage.md +22 -0
  38. package/deps/jq/docs/public/.htaccess +28 -0
  39. package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.css +1058 -0
  40. package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.min.css +9 -0
  41. package/deps/jq/docs/public/bootstrap/css/bootstrap.css +5224 -0
  42. package/deps/jq/docs/public/bootstrap/css/bootstrap.min.css +9 -0
  43. package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings-white.png +0 -0
  44. package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings.png +0 -0
  45. package/deps/jq/docs/public/bootstrap/js/bootstrap.js +2027 -0
  46. package/deps/jq/docs/public/bootstrap/js/bootstrap.min.js +6 -0
  47. package/deps/jq/docs/public/css/base.scss +99 -0
  48. package/deps/jq/docs/public/jq.png +0 -0
  49. package/deps/jq/docs/public/robots.txt +2 -0
  50. package/deps/jq/docs/site.yml +18 -0
  51. package/deps/jq/docs/templates/default.liquid +34 -0
  52. package/deps/jq/docs/templates/index.liquid +60 -0
  53. package/deps/jq/docs/templates/manual.liquid +122 -0
  54. package/deps/jq/docs/templates/shared/_footer.liquid +5 -0
  55. package/deps/jq/docs/templates/shared/_head.liquid +12 -0
  56. package/deps/jq/docs/templates/shared/_header.liquid +26 -0
  57. package/deps/jq/exec_stack.h +112 -0
  58. package/deps/jq/execute.c +1155 -0
  59. package/deps/jq/inject_errors.c +112 -0
  60. package/deps/jq/jq.1.default +39 -0
  61. package/deps/jq/jq.1.prebuilt +3075 -0
  62. package/deps/jq/jq.h +60 -0
  63. package/deps/jq/jq.spec +70 -0
  64. package/deps/jq/jq_parser.h +9 -0
  65. package/deps/jq/jq_test.c +346 -0
  66. package/deps/jq/jv.c +1333 -0
  67. package/deps/jq/jv.h +240 -0
  68. package/deps/jq/jv_alloc.c +179 -0
  69. package/deps/jq/jv_alloc.h +27 -0
  70. package/deps/jq/jv_aux.c +619 -0
  71. package/deps/jq/jv_dtoa.c +4275 -0
  72. package/deps/jq/jv_dtoa.h +22 -0
  73. package/deps/jq/jv_file.c +49 -0
  74. package/deps/jq/jv_parse.c +852 -0
  75. package/deps/jq/jv_print.c +348 -0
  76. package/deps/jq/jv_unicode.c +96 -0
  77. package/deps/jq/jv_unicode.h +11 -0
  78. package/deps/jq/jv_utf8_tables.h +37 -0
  79. package/deps/jq/lexer.c +2442 -0
  80. package/deps/jq/lexer.h +362 -0
  81. package/deps/jq/lexer.l +184 -0
  82. package/deps/jq/libm.h +160 -0
  83. package/deps/jq/linker.c +393 -0
  84. package/deps/jq/linker.h +7 -0
  85. package/deps/jq/locfile.c +91 -0
  86. package/deps/jq/locfile.h +29 -0
  87. package/deps/jq/m4/ax_compare_version.m4 +177 -0
  88. package/deps/jq/m4/ax_prog_bison_version.m4 +68 -0
  89. package/deps/jq/main.c +566 -0
  90. package/deps/jq/opcode_list.h +44 -0
  91. package/deps/jq/parser.c +3914 -0
  92. package/deps/jq/parser.h +193 -0
  93. package/deps/jq/parser.y +923 -0
  94. package/deps/jq/scripts/crosscompile +42 -0
  95. package/deps/jq/scripts/gen_utf8_tables.py +32 -0
  96. package/deps/jq/scripts/version +5 -0
  97. package/deps/jq/setup.sh +33 -0
  98. package/deps/jq/tests/jq.test +1235 -0
  99. package/deps/jq/tests/jqtest +5 -0
  100. package/deps/jq/tests/mantest +7 -0
  101. package/deps/jq/tests/modules/.jq +5 -0
  102. package/deps/jq/tests/modules/a.jq +2 -0
  103. package/deps/jq/tests/modules/b/b.jq +2 -0
  104. package/deps/jq/tests/modules/c/c.jq +16 -0
  105. package/deps/jq/tests/modules/c/d.jq +1 -0
  106. package/deps/jq/tests/modules/data.json +4 -0
  107. package/deps/jq/tests/modules/lib/jq/e/e.jq +1 -0
  108. package/deps/jq/tests/modules/lib/jq/f.jq +1 -0
  109. package/deps/jq/tests/modules/syntaxerror/syntaxerror.jq +1 -0
  110. package/deps/jq/tests/modules/test_bind_order.jq +4 -0
  111. package/deps/jq/tests/modules/test_bind_order0.jq +1 -0
  112. package/deps/jq/tests/modules/test_bind_order1.jq +2 -0
  113. package/deps/jq/tests/modules/test_bind_order2.jq +2 -0
  114. package/deps/jq/tests/onig.supp +21 -0
  115. package/deps/jq/tests/onig.test +85 -0
  116. package/deps/jq/tests/onigtest +5 -0
  117. package/deps/jq/tests/setup +36 -0
  118. package/deps/jq/tests/shtest +205 -0
  119. package/deps/jq/tests/torture/input0.json +7 -0
  120. package/deps/jq/util.c +462 -0
  121. package/deps/jq/util.h +64 -0
  122. package/deps/jq.gyp +35 -0
  123. package/index.d.ts +3 -0
  124. package/jest.config.js +10 -0
  125. package/lib/index.js +14 -0
  126. package/package.json +48 -0
  127. package/reports/jest-port-api.xml +35 -0
  128. package/src/binding.cc +177 -0
  129. package/src/binding.h +13 -0
  130. package/test/santiy.test.js +122 -0
  131. package/util/configure.js +27 -0
@@ -0,0 +1,362 @@
1
+ #ifndef jq_yyHEADER_H
2
+ #define jq_yyHEADER_H 1
3
+ #define jq_yyIN_HEADER 1
4
+
5
+ #line 6 "lexer.h"
6
+
7
+ #line 8 "lexer.h"
8
+
9
+ #define YY_INT_ALIGNED short int
10
+
11
+ /* A lexical scanner generated by flex */
12
+
13
+ #define FLEX_SCANNER
14
+ #define YY_FLEX_MAJOR_VERSION 2
15
+ #define YY_FLEX_MINOR_VERSION 5
16
+ #define YY_FLEX_SUBMINOR_VERSION 35
17
+ #if YY_FLEX_SUBMINOR_VERSION > 0
18
+ #define FLEX_BETA
19
+ #endif
20
+
21
+ /* First, we deal with platform-specific or compiler-specific issues. */
22
+
23
+ /* begin standard C headers. */
24
+ #include <stdio.h>
25
+ #include <string.h>
26
+ #include <errno.h>
27
+ #include <stdlib.h>
28
+
29
+ /* end standard C headers. */
30
+
31
+ /* flex integer type definitions */
32
+
33
+ #ifndef FLEXINT_H
34
+ #define FLEXINT_H
35
+
36
+ /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
37
+
38
+ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
39
+
40
+ /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
41
+ * if you want the limit (max/min) macros for int types.
42
+ */
43
+ #ifndef __STDC_LIMIT_MACROS
44
+ #define __STDC_LIMIT_MACROS 1
45
+ #endif
46
+
47
+ #include <inttypes.h>
48
+ typedef int8_t flex_int8_t;
49
+ typedef uint8_t flex_uint8_t;
50
+ typedef int16_t flex_int16_t;
51
+ typedef uint16_t flex_uint16_t;
52
+ typedef int32_t flex_int32_t;
53
+ typedef uint32_t flex_uint32_t;
54
+ #else
55
+ typedef signed char flex_int8_t;
56
+ typedef short int flex_int16_t;
57
+ typedef int flex_int32_t;
58
+ typedef unsigned char flex_uint8_t;
59
+ typedef unsigned short int flex_uint16_t;
60
+ typedef unsigned int flex_uint32_t;
61
+
62
+ /* Limits of integral types. */
63
+ #ifndef INT8_MIN
64
+ #define INT8_MIN (-128)
65
+ #endif
66
+ #ifndef INT16_MIN
67
+ #define INT16_MIN (-32767-1)
68
+ #endif
69
+ #ifndef INT32_MIN
70
+ #define INT32_MIN (-2147483647-1)
71
+ #endif
72
+ #ifndef INT8_MAX
73
+ #define INT8_MAX (127)
74
+ #endif
75
+ #ifndef INT16_MAX
76
+ #define INT16_MAX (32767)
77
+ #endif
78
+ #ifndef INT32_MAX
79
+ #define INT32_MAX (2147483647)
80
+ #endif
81
+ #ifndef UINT8_MAX
82
+ #define UINT8_MAX (255U)
83
+ #endif
84
+ #ifndef UINT16_MAX
85
+ #define UINT16_MAX (65535U)
86
+ #endif
87
+ #ifndef UINT32_MAX
88
+ #define UINT32_MAX (4294967295U)
89
+ #endif
90
+
91
+ #endif /* ! C99 */
92
+
93
+ #endif /* ! FLEXINT_H */
94
+
95
+ #ifdef __cplusplus
96
+
97
+ /* The "const" storage-class-modifier is valid. */
98
+ #define YY_USE_CONST
99
+
100
+ #else /* ! __cplusplus */
101
+
102
+ /* C99 requires __STDC__ to be defined as 1. */
103
+ #if defined (__STDC__)
104
+
105
+ #define YY_USE_CONST
106
+
107
+ #endif /* defined (__STDC__) */
108
+ #endif /* ! __cplusplus */
109
+
110
+ #ifdef YY_USE_CONST
111
+ #define yyconst const
112
+ #else
113
+ #define yyconst
114
+ #endif
115
+
116
+ /* An opaque pointer. */
117
+ #ifndef YY_TYPEDEF_YY_SCANNER_T
118
+ #define YY_TYPEDEF_YY_SCANNER_T
119
+ typedef void* yyscan_t;
120
+ #endif
121
+
122
+ /* For convenience, these vars (plus the bison vars far below)
123
+ are macros in the reentrant scanner. */
124
+ #define yyin yyg->yyin_r
125
+ #define yyout yyg->yyout_r
126
+ #define yyextra yyg->yyextra_r
127
+ #define yyleng yyg->yyleng_r
128
+ #define yytext yyg->yytext_r
129
+ #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
130
+ #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
131
+ #define yy_flex_debug yyg->yy_flex_debug_r
132
+
133
+ /* Size of default input buffer. */
134
+ #ifndef YY_BUF_SIZE
135
+ #ifdef __ia64__
136
+ /* On IA-64, the buffer size is 16k, not 8k.
137
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
138
+ * Ditto for the __ia64__ case accordingly.
139
+ */
140
+ #define YY_BUF_SIZE 32768
141
+ #else
142
+ #define YY_BUF_SIZE 16384
143
+ #endif /* __ia64__ */
144
+ #endif
145
+
146
+ #ifndef YY_TYPEDEF_YY_BUFFER_STATE
147
+ #define YY_TYPEDEF_YY_BUFFER_STATE
148
+ typedef struct yy_buffer_state *YY_BUFFER_STATE;
149
+ #endif
150
+
151
+ #ifndef YY_TYPEDEF_YY_SIZE_T
152
+ #define YY_TYPEDEF_YY_SIZE_T
153
+ typedef size_t yy_size_t;
154
+ #endif
155
+
156
+ #ifndef YY_STRUCT_YY_BUFFER_STATE
157
+ #define YY_STRUCT_YY_BUFFER_STATE
158
+ struct yy_buffer_state
159
+ {
160
+ FILE *yy_input_file;
161
+
162
+ char *yy_ch_buf; /* input buffer */
163
+ char *yy_buf_pos; /* current position in input buffer */
164
+
165
+ /* Size of input buffer in bytes, not including room for EOB
166
+ * characters.
167
+ */
168
+ yy_size_t yy_buf_size;
169
+
170
+ /* Number of characters read into yy_ch_buf, not including EOB
171
+ * characters.
172
+ */
173
+ int yy_n_chars;
174
+
175
+ /* Whether we "own" the buffer - i.e., we know we created it,
176
+ * and can realloc() it to grow it, and should free() it to
177
+ * delete it.
178
+ */
179
+ int yy_is_our_buffer;
180
+
181
+ /* Whether this is an "interactive" input source; if so, and
182
+ * if we're using stdio for input, then we want to use getc()
183
+ * instead of fread(), to make sure we stop fetching input after
184
+ * each newline.
185
+ */
186
+ int yy_is_interactive;
187
+
188
+ /* Whether we're considered to be at the beginning of a line.
189
+ * If so, '^' rules will be active on the next match, otherwise
190
+ * not.
191
+ */
192
+ int yy_at_bol;
193
+
194
+ int yy_bs_lineno; /**< The line count. */
195
+ int yy_bs_column; /**< The column count. */
196
+
197
+ /* Whether to try to fill the input buffer when we reach the
198
+ * end of it.
199
+ */
200
+ int yy_fill_buffer;
201
+
202
+ int yy_buffer_status;
203
+
204
+ };
205
+ #endif /* !YY_STRUCT_YY_BUFFER_STATE */
206
+
207
+ void jq_yyrestart (FILE *input_file ,yyscan_t yyscanner );
208
+ void jq_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
209
+ YY_BUFFER_STATE jq_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
210
+ void jq_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
211
+ void jq_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
212
+ void jq_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
213
+ void jq_yypop_buffer_state (yyscan_t yyscanner );
214
+
215
+ YY_BUFFER_STATE jq_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
216
+ YY_BUFFER_STATE jq_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
217
+ YY_BUFFER_STATE jq_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
218
+
219
+ void *jq_yyalloc (yy_size_t ,yyscan_t yyscanner );
220
+ void *jq_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
221
+ void jq_yyfree (void * ,yyscan_t yyscanner );
222
+
223
+ /* Begin user sect3 */
224
+
225
+ #define jq_yywrap(n) 1
226
+ #define YY_SKIP_YYWRAP
227
+
228
+ #define yytext_ptr yytext_r
229
+
230
+ #ifdef YY_HEADER_EXPORT_START_CONDITIONS
231
+ #define INITIAL 0
232
+ #define IN_PAREN 1
233
+ #define IN_BRACKET 2
234
+ #define IN_BRACE 3
235
+ #define IN_QQINTERP 4
236
+ #define IN_QQSTRING 5
237
+
238
+ #endif
239
+
240
+ #ifndef YY_NO_UNISTD_H
241
+ /* Special case for "unistd.h", since it is non-ANSI. We include it way
242
+ * down here because we want the user's section 1 to have been scanned first.
243
+ * The user has a chance to override it with an option.
244
+ */
245
+ #include <unistd.h>
246
+ #endif
247
+
248
+ #define YY_EXTRA_TYPE int
249
+
250
+ int jq_yylex_init (yyscan_t* scanner);
251
+
252
+ int jq_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
253
+
254
+ /* Accessor methods to globals.
255
+ These are made visible to non-reentrant scanners for convenience. */
256
+
257
+ int jq_yylex_destroy (yyscan_t yyscanner );
258
+
259
+ int jq_yyget_debug (yyscan_t yyscanner );
260
+
261
+ void jq_yyset_debug (int debug_flag ,yyscan_t yyscanner );
262
+
263
+ YY_EXTRA_TYPE jq_yyget_extra (yyscan_t yyscanner );
264
+
265
+ void jq_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
266
+
267
+ FILE *jq_yyget_in (yyscan_t yyscanner );
268
+
269
+ void jq_yyset_in (FILE * in_str ,yyscan_t yyscanner );
270
+
271
+ FILE *jq_yyget_out (yyscan_t yyscanner );
272
+
273
+ void jq_yyset_out (FILE * out_str ,yyscan_t yyscanner );
274
+
275
+ int jq_yyget_leng (yyscan_t yyscanner );
276
+
277
+ char *jq_yyget_text (yyscan_t yyscanner );
278
+
279
+ int jq_yyget_lineno (yyscan_t yyscanner );
280
+
281
+ void jq_yyset_lineno (int line_number ,yyscan_t yyscanner );
282
+
283
+ YYSTYPE * jq_yyget_lval (yyscan_t yyscanner );
284
+
285
+ void jq_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
286
+
287
+ YYLTYPE *jq_yyget_lloc (yyscan_t yyscanner );
288
+
289
+ void jq_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
290
+
291
+ /* Macros after this point can all be overridden by user definitions in
292
+ * section 1.
293
+ */
294
+
295
+ #ifndef YY_SKIP_YYWRAP
296
+ #ifdef __cplusplus
297
+ extern "C" int jq_yywrap (yyscan_t yyscanner );
298
+ #else
299
+ extern int jq_yywrap (yyscan_t yyscanner );
300
+ #endif
301
+ #endif
302
+
303
+ #ifndef yytext_ptr
304
+ static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
305
+ #endif
306
+
307
+ #ifdef YY_NEED_STRLEN
308
+ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
309
+ #endif
310
+
311
+ #ifndef YY_NO_INPUT
312
+
313
+ #endif
314
+
315
+ /* Amount of stuff to slurp up with each read. */
316
+ #ifndef YY_READ_BUF_SIZE
317
+ #ifdef __ia64__
318
+ /* On IA-64, the buffer size is 16k, not 8k */
319
+ #define YY_READ_BUF_SIZE 16384
320
+ #else
321
+ #define YY_READ_BUF_SIZE 8192
322
+ #endif /* __ia64__ */
323
+ #endif
324
+
325
+ /* Number of entries by which start-condition stack grows. */
326
+ #ifndef YY_START_STACK_INCR
327
+ #define YY_START_STACK_INCR 25
328
+ #endif
329
+
330
+ /* Default declaration of generated scanner - a define so the user can
331
+ * easily add parameters.
332
+ */
333
+ #ifndef YY_DECL
334
+ #define YY_DECL_IS_OURS 1
335
+
336
+ extern int jq_yylex \
337
+ (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
338
+
339
+ #define YY_DECL int jq_yylex \
340
+ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
341
+ #endif /* !YY_DECL */
342
+
343
+ /* yy_get_previous_state - get the state just before the EOB char was reached */
344
+
345
+ #undef YY_NEW_FILE
346
+ #undef YY_FLUSH_BUFFER
347
+ #undef yy_set_bol
348
+ #undef yy_new_buffer
349
+ #undef yy_set_interactive
350
+ #undef YY_DO_BEFORE_ACTION
351
+
352
+ #ifdef YY_DECL_IS_OURS
353
+ #undef YY_DECL_IS_OURS
354
+ #undef YY_DECL
355
+ #endif
356
+
357
+ #line 129 "lexer.l"
358
+
359
+
360
+ #line 361 "lexer.h"
361
+ #undef jq_yyIN_HEADER
362
+ #endif /* jq_yyHEADER_H */
@@ -0,0 +1,184 @@
1
+ %{
2
+ #include <assert.h>
3
+ #include "jv_alloc.h"
4
+ #include "compile.h"
5
+
6
+ struct lexer_param;
7
+
8
+ #include "parser.h" /* Generated by bison. */
9
+
10
+ #define YY_USER_ACTION \
11
+ do { \
12
+ yylloc->start = yyget_extra(yyscanner); \
13
+ yylloc->end = yylloc->start + yyleng; \
14
+ yyset_extra(yylloc->end, yyscanner); \
15
+ } while (0);
16
+
17
+ %}
18
+
19
+ %s IN_PAREN
20
+ %s IN_BRACKET
21
+ %s IN_BRACE
22
+ %s IN_QQINTERP
23
+ %x IN_QQSTRING
24
+ %{
25
+ static int enter(int opening, int state, yyscan_t yyscanner);
26
+ static int try_exit(int closing, int state, yyscan_t yyscanner);
27
+ %}
28
+
29
+ %option noyywrap nounput noinput nodefault
30
+ %option noyyalloc noyyrealloc noyyfree
31
+ %option reentrant
32
+ %option extra-type="int"
33
+ %option bison-bridge bison-locations
34
+ %option prefix="jq_yy"
35
+ %option stack
36
+
37
+
38
+ %%
39
+
40
+ "#"[^\r\n]* { /* comments */ }
41
+
42
+ "!=" { return NEQ; }
43
+ "==" { return EQ; }
44
+ "as" { return AS; }
45
+ "import" { return IMPORT; }
46
+ "include" { return INCLUDE; }
47
+ "module" { return MODULE; }
48
+ "def" { return DEF; }
49
+ "if" { return IF; }
50
+ "then" { return THEN; }
51
+ "else" { return ELSE; }
52
+ "elif" { return ELSE_IF; }
53
+ "and" { return AND; }
54
+ "or" { return OR; }
55
+ "end" { return END; }
56
+ "reduce" { return REDUCE; }
57
+ "foreach" { return FOREACH; }
58
+ "//" { return DEFINEDOR; }
59
+ "try" { return TRY; }
60
+ "catch" { return CATCH; }
61
+ "label" { return LABEL; }
62
+ "break" { return BREAK; }
63
+ "__loc__" { return LOC; }
64
+ "|=" { return SETPIPE; }
65
+ "+=" { return SETPLUS; }
66
+ "-=" { return SETMINUS; }
67
+ "*=" { return SETMULT; }
68
+ "/=" { return SETDIV; }
69
+ "%=" { return SETMOD; }
70
+ "//=" { return SETDEFINEDOR; }
71
+ "<=" { return LESSEQ; }
72
+ ">=" { return GREATEREQ; }
73
+ ".." { return REC; }
74
+ "."|"?"|"="|";"|","|":"|"|"|"+"|"-"|"*"|"/"|"%"|"\$"|"<"|">" { return yytext[0];}
75
+
76
+ "["|"{"|"(" {
77
+ return enter(yytext[0], YY_START, yyscanner);
78
+ }
79
+
80
+ "]"|"}"|")" {
81
+ return try_exit(yytext[0], YY_START, yyscanner);
82
+ }
83
+
84
+ "@"[a-zA-Z0-9_]+ {
85
+ yylval->literal = jv_string_sized(yytext + 1, yyleng - 1); return FORMAT;
86
+ }
87
+
88
+ [0-9.]+([eE][+-]?[0-9]+)? {
89
+ yylval->literal = jv_parse_sized(yytext, yyleng); return LITERAL;
90
+ }
91
+
92
+ "\"" {
93
+ yy_push_state(IN_QQSTRING, yyscanner);
94
+ return QQSTRING_START;
95
+ }
96
+
97
+ <IN_QQSTRING>{
98
+ "\\(" {
99
+ return enter(QQSTRING_INTERP_START, YY_START, yyscanner);
100
+ }
101
+ "\"" {
102
+ yy_pop_state(yyscanner);
103
+ return QQSTRING_END;
104
+ }
105
+ (\\[^u(]|\\u[a-zA-Z0-9]{0,4})+ {
106
+ /* pass escapes to the json parser */
107
+ jv escapes = jv_string_fmt("\"%.*s\"", (int)yyleng, yytext);
108
+ yylval->literal = jv_parse_sized(jv_string_value(escapes), jv_string_length_bytes(jv_copy(escapes)));
109
+ jv_free(escapes);
110
+ return QQSTRING_TEXT;
111
+ }
112
+ [^\\\"]+ {
113
+ yylval->literal = jv_string_sized(yytext, yyleng);
114
+ return QQSTRING_TEXT;
115
+ }
116
+ . {
117
+ return INVALID_CHARACTER;
118
+ }
119
+ }
120
+
121
+
122
+ ([a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext); return IDENT;}
123
+ \.[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext+1); return FIELD;}
124
+
125
+ [ \n\t]+ {}
126
+
127
+ . { return INVALID_CHARACTER; }
128
+
129
+ %%
130
+ /* perhaps these should be calls... */
131
+ /*
132
+ "true" { return TRUE; }
133
+ "false" { return FALSE; }
134
+ "null" { return NULL; }
135
+ */
136
+ static int try_exit(int c, int state, yyscan_t yyscanner) {
137
+ char match = 0;
138
+ int ret;
139
+ switch (state) {
140
+ case IN_PAREN: match = ret = ')'; break;
141
+ case IN_BRACKET: match = ret = ']'; break;
142
+ case IN_BRACE: match = ret = '}'; break;
143
+
144
+ case IN_QQINTERP:
145
+ match = ')';
146
+ ret = QQSTRING_INTERP_END;
147
+ break;
148
+
149
+ default:
150
+ // may not be the best error to give
151
+ return INVALID_CHARACTER;
152
+ }
153
+ assert(match);
154
+ if (match == c) {
155
+ yy_pop_state(yyscanner);
156
+ return ret;
157
+ } else {
158
+ // FIXME: should we pop? Give a better error at least
159
+ return INVALID_CHARACTER;
160
+ }
161
+ }
162
+
163
+ static int enter(int c, int currstate, yyscan_t yyscanner) {
164
+ int state = 0;
165
+ switch (c) {
166
+ case '(': state = IN_PAREN; break;
167
+ case '[': state = IN_BRACKET; break;
168
+ case '{': state = IN_BRACE; break;
169
+ case QQSTRING_INTERP_START: state = IN_QQINTERP; break;
170
+ }
171
+ assert(state);
172
+ yy_push_state(state, yyscanner);
173
+ return c;
174
+ }
175
+
176
+ void* yyalloc(size_t sz, void* extra) {
177
+ return jv_mem_alloc(sz);
178
+ }
179
+ void* yyrealloc(void* p, size_t sz, void* extra) {
180
+ return jv_mem_realloc(p, sz);
181
+ }
182
+ void yyfree(void* p, void* extra) {
183
+ jv_mem_free(p);
184
+ }
package/deps/jq/libm.h ADDED
@@ -0,0 +1,160 @@
1
+ #ifdef HAVE_ACOS
2
+ LIBM_DD(acos)
3
+ #else
4
+ LIBM_DD_NO(acos)
5
+ #endif
6
+ #ifdef HAVE_ACOSH
7
+ LIBM_DD(acosh)
8
+ #else
9
+ LIBM_DD_NO(acosh)
10
+ #endif
11
+ #ifdef HAVE_ASIN
12
+ LIBM_DD(asin)
13
+ #else
14
+ LIBM_DD_NO(asin)
15
+ #endif
16
+ #ifdef HAVE_ASINH
17
+ LIBM_DD(asinh)
18
+ #else
19
+ LIBM_DD_NO(asinh)
20
+ #endif
21
+ #ifdef HAVE_ATAN
22
+ LIBM_DD(atan)
23
+ #else
24
+ LIBM_DD_NO(atan)
25
+ #endif
26
+ #ifdef HAVE_ATANH
27
+ LIBM_DD(atanh)
28
+ #else
29
+ LIBM_DD_NO(atanh)
30
+ #endif
31
+ #ifdef HAVE_CBRT
32
+ LIBM_DD(cbrt)
33
+ #else
34
+ LIBM_DD_NO(cbrt)
35
+ #endif
36
+ #ifdef HAVE_COS
37
+ LIBM_DD(cos)
38
+ #else
39
+ LIBM_DD_NO(cos)
40
+ #endif
41
+ #ifdef HAVE_COSH
42
+ LIBM_DD(cosh)
43
+ #else
44
+ LIBM_DD_NO(cosh)
45
+ #endif
46
+ #ifdef HAVE_EXP2
47
+ LIBM_DD(exp2)
48
+ #else
49
+ LIBM_DD_NO(exp2)
50
+ #endif
51
+ #ifdef HAVE_EXP
52
+ LIBM_DD(exp)
53
+ #else
54
+ LIBM_DD_NO(exp)
55
+ #endif
56
+ #ifdef HAVE_FLOOR
57
+ LIBM_DD(floor)
58
+ #else
59
+ LIBM_DD_NO(floor)
60
+ #endif
61
+ #ifdef HAVE_J0
62
+ LIBM_DD(j0)
63
+ #else
64
+ LIBM_DD_NO(j0)
65
+ #endif
66
+ #ifdef HAVE_J1
67
+ LIBM_DD(j1)
68
+ #else
69
+ LIBM_DD_NO(j1)
70
+ #endif
71
+ #ifdef HAVE_LOG10
72
+ LIBM_DD(log10)
73
+ #else
74
+ LIBM_DD_NO(log10)
75
+ #endif
76
+ #ifdef HAVE_LOG2
77
+ LIBM_DD(log2)
78
+ #else
79
+ LIBM_DD_NO(log2)
80
+ #endif
81
+ #ifdef HAVE_LOG
82
+ LIBM_DD(log)
83
+ #else
84
+ LIBM_DD_NO(log)
85
+ #endif
86
+ #ifdef HAVE_SIN
87
+ LIBM_DD(sin)
88
+ #else
89
+ LIBM_DD_NO(sin)
90
+ #endif
91
+ #ifdef HAVE_SINH
92
+ LIBM_DD(sinh)
93
+ #else
94
+ LIBM_DD_NO(sinh)
95
+ #endif
96
+ #ifdef HAVE_SQRT
97
+ LIBM_DD(sqrt)
98
+ #else
99
+ LIBM_DD_NO(sqrt)
100
+ #endif
101
+ #ifdef HAVE_TAN
102
+ LIBM_DD(tan)
103
+ #else
104
+ LIBM_DD_NO(tan)
105
+ #endif
106
+ #ifdef HAVE_TANH
107
+ LIBM_DD(tanh)
108
+ #else
109
+ LIBM_DD_NO(tanh)
110
+ #endif
111
+ #ifdef HAVE_TGAMMA
112
+ LIBM_DD(tgamma)
113
+ #else
114
+ LIBM_DD_NO(tgamma)
115
+ #endif
116
+ #ifdef HAVE_Y0
117
+ LIBM_DD(y0)
118
+ #else
119
+ LIBM_DD_NO(y0)
120
+ #endif
121
+ #ifdef HAVE_Y1
122
+ LIBM_DD(y1)
123
+ #else
124
+ LIBM_DD_NO(y1)
125
+ #endif
126
+ #ifdef HAVE_POW
127
+ LIBM_DDD(pow)
128
+ #else
129
+ LIBM_DDD_NO(pow)
130
+ #endif
131
+ #ifdef HAVE_JN
132
+ LIBM_DID(jn)
133
+ #endif
134
+ #ifdef HAVE_YN
135
+ LIBM_DID(yn)
136
+ #endif
137
+ #ifdef HAVE_ATAN2
138
+ LIBM_DDD(atan2)
139
+ #else
140
+ LIBM_DDD_NO(atan2)
141
+ #endif
142
+ #ifdef HAVE_HYPOT
143
+ LIBM_DDD(hypot)
144
+ #else
145
+ LIBM_DDD_NO(hypot)
146
+ #endif
147
+ #ifdef HAVE_REMAINDER
148
+ LIBM_DDD(remainder)
149
+ #else
150
+ LIBM_DDD_NO(remainder)
151
+ #endif
152
+
153
+ #if 0
154
+ #ifdef HAVE_SCALBN
155
+ LIBM_DDI(scalbn)
156
+ #endif
157
+ #ifdef HAVE_LGAMMA_R
158
+ LIBM_DDIP(lgamma_r)
159
+ #endif
160
+ #endif