JohnnyMorganz / StyLua

An opinionated Lua code formatter
Mozilla Public License 2.0
1.52k stars 67 forks source link

Output AST generated a syntax error #873

Open pedrohgmacedo opened 1 month ago

pedrohgmacedo commented 1 month ago

I get this error:

[ERROR] Formatter 'stylua' error: error: could not format from stdin: failed to format from stdin: INTERNAL ERROR: Output AST generated a syntax error. Please report this at https://github.com/johnnymorganz/stylua/issues
  error occurred while creating ast: unexpected token `console`

When attempting to format this example file from the IUP gui library.

JohnnyMorganz commented 1 month ago

Thanks for reporting! Looks like the problematic part are the comments in this section:


console.dialog = iup.dialog
{
  iup.vbox
  {
    iup.frame
    {
      iup.hbox -- use it to inherit margins
      {
        console.prompt,
      },
      title = "Command:",
    },
    iup.frame
    {
      iup.hbox -- use it to inherit margins
      {
        console.output
      },
      title = "Output:",
    },
    margin = "5x5",
    gap = "5",
  },
  title="Lua Console",
  size="250x180", -- initial size
  icon=0, -- use the Lua icon from the executable in Windows
}