Changeset 54791


Ignore:
Timestamp:
Jul 8, 2009, 1:01:10 PM (9 years ago)
Author:
Hartmut Kaiser
Message:

Spirit: added lexer testcase exhibiting a problem in current code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/spirit/test/lex/set_token_value.cpp

    r54690 r54791  
    251251    }
    252252
     253    // test two dedents, currently triggers a possible problem in regex engine
     254    {
     255        set_token_value<lexer_type> lexer;
     256        std::vector<token_type> tokens;
     257        std::string input(
     258            "\n"
     259            "    \n"
     260            "        \n"
     261            "\n");
     262        base_iterator_type first = input.begin();
     263
     264        using phoenix::arg_names::_1;
     265        BOOST_TEST(lex::tokenize(first, input.end(), lexer
     266          , phoenix::push_back(phoenix::ref(tokens), _1)));
     267
     268        int i[] = { 4, -1 };
     269        BOOST_TEST(test_indents(i, lexer.indents));
     270
     271        token_data d[] = {
     272            { ID_INDENT, 1 }, { ID_INDENT, 1 }, { ID_INDENT, 1 }
     273          , { ID_DEDENT, 2 }
     274          , { -1, 0 } };
     275        BOOST_TEST(test_tokens(d, tokens));
     276    }
     277
    253278    return boost::report_errors();
    254279}
Note: See TracChangeset for help on using the changeset viewer.