{
uint fillIndex;
bool hasFillIndex = (0<=vFillIndexes);
+
if ( hasFillIndex == true )
{
fillIndex = vFillIndexes++;
}
}
-static
-bool state_is_in_non_trivial_SCC( const State* s )
+static bool state_is_in_non_trivial_SCC( const State* s )
{
-
- // does not link to self
- if ( s->link != s ){
- return true;
- }
-
- // or exists i: (s->go.spans[i].to->link == s)
- //
- // Note: (s->go.spans[i].to == s) is allowed, corresponds to s
- // looping back to itself.
- //
- for (uint i = 0; i < s->go.nSpans; ++i)
- {
- const State* t = s->go.span[i].to;
-
- if (t && t->link == s){
- return true;
- }
- }
- // otherwise no
- return false;
+
+ // does not link to self
+ if (s->link != s)
+ {
+ return true;
+ }
+
+ // or exists i: (s->go.spans[i].to->link == s)
+ //
+ // Note: (s->go.spans[i].to == s) is allowed, corresponds to s
+ // looping back to itself.
+ //
+ for (uint i = 0; i < s->go.nSpans; ++i)
+ {
+ const State* t = s->go.span[i].to;
+
+ if (t && t->link == s)
+ {
+ return true;
+ }
+ }
+ // otherwise no
+ return false;
}
uint maxDist(State *s)
{
- if ( s->depth != cInfinity ){
- // Already calculated, just return result.
- return s->depth;
- }
+ if (s->depth != cInfinity)
+ {
+ // Already calculated, just return result.
+ return s->depth;
+ }
uint mm = 0;
for (uint i = 0; i < s->go.nSpans; ++i)
void calcDepth(State *head)
{
// mark non-key states by s->link = NULL ;
- for (State* s = head; s; s = s->next )
+ for (State* s = head; s; s = s->next)
{
if ( (s!=head) && !state_is_in_non_trivial_SCC(s) )
{
}
}
- for (State* s = head; s; s = s->next )
+ for (State* s = head; s; s = s->next)
{
s->depth = cInfinity;
}
// calculate max number of transitions before guarantied to reach
// a key state.
- for (State* s = head; s; s = s->next ){
+ for (State* s = head; s; s = s->next)
+ {
maxDist(s);
}
}
{
o << "{\n\tYYCTYPE yych;\n";
oline += 2;
- if (bUsedYYAccept) {
+ if (bUsedYYAccept)
+ {
o << "\tunsigned int yyaccept = 0;\n";
oline++;
}