8000 fix: parse ` ` correctly by david-christiansen · Pull Request #433 · leanprover/verso · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: parse correctly #433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions src/verso/Verso/Parser.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1178,8 +1178,9 @@ mutual
let str := s.stxStack.back
if let .atom info str := str then
if str.startsWith "\" " && str.endsWith " \"" then
let str := "\"" ++ (str.drop 2 |>.dropRight 2) ++ "\""
if str.any (· != ' ') then
let core := str.drop 2 |>.dropRight 2
if core.any (· != ' ') then
let str := "\"" ++ core ++ "\""
let info : SourceInfo :=
match info with
| .none => .none
Expand Down Expand Up @@ -1398,6 +1399,39 @@ All input consumed.
#guard_msgs in
#eval code.test! "``foo bar``"

/--
info: Success! Final stack:
(Verso.Syntax.code "`" (str "\" \"") "`")
All input consumed.
-/
#guard_msgs in
#eval code.test! "` `"

/--
info: Success! Final stack:
(Verso.Syntax.code "`" (str "\" \"") "`")
All input consumed.
-/
#guard_msgs in
#eval code.test! "` `"

/--
info: Success! Final stack:
(Verso.Syntax.code "`" (str "\" \"") "`")
All input consumed.
-/
#guard_msgs in
#eval code.test! "` `"


/--
info: Success! Final stack:
(Verso.Syntax.code "`" (str "\"x\"") "`")
All input consumed.
-/
#guard_msgs in
#eval code.test! "` x `"

/--
info: Success! Final stack:
(Verso.Syntax.code
Expand Down
0