Skip to content

Hi, I just make it works with recent version of pyparsing again #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ dist/
example.synctex.gz
extractsagecode.py
makecmds.sty
makestatic.py
remote-sagetex.py
run-sagetex-if-necessary.py
sage-plots-for-*.tex/
Expand All @@ -28,7 +27,6 @@ sagetex.ind
sagetex.py
sagetex.pyc
sagetex.sty
sagetexparse.py
.*.sage-history
.*.sage-chat
MANIFEST
10 changes: 6 additions & 4 deletions scripts.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ from pyparsing import *
% \begin{macrocode}
def skipToMatching(opener, closer):
nest = nestedExpr(opener, closer)
nest.setParseAction(lambda l, s, t: l[s:getTokensEndLoc()])
return nest
return originalTextFor(nest)

curlybrackets = skipToMatching('{', '}')
squarebrackets = skipToMatching('[', ']')
% \end{macrocode}
% Next, parser for |\sage|, |\sageplot|, and pause/unpause calls:
% \begin{macrocode}
sagemacroparser = r'\sage' + curlybrackets('code')
sagestrmacroparser = r'\sagestr' + curlybrackets('code')
sageplotparser = (r'\sageplot'
+ Optional(squarebrackets)('opts')
+ Optional(squarebrackets)('format')
Expand Down Expand Up @@ -365,8 +365,10 @@ class DeSageTex():
% Parse |\sage| macros. We just need to pull in the result from the
% |.sout| file and increment the counter---that's what |self.sage| does.
% \begin{macrocode}
strmacro = sagestrmacroparser
smacro = sagemacroparser
smacro.setParseAction(self.sage)
strmacro.setParseAction(self.sage)
% \end{macrocode}
% Parse the |\usepackage{sagetex}| line. Right now we don't support
% comma-separated lists of packages.
Expand Down Expand Up @@ -410,7 +412,7 @@ class DeSageTex():
% looks for any one of the above bits, while ignoring anything that
% should be ignored.
% \begin{macrocode}
doit = smacro | senv | ssilent | usepackage | splot | stexindent
doit = smacro | senv | ssilent | usepackage | splot | stexindent |strmacro
doit.ignore('%' + restOfLine)
doit.ignore(r'\begin{verbatim}' + SkipTo(r'\end{verbatim}'))
doit.ignore(r'\begin{comment}' + SkipTo(r'\end{comment}'))
Expand Down Expand Up @@ -496,7 +498,7 @@ class SageCodeExtractor():

def plotout(self, s, l, t):
self.result += '# \\sageplot{} from line %s:\n' % lineno(l, s)
if t.format is not '':
if t.format != '':
self.result += '# format: %s' % t.format[0][1:-1] + '\n'
self.result += t.code[1:-1] + '\n\n'

Expand Down