- 
                Notifications
    
You must be signed in to change notification settings  - Fork 833
 
Implements extended if grammar #55
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
| 
           Migrated from CodePlex (mainly because I wanted a clean-slate as the history of this PR is quite long)  | 
    
| 
           After pouring through the F# parser on how to do error handling I have incorporated similar techniques now. The result should be a more stable preprocessor parser and with support for better error messages to the user. I ran the test suites (including VS integration) I saw no errors that were due to extended if grammar. There are two "small" issues remaining: Inside visual studio the squiggle for unrecognized characters are rendered in the wrong place: The error message from the compiler looks correct though but I think its due to that I consume all characters. If I go back to a previous pattern and simpler pattern it's probably fixed. The unit test for: This generates a parse error (and indication the preprocessor parser needs to be extended to handle this case). I have code that are supposed to handle it but it doesn't pick it up properly yet. Conclusion: 
 Therefore to my current knowledge I think this could be good to merge and schedule some minor bug fixes for later.  | 
    
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.
I suspect consuming "rest" is what causes the squiggle to be rendered in the wrong place on this error. Should be ok with just consuming '_'
| 
           Please consider to revert the changes in   | 
    
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.
This file should not be included in the commit
| 
           I think the code looks good - the addition of FSharp.Compiler.UnitTests as well as the actual implementation of the feature. I'm not sure if this has made the Jan 16 deadline for F# 4.0 though?  | 
    
| 
           This has been in-progress and earmarked for F# 4.0 for a long time. Given Marten's responsiveness to my requests and feedback over the past weeks/months (see original Codeplex thread) I think it's only fair to merge this for 4.0.  | 
    
| 
           Great, let's do it :)  | 
    
5f8880c    to
    417d3d1      
    Compare
  
    Origin: https://fslang.uservoice.com/forums/245727-f-language/suggestions/6079342-allow-extended-if-grammar This commit adds the possibility to write condtional compilation expressions like this: #if SILVERLIGHT || NETFX #endif or a bit more advanced: #if (SILVERLIGHT || NETFX) && COMPILED || !DEBUG #endif This commit doesn't add #elif which is an orthogonal problem.
417d3d1    to
    42e0766      
    Compare
  
    | 
           Fantastic!!!  | 
    
| 
           Hi @mrange, We need to add a "Speclet" to this feature to this collection. The format should follow the others: Links, Aim, Background, Design, Specification and so on. The "specification" section should give a guide for how the F# Language Specification will be updated for this feature. Could you submit a PR to that repo with an initial design/spec document please, and we'll iterate with you. If you need help doing the doc please let me know. Thanks  | 
    
| 
           @dsyme - I threw together a speclet: fsharp/fslang-design#40  | 
    

Origin: https://fslang.uservoice.com/forums/245727-f-language/suggestions/6079342-allow-extended-if-grammar
This commit adds the possibility to write condtional compilation expressions like this:
#if SILVERLIGHT || NETFX
#endif
or a bit more advanced:
#if (SILVERLIGHT || NETFX) && COMPILED || !DEBUG
#endif
This commit doesn't add #elif which is an orthogonal problem.