Add String concatenation and String Interpolation#954
Add String concatenation and String Interpolation#954
Conversation
…ort string additions
Kronos3
left a comment
There was a problem hiding this comment.
Thanks for the contribution! This is missing some tests. Take a look at compiler/tools/fpp-check and fpp-to-cpp.
We'll probably need tests for various forms of error/ok cases in fpp-check and a nominal case for the fpp-to-cpp.
|
Thanks for this pull request! It is a good start. To contribute a new feature to FPP, you will need to use this process: https://github.com/nasa/fpp/wiki/Adding-New-Features-to-FPP. If this sounds OK, we will make a feature branch, and you can make PRs to that. The first thing we will need to do is to agree on the spec. The approach to string concatenation seems good. For interpolation, I think we will need to define an interpolation syntax that is parsed and interpreted during analysis, similar to the way that string interpolation works in Scala or Python. For instance, we probably want to allow this: It might make sense to add concatenation separately, since it seems simpler. |
|
We will also decide whether we want to allow string expressions inside an interpolation, like this: In this case we could just write or so maybe it's not that useful. However, for consistency, it might be good to allow it. All of this has to be worked out in the spec before we proceed to implementation. |
@Kronos3 Thank you for your review. I understand that testing is needed. I will add more test cases; here are the test files that I have identified as needing modification for robust test cases:
It looks like we will be trying a different approach for string interpolation.
Please review and let me know if any changes. |
@bocchino Thanks, I understand. Please make the feature branch; I will work on that with wiki guidelines.
I understand. That approach is cleaner architecturally, but it would require extending the analyzer to resolve interpolated variables. I initially tried handling interpolation in the lexer/parser to keep the implementation localized and avoid modifying later compilation phases. I’m happy to refactor it toward the cleaner architecture.
Absolutely, I will update the tests needed for concatenation and make a separate pull request (after closing this one). Please let me know what do you think. |
|
Sounds good, thanks for agreeing to develop this feature! I made a feature branch here: https://github.com/nasa/fpp/tree/feature/string-concat Since string concatenation is simpler, and since concatenation is already a complete solution for configuring FPP code phases, let's start with concatenation only. Can you make a pull request to the feature branch that follows the procedure on the wiki for adding string concatenation? Once that's done we can proceed to string interpolation. |
|
Closing this now |
Added:
String concatenation
Stringtype.String interpolation
Closes #893