-
Notifications
You must be signed in to change notification settings - Fork 847
Add FSC option for retrieving raw lexer tokens #10578
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
Conversation
4c7f088 to
4ff375e
Compare
|
Rebased due to awkward habits - but since there was a semi-direct merge conflict there I think it mostly works out to have a cleaner single commit to add this behavior. The only change from the initial PR commit is that I have now added the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be nice to add a test case.
Miserably these types of tests are still in our very worst test harness and haven't been ported to our newer less (but still quite) horrific test harness.
For now the test belongs here:
The tests are really quite yukky!!
The command line goes in an env.lst file, like this
This example validates the output of fsc /?
ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >help40.txt /? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx help40.txt help40.437.1033.bsl" # /?
The precmd here executes fsc and gathers the output
The post cmd compares the output against a
To verify the tests still succeed, use:
build -c release -testfsharpqa
|
I'll hack it in and get a commit up over the holidays, thanks for the feedback! |
|
Other than that the code looks good mate. Thanks for this. |
Thanks! I have two things to follow up on, before I've got a commit ready:
|
|
@dsyme - Context around this is starting to blur really badly in my memory. I summon thee, to determine whether we should:
|
|
Bump @dsyme @KevinRansom |
|
@laenas Can we please have some tests added. Thanks Kevin |
|
@KevinRansom |
This reverts commit 4080ff8.
|
@KevinRansom @laenas yeah, we will need to add some sort of framework for comparing the lexer tokens (with paths and (possibly) ranges erasure). Also, I think I messed up a bit with reverts, I'm gonna take a look at it. |
|
@vzarytovskii I'm happy to pitch in with regards to trying to bolt some framework on for that output comparison, I'm just trying to think through the edge-cases of the parsing of the string, since filepaths can be so wildly similar to other tokens we'd be looking for. I suppose rather than trying to 'skip over' what looks like a filepath, we could just read from both ends? Up to the first |
|
Yeah, that's a good question...in IL comparer/verifier, we just try to skip the paths and normalize certain things. Not sure if the same will work with the tokenizer. |
|
At a glance it should, I'm just thinking through trying to minimize the parsing complexity - since so much overlap exists between allowed filepaths and 'known' tokens in the output string. But second to that, what do we want these sort of tests to even...test? All tokens? Only tokens that filter? I'm a little fuzzy and don't have the source up now, but I don't think even normal |
Yeah, I think the only tokenizer tests are in service (TokenizerTests), which is slightly different. We pretty much only want to test if the command line switch works and outputs something which looks like tokens (both normal and unfiltered). I don't think we want to test tokenizer correctness here, since you didn't change anything about tokenizer itself. I don't even think we even should check ranges in such a test. |
|
@laenas I've added a few basic tests which are checking tokens for given source. Does it look right to you? |
|
CI is having a nap. There are some issues with AzDo currently. |
|
@vzarytovskii at a glance that all looks correct from the differentials. Could you elaborate for me - when you say 'removed paths and ranges' - this is because the test stuff now can use the |
Yeah, value inside I didn't include ranges and filenames in it (although it certainly could be done), the original output was looking like this:
So, Do you think we should include ranges and filenames into tests? They should be consistent between runs. |
That makes a lot of sense - out of curiosity - is that whole behavior something new this year? Because that's pretty much the right balance on this - and seems a lot better than my initial concerns, which were based on how a bunch of the other tests actually do full-compiler-output string matching - which seemed like it was going to be a pain to work with for this use case. |
I don't think it's new, probably only F#QA tests have this (and not CompilerAssert based ones). |
|
Aha, that's probably it. Makes tons of sense, thanks for polishing that up and explaining! |
Np, sorry that it took that long, and thanks for implementing it! |
|
CI is having a really bad day today :( |
We have a disjointed venn-diagram of the three state situation and the two relevant outcomes of that state - since two of them share a tokenizer and the other two of them share the consumption function. It seemed to either end up in duplication of the match deconstruction or duplication in the deconstruction. I chose the latter.
Also added a note that threw me for a brief moment at first glance as to how the flag's while loop was exiting and to what effect. A guidepost to the future.