Example #1
0
void RDOLexer::loc_action()
{
    if (m_lploc)
    {
        m_lploc->m_first_line = m_lploc->m_last_line;
        m_lploc->m_first_pos  = m_lploc->m_last_pos;
        m_lploc->m_first_seek = m_lploc->m_last_seek;
        for (int i = 0; i < YYLeng(); i++)
        {
            switch (YYText()[i])
            {
            case '\n': 
                m_lploc->m_last_line++;
                m_lploc->m_last_pos = 0;
                break;
            case '\r':
                m_lploc->m_last_pos = 0;
                break;
            default:
                m_lploc->m_last_pos++;
                break;
            }

            m_lploc->m_last_seek++;
        }
    }
}
Example #2
0
 void LexerError(const char * msg)
 {
    std::cout << msg << " at line number |" << lineno() << "|\t" ;
    std::cout << "text is |" << YYText() << "|" << std::endl ;
    throw "Parse Error";
 }