cctools
jx_parse.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2015- 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 
29 struct jx * jx_parse_string( const char *str );
30 
32 struct jx * jx_parse_stream( FILE *file );
33 
35 struct jx * jx_parse_file( const char *name );
36 
38 struct jx * jx_parse_link( struct link *l, time_t stoptime );
39 
47 struct jx *jx_parse_cmd_args(struct jx *jx_args, char *args_file);
48 
55 int jx_parse_cmd_define(struct jx *jx_args, char *define_stmt);
56 
58 struct jx_parser *jx_parser_create(bool strict_mode);
59 
61 void jx_parser_read_stream( struct jx_parser *p, FILE *file );
62 
64 void jx_parser_read_string( struct jx_parser *p, const char *str );
65 
67 void jx_parser_read_link( struct jx_parser *p, struct link *l, time_t stoptime );
68 
70 struct jx * jx_parser_yield( struct jx_parser *p );
71 
73 struct jx * jx_parse( struct jx_parser *p );
74 
76 int jx_parser_errors( struct jx_parser *p );
77 
79 const char *jx_parser_error_string( struct jx_parser *p );
80 
82 void jx_parser_delete( struct jx_parser *p );
83 
84 /* Private function used by jx_print to put parens in the right place. */
85 int jx_operator_precedence( jx_operator_t op );
86 
87 
88 #endif
int jx_parser_errors(struct jx_parser *p)
Return number of parse errors.
struct jx_parser * jx_parser_create(bool strict_mode)
Create a JX parser object.
struct jx * jx_parse_string(const char *str)
Parse a JSON string to a JX expression.
struct jx * jx_parse_cmd_args(struct jx *jx_args, char *args_file)
Parse a jx argument file from a commandline option.
struct jx * jx_parse_link(struct link *l, time_t stoptime)
Parse a network link to a JX expression.
const char * jx_parser_error_string(struct jx_parser *p)
Return text of first parse error encountered.
void jx_parser_read_link(struct jx_parser *p, struct link *l, time_t stoptime)
Attach parser to a link.
struct jx * jx_parse_stream(FILE *file)
Parse a standard IO stream to a JX expression.
struct jx * jx_parse(struct jx_parser *p)
Parse a JX expression.
void jx_parser_read_string(struct jx_parser *p, const char *str)
Attach parser to a string.
JSON Expressions (JX) library.
int jx_parse_cmd_define(struct jx *jx_args, char *define_stmt)
Parse a jx define statement from a commandline option.
void jx_parser_delete(struct jx_parser *p)
Delete a parser.
JX value representing any expression type.
Definition: jx.h:117
struct jx * jx_parse_file(const char *name)
Parse a file to a JX expression.
void jx_parser_read_stream(struct jx_parser *p, FILE *file)
Attach parser to a file.
struct jx * jx_parser_yield(struct jx_parser *p)
Parse and return a single value.