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

SyntaxError: Sequence items are not allowed on the same line with map keys #10

Closed
ikatyang opened this issue May 30, 2018 · 4 comments
Closed

Comments

@ikatyang
Copy link
Contributor

ikatyang commented May 30, 2018

Sorry for the bad title, I'm not sure how to name this issue.

version:
1.0.0-beta.6

input:

(extract from https://github.com/prettier/prettier/blob/d0cd112/.circleci/config.yml)

aliases:
  - restore_cache:
      - v1-yarn-cache
  - save_cache:
      paths:
        - ~/.cache/yarn
  - &restore_deps_cache
    keys:
      - v1-deps-cache-{{ checksum "yarn.lock" }}

output:

SyntaxError: Sequence items are not allowed on the same line with map keys (7:3)
  5 |       paths:
  6 |         - ~/.cache/yarn
> 7 |   - &restore_deps_cache
    |   ^^^^^^^^^^^^^^^^^^^^
> 8 |     keys:
    | ^^^^^^^^^
> 9 |       - v1-deps-cache-{{ checksum "yarn.lock" }}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

expected:

no error.

P.S. It parses correctly if there's no indentation:

aliases:
- restore_cache:
    - v1-yarn-cache
- save_cache:
    paths:
      - ~/.cache/yarn
- &restore_deps_cache
  keys:
    - v1-deps-cache-{{ checksum "yarn.lock" }}
@eemeli
Copy link
Owner

eemeli commented May 31, 2018

This is a frankly ludicrous corner case that you've managed to find. Will dig into this a bit more later, but here's the minimal case that I've been able to break it down to:

  - a
  - b:
    - c
  - d

If you remove any part of that, the bug is not triggered.

@eemeli eemeli closed this as completed in 50f0073 May 31, 2018
@ikatyang
Copy link
Contributor Author

Tried on the current master 024e81d, the case mentioned above is fixed, but if I tried to parse the entire file (https://github.com/prettier/prettier/blob/d0cd112/.circleci/config.yml) it fails again, it seems the entire file should be a good test case.

Here's the minimal failed part (probably):

aliases:
- save_cache:
    paths:
      - ~/.cache/yarn
    key: v1-yarn-cache
- keys:
SyntaxError: Sequence items are not allowed on the same line with map keys (6:1)
  4 |       - ~/.cache/yarn
  5 |     key: v1-yarn-cache
> 6 | - keys:
    | ^^^^^^^
  7 | 

@ikatyang
Copy link
Contributor Author

ikatyang commented Jun 7, 2018

Friendly ping @eemeli, should I open another issue to track it?

@eemeli
Copy link
Owner

eemeli commented Jun 7, 2018

Nah, this is still good for tracking this. Sorry for the delay, have been busy with some other things recently. Will return to this hopefully later today, but at least within a few days.

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