forked from westes/flex
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Retargeted to rust #10
Open
db48x
wants to merge
93
commits into
eric-s-raymond:retargeting
Choose a base branch
from
db48x:retargeted-to-rust
base: retargeting
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This adds the Rust backend, along with a command-line switch to choose it over the cpp backend. The rust directory contains a manual port of a generated lexer to Rust; once it compiles and works I'll be able to make the corresponding changes to the rust-flex.skl and rust_backend.c.
turns out that two of the gotos cannot simply be replaced by loop labels
This requires an explicit break after the 'find_action loop, so that most code paths don't actually loop after entering 'yy_match.
…and expand a few C macros
and add a FILE type that so that we can implement Eq for it
so there's no need for a special method to do it. Also, this method presumably breaks things if you accidentally delete a buffer that is in the buffer stack but isn't the current buffer. The detail about not deallocating the buffer contents if we don't own it can be handled at the type level in Rust; currently we just have an owned Vec<u8> for that, but I can go back and make it generic, with a bound of AsRef<&[u8]>, so that we can handle both the owned and unowned cases automatically.
Still need to go in and remove yy_buffer_stack_top, since the Vec we store the stack in already knows its own length.
We're storing the stack in a Vec, which already has that information.
Also, make the input and output streams be Option<FILE>.
It's actually buffer.init() now.
Using Scan::wrap instead.
as previously suspected
and add a Debug impl to everything
Now that I've pretty much finished porting everything, I think that I have enough information to replace this with ordinary reads from the rust standard library, which would prevent this type of brain damage.
I put that in scare quotes because this is still pretty stupid, considering that the standard library is right there… Also, we need to actually store the number of bytes that we read.
Rust doesn't have them; use += and -= instead.
Just to be consistent between different m4 branches.
so it must therefore be a method
fixes ccl_rust
Fixes both the yymorearraybol_rust and yymorearray_rust tests.
and add some m4_dnl to clean up the blank lines
when M4_NO_MODE_YYMORE_USED is defined.
Mostly the changes are in ruleset.sh, which is printing out rules to build the "Go" tests using gcc, since the Go backend isn't quite producing Go code yet.
now that they are generated as part of the ruleset.
by tossing in a bunch of m4_dnl to delete newline characters.
the .l.go and .l.rs rules are quite important.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All the tests pass this time around