com php-langspec: Add $skipFiles to spec_files(): too ls/grammar.php tools/util.php
| From: | Nikita Popov | Date: | Fri, 25 Nov 2016 17:36:40 +0000 |
| Subject: | com php-langspec: Add $skipFiles to spec_files(): too ls/grammar.php tools/util.php | ||
| Groups: | php.standards.cvs | ||
| Request: | Send a blank email to standards--cvs+get-368@lists.php.net to get a copy of this message | ||
Commit: f550b7423df0afa4583a77d7c1ef130ce8277ecd
Author: Nikita Popov <nikic@php.net> Fri, 25 Nov 2016 18:36:40 +0100
Parents: bb8f2d45961447e4deb4e730c8a2c0fb3d525bcd
Branches: master
Link: http://git.php.net/?p=php-langspec.git;a=commitdiff;h=f550b7423df0afa4583a77d7c1ef130ce8277ecd
Log:
Add $skipFiles to spec_files()
Changed paths:
M tools/grammar.php
M tools/util.php
Diff:
diff --git a/tools/grammar.php b/tools/grammar.php
index 2ba0186..1ad7f71 100644
--- a/tools/grammar.php
+++ b/tools/grammar.php
@@ -23,13 +23,8 @@ $output .= extract_grammar($lexical);
$output .= "\n\n##Syntactic Grammar";
-foreach (spec_files() as $fileName => $path) {
- if ($fileName === '05-types.md'
- || $fileName === '09-lexical-structure.md'
- || $fileName === '19-grammar.md') {
- continue;
- }
-
+$skipFiles = ['05-types.md', '09-lexical-structure.md',
'19-grammar.md'];
+foreach (spec_files($skipFiles) as $fileName => $path) {
$code = file_get_contents($path);
$grammar = extract_grammar($code);
if (null === $grammar) {
diff --git a/tools/util.php b/tools/util.php
index fa1a8cb..8cd521e 100644
--- a/tools/util.php
+++ b/tools/util.php
@@ -1,7 +1,7 @@
<?php
/* Iterator of spec files, using $fileName => $path. */
-function spec_files() {
+function spec_files($skipFiles = []) {
$dir = __DIR__ . '/../spec/';
$files = scandir($dir);
@@ -9,7 +9,8 @@ function spec_files() {
if (pathinfo($file, PATHINFO_EXTENSION) != 'md') {
continue;
}
- if ($file == '00-specification-for-php.md') {
+ if ($file == '00-specification-for-php.md'
+ || in_array($file, $skipFiles)) {
continue;
}