refactor lexer (#2)

Reduce manual usage of getPosition and setting it and improve some helper functions.

Reviewed-on: #2
Reviewed-by: elland <igor@elland.me>
Co-authored-by: Léana 江 <leana.jiang+git@icloud.com>
Co-committed-by: Léana 江 <leana.jiang+git@icloud.com>
This commit is contained in:
Primrose 2025-09-26 14:44:46 +00:00 committed by Primrose
parent 39cfe2035d
commit 6064afd0b9
3 changed files with 91 additions and 106 deletions

View file

@ -12,7 +12,7 @@ bold ::= '__' text_no_newline '__'
monospace ::= '@' text_content '@'
link ::= module_link | hyperlink | markdown_link
module_link ::= '"' module_name ( '#' anchor_name )? '"'
module_link ::= '"' module_name ( ('#' | '\#') anchor_name )? '"'
hyperlink ::= '<' url ( ' ' link_text )? '>'
markdown_link ::= '[' link_text '](' ( url | module_link ) ')'