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

multiple with_prototypes at the same stack level are currently unsupported #178

Closed
keith-hall opened this issue Jun 13, 2018 · 0 comments · Fixed by #220
Closed

multiple with_prototypes at the same stack level are currently unsupported #178

keith-hall opened this issue Jun 13, 2018 · 0 comments · Fixed by #220

Comments

@keith-hall
Copy link
Collaborator

For example, this test, if put in parser.rs, would fail:

#[test]
    fn can_parse_two_with_prototypes_at_same_stack_level() {
        let syntax = r#"
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
scope: source.example-wp
contexts:
  main:
    - match: a
      scope: a
      push:
        - match: b
          scope: b
          set:
            - match: c
              scope: c
          with_prototype:
            - match: '2'
              scope: '2'
      with_prototype:
        - match: '1'
          scope: '1'
"#;

        let syntax = SyntaxDefinition::load_from_str(&syntax, true, None).unwrap();
        expect_scope_stacks_with_syntax("abc12", &["<1>", "<2>"], syntax);
    }
failures:

---- parsing::parser::tests::can_parse_two_with_prototypes_at_same_stack_level stdout ----
	abc12
^ +source.example-wp
abc12
^ +a
abc12
 ^ pop 1
abc12
 ^ +b
abc12
  ^ pop 1
abc12
  ^ +c
abc12
   ^ pop 1
abc12
    ^ +2
abc12
     ^ pop 1
ScopeStack { clear_stack: [], scopes: [<source.example-wp>] }
ScopeStack { clear_stack: [], scopes: [<source.example-wp>, <a>] }
ScopeStack { clear_stack: [], scopes: [<source.example-wp>] }
ScopeStack { clear_stack: [], scopes: [<source.example-wp>, <b>] }
ScopeStack { clear_stack: [], scopes: [<source.example-wp>] }
ScopeStack { clear_stack: [], scopes: [<source.example-wp>, <c>] }
ScopeStack { clear_stack: [], scopes: [<source.example-wp>] }
ScopeStack { clear_stack: [], scopes: [<source.example-wp>, <2>] }
ScopeStack { clear_stack: [], scopes: [<source.example-wp>] }
thread 'parsing::parser::tests::can_parse_two_with_prototypes_at_same_stack_level' panicked at 'expected scope stack '<1>' missing', src/parsing/parser.rs:1324:13

but using this syntax definition in Sublime Text, the 1 and the 2 both receive scopes.

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

Successfully merging a pull request may close this issue.

1 participant