~sircmpwn/hare-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH 1/2] strings::template: fix typo in README

Details
Message ID
<20221201093957.24303-1-noam@pixelhero.dev>
DKIM signature
missing
Download raw message
Patch: +1 -1
Signed-off-by: Noam Preil <noam@pixelhero.dev>
---
 strings/template/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/strings/template/README b/strings/template/README
index 30d8d68f..98a95f45 100644
--- a/strings/template/README
+++ b/strings/template/README
@@ -7,7 +7,7 @@ names must be alphanumeric ASCII characters (i.e. for which [[ascii::isalnum]]
returns true). A literal "$" may be printed by using it twice: "$$". Variables
may also be used with braces, i.e. ${variable}, so that they can be placed
immediately next to alphanumeric characters; such variables may include
non-alphanumeric characters other than '_'.
non-alphanumeric characters other than '}'.

	const src = "Hello, $user! Your balance is $$$balance.\n";
	const template = template::compile(src)!;
-- 
2.38.1


 Noam Preil

[PATCH 2/2] strings::template: reject left braces

Details
Message ID
<20221201093957.24303-2-noam@pixelhero.dev>
In-Reply-To
<20221201093957.24303-1-noam@pixelhero.dev> (view parent)
DKIM signature
missing
Download raw message
Patch: +4 -2
Signed-off-by: Noam Preil <noam@pixelhero.dev>
---
 strings/template/README      | 2 +-
 strings/template/template.ha | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/strings/template/README b/strings/template/README
index 98a95f45..d693d45b 100644
--- a/strings/template/README
+++ b/strings/template/README
@@ -7,7 +7,7 @@ names must be alphanumeric ASCII characters (i.e. for which [[ascii::isalnum]]
returns true). A literal "$" may be printed by using it twice: "$$". Variables
may also be used with braces, i.e. ${variable}, so that they can be placed
immediately next to alphanumeric characters; such variables may include
non-alphanumeric characters other than '}'.
non-alphanumeric characters other than '{' and '}'.

	const src = "Hello, $user! Your balance is $$$balance.\n";
	const template = template::compile(src)!;
diff --git a/strings/template/template.ha b/strings/template/template.ha
index 2dd335e1..2ce586bc 100644
--- a/strings/template/template.ha
+++ b/strings/template/template.ha
@@ -132,7 +132,9 @@ fn parse_variable(
		};

		if (brace) {
			if (rn != '}') {
			if (rn == '{') {
				return errors::invalid;
			} else if (rn != '}') {
				strio::appendrune(buf, rn)!;
			} else {
				break;
-- 
2.38.1


 Noam Preil
Details
Message ID
<CP5RJOY26FDT.2E9E53W0USENP@taiga>
In-Reply-To
<20221201093957.24303-1-noam@pixelhero.dev> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git@git.sr.ht:~sircmpwn/hare
   637d730a..abaf8ec9  master -> master
Reply to thread Export thread (mbox)