final move of files
[web.mtrack] / MTrack / hyperlight / xml.php
1 <?php
2
3 class XmlLanguage extends HyperLanguage {
4     public function __construct() {
5         $this->setInfo(array(
6             parent::NAME => 'XML',
7             parent::VERSION => '0.3',
8             parent::AUTHOR => array(
9                 parent::NAME => 'Konrad Rudolph',
10                 parent::WEBSITE => 'madrat.net',
11                 parent::EMAIL => 'konrad_rudolph@madrat.net'
12             )
13         ));
14
15         $this->setExtensions(array('xml', 'xsl', 'xslt', 'xsd', 'manifest'));
16
17         $inline = array('entity');
18         $common = array('tagname', 'attribute', 'value' => array('double', 'single'));
19
20         $this->addStates(array(
21             'init' => array_merge(array('comment', 'cdata', 'tag'), $inline),
22             'tag' => array_merge(array('preprocessor', 'meta'), $common),
23             'preprocessor' => $common,
24             'meta' => $common,
25             'value double' => $inline,
26             'value single' => $inline,
27         ));
28         
29         $this->addRules(array(
30             'comment' => '/<!--.*?-->/s',
31             'cdata' => '/<!\[CDATA\[.*?\]\]>/',
32             'tag' => new Rule('/</', '/>/'),
33             'tagname' => '#(?:(?<=<)|(?<=</)|(?<=<\?)|(?<=<!))[a-z0-9:-]+#i',
34             'attribute' => '/[a-z0-9:-]+/i',
35             'preprocessor' => new Rule('/\?/'),
36             'meta' => new Rule('/!/'),
37             'value' => array(
38                 'double' => new Rule('/"/', '/"/'),
39                 'single' => new Rule("/'/", "/'/")
40             ),
41             'entity' => '/&.*?;/',
42         ));
43
44         $this->addMappings(array(
45             'attribute' => 'keyword type',
46             'cdata' => '',
47             'value double' => 'string',
48             'value single' => 'string',
49             'entity' => 'escaped',
50             'tagname' => 'keyword'
51         ));
52     }
53 }
54
55 ?>