1#ifndef MUPDF_PDF_PARSE_H
2#define MUPDF_PDF_PARSE_H
3
4typedef enum
5{
6 PDF_TOK_ERROR, PDF_TOK_EOF,
7 PDF_TOK_OPEN_ARRAY, PDF_TOK_CLOSE_ARRAY,
8 PDF_TOK_OPEN_DICT, PDF_TOK_CLOSE_DICT,
9 PDF_TOK_OPEN_BRACE, PDF_TOK_CLOSE_BRACE,
10 PDF_TOK_NAME, PDF_TOK_INT, PDF_TOK_REAL, PDF_TOK_STRING, PDF_TOK_KEYWORD,
11 PDF_TOK_R, PDF_TOK_TRUE, PDF_TOK_FALSE, PDF_TOK_NULL,
12 PDF_TOK_OBJ, PDF_TOK_ENDOBJ,
13 PDF_TOK_STREAM, PDF_TOK_ENDSTREAM,
14 PDF_TOK_XREF, PDF_TOK_TRAILER, PDF_TOK_STARTXREF,
15 PDF_NUM_TOKENS
16} pdf_token;
17
18void pdf_lexbuf_init(fz_context *ctx, pdf_lexbuf *lexbuf, int size);
19void pdf_lexbuf_fin(fz_context *ctx, pdf_lexbuf *lexbuf);
20ptrdiff_t pdf_lexbuf_grow(fz_context *ctx, pdf_lexbuf *lexbuf);
21
22pdf_token pdf_lex(fz_context *ctx, fz_stream *f, pdf_lexbuf *lexbuf);
23pdf_token pdf_lex_no_string(fz_context *ctx, fz_stream *f, pdf_lexbuf *lexbuf);
24
25pdf_obj *pdf_parse_array(fz_context *ctx, pdf_document *doc, fz_stream *f, pdf_lexbuf *buf);
26pdf_obj *pdf_parse_dict(fz_context *ctx, pdf_document *doc, fz_stream *f, pdf_lexbuf *buf);
27pdf_obj *pdf_parse_stm_obj(fz_context *ctx, pdf_document *doc, fz_stream *f, pdf_lexbuf *buf);
28pdf_obj *pdf_parse_ind_obj(fz_context *ctx, pdf_document *doc, fz_stream *f, pdf_lexbuf *buf, int *num, int *gen, int64_t *stm_ofs, int *try_repair);
29
30void pdf_append_token(fz_context *ctx, fz_buffer *buf, int tok, pdf_lexbuf *lex);
31
32#endif
33