You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: use parser restarting API instead of whitespace hacks.
This is possible after leanprover/lean4#10043
improved upstream parsing API.
This replaces the current use of `parserInputString` and seems clearer overall.
There are two main cases for string literals for us to process:
- string literals coming from Verso: in this case, `.getPos` and
`.getTailPos` do provide the correct start / end of the string,
without the quotes.
- string literals coming from Lean: in this case, we must account for
the quotes and fixup the positions.
We have handled this by convention, but `VersoUtils.parseString` takes
an optional parameter as it is used in both modes. Eventually we'd
like to move Verso-style strings to its own type instead of `StrLit`.
Notes:
- I couldn't port `VersoBlog.leanInit` as `Parser.parseHeader` always
parses from `pos := 0`. This is the last blocker to completely
remove `parserInputString`.
- In general, it seems like most functions using `mkParserState`
upstream could benefit from an update to take positions.
- Tests in `UsersGuide.Markup` had to be adapted due to use of
`contents.getString.trimAsciiEnd.copy`. I did this to pass CI, must
implement a better fix before merging.
- Code that depends on MD4Lean hasn't been ported as MD4 doesn't seem
to provide the right API for us.
- TODO: we should test `canonical := true` and quoting properly. Note
special cases such as `` `code ``
0 commit comments