aboutsummaryrefslogtreecommitdiff
path: root/src/json-lex.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/json-lex.l')
-rw-r--r--src/json-lex.l35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/json-lex.l b/src/json-lex.l
index 169cf32..4bbdedf 100644
--- a/src/json-lex.l
+++ b/src/json-lex.l
@@ -55,18 +55,6 @@ struct grecs_locus json_err_locus;
} while (0);
void
-jsonlex_setup(char const *s, size_t l)
-{
- input_ptr = s;
- input_size = l;
- json_current_locus_point.file = NULL;
- json_current_locus_point.line = 1;
- json_current_locus_point.col = 0;
- json_err_diag = NULL;
- yy_flex_debug = 0;
-}
-
-void
jsonlex_diag(const char *s)
{
if (!json_err_diag) {
@@ -227,3 +215,26 @@ false { yylval.b = 0; return T_BOOL; }
\n grecs_locus_point_advance_line(json_current_locus_point);
. { jsonlex_diag("bogus character");
return T_ERR; }
+%%
+void
+jsonlex_setup(char const *s, size_t l)
+{
+ input_ptr = s;
+ input_size = l;
+ json_current_locus_point.file = "input";
+ json_current_locus_point.line = 1;
+ json_current_locus_point.col = 0;
+ json_err_diag = NULL;
+ yy_flex_debug = 0;
+ BEGIN(INITIAL);
+ yyrestart(NULL);
+}
+
+void
+jsonlex_cleanup(void)
+{
+ if (json_line_acc) {
+ grecs_txtacc_free(json_line_acc);
+ json_line_acc = NULL;
+ }
+}

Return to:

Send suggestions and report system problems to the System administrator.