jgm / typst-hs

Haskell library for parsing and evaluating typst
Other
42 stars 5 forks source link

Colon for declaring dict literal should always be allowed #45

Closed CMDJojo closed 6 months ago

CMDJojo commented 6 months ago

In regards to #43,

A leading colon in dict literals should always be allowed (even if it isn't always required). Following are examples that Typst accepts but not typst-hs:

#let b = (:b:2)
#let c = ( : c : 3)
#let d = (:..a)
#let e = ( : ..b)

The grammar should be updated accordingly:

-- dict-expr ::= '(' (':' | ':'? (pair (',' pair)* ','?)) ')'
-- pair ::= (ident | str) ':' expr

I am working on this as we speak