diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-08-07 13:38:15 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-08-07 13:38:15 -0700 |
commit | 9e6b9cdc5face62842cfee6a0eacefed82973239 (patch) | |
tree | 25acbc2e7952c995c35a8cbbd2258e8001ed8d56 /src/Text/Pandoc/Readers/LaTeX | |
parent | 3504915e63c68c3a4e91b8dcccb90c93435cf212 (diff) | |
download | pandoc-9e6b9cdc5face62842cfee6a0eacefed82973239.tar.gz |
LaTeX reader: Support `\let`.
Also, fix regular macros so they're expanded at the
point of use, and NOT also the point of definition.
`\let` macros, by contrast, are expanded at the
point of definition. Added an `ExpansionPoint`
field to `Macro` to track this difference.
Diffstat (limited to 'src/Text/Pandoc/Readers/LaTeX')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX/Types.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/Types.hs b/src/Text/Pandoc/Readers/LaTeX/Types.hs index 6f84ae1f1..2bef3cb1a 100644 --- a/src/Text/Pandoc/Readers/LaTeX/Types.hs +++ b/src/Text/Pandoc/Readers/LaTeX/Types.hs @@ -30,6 +30,7 @@ Types for LaTeX tokens and macros. module Text.Pandoc.Readers.LaTeX.Types ( Tok(..) , TokType(..) , Macro(..) + , ExpansionPoint(..) , Line , Column ) where @@ -43,6 +44,9 @@ data TokType = CtrlSeq Text | Spaces | Newline | Symbol | Word | Comment | data Tok = Tok (Line, Column) TokType Text deriving (Eq, Ord, Show) -data Macro = Macro Int (Maybe [Tok]) [Tok] +data ExpansionPoint = ExpandWhenDefined | ExpandWhenUsed + deriving (Eq, Ord, Show) + +data Macro = Macro ExpansionPoint Int (Maybe [Tok]) [Tok] deriving Show |