mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
parser/libapparmor_re: expand comment of firstpos, lastpos, followpos
Elaborate in class comment of firstpos, lastpos, followpos, and nullable fields beyond just referencing the Dragon book. Also add the section of the book these are explained in.
This commit is contained in:
parent
39a2031487
commit
197b5d63fe
@ -116,13 +116,34 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* See the "Dragon Book" for an explanation of nullable, firstpos,
|
||||
* lastpos, and followpos.
|
||||
* firstpos, lastpos, and followpos are used to convert the syntax tree
|
||||
* to a DFA.
|
||||
*
|
||||
* firstpos holds nodes that can match the first character of a string
|
||||
* that matches the syntax tree. For the regex 'a*bcd', firstpos holds
|
||||
* the 'a' and 'b' nodes. firstpos is used to determine the start state
|
||||
* of the DFA.
|
||||
*
|
||||
* lastpos is the same as firstpos for the last character. For the regex
|
||||
* 'a*bcd', lastpos holds the 'd' node. lastpos is used to determine the
|
||||
* accepting states of the DFA.
|
||||
*
|
||||
* followpos holds the set of nodes that can match a character directly
|
||||
* after the current node. For the regexp 'a*bcd', the followpos of the
|
||||
* 'a' node are the 'b' node and the 'a' node itself. followpos is used
|
||||
* to determine the transitions of the DFA.
|
||||
*
|
||||
* nullable indicates that a node can match the empty string. It is used
|
||||
* to compute firstpos and lastpos.
|
||||
*
|
||||
* See the "Dragon Book" 2nd Edition section 3.9.2 for an in-depth
|
||||
* explanation.
|
||||
*/
|
||||
virtual void compute_nullable() { }
|
||||
virtual void compute_firstpos() = 0;
|
||||
virtual void compute_lastpos() = 0;
|
||||
virtual void compute_followpos() { }
|
||||
|
||||
virtual int eq(Node *other) = 0;
|
||||
virtual ostream &dump(ostream &os) = 0;
|
||||
void dump_syntax_tree(ostream &os);
|
||||
|
Loading…
x
Reference in New Issue
Block a user