mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-29 13:28:19 +00:00
This is part of a serious of patches to cleanup expr nodes, by separating
out functionality and reducing the number of dynamic casts.
This commit is contained in:
parent
adb0973d61
commit
d2581332db
@ -114,6 +114,13 @@
|
||||
}
|
||||
};
|
||||
|
||||
class InnerNode : public Node {
|
||||
public:
|
||||
InnerNode() : Node() { };
|
||||
InnerNode(Node *left) : Node(left) {};
|
||||
InnerNode(Node *left, Node *right) : Node(left, right) { };
|
||||
};
|
||||
|
||||
/* Match nothing (//). */
|
||||
class EpsNode : public Node {
|
||||
public:
|
||||
@ -331,10 +338,10 @@
|
||||
};
|
||||
|
||||
/* Match a pair of consecutive nodes. */
|
||||
class CatNode : public Node {
|
||||
class CatNode : public InnerNode {
|
||||
public:
|
||||
CatNode(Node *left, Node *right) :
|
||||
Node(left, right) { }
|
||||
InnerNode(left, right) { }
|
||||
void compute_nullable()
|
||||
{
|
||||
nullable = child[0]->nullable && child[1]->nullable;
|
||||
@ -378,10 +385,10 @@
|
||||
};
|
||||
|
||||
/* Match a node zero or more times. (This is a unary operator.) */
|
||||
class StarNode : public Node {
|
||||
class StarNode : public InnerNode {
|
||||
public:
|
||||
StarNode(Node *left) :
|
||||
Node(left)
|
||||
InnerNode(left)
|
||||
{
|
||||
nullable = true;
|
||||
}
|
||||
@ -414,10 +421,10 @@
|
||||
};
|
||||
|
||||
/* Match a node one or more times. (This is a unary operator.) */
|
||||
class PlusNode : public Node {
|
||||
class PlusNode : public InnerNode {
|
||||
public:
|
||||
PlusNode(Node *left) :
|
||||
Node(left) { }
|
||||
InnerNode(left) { }
|
||||
void compute_nullable()
|
||||
{
|
||||
nullable = child[0]->nullable;
|
||||
@ -451,10 +458,10 @@
|
||||
};
|
||||
|
||||
/* Match one of two alternative nodes. */
|
||||
class AltNode : public Node {
|
||||
class AltNode : public InnerNode {
|
||||
public:
|
||||
AltNode(Node *left, Node *right) :
|
||||
Node(left, right) { }
|
||||
InnerNode(left, right) { }
|
||||
void compute_nullable()
|
||||
{
|
||||
nullable = child[0]->nullable || child[1]->nullable;
|
||||
|
Loading…
x
Reference in New Issue
Block a user