2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-02 07:15:18 +00:00

parser: revert changes from commit rev 3248

The changes to the parser made in commit rev 3248 were accidental and
not intended to be committed.
This commit is contained in:
Steve Beattie
2015-10-14 13:49:26 -07:00
parent a1482f37d8
commit 768f11b497
4 changed files with 110 additions and 79 deletions

View File

@@ -229,11 +229,41 @@ public:
int is_postprocess(void) { return false; }
};
/* Match one specific character (/c/). */
class CharNode: public CNode {
public:
CharNode(uchar c): c(c) { }
void follow(Cases &cases)
{
NodeSet **x = &cases.cases[c];
if (!*x) {
if (cases.otherwise)
*x = new NodeSet(*cases.otherwise);
else
*x = new NodeSet;
}
(*x)->insert(followpos.begin(), followpos.end());
}
int eq(Node *other)
{
CharNode *o = dynamic_cast<CharNode *>(other);
if (o) {
return c == o->c;
}
return 0;
}
ostream &dump(ostream &os)
{
return os << c;
}
uchar c;
};
/* Match a set of characters (/[abc]/). */
class CharSetNode: public CNode {
public:
CharSetNode(Chars &chars): chars(chars) { }
CharSetNode(uchar c): chars() { chars.insert(c); }
void follow(Cases &cases)
{
for (Chars::iterator i = chars.begin(); i != chars.end(); i++) {
@@ -561,6 +591,7 @@ public:
};
struct node_counts {
int charnode;
int charset;
int notcharset;
int alt;