forked from BranchTaken/Hemlock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
{|...|}
quoted string literal syntax scanning
This is OCaml-specific syntax. Omit support for tags, e.g. `{tag|...|tag}`, since doing so would substantially complicate scanning, and no extant code uses tags.
- Loading branch information
Jason Evans
committed
Sep 20, 2024
1 parent
65d1c61
commit 696b594
Showing
6 changed files
with
224 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
``{||}`` | ||
(Tok_qstring {source=[1:0..1:4); qstring=(Constant "")}) | ||
(Tok_end_of_input {source=[1:4..1:4)}) | ||
``{| | ||
|}`` | ||
(Tok_qstring {source=[1:0..2:2); qstring=(Constant "\n")}) | ||
(Tok_end_of_input {source=[2:2..2:2)}) | ||
``{| | ||
|
||
|}`` | ||
(Tok_qstring {source=[1:0..3:2); qstring=(Constant "\n\n")}) | ||
(Tok_end_of_input {source=[3:2..3:2)}) | ||
``{| | ||
|
||
|
||
|}`` | ||
(Tok_qstring {source=[1:0..4:2); qstring=(Constant "\n\n\n")}) | ||
(Tok_end_of_input {source=[4:2..4:2)}) | ||
``{|a | ||
b|}`` | ||
(Tok_qstring {source=[1:0..2:3); qstring=(Constant "a\nb")}) | ||
(Tok_end_of_input {source=[2:3..2:3)}) | ||
``{|a||}`` | ||
(Tok_qstring {source=[1:0..1:6); qstring=(Constant "a|")}) | ||
(Tok_end_of_input {source=[1:6..1:6)}) | ||
``{||a|}`` | ||
(Tok_qstring {source=[1:0..1:6); qstring=(Constant "|a")}) | ||
(Tok_end_of_input {source=[1:6..1:6)}) | ||
``{|||}`` | ||
(Tok_qstring {source=[1:0..1:5); qstring=(Constant "|")}) | ||
(Tok_end_of_input {source=[1:5..1:5)}) | ||
``{||||}`` | ||
(Tok_qstring {source=[1:0..1:6); qstring=(Constant "||")}) | ||
(Tok_end_of_input {source=[1:6..1:6)}) | ||
``{||a}|}`` | ||
(Tok_qstring {source=[1:0..1:7); qstring=(Constant "|a}")}) | ||
(Tok_end_of_input {source=[1:7..1:7)}) | ||
``{|�|}`` | ||
(Tok_qstring {source=[1:0..1:5); qstring=(Constant "�")}) | ||
(Tok_end_of_input {source=[1:5..1:5)}) | ||
``{||�|}`` | ||
(Tok_qstring {source=[1:0..1:6); qstring=(Constant "|�")}) | ||
(Tok_end_of_input {source=[1:6..1:6)}) | ||
``{|`` | ||
(Tok_qstring {source=[1:0..1:2); qstring=(Malformed ["[1:0..1:2): Unterminated string literal"])}) | ||
(Tok_end_of_input {source=[1:2..1:2)}) | ||
``{||`` | ||
(Tok_qstring {source=[1:0..1:3); qstring=(Malformed ["[1:0..1:3): Unterminated string literal"])}) | ||
(Tok_end_of_input {source=[1:3..1:3)}) |
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,31 @@ | ||
open! Basis.Rudiments | ||
open! Basis | ||
open! Hmc | ||
open! ScanTest | ||
|
||
let test () = | ||
scan_str "{||}"; | ||
scan_str "{| | ||
|}"; | ||
scan_str "{| | ||
|}"; | ||
scan_str "{| | ||
|}"; | ||
scan_str "{|a | ||
b|}"; | ||
scan_str "{|a||}"; | ||
scan_str "{||a|}"; | ||
scan_str "{|||}"; | ||
scan_str "{||||}"; | ||
scan_str "{||a}|}"; | ||
scan_str "{|�|}"; | ||
scan_str "{||�|}"; | ||
|
||
(* Errors. *) | ||
scan_str "{|"; | ||
scan_str "{||" | ||
|
||
let _ = test () |