Skip to content

bug: parser.js can make an endless loop #415

@cuixiping

Description

@cuixiping

Describe your issue/suggestions

The browser was freezed when I played the online IDE with some code looks right.
I tracked the following code

https://github.com/LingDong-/wenyan-lang/blob/master/src/parser.js#L308-L322

308:    while (!(gettok(i, 0) == "ctrl" && gettok(i, 1) == "funbody")) {
309:      if (gettok(i, 0) == "num") {
            ....
322:      }
323:    }

There will be an endless loop once gettok(i, 0) == "num" is false.
In my case, the result of gettok(i, 0) here is "data".
I don't quite understand the logic here.
Does this place need a i++

Checklist

Before you create this issue, Please make sure ALL the following items are checked

  • If this is a feature request, it's NOT listed Here
  • If this is a bug report, it's NOT listed Here

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions