# -*- coding: utf-8 -*-
"""
    pygments.lexers.puppet
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexer for the Puppet DSL.

    :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

from pygments.lexer import RegexLexer, bygroups
from pygments.token import *

__all__ = ['PuppetLexer']


class PuppetLexer(RegexLexer):
    name = 'Puppet'
    aliases = ['puppet']
    filenames = ['*.pp']

    tokens = {
        'root': [
            (r'\s*#.*$', Comment),
            (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),

            (r'\s(\?|<|>|=|\+|-|\/|\*|~|!|\|)\s', Operator),
            (r'(in|and|or|not)\b', Operator.Word),
            (r'[]{}:(),;[]', Punctuation),

            (r'(if|else|elsif|case|class|true|false|define)\b', Keyword),
            (r'(inherits|notice|node|include|realize|import)\b', Keyword),

            (r'\'(.*?)\'', String),
            (r'"(.*?)"', String),

            (r'(.*?)(\s*)(=>)(\s*)(.*?)$',
             bygroups(Name.Attribute, Text, Operator, Text, String)),

            (r'[^\S\n]+', Text),
            ],
        }

@@ -589,16 +589,17 @@
    (r'%5Cs
+*
 (%5C?%7C%3C%7C%3E%7C
@@ -620,16 +620,17 @@
 %7C!%7C%5C%7C)%5Cs
+*
 ', Opera
@@ -726,24 +726,113 @@
 ctuation),%0A%0A
+            (r'(.*)(include)(%5Cs*)(.*)$', bygroups(Text, Keyword, Text, Name.Variable)),%0A%0A
             
@@ -934,16 +934,8 @@
 ode%7C
-include%7C
 real
@@ -957,24 +957,66 @@
  Keyword),%0A%0A
+            (r'%5C$%5B%5E %5D*', Name.Variable),%0A%0A
             

allow more than once space around operators, bygroups around includes, variables