Changeset 5938 for icGREP


Ignore:
Timestamp:
Apr 2, 2018, 10:55:39 AM (14 months ago)
Author:
cameron
Message:

Parser reorganization step; initial check-in for FileGLOB parser

Location:
icGREP/icgrep-devel/icgrep
Files:
3 added
8 edited
13 moved

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/CMakeLists.txt

    r5934 r5938  
    9696add_library(CCADT re/re_re.cpp re/re_cc.cpp cc/cc_compiler.cpp cc/alphabet.cpp cc/multiplex_CCs.cpp UCD/unicode_set.cpp)
    9797# RegExpADT is the core library for representing, parsing and printing regular expressions
    98 add_library(RegExpADT re/re_rep.cpp re/re_diff.cpp re/re_intersect.cpp re/re_range.cpp re/re_assertion.cpp re/printer_re.cpp re/re_parser_pcre.cpp re/re_parser_ere.cpp re/re_parser_bre.cpp re/re_parser_prosite.cpp re/parse_fixed_strings.cpp)
    99 add_library(RegExpCompiler re/casing.cpp re/to_utf8.cpp re/re_parser.cpp re/re_memoizer.cpp re/re_nullable.cpp re/re_simplifier.cpp re/re_star_normal.cpp re/re_minimizer.cpp re/re_local.cpp re/re_compiler.cpp re/re_analysis.cpp re/re_toolchain.cpp re/re_name_resolve.cpp re/re_name_gather.cpp re/collect_ccs.cpp re/re_multiplex.cpp re/re_utility.cpp re/grapheme_clusters.cpp re/exclude_CC.cpp re/replaceCC.cpp)
     98add_library(RegExpADT re/re_rep.cpp re/re_diff.cpp re/re_intersect.cpp re/re_range.cpp re/re_assertion.cpp re/printer_re.cpp re/parsers/PCRE_parser.cpp re/parsers/ERE_parser.cpp re/parsers/BRE_parser.cpp re/parsers/Prosite_parser.cpp re/parsers/fixed_string_parser.cpp re/parsers/GLOB_parser.cpp)
     99add_library(RegExpCompiler re/casing.cpp re/to_utf8.cpp re/parsers/parser.cpp re/re_memoizer.cpp re/re_nullable.cpp re/re_simplifier.cpp re/re_star_normal.cpp re/re_minimizer.cpp re/re_local.cpp re/re_compiler.cpp re/re_analysis.cpp re/re_toolchain.cpp re/re_name_resolve.cpp re/re_name_gather.cpp re/collect_ccs.cpp re/re_multiplex.cpp re/re_utility.cpp re/grapheme_clusters.cpp re/exclude_CC.cpp re/replaceCC.cpp)
    100100add_library(UCDlib UCD/CaseFolding.cpp utf8_encoder.cpp utf16_encoder.cpp UCD/ucd_compiler.cpp UCD/PropertyObjects.cpp UCD/resolve_properties.cpp)
    101101add_library(GrepEngine  ${GREP_CORE_SRC} grep/grep_engine.cpp kernels/cc_kernel.cpp kernels/cc_scan_kernel.cpp kernels/charclasses.cpp kernels/streams_merge.cpp kernels/until_n.cpp kernels/UCD_property_kernel.cpp kernels/grapheme_kernel.cpp)
  • icGREP/icgrep-devel/icgrep/UCD/resolve_properties.cpp

    r5898 r5938  
    1515#include <re/re_seq.h>
    1616#include <re/re_assertion.h>
    17 #include <re/re_parser.h>
     17#include <re/parsers/parser.h>
    1818#include <re/re_name_resolve.h>
    1919#include <re/grapheme_clusters.h>
  • icGREP/icgrep-devel/icgrep/combine/regexGen.cpp

    r5825 r5938  
    1717#include <re/re_diff.h>
    1818#include <re/re_any.h>
    19 #include <re/re_parser.h>
     19#include <re/parsers/parser.h>
    2020
    2121
  • icGREP/icgrep-devel/icgrep/combine/regexGen.h

    r5825 r5938  
    44#include <vector>
    55#include <string>
    6 #include <re/re_parser.h>
     6#include <re/parsers/parser.h>
    77
    88using namespace std;
  • icGREP/icgrep-devel/icgrep/combine/stringGen.cpp

    r5825 r5938  
    1919#include <algorithm>
    2020#include <iostream>
    21 #include <re/re_parser.h>
     21#include <re/parsers/parser.h>
    2222#include <functional>
    2323#include <locale>
  • icGREP/icgrep-devel/icgrep/combine/stringGen.h

    r5825 r5938  
    55#include <vector>
    66#include <re/re_cc.h>
    7 #include <re/re_parser.h>
     7#include <re/parsers/parser.h>
    88
    99namespace re {
  • icGREP/icgrep-devel/icgrep/grep_interface.h

    r5900 r5938  
    1313#include <string>       // for string
    1414#include <vector>
    15 #include <re/re_parser.h>  // for re::RE_Syntax
     15#include <re/parsers/parser.h>  // for re::RE_Syntax
    1616
    1717namespace re { class CC; }
  • icGREP/icgrep-devel/icgrep/icgrep.cpp

    r5930 r5938  
    1515#include <re/re_start.h>
    1616#include <re/re_end.h>
    17 #include <re/re_parser.h>
     17#include <re/parsers/parser.h>
    1818#include <re/re_utility.h>
    1919#include <grep/grep_engine.h>
     
    2525#include <pablo/pablo_toolchain.h>
    2626#include <boost/filesystem.hpp>
    27 #include <iostream> // MEEE
    28 #ifdef PRINT_TIMING_INFORMATION
    29 #include <hrtime.h>
    30 #include <util/papi_helper.hpp>
    31 #endif
    3227#include <sys/stat.h>
    3328#include <fcntl.h>
  • icGREP/icgrep-devel/icgrep/re/parsers/BRE_parser.cpp

    r5937 r5938  
    11/*
    2  *  Copyright (c) 2016 International Characters.
     2 *  Copyright (c) 2018 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
    55 */
    66
    7 #include <re/re_parser_bre.h>
     7#include "BRE_parser.h"
    88#include <re/re_alt.h>
    99#include <re/re_any.h>
     
    1919
    2020
    21 RE * RE_Parser_BRE::parse_alt() {
     21RE * BRE_Parser::parse_alt() {
    2222    std::vector<RE *> alt;
    2323    do {
     
    2828}
    2929
    30 RE * RE_Parser_BRE::parse_seq() {
     30RE * BRE_Parser::parse_seq() {
    3131    std::vector<RE *> seq;
    3232    if (!mCursor.more() || at("\\|") || at("\\)")) return makeSeq();
     
    4343
    4444
    45 RE * RE_Parser_BRE::parse_next_item() {
     45RE * BRE_Parser::parse_next_item() {
    4646    if (mCursor.noMore() || at('*') || at("\\?") || at("\\{") || at("\\|")) return nullptr;
    4747    else if ((mGroupsOpen > 0) && at("\\)")) return nullptr;
     
    5656
    5757// A parenthesized capture group.  Input precondition: the opening \( has been consumed
    58 RE * RE_Parser_BRE::parse_group() {
     58RE * BRE_Parser::parse_group() {
    5959    mGroupsOpen++;
    6060    RE * captured = parse_capture_body();
     
    6565
    6666// Extend a RE item with one or more quantifiers
    67 RE * RE_Parser_BRE::extend_item(RE * re) {
     67RE * BRE_Parser::extend_item(RE * re) {
    6868    int lb, ub;
    6969    if (accept('*')) {lb = 0; ub = Rep::UNBOUNDED_REP;}
     
    8080}
    8181
    82 std::pair<int, int> RE_Parser_BRE::parse_range_bound() {
     82std::pair<int, int> BRE_Parser::parse_range_bound() {
    8383    int lb, ub;
    8484    if (accept(',')) {
  • icGREP/icgrep-devel/icgrep/re/parsers/BRE_parser.h

    r5937 r5938  
    11/*
    2  *  Copyright (c) 2016 International Characters.
     2 *  Copyright (c) 2018 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
    55 */
    66
    7 #ifndef ICGREP_RE_PARSER_BRE_H
    8 #define ICGREP_RE_PARSER_BRE_H
     7#ifndef BRE_PARSER_H
     8#define BRE_PARSER_H
    99
    10 #include <re/re_parser.h>
    11 #include <re/re_parser_ere.h>
     10#include <re/parsers/parser.h>
     11#include <re/parsers/ERE_parser.h>
    1212
    1313namespace re {
    14     class RE_Parser_BRE : public RE_Parser_ERE  {
     14    class BRE_Parser : public ERE_Parser  {
    1515    public:
    16         RE_Parser_BRE(const std::string & regular_expression) : RE_Parser_ERE(regular_expression) {
     16        BRE_Parser(const std::string & regular_expression) : ERE_Parser(regular_expression) {
    1717            mReSyntax = RE_Syntax::BRE;
    1818        }
     
    2828}
    2929
    30 
    31 #endif //ICGREP_RE_PARSER_BRE_H
     30#endif
  • icGREP/icgrep-devel/icgrep/re/parsers/ERE_parser.cpp

    r5937 r5938  
    11/*
    2  *  Copyright (c) 2016 International Characters.
     2 *  Copyright (c) 2018 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
    55 */
    66
    7 #include <re/re_parser_ere.h>
     7#include "ERE_parser.h"
    88#include <re/re_start.h>
    99#include <re/re_end.h>
     
    1515
    1616
    17 RE * RE_Parser_ERE::parse_next_item() {
     17RE * ERE_Parser::parse_next_item() {
    1818    if (mCursor.noMore() || atany("*?+{|")) return nullptr;
    1919    else if ((mGroupsOpen > 0) && at(')')) return nullptr;
     
    2828
    2929// A parenthesized capture group.  Input precondition: the opening ( has been consumed
    30 RE * RE_Parser_ERE::parse_group() {
     30RE * ERE_Parser::parse_group() {
    3131    mGroupsOpen++;
    3232    RE * captured = parse_capture_body();
     
    3636}
    3737
    38 RE * RE_Parser_ERE::parse_escaped() {
     38RE * ERE_Parser::parse_escaped() {
    3939    if (accept('b')) return makeWordBoundary();
    4040    if (accept('B')) return makeWordNonBoundary();
     
    5454// Ranges may be formed by individual character items separated by '-'.
    5555// Note that there are no backslash escapes for ERE or BRE bracket expressions.
    56 RE * RE_Parser_ERE::parse_bracket_expr () {
     56RE * ERE_Parser::parse_bracket_expr () {
    5757    bool negated = accept('^');
    5858    std::vector<RE *> items;
  • icGREP/icgrep-devel/icgrep/re/parsers/ERE_parser.h

    r5937 r5938  
    11/*
    2  *  Copyright (c) 2016 International Characters.
     2 *  Copyright (c) 2018 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
    55 */
    66
    7 #ifndef ICGREP_RE_PARSER_ERE_H
    8 #define ICGREP_RE_PARSER_ERE_H
     7#ifndef ERE_PARSER_H
     8#define ERE_PARSER_H
    99
    10 #include <re/re_parser.h>
     10#include <re/parsers/parser.h>
    1111
    1212namespace re {
    13     class RE_Parser_ERE : public RE_Parser  {
     13    class ERE_Parser : public RE_Parser  {
    1414    public:
    15         RE_Parser_ERE(const std::string & regular_expression) : RE_Parser(regular_expression) {
     15        ERE_Parser(const std::string & regular_expression) : RE_Parser(regular_expression) {
    1616            mReSyntax = RE_Syntax::ERE;
    1717        }
     
    3030}
    3131
    32 
    33 #endif //ICGREP_RE_PARSER_ERE_H
     32#endif
  • icGREP/icgrep-devel/icgrep/re/parsers/PCRE_parser.cpp

    r5937 r5938  
    11/*
    2  *  Copyright (c) 2016 International Characters.
     2 *  Copyright (c) 2018 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
    55 */
    66
    7 #include <re/re_parser_pcre.h>
    8 #include <re/re_parser_helper.h>
    9 #include <re/re_alt.h>
    10 #include <re/re_seq.h>
    11 #include <re/re_start.h>
    12 #include <re/re_end.h>
    13 #include <re/re_assertion.h>
     7#include "PCRE_parser.h"
     8#include <re/parsers/parser_helper.h>
    149
    1510namespace re{
     
    1914                                         bit3C('P') | bit3C('Q') | bit3C('D') | bit3C('W') | bit3C('S') | bit3C('N') | bit3C('X');
    2015
    21     bool RE_Parser_PCRE::isSetEscapeChar(char c) {
     16    bool PCRE_Parser::isSetEscapeChar(char c) {
    2217        return c >= 0x3C && c <= 0x7B && ((setEscapeCharacters >> (c - 0x3C)) & 1) == 1;
    2318    }
  • icGREP/icgrep-devel/icgrep/re/parsers/PCRE_parser.h

    r5937 r5938  
    11/*
    2  *  Copyright (c) 2016 International Characters.
     2 *  Copyright (c) 2018 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
    55 */
    66
    7 #ifndef ICGREP_RE_PARSER_PCRE_H
    8 #define ICGREP_RE_PARSER_PCRE_H
     7#ifndef PCRE_PARSER_H
     8#define PCRE_PARSER_H
    99
    10 #include <re/re_parser.h>
     10#include <re/parsers/parser.h>
    1111
    1212namespace re {
    13     class RE_Parser_PCRE : public RE_Parser {
     13    class PCRE_Parser : public RE_Parser {
    1414    public:
    15         RE_Parser_PCRE(const std::string & regular_expression) : RE_Parser(regular_expression) {
    16             mReSyntax = RE_Syntax ::PCRE;
     15        PCRE_Parser(const std::string & regular_expression) : RE_Parser(regular_expression) {
     16            mReSyntax = RE_Syntax::PCRE;
    1717        }
    1818    protected:
     
    2121}
    2222
    23 #endif //ICGREP_RE_PARSER_PCRE_H
     23#endif
  • icGREP/icgrep-devel/icgrep/re/parsers/Prosite_parser.cpp

    r5937 r5938  
    55 */
    66
    7 #include <re/re_parser_prosite.h>
    8 #include <re/re_parser_helper.h>
     7#include "Prosite_parser.h"
     8#include <re/parsers/parser_helper.h>
    99#include <re/re_alt.h>
    1010#include <re/re_any.h>
  • icGREP/icgrep-devel/icgrep/re/parsers/Prosite_parser.h

    r5937 r5938  
    88#define ICGREP_RE_PARSER_PROSITE_H
    99
    10 #include <re/re_parser.h>
     10#include <re/parsers/parser.h>
    1111
    1212namespace re {
  • icGREP/icgrep-devel/icgrep/re/parsers/fixed_string_parser.cpp

    r5937 r5938  
    11/*
    2  *  Copyright (c) 2017 International Characters.
     2 *  Copyright (c) 2018 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
    55 */
    66
    7 #include <re/re_parser.h>
    8 #include <re/parse_fixed_strings.h>
     7#include <re/parsers/parser.h>
     8#include "fixed_string_parser.h"
    99#include <re/re_alt.h>
    1010#include <re/re_seq.h>
  • icGREP/icgrep-devel/icgrep/re/parsers/fixed_string_parser.h

    r5937 r5938  
    11/*
    2  *  Copyright (c) 2017 International Characters.
     2 *  Copyright (c) 2018 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
    55 */
    66
    7 #ifndef PARSE_FIXED_STRINGS_H
    8 #define PARSE_FIXED_STRINGS_H
    9 #include <re/re_parser.h>
     7#ifndef PARSE_FIXED_STRING_PARSER_H
     8#define PARSE_FIXED_STRING_PARSER_H
     9#include <re/parsers/parser.h>
    1010
    1111namespace re {
     
    2020}
    2121
    22 #endif //PARSE_FIXED_STRINGS_H
     22#endif
  • icGREP/icgrep-devel/icgrep/re/parsers/parser.cpp

    r5937 r5938  
    55 */
    66
    7 #include <re/re_parser.h>
    8 #include <re/re_parser_helper.h>
    9 #include <re/re_parser_pcre.h>
    10 #include <re/re_parser_ere.h>
    11 #include <re/re_parser_bre.h>
    12 #include <re/re_parser_prosite.h>
    13 #include <re/parse_fixed_strings.h>
     7#include <re/parsers/parser.h>
     8#include <re/parsers/parser_helper.h>
     9#include <re/parsers/PCRE_parser.h>
     10#include <re/parsers/ERE_parser.h>
     11#include <re/parsers/BRE_parser.h>
     12#include <re/parsers/GLOB_parser.h>
     13#include <re/parsers/Prosite_parser.h>
     14#include <re/parsers/fixed_string_parser.h>
    1415#include <re/re_name.h>
    1516#include <re/re_alt.h>
     
    4445    switch (syntax) {
    4546        case RE_Syntax::PCRE:
    46             parser = make_unique<RE_Parser_PCRE>(regular_expression);
     47            parser = make_unique<PCRE_Parser>(regular_expression);
    4748            break;
    4849        case RE_Syntax::ERE:
    49             parser = make_unique<RE_Parser_ERE>(regular_expression);
     50            parser = make_unique<ERE_Parser>(regular_expression);
    5051            break;
    51         case RE_Syntax ::BRE:
    52             parser = make_unique<RE_Parser_BRE>(regular_expression);
     52        case RE_Syntax::BRE:
     53            parser = make_unique<BRE_Parser>(regular_expression);
     54            break;
     55        case RE_Syntax::FileGLOB:
     56            parser = make_unique<FileGLOB_Parser>(regular_expression);
    5357            break;
    5458        case RE_Syntax ::PROSITE:
  • icGREP/icgrep-devel/icgrep/re/parsers/parser.h

    r5937 r5938  
    1010#include <map>
    1111#include <re/re_memoizer.hpp>
    12 #include "re/re_cc.h"
     12#include <re/re_cc.h>
    1313
    1414namespace re { class Name; }
     
    1616namespace re {
    1717
    18 enum RE_Syntax {FixedStrings, BRE, ERE, PCRE, PROSITE};
     18enum RE_Syntax {FixedStrings, BRE, ERE, FileGLOB, PCRE, PROSITE};
    1919
    2020enum ModeFlagType : unsigned {
Note: See TracChangeset for help on using the changeset viewer.