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

Rule 'name' didn't match at '' #61

Closed
tshead2 opened this issue May 4, 2018 · 7 comments
Closed

Rule 'name' didn't match at '' #61

tshead2 opened this issue May 4, 2018 · 7 comments

Comments

@tshead2
Copy link

tshead2 commented May 4, 2018

After adding sphinx-js to my documentation build, I get the following:

Exception occurred:
  File "/ascldap/users/tshead/miniconda3/lib/python3.6/site-packages/parsimonious/expressions.py", line 127, in match
    raise error
parsimonious.exceptions.ParseError: Rule 'name' didn't match at '' (line 2, column 26).

Here's my software stack:

$ conda --version
conda 4.5.2
$ python --version
Python 3.6.3 :: Anaconda, Inc.
$ conda list | grep -i nodejs
nodejs                    8.9.3                h439df22_0  
$ conda list | grep -i sphinx-js
sphinx-js                 2.5                       <pip>
$ npm list -g | grep -i jsdoc
├─┬ jsdoc@3.5.5

I've tried experimenting with older versions of JSDoc and sphinx-js, but the symptoms are unchanged.

Here's the full traceback from the Sphinx log:

$ cat /tmp/sphinx-err-zfw3zcng.log
# Sphinx version: 1.7.4
# Python version: 3.6.3 (CPython)
# Docutils version: 0.14 
# Jinja2 version: 2.10
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
  File "/ascldap/users/tshead/miniconda3/lib/python3.6/site-packages/sphinx/cmdline.py", line 303, in main
    args.warningiserror, args.tags, args.verbosity, args.jobs)
  File "/ascldap/users/tshead/miniconda3/lib/python3.6/site-packages/sphinx/application.py", line 233, in __init__
    self._init_builder()
  File "/ascldap/users/tshead/miniconda3/lib/python3.6/site-packages/sphinx/application.py", line 311, in _init_builder
    self.emit('builder-inited')
  File "/ascldap/users/tshead/miniconda3/lib/python3.6/site-packages/sphinx/application.py", line 444, in emit
    return self.events.emit(event, self, *args)
  File "/ascldap/users/tshead/miniconda3/lib/python3.6/site-packages/sphinx/events.py", line 79, in emit
    results.append(callback(*args))
  File "/ascldap/users/tshead/miniconda3/lib/python3.6/site-packages/sphinx_js/jsdoc.py", line 64, in run_jsdoc
    doclet_full_path(d, root_for_relative_paths),
  File "/ascldap/users/tshead/miniconda3/lib/python3.6/site-packages/sphinx_js/jsdoc.py", line 135, in doclet_full_path
    path_and_formal_params['path'].parse(path))
  File "/ascldap/users/tshead/miniconda3/lib/python3.6/site-packages/parsimonious/expressions.py", line 110, in parse
    node = self.match(text, pos=pos)
  File "/ascldap/users/tshead/miniconda3/lib/python3.6/site-packages/parsimonious/expressions.py", line 127, in match
    raise error
parsimonious.exceptions.ParseError: Rule 'name' didn't match at '' (line 2, column 26).

Cheers,
Tim

@erikrose
Copy link
Contributor

erikrose commented May 4, 2018

sphinx-js is getting surprised by something jsdoc is emitting. This shouldn't happen and is probably my fault. Can you share the code you're running it over? Failing that, can you muck with the code to give me more to go on?

Change this, in jsdoc.py…

        try:
            app._sphinxjs_doclets_by_path.add(
                doclet_full_path(d, root_for_relative_paths),
                d)
        except PathTaken as conflict:
            conflicts.append(conflict.segments)

…to this…

        try:
            app._sphinxjs_doclets_by_path.add(
                doclet_full_path(d, root_for_relative_paths),
                d)
        except PathTaken as conflict:
            conflicts.append(conflict.segments)
        except:
            print(d)

…and it'll spit out the raw jsdoc output when you run it again. Then send me the result. Thanks!

@tshead2
Copy link
Author

tshead2 commented May 4, 2018

Thanks for the quick response. Here's the problematic output and the code that triggers it (note: .js file renamed so it can be attached):

problem.txt
jquery.gridster.js.txt

Cheers,
Tim

@erikrose
Copy link
Contributor

erikrose commented May 4, 2018

Thanks for the info! I'll have a look.

@erikrose
Copy link
Contributor

erikrose commented May 30, 2018

The trouble is these lines…

	 * @method add_resize_handle
	 *  representing the widget.

…which cause the method's longname to be literally add_resize_handle\n representing the widget., probably not your intent. I'll do some thinking about what to do in such cases. :-)

@tshead2
Copy link
Author

tshead2 commented May 30, 2018

I should mention that this is third-party code, so setting jsdoc_config_path and setting-up a source include pattern (which I would have done anyway) is the workaround.

Cheers,
Tim

@erikrose
Copy link
Contributor

erikrose commented Jun 6, 2018

I spent some time trying to make us properly tolerate and escape chars like CR and LF (and the namepath separators like #, ., and ~) but ran out of time and brainpower for now. There are a lot of corner cases. Here's where I stopped: https://github.com/erikrose/sphinx-js/compare/namepath-separator-escaping?expand=1.

Interestingly, the root of your particular problem wasn't the line break at all; my parser is happy to eat that. It's the trailing period. Since it expects a namepath and period is a separator, it rightly expects something to come after it.

@erikrose
Copy link
Contributor

erikrose commented Jun 6, 2018

Filed under #66.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants