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

Inline comment in multiline expression creates syntax error #236

Closed
asottile opened this issue Jun 7, 2016 · 0 comments
Closed

Inline comment in multiline expression creates syntax error #236

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

Comments

@asottile
Copy link
Collaborator

asottile commented Jun 7, 2016

#py x = [
    1,  ## For reasons
    2,
]
 $ 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 541, in getModuleCode
    self._parser.parse()
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 217, 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 207, 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 801, in parse
    self.eatDirective()
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_parser.py", line 854, in eatDirective
    handler(expr, line_col=line_col)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_compiler.py", line 205, in _add_with_line_col
    self._update_locals(expr)
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/legacy_compiler.py", line 198, in _update_locals
    self._local_vars.update(get_lvalues(expr))
  File "/nail/home/asottile/pg/yelp-main/virtualenv_run/lib/python2.7/site-packages/Cheetah/ast_utils.py", line 69, in get_lvalues
    ast_obj = ast.parse(expression)
  File "/usr/lib64/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
Cheetah.legacy_parser.ParseError: 

SyntaxError: unexpected EOF while parsing (<unknown>, line 1)

Line 4, column 2

Line|Cheetah Code
----|-------------------------------------------------------------
1   |#py x = [
2   |    1,  ## for reasons
3   |    2,
4   |]
      ^
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