source: icGREP/icgrep-devel/icgrep/re/re_toolchain.h @ 6170

Last change on this file since 6170 was 6170, checked in by cameron, 8 months ago

RE Transformation names and printing

File size: 2.2 KB
Line 
1/*
2 *  Copyright (c) 2018 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_TOOLCHAIN_H
8#define RE_TOOLCHAIN_H
9#include <string>
10#include <llvm/Support/Compiler.h>
11namespace llvm { namespace cl { class OptionCategory; } }
12namespace pablo { class PabloKernel; class PabloAST; }
13namespace re { class RE; class CC;}
14namespace re { class Name; class Start; class End; class CC; class Seq; class Alt;
15    class Rep; class Intersect; class Diff; class Range; class Group;
16    class Assertion;
17}
18
19namespace re {
20
21enum RE_PrintFlags {
22    ShowREs, ShowAllREs, ShowStrippedREs, ShowSimplifiedREs
23};
24   
25enum RE_AlgorithmFlags {
26    DisableLog2BoundedRepetition, DisableIfHierarchy, DisableMatchStar, DisableUnicodeMatchStar, 
27    DisableUnicodeLineBreak, UsePregeneratedUnicode
28};
29   
30bool LLVM_READONLY AlgorithmOptionIsSet(RE_AlgorithmFlags flag);
31   
32extern int IfInsertionGap;
33
34const llvm::cl::OptionCategory * LLVM_READONLY re_toolchain_flags();
35   
36   
37void UndefinedNameError (const Name * n);
38
39enum class NameTransformationMode {None, TransformDefinition};
40
41class RE_Transformer {
42public:
43    RE_Transformer(std::string transformationName = "",
44                   NameTransformationMode m = NameTransformationMode::None) :
45    mTransformationName(transformationName), mNameTransform(m) {}
46    RE * transformRE(RE * r);
47protected:
48    RE * transform(RE * r);
49    virtual RE * transformName(Name * n);
50    virtual RE * transformStart(Start * s);
51    virtual RE * transformEnd(End * e);
52    virtual RE * transformCC(CC * cc);
53    virtual RE * transformSeq(Seq * s);
54    virtual RE * transformAlt(Alt * a);
55    virtual RE * transformRep(Rep * rep);
56    virtual RE * transformIntersect(Intersect * e);
57    virtual RE * transformDiff(Diff * d);
58    virtual RE * transformRange(Range * rg);
59    virtual RE * transformGroup(Group * g);
60    virtual RE * transformAssertion(Assertion * a);
61   
62    std::string mTransformationName;
63    NameTransformationMode mNameTransform;
64};
65
66RE * resolveModesAndExternalSymbols(RE * r, bool globallyCaseInsensitive = false);
67
68RE * excludeUnicodeLineBreak(RE * r);
69
70RE * regular_expression_passes(RE * r);
71   
72}
73#endif
Note: See TracBrowser for help on using the repository browser.