Skip to content

Commit

Permalink
Remove \/ from escape sequences (kdl v2)
Browse files Browse the repository at this point in the history
  • Loading branch information
eilvelia committed Oct 15, 2023
1 parent a08ad0e commit 6e872b1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Updated to KDL v2.0:
- - Added Line Tabulation U+000B to whitespace characters
- - Removed `\/` from escape sequences

## 0.1.0 (2022-10-01)

Expand Down
2 changes: 1 addition & 1 deletion GRAMMAR.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ float ::= dec-float
raw-string ::= "r" <any number of #> '"' <any-char>* '"' <the same number of #>
string ::= '"' string-character* '"'
string-character ::= <any-regular-char>
| "\n" | "\r" | "\t" | "\\" | "\/" | '\"' | "\b" | "\f"
| "\n" | "\r" | "\t" | "\\" | '\"' | "\b" | "\f"
| "\u{" hex-digit{1,6} "}"
```

Expand Down
1 change: 0 additions & 1 deletion src/lexer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ let rec string lexbuf =
| "\\r" -> Buffer.add_char string_buffer '\r'; string lexbuf
| "\\t" -> Buffer.add_char string_buffer '\t'; string lexbuf
| "\\\\" -> Buffer.add_char string_buffer '\\'; string lexbuf
| "\\/" -> Buffer.add_char string_buffer '/'; string lexbuf
| "\\\"" -> Buffer.add_char string_buffer '"'; string lexbuf
| "\\b" -> Buffer.add_char string_buffer '\b'; string lexbuf
| "\\f" -> Buffer.add_char string_buffer '\012'; string lexbuf
Expand Down
5 changes: 2 additions & 3 deletions test/parse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ let%expect_test "single-line comments" =
[%expect {| (node) |}]

let%expect_test "single-line comments can be empty" =
(* This is non-standard for now *)
test {|node //|};
[%expect {| (node) |}]

Expand Down Expand Up @@ -348,9 +347,9 @@ let%test_module "strings" = (module struct
[%expect {| Error: :1:19-1:19: Unterminated raw string |}]

let%expect_test "escapes" =
test {|- "\"\\\/\b\f\n\r\t"|};
test {|- "\"\\\b\f\n\r\t"|};
[%expect {|
(- (string "\"\\/\b\012\
(- (string "\"\\\b\012\
\n\r\t")) |}]

let%expect_test "escapes should not be interpreted in a raw string" =
Expand Down

0 comments on commit 6e872b1

Please sign in to comment.