source: icGREP/icgrep-0.8/icgrep/re_parser.h @ 3972

Last change on this file since 3972 was 3850, checked in by cameron, 5 years ago

icgrep-0.8 distribution

File size: 1.8 KB
Line 
1/*
2 *  Copyright (c) 2014 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#ifndef RE_PARSER_H
8#define RE_PARSER_H
9
10#include "re_re.h"
11#include "parseresult.h"
12#include "parsesuccess.h"
13#include "parsefailure.h"
14
15#include "cc_compiler.h"
16
17#include <fstream>
18#include <iostream>
19#include <string>
20#include <sstream>
21#include <vector>
22#include <ctype.h>
23
24
25struct parse_int_retVal{
26    int i;
27    std::string remaining;
28};
29
30struct parse_result_retVal{
31    ParseResult* result;
32    std::string remaining;
33};
34
35struct parse_re_list_retVal{
36    std::list<RE*> re_list;
37    std::string remaining;
38};
39
40class RE_Parser
41{
42public:
43    RE_Parser();
44    //The module exports the parse result.
45    ParseResult* parse_re(std::string intput_string);
46private:
47    parse_result_retVal parse_re_helper(std::string s);
48    parse_re_list_retVal parse_re_alt_form_list(std::string s);
49    parse_result_retVal parse_re_form(std::string s);
50    parse_re_list_retVal parse_re_item_list(std::string s);
51    parse_result_retVal parse_re_item(std::string s);
52    parse_result_retVal parse_re_unit(std::string s);
53    parse_result_retVal extend_item(RE* re, std::string s);
54    parse_result_retVal parse_cc(std::string s);
55    parse_result_retVal parse_cc_body(std::string s);
56    parse_result_retVal parse_cc_body0(std::string s, CC* cc_sofar);
57    parse_result_retVal parse_cc_body1(int chr, std::string s, CC* cc_sofar);
58
59    parse_int_retVal parse_hex(std::string s);
60    parse_int_retVal parse_hex_body(int i, std::string s);
61    int parse_hex_body1(int i, std::string hex_str);
62
63    parse_int_retVal parse_int(std::string s);
64    parse_int_retVal parse_int1(int i, std::string s);
65    parse_result_retVal negate_cc_result(parse_result_retVal cc_result);
66};
67
68#endif // RE_PARSER_H
Note: See TracBrowser for help on using the repository browser.