Skip to content
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

Single line #def ending in #slurp causes compilation error #246

Open
asottile opened this issue Jun 29, 2016 · 0 comments
Open

Single line #def ending in #slurp causes compilation error #246

asottile opened this issue Jun 29, 2016 · 0 comments
Labels

Comments

@asottile
Copy link
Collaborator

Not sure what this is supposed to do, but it certainly shouldn't stacktrace!

#def f(): #slurp
$ cheetah-compile test.tmpl
Compiling test.tmpl
Traceback (most recent call last):
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/bin/cheetah-compile", line 11, in <module>
    sys.exit(main())
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/cheetah_compile.py", line 91, in main
    compile_all(sys.argv[1:])
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/cheetah_compile.py", line 87, in compile_all
    compile_template(filename)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/cheetah_compile.py", line 20, in compile_template
    return compile_file(filename, **kwargs)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/compile.py", line 50, in compile_file
    compiled_source = compile_source(contents, **kwargs)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/compile.py", line 33, in compile_source
    return compiler.getModuleCode()
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_compiler.py", line 547, in getModuleCode
    self._parser.parse()
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 153, in inner
    return func(self, *args, **kwargs)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 435, in parse
    self.eatDirective()
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 477, in eatDirective
    directiveParser()
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 642, in eatDef
    self._eatDefOrBlock('def')
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 678, in _eatDefOrBlock
    endPos=endOfFirstLinePos,
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 721, in _eatSingleLineDef
    self.parse(breakPoint=endPos)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 160, in inner
    sys.exc_info()[2],
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 153, in inner
    return func(self, *args, **kwargs)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 435, in parse
    self.eatDirective()
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 477, in eatDirective
    directiveParser()
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 774, in eatSlurp
    self.readToEOL(gobble=True)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/SourceReader.py", line 126, in readToEOL
    return self.readTo(to=pos, start=start)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/SourceReader.py", line 114, in readTo
    self.checkPos(to)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/SourceReader.py", line 73, in checkPos
    pos, self._breakPoint - 1
Cheetah.legacy_parser.ParseError: 

AssertionError: pos (17) is invalid: beyond the stream's end (15)

Line 1, column 11

Line|Cheetah Code
----|-------------------------------------------------------------
1   |#def f(): #slurp
               ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant