File: tokenidx.cc

package info (click to toggle)
bobcat 2.08.01-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,668 kB
  • ctags: 953
  • sloc: cpp: 10,403; makefile: 9,042; perl: 401; sh: 195
file content (17 lines) | stat: -rw-r--r-- 558 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "cgi.ih"

size_t CGIFSA::tokenIdx()
{
    size_t token = (this->*s_tokenizer[d_state])(); // get the next token

    vector<Transition>::iterator ret =              // look it up
        find_if(s_fsa[d_state].begin(), s_fsa[d_state].end(), 
            FnWrap1c<Transition const &, size_t, bool>
                    (&hasToken, token));

    d_tokenIdx = ret - s_fsa[d_state].begin();      // determine the index
    if (d_tokenIdx == s_fsa[d_state].size())
        --d_tokenIdx;

    return d_tokenIdx;                              // return it
}