Completed
Push — master ( 6054a8...c11aa8 )
by Kacper
04:06
created

Scss::getMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
c 0
b 0
f 0
nc 1
nop 0
dl 8
loc 8
rs 9.4285
1
<?php
2
/**
3
 * Highlighter
4
 *
5
 * Copyright (C) 2016, Some right reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Highlighter\Language\Css;
17
18
use Kadet\Highlighter\Matcher\RegexMatcher;
19
use Kadet\Highlighter\Parser\Rule;
20
21
class Scss extends PreProcessor
22
{
23
    /**
24
     * Tokenization rules
25
     */
26
    public function setupRules()
27
    {
28
        parent::setupRules();
29
30
        $this->rules->remove('symbol.selector.tag');
31
        $this->rules->add('symbol.selector.tag', new Rule(new RegexMatcher('/(?>[\s{};]|^)(?=(\w+)[^;}]*\{)/m'), [
32
            'context' => ['!symbol', '!string', '!number']
33
        ]));
34
35
        $this->rules->add('variable', new Rule(new RegexMatcher('/(\$[\w-]+)/'), ['context' => $this->everywhere()]));
36
    }
37
38
    public function getIdentifier()
39
    {
40
        return 'scss';
41
    }
42
43 View Code Duplication
    public static function getMetadata()
44
    {
45
        return [
46
            'name'      => ['scss'],
47
            'mime'      => ['text/x-scss'],
48
            'extension' => ['*.scss']
49
        ];
50
    }
51
}
52