Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative Byte Sources for the Lexer #6

Open
sebastianriese opened this issue Aug 27, 2012 · 2 comments
Open

Alternative Byte Sources for the Lexer #6

sebastianriese opened this issue Aug 27, 2012 · 2 comments

Comments

@sebastianriese
Copy link
Owner

Currently the generated lexers can only open files by name and the files must be mmap-able.

Therefore it would be nice to be capable of lexing from other sources, such as strings, sockets, pipes, stdin etc. (On 32bit machines there may also be a problem when mmap-ing very large files due to limited address space).

While lexing from strings is trivially added (just the constructor of the Lexer class has to be adapted), lexing from other sources is an interesting task, especially if the lookahead should be limited (compare the flex interactive mode).

Additionally a stack of input files would be nice to enable inclusion of source files.

@sebastianriese
Copy link
Owner Author

Partially solved: We now can parse from strings and non-mmappable files, which are slurped (this behavious is obviously non-optimal in many cases and non-interactive).

@sebastianriese
Copy link
Owner Author

The switch to an InputBuffer which wraps the file for reading makes easy extension of byte-sources possible. Until now only string input and whole file input (via mmap or that is not possible by slurping the file). Other Strategies should be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant