package xm::code::make;

use xm::o;
use xm::code::vars;
use xm::code::func;

sub DESC{"
  highlight sourcecode - MAKEFILE mode
"}

# BEGIN {


# taken from nedit
# modified by PP
$LANGUAGE{'make'}       = {
                            'filename'   => '[Mm]akefile.*',
                            'regex'      => '',
                            'patterns'   => [
                                              {
                                                'name'       => 'Comment',
                                                'regex'      => '#.*?$',
                                                'style'      => 'comment',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Assignment',
                                                'regex'      => '^( *| [ \\t]*)[A-Za-z0-9_+]*[ \\t]*(\\+|:)?=',
                                                'style'      => 'assignment',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Dependency Line',
                                                'regex'      => '^ *([A-Za-z0-9./$(){} _%+-]|\\n)*::?',
                                                'style'      => 'dependency line',
                                                'childregex' => [
                                                                  {
                                                                    'name'       => 'Dependency Target',
                                                                    'regex'      => '[A-Za-z0-9./$(){} _%+-]+',
                                                                    'style'      => 'dependency target',
                                                                    'childregex' => []
                                                                  },
                                                                  {
                                                                    'name'       => 'Dependency Continuation',
                                                                    'regex'      => '\\\\\\n',
                                                                    'style'      => 'dependency continuation',
                                                                    'childregex' => []
                                                                  },
                                                                  {
                                                                    'name'       => 'comment',
                                                                    'regex'      => '#.*?$',
                                                                    'style'      => 'comment',
                                                                    'childregex' => []
                                                                  },
                                                                  {
                                                                    'name'       => 'macro',
                                                                    'regex'      => '\\$([A-Za-z0-9_]|\\([^)]*\\)|{[^}]*})',
                                                                    'style'      => 'macro',
                                                                    'childregex' => []
                                                                  },
                                                                  {
                                                                    'name'       => 'int macro',
                                                                    'regex'      => '\\$([<@*?%]|\\$@)',
                                                                    'style'      => 'int macro',
                                                                    'childregex' => []
                                                                  }
                                                                ]
                                              },
                                              {
                                                'name'       => 'Continuation',
                                                'regex'      => '\\\\$',
                                                'style'      => 'continuation',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Macro',
                                                'regex'      => '\\$([A-Za-z0-9_]|\\([^)]*\\)|{[^}]*})',
                                                'style'      => 'macro',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Internal Macro',
                                                'regex'      => '\\$([<@*?%]|\\$@)',
                                                'style'      => 'int macro',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Escaped $$$',
                                                'regex'      => '\\$\\$',
                                                'style'      => 'esc $$$',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Include',
                                                'regex'      => '^include[ \\t]',
                                                'style'      => 'include',
                                                'childregex' => []
                                              }
                                            ]
                          };
$LANGUAGE{'makefile'} = $LANGUAGE{'make'};

# }1;

sub DO
{
    return xm::code::func::DO($_[0],$LANGUAGE{makefile}{patterns});
}

sub ARGS { return    xm::o::args_stdin(@_, DESC); }
sub main { return DO(xm::o::args_stdin(@_, DESC)); }

1;