-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic f-strings (intepolated strings) (#258)
* Squashed commit of the following: commit 1dbafe3 Author: Mikhail Yakshin <[email protected]> Date: Thu Feb 29 15:08:24 2024 +0000 ExpressionsSpec: f-strings: added test with newline in the middle, fixed name of test with double quote in the middle commit 8605f3f Author: Mikhail Yakshin <[email protected]> Date: Thu Feb 29 15:04:40 2024 +0000 Lexical: moved fstringItem + fstringChar from Expressions; Expressions: fixed rep -> repX to avoid whitespace problem commit 17f9e40 Author: Mikhail Yakshin <[email protected]> Date: Sat Oct 14 21:07:58 2023 +0100 Added similar escaped quote+space test for double-quoted string commit c0083fb Author: Mikhail Yakshin <[email protected]> Date: Sat Oct 14 20:48:19 2023 +0100 Added tests suggested in PR review: quote in f-string, regular string in f-string, f-string in f-string commit 1b22258 Author: Mikhail Yakshin <[email protected]> Date: Sat Oct 14 20:38:19 2023 +0100 Apply suggestions from code review Co-authored-by: Petr Pučil <[email protected]> commit 97ffceb Author: Mikhail Yakshin <[email protected]> Date: Sat Oct 14 08:50:41 2023 +0100 Added basic interpolated string (f-string) translation into target languages, mostly working off concatenation and existing other-types-to-string conversions. Supports only integers and strings now. Added basic unit tests. * GoTranslator: given non-string nature, added custom implementation using `fmt.Sprintf` * CommonLiterals: split generation of string "body" (without quotes) and adding quotes to it * CommonMethods: param name cleanup commit 1c7c759 Author: Mikhail Yakshin <[email protected]> Date: Sat Oct 14 08:23:12 2023 +0100 Implemented basic f-string parsing in expression language * Adjust to adhere to Scala 2.13 + FastParse 2.3.3 * GoTranslator: fixed as per discussion in PR to replace everything with just `%v` * Expressions: used raw sequence operators which bypass whitespace allowance, added lots of tests to ensure that it works as intended * GoTranslator: fix problem with `%` in the raw string segment in f-strings; modified common test to accommodate this pattern * ExpressionValidator: allow validation of Ast.expr.InterpolatedStr * doInterpolatedStringLiteral: handle empty string special case
- Loading branch information
Showing
13 changed files
with
273 additions
and
63 deletions.
There are no files selected for viewing
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 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 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 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 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 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 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 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
Oops, something went wrong.