Skip to content

Commit ab6ce04

Browse files
Joe NeemanEthiraric
authored andcommitted
Parse True and TRUE as bools
1 parent 719c168 commit ab6ce04

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

saphyr/src/scalar.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ impl<'input> Scalar<'input> {
188188
}
189189
}
190190
match &*v {
191-
"~" | "null" | "NULL" => Self::Null,
192-
"true" => Self::Boolean(true),
193-
"false" => Self::Boolean(false),
191+
"~" | "null" | "Null" | "NULL" => Self::Null,
192+
"true" | "True" | "TRUE" => Self::Boolean(true),
193+
"false" | "False" | "FALSE" => Self::Boolean(false),
194194
_ => {
195195
if let Ok(integer) = v.parse::<i64>() {
196196
Self::Integer(integer)

saphyr/tests/emitter.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ string2: "true"
126126
string3: "false"
127127
string4: "~"
128128
null0: ~
129-
[true, false]: real_bools
130-
[True, TRUE, False, FALSE, y,Y,yes,Yes,YES,n,N,no,No,NO,on,On,ON,off,Off,OFF]: false_bools
129+
[true, True, TRUE, false, False, FALSE]: real_bools
130+
[y,Y,yes,Yes,YES,n,N,no,No,NO,on,On,ON,off,Off,OFF]: false_bools
131131
bool0: true
132132
bool1: false"#;
133133
let expected = r#"---
@@ -138,13 +138,13 @@ string3: "false"
138138
string4: "~"
139139
null0: ~
140140
? - true
141+
- true
142+
- true
143+
- false
144+
- false
141145
- false
142146
: real_bools
143-
? - "True"
144-
- "TRUE"
145-
- "False"
146-
- "FALSE"
147-
- y
147+
? - y
148148
- Y
149149
- "yes"
150150
- "Yes"

0 commit comments

Comments
 (0)