@@ -390,15 +390,15 @@ from pyparsing import *
390390% \begin{macrocode}
391391def skipToMatching(opener, closer):
392392 nest = nestedExpr(opener, closer)
393- nest.setParseAction(lambda l, s, t: l[s:getTokensEndLoc()])
394- return nest
393+ return originalTextFor(nest)
395394
396395curlybrackets = skipToMatching('{', '}' )
397396squarebrackets = skipToMatching('[', ']' )
398397% \end{macrocode}
399398% Next, parser for |\sage|, |\sageplot|, and pause/unpause calls:
400399% \begin{macrocode}
401400sagemacroparser = r'\sage ' + curlybrackets('code')
401+ sagestrmacroparser = r'\sagestr ' + curlybrackets('code')
402402sageplotparser = (r'\sageplot '
403403 + Optional(squarebrackets)('opts')
404404 + Optional(squarebrackets)('format')
@@ -474,8 +474,10 @@ class DeSageTex():
474474% Parse |\sage| macros. We just need to pull in the result from the
475475% |.sout| file and increment the counter---that's what |self.sage| does.
476476% \begin{macrocode}
477+ strmacro = sagestrmacroparser
477478 smacro = sagemacroparser
478479 smacro.setParseAction(self.sage)
480+ strmacro.setParseAction(self.sage)
479481% \end{macrocode}
480482% Parse the |\usepackage{sagetex}| line. Right now we don't support
481483% comma-separated lists of packages.
@@ -519,7 +521,7 @@ class DeSageTex():
519521% looks for any one of the above bits, while ignoring anything that
520522% should be ignored.
521523% \begin{macrocode}
522- doit = smacro | senv | ssilent | usepackage | splot | stexindent
524+ doit = smacro | senv | ssilent | usepackage | splot | stexindent |strmacro
523525 doit.ignore('% ' + restOfLine)
524526 doit.ignore(r'\begin {verbatim }' + SkipTo(r' \end {verbatim }'))
525527 doit.ignore(r'\begin {comment }' + SkipTo(r'\end {comment }'))
0 commit comments