mirror of
https://github.com/micropython/micropython.git
synced 2026-01-08 21:20:13 +01:00
py/lexer: Support raw f-strings.
Support for raw str/bytes already exists, and extending that to raw f-strings is easy. It also reduces code size because it eliminates an error message. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -75,3 +75,7 @@ print(
|
||||
f"cd---------------------------------"
|
||||
f"e{y}f---------------------------------"
|
||||
)
|
||||
|
||||
# Raw f-strings.
|
||||
print(rf"\r\a\w {'f'} \s\t\r\i\n\g")
|
||||
print(fr"\r{x}")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
----------------
|
||||
[ 1] file_input_2(1) (n=10)
|
||||
tok(6)
|
||||
tok(5)
|
||||
[ 4] \(rule\|for_stmt\)(22) (n=4)
|
||||
id(i)
|
||||
[ 4] \(rule\|atom_paren\)(45) (n=1)
|
||||
@@ -9,7 +9,7 @@
|
||||
NULL
|
||||
[ 6] \(rule\|expr_stmt\)(5) (n=2)
|
||||
id(a)
|
||||
tok(16)
|
||||
tok(15)
|
||||
[ 7] \(rule\|expr_stmt\)(5) (n=2)
|
||||
id(b)
|
||||
str(str)
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
"""
|
||||
categories: Core
|
||||
description: Raw f-strings are not supported
|
||||
cause: MicroPython is optimised for code space.
|
||||
workaround: Unknown
|
||||
"""
|
||||
|
||||
rf"hello"
|
||||
Reference in New Issue
Block a user