@@ -41,7 +41,7 @@ |
||
41 | 41 | new Rule(new RegexMatcher('/(\\\\\[.*?\\\\\])/s')), |
42 | 42 | new Rule( |
43 | 43 | new RegexMatcher( |
44 | - '/\\\begin{((?:' . implode('|', self::$mathEnvironments) . ')\*?)}(.*?)\\\end{\1}/s', |
|
44 | + '/\\\begin{((?:'.implode('|', self::$mathEnvironments).')\*?)}(.*?)\\\end{\1}/s', |
|
45 | 45 | [2 => Token::NAME] |
46 | 46 | ) |
47 | 47 | ) |
@@ -38,9 +38,9 @@ |
||
38 | 38 | new OpenRule(new RegexMatcher('/(<[\w\.-]+)[:\/>:\s]/')), |
39 | 39 | new CloseRule(new SubStringMatcher('>'), ['context' => ['!string', '!comment']]), |
40 | 40 | ], |
41 | - 'tag.close' => new Rule(new RegexMatcher('/(<\/' . self::IDENTIFIER . '>)/')), |
|
41 | + 'tag.close' => new Rule(new RegexMatcher('/(<\/'.self::IDENTIFIER.'>)/')), |
|
42 | 42 | |
43 | - 'symbol.tag' => new Rule(new RegexMatcher('/<\\/?' . self::IDENTIFIER . '/', [ |
|
43 | + 'symbol.tag' => new Rule(new RegexMatcher('/<\\/?'.self::IDENTIFIER.'/', [ |
|
44 | 44 | 'name' => Token::NAME, |
45 | 45 | 'namespace' => '$.namespace', |
46 | 46 | ]), ['context' => ['tag', '!string']]), |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | 'comment' => new Rule(new CommentMatcher(['//'], [['/*', '*/']]), ['priority' => 3]), |
64 | 64 | |
65 | - 'call' => new Rule(new RegexMatcher('/(' . self::IDENTIFIER . ')\s*\(/iu'), ['priority' => -1]), |
|
65 | + 'call' => new Rule(new RegexMatcher('/('.self::IDENTIFIER.')\s*\(/iu'), ['priority' => -1]), |
|
66 | 66 | |
67 | 67 | 'keyword' => new Rule(new WordMatcher([ |
68 | 68 | 'do', 'if', 'in', 'for', 'let', 'new', 'try', 'var', 'case', 'else', 'enum', 'eval', |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ]) |
92 | 92 | ], |
93 | 93 | |
94 | - 'variable' => new Rule(new RegexMatcher('/\b(?<!\.)(' . self::IDENTIFIER . ':?)/iu'), [ |
|
94 | + 'variable' => new Rule(new RegexMatcher('/\b(?<!\.)('.self::IDENTIFIER.':?)/iu'), [ |
|
95 | 95 | 'priority' => -1, |
96 | 96 | 'enabled' => $this->variables |
97 | 97 | ]), |
@@ -19,7 +19,7 @@ |
||
19 | 19 | new Rule(new RegexMatcher('/(?:[)\w]\??:|\bas\b)\s*(\w+)/si'), [ |
20 | 20 | 'context' => ['!meta.json', '!string', '!comment'] |
21 | 21 | ]), |
22 | - new Rule(new RegexMatcher('/(?:(?=(<\w+(?1)?>))|\G)<(\w+)/six', [ 2 => Token::NAME ]), [ |
|
22 | + new Rule(new RegexMatcher('/(?:(?=(<\w+(?1)?>))|\G)<(\w+)/six', [2 => Token::NAME]), [ |
|
23 | 23 | 'context' => ['!meta.json', '!string', '!comment'] |
24 | 24 | ]), |
25 | 25 | ], |
@@ -67,7 +67,7 @@ |
||
67 | 67 | |
68 | 68 | public function set($style) |
69 | 69 | { |
70 | - $escape = "\e[".implode(';', array_map(function ($style, $name) { |
|
70 | + $escape = "\e[".implode(';', array_map(function($style, $name) { |
|
71 | 71 | return $this->_style($style, $name); |
72 | 72 | }, array_keys($style), $style)).'m'; |
73 | 73 |
@@ -98,6 +98,9 @@ |
||
98 | 98 | || $input->hasParameterOption('-r'); |
99 | 99 | } |
100 | 100 | |
101 | + /** |
|
102 | + * @param string $filename |
|
103 | + */ |
|
101 | 104 | private function regenerate(InputInterface $input, $filename) |
102 | 105 | { |
103 | 106 | $filename = str_replace(DIRECTORY_SEPARATOR, '/', $filename); |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | $this->_keylighter = KeyLighter::get(); |
40 | 40 | $this->_formatter = new TestFormatter(); |
41 | 41 | |
42 | - $this->_input = realpath(__DIR__ . '/../../../Tests/Samples'); |
|
43 | - $this->_output = realpath(__DIR__ . '/../../../Tests/Expected/Test'); |
|
42 | + $this->_input = realpath(__DIR__.'/../../../Tests/Samples'); |
|
43 | + $this->_output = realpath(__DIR__.'/../../../Tests/Expected/Test'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | if ($this->review($input, $output, $tokens, $reviewer)) { |
71 | 71 | $result = StringHelper::normalize($this->_formatter->format($tokens)); |
72 | 72 | |
73 | - if (!file_exists($this->_output . '/' . dirname($pathname))) { |
|
74 | - mkdir($this->_output . '/' . dirname($pathname), 0755, true); |
|
73 | + if (!file_exists($this->_output.'/'.dirname($pathname))) { |
|
74 | + mkdir($this->_output.'/'.dirname($pathname), 0755, true); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | file_put_contents("{$this->_output}/$pathname.tkn", $result); |
@@ -43,6 +43,9 @@ discard block |
||
43 | 43 | return $result . ($this->_options['lines']['enable'] ? $this->formatLineEnd($this->_line++) : ''); |
44 | 44 | } |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $text |
|
48 | + */ |
|
46 | 49 | private function _content($text) |
47 | 50 | { |
48 | 51 | $content = $this->content($text); |
@@ -57,11 +60,17 @@ discard block |
||
57 | 60 | return $text; |
58 | 61 | } |
59 | 62 | |
63 | + /** |
|
64 | + * @param integer $line |
|
65 | + */ |
|
60 | 66 | protected function formatLineStart($line) |
61 | 67 | { |
62 | 68 | return null; |
63 | 69 | } |
64 | 70 | |
71 | + /** |
|
72 | + * @param integer $line |
|
73 | + */ |
|
65 | 74 | protected function formatLineEnd($line) |
66 | 75 | { |
67 | 76 | return null; |
@@ -40,15 +40,15 @@ |
||
40 | 40 | } |
41 | 41 | $result .= $this->_content(substr($source, $last)); |
42 | 42 | |
43 | - return $result . ($this->_options['lines']['enable'] ? $this->formatLineEnd($this->_line++) : ''); |
|
43 | + return $result.($this->_options['lines']['enable'] ? $this->formatLineEnd($this->_line++) : ''); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | private function _content($text) |
47 | 47 | { |
48 | 48 | $content = $this->content($text); |
49 | 49 | |
50 | - return $this->_options['lines']['enable'] ? preg_replace_callback('/\R/u', function ($feed) { |
|
51 | - return $this->formatLineEnd($this->_line++) . $feed[0] . $this->formatLineStart($this->_line); |
|
50 | + return $this->_options['lines']['enable'] ? preg_replace_callback('/\R/u', function($feed) { |
|
51 | + return $this->formatLineEnd($this->_line++).$feed[0].$this->formatLineStart($this->_line); |
|
52 | 52 | }, $content) : $content; |
53 | 53 | } |
54 | 54 |
@@ -60,7 +60,7 @@ |
||
60 | 60 | return sprintf( |
61 | 61 | '<%s class="%s">', |
62 | 62 | $this->_tag, |
63 | - $this->_prefix . str_replace('.', " {$this->_prefix}", $token->name) |
|
63 | + $this->_prefix.str_replace('.', " {$this->_prefix}", $token->name) |
|
64 | 64 | ); |
65 | 65 | } |
66 | 66 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | public function __construct(array $options = []) |
38 | 38 | { |
39 | 39 | parent::__construct(array_replace_recursive([ |
40 | - 'styles' => include __DIR__ . '/../Styles/Cli/Default.php' |
|
40 | + 'styles' => include __DIR__.'/../Styles/Cli/Default.php' |
|
41 | 41 | ], $options)); |
42 | 42 | |
43 | 43 | $this->_styles = $this->_options['styles']; |