Skip to content

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

@keith-hall

Description

@keith-hall

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions