Changeset 5649


Ignore:
Timestamp:
Sep 26, 2017, 10:51:47 AM (20 months ago)
Author:
cameron
Message:

Some RE tidy-ups; an empty Alt is permitted and represents the set of no strings

Location:
icGREP/icgrep-devel/icgrep/re
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/re_alt.h

    r5267 r5649  
    6262RE * makeAlt(iterator begin, iterator end) {
    6363    if (LLVM_UNLIKELY(std::distance(begin, end) == 0)) {
    64         throw std::runtime_error("Alt objects cannot be empty!");
     64        return makeAlt();
    6565    } else if (std::distance(begin, end) == 1) {
    6666        return *begin;
  • icGREP/icgrep-devel/icgrep/re/re_analysis.cpp

    r5604 r5649  
    1111#include <re/re_intersect.h>
    1212#include <re/re_assertion.h>
    13 #include <iostream>
     13#include <re/re_nullable.h>
    1414#include <re/printer_re.h>
    1515#include <limits.h>
     16#include <llvm/Support/ErrorHandling.h>
    1617
    1718using namespace llvm;
     
    193194    return 0; // otherwise
    194195}
    195 
     196   
    196197//If a regular expression contains unit and not byteLength bounded repetition type, we select a different pipeline to utilize the log2 technique.
    197198bool unitBoundedRep(const RE * re) {
     
    261262}
    262263
    263 }
     264void UndefinedNameError(const Name * n) {
     265    report_fatal_error("Error: Undefined name in regular expression: \"" + n->getName() + "\".");
     266}
     267}
  • icGREP/icgrep-devel/icgrep/re/re_analysis.h

    r5604 r5649  
    33
    44#include <utility>
    5 namespace re { class RE; }
     5namespace re { class RE; class Name;}
    66
    77namespace re {
     
    1818
    1919bool isTypeForLocal(const RE * re);
     20   
     21void UndefinedNameError (const Name * n);
    2022
    2123}
  • icGREP/icgrep-devel/icgrep/re/re_cc.h

    r5278 r5649  
    5353
    5454    inline CC()
    55     : RE(ClassTypeId::CC) {
     55    : RE(ClassTypeId::CC), UnicodeSet() {
    5656
    5757    }
  • icGREP/icgrep-devel/icgrep/re/re_local.cpp

    r5632 r5649  
    3333            return first(name->getDefinition());
    3434        } else {
    35             throw std::runtime_error("All non-unicode-property Name objects should have been defined prior to Unicode property resolution.");
     35            UndefinedNameError(name);
    3636        }
    3737    } else if (CC * cc = dyn_cast<CC>(re)) {
     
    7575            return final(name->getDefinition());
    7676        } else {
    77             throw std::runtime_error("All non-unicode-property Name objects should have been defined prior to Unicode property resolution.");
     77            UndefinedNameError(name);
    7878        }
    7979    } else if (CC * cc = dyn_cast<CC>(re)) {
     
    118118            return follow(name->getDefinition(), follow_map);
    119119        } else {
    120             throw std::runtime_error("All non-unicode-property Name objects should have been defined prior to Unicode property resolution.");
     120            UndefinedNameError(name);
    121121        }
    122122    } else if (Seq * seq = dyn_cast<Seq>(re)) {
Note: See TracChangeset for help on using the changeset viewer.