Skip to content

Curly bracket detected as endInterpolant #27

@nisalikularatne

Description

@nisalikularatne

Hi,

When we tokenize the following example

@mixin bg-variant($parent,$color){
  a#{$parent},
  button#{$parent} {
  }
}

the output returned is

[ [ '@', '@', 1, 1 ],
  [ 'ident', 'mixin', 1, 2, 1, 6 ],
  [ 'space', ' ' ],
  [ 'ident', 'bg-variant', 1, 8, 1, 17 ],
  [ '(', '(', 1, 18 ],
  [ '$', '$', 1, 19 ],
  [ 'ident', 'parent', 1, 20, 1, 25 ],
  [ ',', ',', 1, 26 ],
  [ '$', '$', 1, 27 ],
  [ 'ident', 'color', 1, 28, 1, 32 ],
  [ ')', ')', 1, 33 ],
  [ '{', '{', 1, 34 ],
  [ 'newline', '\n', 2, 0 ],
  [ 'space', '  ' ],
  [ 'ident', 'a', 2, 3, 2, 3 ],
  [ 'startInterpolant', '#{', 2, 5 ],
  [ '$', '$', 2, 6 ],
  [ 'ident', 'parent', 2, 7, 2, 12 ],
  [ 'endInterpolant', '}', 2, 13 ],
  [ ',', ',', 2, 14 ],
  [ 'newline', '\n', 3, 0 ],
  [ 'space', '  ' ],
  [ 'ident', 'button', 3, 3, 3, 8 ],
  [ 'startInterpolant', '#{', 3, 10 ],
  [ '$', '$', 3, 11 ],
  [ 'ident', 'parent', 3, 12, 3, 17 ],
  [ 'endInterpolant', '}', 3, 18 ],
  [ 'space', ' ' ],
  [ '{', '{', 3, 20 ],
  [ 'newline', '\n', 4, 0 ],
  [ 'space', '  ' ],
  [ 'endInterpolant', '}', 4, 3 ],
  [ 'newline', '\n', 5, 0 ],
  [ '}', '}', 5, 1 ] ]

The tokenizer detects the second last curly bracket '}' as an endInterpolant token.
Any idea on how it can be solved ?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions