diagrams / diagrams-contrib

User-contributed extensions to diagrams
BSD 3-Clause "New" or "Revised" License
27 stars 30 forks source link

parser does not handle much of Plain Metafont #18

Closed byorgey closed 10 years ago

byorgey commented 10 years ago
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings         #-}

import           Diagrams.Backend.SVG.CmdLine
import           Diagrams.Coordinates
import           Diagrams.Prelude
import qualified Diagrams.TwoD.Path.Metafont  as MF

import           Data.Text

main =
   case (MF.fromString "(0,100)..(50,0)---(180,0)...{up}(200,100)") of
     Left err -> print err
     Right d  -> defaultMain (d # lw 1)
bergey commented 10 years ago

I should implement ---, ... and the direction aliases! And in the meantime, mention that they aren't supported.

byorgey commented 10 years ago

Hahaha, OK =)

byorgey commented 10 years ago

This was just the first example from the Metafont book that I picked at random.

bergey commented 10 years ago

It's the example I picked from the Metafont book to find out what those tokens are supposed to mean. =)

bergey commented 10 years ago

https://github.com/diagrams/diagrams-contrib/issues/23 implements '...', '--', and '---'. The direction aliases are trivial. I'm not planning to implement '&', because the semantics are clearer using Diagrams' '<>'.