2 Copyright (C) 2021 David Knapp (Cloudwalk)
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #define PARSER_MAX_DEPTH 256
26 typedef enum qparser_err_e
28 PARSE_ERR_SUCCESS = 0,
35 typedef struct qparser_state_s
44 qbool (*CheckComment_SingleLine)(struct qparser_state_s *);
45 qbool (*CheckComment_Multiline_Start)(struct qparser_state_s *);
46 qbool (*CheckComment_Multiline_End)(struct qparser_state_s *);
50 extern jmp_buf parse_error;
52 void Parse_Error(struct qparser_state_s *state, qparser_err_t error, const char *expected);
53 void Parse_Next(struct qparser_state_s *state, int count);
54 char Parse_NextToken(struct qparser_state_s *state, int skip);
55 qparser_state_t *Parse_New(const unsigned char *in);
56 qparser_state_t *Parse_LoadFile(const char *file);
58 static inline void Parse_Indent(struct qparser_state_s *state)
60 if(state->depth >= PARSER_MAX_DEPTH)
61 Parse_Error(state, PARSE_ERR_DEPTH, NULL);
65 static inline void Parse_Dedent(struct qparser_state_s *state)