Skip to content

Each iteration on string containing " of " leads to an "Syntax Error: Unexpected token" error #3462

@Bacto

Description

@Bacto

Hi,

First, I want to thank you for Pug, I really appreciate it!

This code:

each link in ['Terms of service', 'Privacy policy', 'License']
  a= link

Leads to:

  > 1| each link in ['Terms of service', 'Privacy policy', 'License']
--------------------------------------^
    2|   a= link
    3|

Syntax Error: Unexpected token
    at makeError (node_modules/pug-error/lib/index.js:34:15)
    at Lexer.error (node_modules/pug-lexer/index.js:62:15)
    at Lexer.assertExpression (node_modules/pug-lexer/index.js:96:12)
    at Lexer.eachOf (node_modules/pug-lexer/index.js:1095:12)
    at Lexer.callLexerFunction (node_modules/pug-lexer/index.js:1647:23)
    at Lexer.advance (node_modules/pug-lexer/index.js:1676:12)
    at Lexer.callLexerFunction (node_modules/pug-lexer/index.js:1647:23)
    at Lexer.getTokens (node_modules/pug-lexer/index.js:1706:12)
    at lex (node_modules/pug-lexer/index.js:12:42)
    at Object.lex (node_modules/pug/lib/index.js:104:9) {
  code: 'PUG:SYNTAX_ERROR',
  msg: 'Syntax Error: Unexpected token',
  line: 1,
  column: 32,
  filename: 'test.pug',
  src: "each link in ['Terms of service', 'Privacy policy', 'License']\n  a= link\n",
  toJSON: [Function (anonymous)]
}

I got this error with the latest version 3.0.3.

If seems related to #3275 which was supposed to be solved.

Hope someone can solve it :)

Best,
Adrien

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions