cctools
jx_parse.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2022 The University of Notre Dame
3 This software is distributed under the GNU General Public License.
4 See the file COPYING for details.
5 */
6 
7 #ifndef JX_PARSE_H
8 #define JX_PARSE_H
9 
20 #include "jx.h"
21 #include "link.h"
22 
23 #include <stdbool.h>
24 #include <stdio.h>
25 
26 struct jx_parser;
27 
28 /* Sets module-wide flag for static parse mode */
29 void jx_parse_set_static_mode( bool mode );
30 
32 struct jx * jx_parse_string( const char *str );
33 
35 struct jx * jx_parse_stream( FILE *file );
36 
38 struct jx * jx_parse_file( const char *name );
39 
41 struct jx * jx_parse_link( struct link *l, time_t stoptime );
42 
50 struct jx *jx_parse_cmd_args(struct jx *jx_args, char *args_file);
51 
58 int jx_parse_cmd_define(struct jx *jx_args, char *define_stmt);
59 
61 struct jx_parser *jx_parser_create(bool strict_mode);
62 
64 void jx_parser_read_stream( struct jx_parser *p, FILE *file );
65 
67 void jx_parser_read_string( struct jx_parser *p, const char *str );
68 
70 void jx_parser_read_link( struct jx_parser *p, struct link *l, time_t stoptime );
71 
73 struct jx * jx_parser_yield( struct jx_parser *p );
74 
76 struct jx * jx_parse( struct jx_parser *p );
77 
79 int jx_parser_errors( struct jx_parser *p );
80 
82 const char *jx_parser_error_string( struct jx_parser *p );
83 
85 void jx_parser_delete( struct jx_parser *p );
86 
87 /* Private function used by jx_print to put parens in the right place. */
88 int jx_operator_precedence( jx_operator_t op );
89 
90 
91 #endif
jx_parser_error_string
const char * jx_parser_error_string(struct jx_parser *p)
Return text of first parse error encountered.
jx.h
jx_parser_delete
void jx_parser_delete(struct jx_parser *p)
Delete a parser.
jx_parse_cmd_define
int jx_parse_cmd_define(struct jx *jx_args, char *define_stmt)
Parse a jx define statement from a commandline option.
jx_parser_yield
struct jx * jx_parser_yield(struct jx_parser *p)
Parse and return a single value.
jx_parser_read_link
void jx_parser_read_link(struct jx_parser *p, struct link *l, time_t stoptime)
Attach parser to a link.
jx_parse_cmd_args
struct jx * jx_parse_cmd_args(struct jx *jx_args, char *args_file)
Parse a jx argument file from a commandline option.
jx_parse_string
struct jx * jx_parse_string(const char *str)
Parse a JSON string to a JX expression.
jx_parser_create
struct jx_parser * jx_parser_create(bool strict_mode)
Create a JX parser object.
jx_parser_errors
int jx_parser_errors(struct jx_parser *p)
Return number of parse errors.
jx_parse
struct jx * jx_parse(struct jx_parser *p)
Parse a JX expression.
jx_parse_stream
struct jx * jx_parse_stream(FILE *file)
Parse a standard IO stream to a JX expression.
jx_parser_read_string
void jx_parser_read_string(struct jx_parser *p, const char *str)
Attach parser to a string.
jx_parse_file
struct jx * jx_parse_file(const char *name)
Parse a file to a JX expression.
jx
JX value representing any expression type.
Definition: jx.h:117
jx_parse_link
struct jx * jx_parse_link(struct link *l, time_t stoptime)
Parse a network link to a JX expression.
jx_parser_read_stream
void jx_parser_read_stream(struct jx_parser *p, FILE *file)
Attach parser to a file.