Example #1
0
bool Importar::esNif(const std::string &lin, Lexer &lex)
{
    bool toret = false;
    unsigned int pos = lex.getCurrentPos();

    if ( std::isalpha( lex.getCurrentChar() ) ) {
        lex.advance();

        if ( Lexer::StandardDelimiters.find( lex.getCurrentChar() ) != std::string::npos
          || this->esSeparador( lex.getCurrentChar() ) )
        {
            toret = true;
        }
    }

    lex.reset( pos );
    return toret;
}
Example #2
0
bool GeneralLexer::chkSig(Lexer &flex, const std::string &ctrl)
{
    // Pasar delimitadores
    flex.skipDelim();

    // Apuntar los iteradores a las cadenas correctas
    const std::string &line = flex.getLine();
    std::string::const_iterator it2 = line.begin();
    std::string::const_iterator it = ctrl.begin();

    std::advance( it2, flex.getCurrentPos() );

    // Comparar
    for(; it != ctrl.end() && it2 != line.end(); ++it, ++it2) {
        if ( *it != *it2 ) {
            break;
        }
    }

    return ( it == ctrl.end() );
}