-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement raw string literals (#3556)
* feat: Implement raw string literals * Add documentation for raw strings * Add tests for raw strings * Changes for raw strings * Fixes for raw strings tests * Add test for raw strings * Add test for nested raw strings * Fix logic bug for raw strings * Update docs/docs/language_concepts/data_types/03_strings.md --------- Co-authored-by: kevaundray <kevtheappdev@gmail.com> Co-authored-by: jfecher <jfecher11@gmail.com>
- Loading branch information
1 parent
f3eac52
commit 87a302f
Showing
11 changed files
with
219 additions
and
4 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
5 changes: 5 additions & 0 deletions
5
tooling/nargo_cli/tests/compile_failure/raw_string_huge/Nargo.toml
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,5 @@ | ||
[package] | ||
name = "raw_string_huge" | ||
type = "bin" | ||
authors = [""] | ||
[dependencies] |
4 changes: 4 additions & 0 deletions
4
tooling/nargo_cli/tests/compile_failure/raw_string_huge/src/main.nr
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,4 @@ | ||
fn main() { | ||
// Fails because of too many hashes for raw string (256+ hashes) | ||
let _a = r##############################################################################################################################################################################################################################################################################"hello"##############################################################################################################################################################################################################################################################################; | ||
} |
6 changes: 6 additions & 0 deletions
6
tooling/nargo_cli/tests/compile_success_empty/raw_string/Nargo.toml
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 @@ | ||
[package] | ||
name = "raw_string" | ||
type = "bin" | ||
authors = [""] | ||
|
||
[dependencies] |
13 changes: 13 additions & 0 deletions
13
tooling/nargo_cli/tests/compile_success_empty/raw_string/src/main.nr
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,13 @@ | ||
global D = r#####"Hello "world""#####; | ||
|
||
fn main() { | ||
let a = "Hello \"world\""; | ||
let b = r#"Hello "world""#; | ||
let c = r##"Hello "world""##; | ||
assert(a == b); | ||
assert(b == c); | ||
assert(c == D); | ||
let x = r#"Hello World"#; | ||
let y = r"Hello World"; | ||
assert(x == y); | ||
} |
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