From c40857b38905b9ea298a777354eb4cb0da2213c6 Mon Sep 17 00:00:00 2001 From: John MacFarlane <jgm@berkeley.edu> Date: Mon, 16 Oct 2017 22:03:57 -0700 Subject: Improved handling of include files in LaTeX reader. Previously `\include` wouldn't work if the included file contained, e.g., a begin without a matching end. We've changed the Tok type so that it stores a full SourcePos, rather than just a line and column. So tokens keeep track of the file they came from. This allows us to use a simpler method for includes, which doesn't require parsing the included document as a whole. Closes #3971. --- src/Text/Pandoc/Readers/LaTeX/Types.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Text/Pandoc/Readers/LaTeX') diff --git a/src/Text/Pandoc/Readers/LaTeX/Types.hs b/src/Text/Pandoc/Readers/LaTeX/Types.hs index 2bef3cb1a..9e441714d 100644 --- a/src/Text/Pandoc/Readers/LaTeX/Types.hs +++ b/src/Text/Pandoc/Readers/LaTeX/Types.hs @@ -31,17 +31,17 @@ module Text.Pandoc.Readers.LaTeX.Types ( Tok(..) , TokType(..) , Macro(..) , ExpansionPoint(..) - , Line - , Column ) + , SourcePos + ) where import Data.Text (Text) -import Text.Parsec.Pos (Line, Column) +import Text.Parsec.Pos (SourcePos) data TokType = CtrlSeq Text | Spaces | Newline | Symbol | Word | Comment | Esc1 | Esc2 | Arg Int deriving (Eq, Ord, Show) -data Tok = Tok (Line, Column) TokType Text +data Tok = Tok SourcePos TokType Text deriving (Eq, Ord, Show) data ExpansionPoint = ExpandWhenDefined | ExpandWhenUsed -- cgit v1.2.3