Skip to content

Commit

Permalink
Rewrote LaTeX reader with proper tokenization.
Browse files Browse the repository at this point in the history
This rewrite is primarily motivated by the need to
get macros working properly (#982, #934, #3779, #3236,
 #1390, #2888, #2118).

We now tokenize the input text, then parse the token stream.
Macros modify the token stream, so they should now be effective in any
context, including math. (Thus, we no longer need the clunky macro
processing capacities of texmath.)

A custom state LaTeXState is used instead of ParserState.
This, plus the tokenization, will require some rewriting
of the exported functions rawLaTeXInline, inlineCommand,
rawLaTeXBlock.
  • Loading branch information
jgm committed Jul 5, 2017
1 parent 3449f8b commit 0c100a2
Show file tree
Hide file tree
Showing 5 changed files with 961 additions and 780 deletions.
3 changes: 3 additions & 0 deletions src/Text/Pandoc/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ data PandocError = PandocIOError String IOError
| PandocTemplateError String
| PandocAppError String
| PandocEpubSubdirectoryError String
| PandocMacroLoop String
deriving (Show, Typeable, Generic)

instance Exception PandocError
Expand Down Expand Up @@ -107,6 +108,8 @@ handleError (Left e) =
PandocAppError s -> err 1 s
PandocEpubSubdirectoryError s -> err 31 $
"EPUB subdirectory name '" ++ s ++ "' contains illegal characters"
PandocMacroLoop s -> err 91 $
"Loop encountered in expanding macro " ++ s

err :: Int -> String -> IO a
err exitCode msg = do
Expand Down
Loading

0 comments on commit 0c100a2

Please sign in to comment.