package xm::code::ada;

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

sub DESC{"
  highlight sourcecode - ADA mode
"}


# BEGIN {

$LANGUAGE{'ada'}        = {
                            'filename'   => '(?i)\\.a(d[asb]?)?$',
                            'regex'      => '',
                            'patterns'   => [
                                              {
                                                'name'       => 'Comments',
                                                'regex'      => '--.*?$',
                                                'style'      => 'comment',
                                                'childregex' => [],
                                              },
                                              {
                                                'name'       => 'String Literals',
                                                'regex'      => '".*?("|$)',
                                                'style'      => 'string',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Character Literals',
                                                'regex'      => '\'.\'',
                                                'style'      => 'character',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Ada Attributes',
                                                'regex'      => '\'[a-zA-Z][a-zA-Z_]+\\b',
                                                'style'      => 'reserved word',                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Numeric Literals',
                                                'regex'      => '(((2|8|10|16)#[_0-9a-fA-F]*#)|[0-9.]+)',
                                                'style'      => 'numeric',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Withs Pragmas Use',
                                                'regex'      => '\\b(?i)((with|pragma|use)[ \\t\\n\\f\\r]+[a-zA-Z0-9_.]+;)+\\b',
                                                'style'      => 'include',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Predefined Types',
                                                'regex'      => '\\b(?i)(boolean|character|count|duration|float|integer|long_float|long_integer|priority|short_float|short_integer|string)\\b',
                                                'style'      => 'predefined type',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Predefined Subtypes',
                                                'regex'      => '\\b(?i)field|natural|number_base|positive|priority\\b',
                                                'style'      => 'predefined type',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Reserved Words',
                                                'regex'      => '\\b(?i)(abort|abs|accept|access|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|is|limited|loop|mod|new|not|null|of|or|others|out|package|pragma|private|procedure|raise|range|record|rem|renames|return|reverse|select|separate|subtype|task|terminate|then|type|use|when|while|with|xor)\\b',
                                                'style'      => 'reserved word',                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Ada 95 Only',
                                                'regex'      => '\\b(?i)(abstract|tagged|all|protected|aliased|requeue|until)\\b',
                                                'style'      => 'reserved word',                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Identifiers',
                                                'regex'      => '\\b[a-zA-Z][a-zA-Z0-9_]*\\b',
                                                'style'      => 'identifier',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'Dot All',
                                                'regex'      => '(?i)\\.all\\b',                                                'style'      => 'predefined identifier',
                                                'childregex' => []
                                              }
                                            ]
                          };
$LANGUAGE{'ada95'}      = $LANGUAGE{'ada'};


# }1;

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

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

1;