Changeset 5167 for icGREP


Ignore:
Timestamp:
Sep 27, 2016, 7:49:07 AM (3 years ago)
Author:
cameron
Message:

Flags for future syntax options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/icgrep.cpp

    r5163 r5167  
    3232static cl::OptionCategory LegacyGrepOptions("A. Standard Grep Options",
    3333                                       "These are standard grep options intended for compatibility with typical grep usage.");
     34enum RE_Syntax {FixedStrings, BRE, ERE, PCRE};
     35
     36#ifdef FUTURE
     37static cl::OptionCategory RegexpOptions("Regular Expression Interpretation", "These options control regular expression interpretation");
     38static cl::opt<RE_Syntax> RegexpSyntax(cl::desc("Regular expression syntax:"),
     39    cl::values(
     40        clEnumValN(FixedStrings, "F", "Fixed strings, separated by newlines"),
     41        clEnumValN(BRE, "G", "Posix basic regular expression (BRE) syntax"),
     42        clEnumValN(ERE, "E", "Posix extened regular expression (ERE) syntax"),
     43        clEnumValN(PCRE, "P", "Perl-compatible regular expression (PCRE) syntax - default"),
     44               clEnumValEnd), cl::cat(LegacyGrepOptions), cl::Grouping, cl::init(PCRE));
     45#endif
     46
    3447static cl::opt<bool> UTF_16("UTF-16", cl::desc("Regular expressions over the UTF-16 representation of Unicode."), cl::cat(LegacyGrepOptions));
    3548static cl::OptionCategory EnhancedGrepOptions("B. Enhanced Grep Options",
     
    282295    cl::HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *>{&LegacyGrepOptions, &EnhancedGrepOptions, re::re_toolchain_flags(), pablo::pablo_toolchain_flags(), codegen::codegen_flags()});
    283296    cl::ParseCommandLineOptions(argc, argv);
    284    
     297#ifdef FUTURE
     298    if (RegexpSyntax != RE_Syntax::PCRE) {
     299        llvm::report_fatal_error("Sorry, only PCRE syntax is fully supported\n.");
     300    }
     301#endif
    285302    re::RE * re_ast = get_icgrep_RE();
    286303    std::string module_name = "grepcode:" + sha1sum(allREs) + ":" + std::to_string(globalFlags);
Note: See TracChangeset for help on using the changeset viewer.