libcpp backtrack lexer

Prathamesh Kulkarni bilbotheelffriend@gmail.com
Wed Feb 26 19:30:00 GMT 2014


Ping ?

On Tue, Feb 25, 2014 at 12:55 AM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> How do I backtrack the lexer to restart lexing from a particular token
> on the same
> line ?
> Shall this be correct: ?
> cpp_token *cur_token = pfile->cur_token;
> if (foo (pfile) == 0)  // foo advances pfile->cur_token
>   pfile->cur_token = cur_token; // restart lexing from cur_token
>
> foo does not advance pfile->cur_token beyond the same line, so I guess
> cur_token shall still be pointing to a valid token (since tokens on
> the same line are preserved) ?
>
> Thanks and Regards,
> Prathamesh



More information about the Gcc-help mailing list