This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #550 from Jaseci-Labs/triple_quoted_string_formatter
Triple-Quoted String Formatting Enhance
- Loading branch information
Showing
4 changed files
with
27 additions
and
16 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
6 changes: 6 additions & 0 deletions
6
jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/triple_quoted_string.jac
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
with entry { | ||
triple_quoted_string = """This is a triple quoted string. | ||
It can span multiple lines. | ||
It can contain any number of quotes or apostrophes. | ||
"""; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
import:py re; | ||
|
||
glob a: int=5; | ||
glob a: int = 5; | ||
|
||
with entry { | ||
arguments = {x:None for x in re.findall(r'\{([A-Za-z0-9_]+)\}', "Apple {apple} pineapple {pineapple}")}; | ||
a: int=5; | ||
arguments = {x: None for x in re.findall( | ||
r'\{([A-Za-z0-9_]+)\}', | ||
"Apple {apple} pineapple {pineapple}" | ||
)}; | ||
a: int = 5; | ||
if False { | ||
with open(f"Apple{apple}.txt") as f { # Fix syntax highlighting | ||
|
||
print(f.read()); | ||
} | ||
} | ||
print(arguments); | ||
print( | ||
"""This is a long | ||
line of code.""" | ||
); | ||
print("""This is a long | ||
line of code."""); | ||
} | ||
|
||
with entry{ | ||
a={"a":"apple", "b":"ball", "c":"cat"}; | ||
y={**a, "d":"dog", "e":"elephant"}; | ||
with entry { | ||
a = {"a": "apple", "b": "ball", "c": "cat"}; | ||
y = {**a, "d": "dog", "e": "elephant"}; | ||
print(y); | ||
} | ||
# Use before def error would be nice |
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