
"""This module exports the Puppet plugin class."""

from SublimeLinter.lint import Linter, util


class Puppet(Linter):

    """Provides an interface to puppet."""

    syntax = 'puppet'
    cmd = ('puppet', 'parser', 'validate', '--color=false')
    regex = r'^Error:.+?(?P<message>Syntax error at \'(?P<near>.+?)\'; expected \'.+\').+?line (?P<line>\d+)'
    error_stream = util.STREAM_STDERR


"""This module exports the Puppet plugin class."""

from SublimeLinter.lint import Linter, util


class Puppet(Linter):

    """Provides an interface to puppet."""

    syntax = 'puppet'
    cmd = ('puppet', 'parser', 'validate', '--color=false')
    regex = r'^Error:.+?(?P<message>Syntax error at \'?(?P<near>.+?)\'?(?:; expected \'.+\')?) at line (?P<line>\d+)'
    error_stream = util.STREAM_STDERR

Support Additional Error Output Formats
Support Additional Error Output Formats

Make the 'near' match group more flexible to support multiple error
output styles for some syntax errors.

Examples:

    Error: Could not parse for environment production: Syntax error at 'class' at line 27
    Error: Could not parse for environment production: Syntax error at end of file at line 32
    Error: Could not parse for environment production: Syntax error at ','; expected '}' at line 28

See https://regex101.com/r/aT3aR3/3 for testing

  
  """This module exports the Puppet plugin class."""
  
  from SublimeLinter.lint import Linter, util
  
  
  class Puppet(Linter):
  
      """Provides an interface to puppet."""
  
      syntax = 'puppet'
      cmd = ('puppet', 'parser', 'validate', '--color=false')
-     regex = r'^Error:.+?(?P<message>Syntax error at \'(?P<near>.+?)\'; expected \'.+\').+?line (?P<line>\d+)'
+     regex = r'^Error:.+?(?P<message>Syntax error at \'?(?P<near>.+?)\'?(?:; expected \'.+\')?) at line (?P<line>\d+)'
      error_stream = util.STREAM_STDERR
  
Support Additional Error Output Formats
## Code Before:

"""This module exports the Puppet plugin class."""

from SublimeLinter.lint import Linter, util


class Puppet(Linter):

    """Provides an interface to puppet."""

    syntax = 'puppet'
    cmd = ('puppet', 'parser', 'validate', '--color=false')
    regex = r'^Error:.+?(?P<message>Syntax error at \'(?P<near>.+?)\'; expected \'.+\').+?line (?P<line>\d+)'
    error_stream = util.STREAM_STDERR

## Instruction:
Support Additional Error Output Formats
## Code After:

"""This module exports the Puppet plugin class."""

from SublimeLinter.lint import Linter, util


class Puppet(Linter):

    """Provides an interface to puppet."""

    syntax = 'puppet'
    cmd = ('puppet', 'parser', 'validate', '--color=false')
    regex = r'^Error:.+?(?P<message>Syntax error at \'?(?P<near>.+?)\'?(?:; expected \'.+\')?) at line (?P<line>\d+)'
    error_stream = util.STREAM_STDERR
