Skip to content

Lyrics parsing failure #26

@ofekd

Description

@ofekd

There's an error parsing one of Fountain's sample files:

125 |                 text = text.trim();
126 |                 if (rules_1.rules.parenthetical.test(text)) {
127 |                     return [...p, new ParentheticalToken(text)];
128 |                 }
129 |                 if (rules_1.rules.lyrics.test(text)) {
130 |                     if (previousToken.type === 'lyrics') {
                              ^
TypeError: undefined is not an object (evaluating 'previousToken.type')
Please submit an issue to https://github.com/jonnygreenwald/fountain-js/issues
      at <anonymous> (node_modules/fountain-js/dist/token.js:130:25)
      at reduce (1:11)
      at new DialogueBlock (node_modules/fountain-js/dist/token.js:116:34)
      at <anonymous> (node_modules/fountain-js/dist/lexer.js:85:39)
      at reduce (1:11)
      at tokenizeScript (node_modules/fountain-js/dist/lexer.js:63:36)
      at tokenize (node_modules/fountain-js/dist/lexer.js:35:36)
      at parse (node_modules/fountain-js/dist/fountain.js:15:67)

Here's the file:

https://github.com/nyousefi/Fountain/blob/c09b65e9d4bf6cb1c672501f793b9b3f2becd452/FountainTests/ForcedElements.fountain

I believe a simple null check at that if branch will fallback to correct behavior, but am not familiar enough with the code base to be sure that that is the case

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