Skip to content

Commit 18989fe

Browse files
committed
Update ContextGenerator.php
1 parent a6e45c5 commit 18989fe

File tree

6 files changed

+24
-49
lines changed

6 files changed

+24
-49
lines changed

src/Contexts/ContextMySql50000.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
*
66
* This file was auto-generated.
77
*
8-
* @package SqlParser
9-
* @subpackage Contexts
10-
* @link https://dev.mysql.com/doc/refman/5.0/en/keywords.html
8+
* @see https://dev.mysql.com/doc/refman/5.0/en/keywords.html
119
*/
10+
1211
namespace SqlParser\Contexts;
1312

1413
use SqlParser\Context;
@@ -17,13 +16,11 @@
1716
* Context for MySQL 5.
1817
*
1918
* @category Contexts
20-
* @package SqlParser
21-
* @subpackage Contexts
19+
*
2220
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
2321
*/
2422
class ContextMySql50000 extends Context
2523
{
26-
2724
/**
2825
* List of keywords.
2926
*
@@ -34,7 +31,6 @@ class ContextMySql50000 extends Context
3431
* @var array
3532
*/
3633
public static $KEYWORDS = array(
37-
3834
'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
3935
'ANY' => 1, 'BDB' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1,
4036
'NEW' => 1, 'ONE' => 1, 'ROW' => 1,
@@ -283,6 +279,5 @@ class ContextMySql50000 extends Context
283279
'CHAR' => 43,
284280
'BINARY' => 43,
285281
'INTERVAL' => 43,
286-
287282
);
288283
}

src/Contexts/ContextMySql50100.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
*
66
* This file was auto-generated.
77
*
8-
* @package SqlParser
9-
* @subpackage Contexts
10-
* @link https://dev.mysql.com/doc/refman/5.1/en/keywords.html
8+
* @see https://dev.mysql.com/doc/refman/5.1/en/keywords.html
119
*/
10+
1211
namespace SqlParser\Contexts;
1312

1413
use SqlParser\Context;
@@ -17,13 +16,11 @@
1716
* Context for MySQL 5.1.
1817
*
1918
* @category Contexts
20-
* @package SqlParser
21-
* @subpackage Contexts
19+
*
2220
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
2321
*/
2422
class ContextMySql50100 extends Context
2523
{
26-
2724
/**
2825
* List of keywords.
2926
*
@@ -34,7 +31,6 @@ class ContextMySql50100 extends Context
3431
* @var array
3532
*/
3633
public static $KEYWORDS = array(
37-
3834
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
3935
'ANY' => 1, 'BDB' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1,
4036
'NEW' => 1, 'ONE' => 1, 'ROW' => 1,
@@ -308,6 +304,5 @@ class ContextMySql50100 extends Context
308304
'CHAR' => 43,
309305
'BINARY' => 43,
310306
'INTERVAL' => 43,
311-
312307
);
313308
}

src/Contexts/ContextMySql50500.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
*
66
* This file was auto-generated.
77
*
8-
* @package SqlParser
9-
* @subpackage Contexts
10-
* @link https://dev.mysql.com/doc/refman/5.5/en/keywords.html
8+
* @see https://dev.mysql.com/doc/refman/5.5/en/keywords.html
119
*/
10+
1211
namespace SqlParser\Contexts;
1312

1413
use SqlParser\Context;
@@ -17,13 +16,11 @@
1716
* Context for MySQL 5.5.
1817
*
1918
* @category Contexts
20-
* @package SqlParser
21-
* @subpackage Contexts
19+
*
2220
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
2321
*/
2422
class ContextMySql50500 extends Context
2523
{
26-
2724
/**
2825
* List of keywords.
2926
*
@@ -34,7 +31,6 @@ class ContextMySql50500 extends Context
3431
* @var array
3532
*/
3633
public static $KEYWORDS = array(
37-
3834
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
3935
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
4036
'ONE' => 1, 'ROW' => 1,
@@ -313,6 +309,5 @@ class ContextMySql50500 extends Context
313309
'CHAR' => 43,
314310
'BINARY' => 43,
315311
'INTERVAL' => 43,
316-
317312
);
318313
}

src/Contexts/ContextMySql50600.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
*
66
* This file was auto-generated.
77
*
8-
* @package SqlParser
9-
* @subpackage Contexts
10-
* @link https://dev.mysql.com/doc/refman/5.6/en/keywords.html
8+
* @see https://dev.mysql.com/doc/refman/5.6/en/keywords.html
119
*/
10+
1211
namespace SqlParser\Contexts;
1312

1413
use SqlParser\Context;
@@ -17,13 +16,11 @@
1716
* Context for MySQL 5.6.
1817
*
1918
* @category Contexts
20-
* @package SqlParser
21-
* @subpackage Contexts
19+
*
2220
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
2321
*/
2422
class ContextMySql50600 extends Context
2523
{
26-
2724
/**
2825
* List of keywords.
2926
*
@@ -34,7 +31,6 @@ class ContextMySql50600 extends Context
3431
* @var array
3532
*/
3633
public static $KEYWORDS = array(
37-
3834
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
3935
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
4036
'ONE' => 1, 'ROW' => 1,
@@ -342,6 +338,5 @@ class ContextMySql50600 extends Context
342338
'CHAR' => 43,
343339
'BINARY' => 43,
344340
'INTERVAL' => 43,
345-
346341
);
347342
}

src/Contexts/ContextMySql50700.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
*
66
* This file was auto-generated.
77
*
8-
* @package SqlParser
9-
* @subpackage Contexts
10-
* @link https://dev.mysql.com/doc/refman/5.7/en/keywords.html
8+
* @see https://dev.mysql.com/doc/refman/5.7/en/keywords.html
119
*/
10+
1211
namespace SqlParser\Contexts;
1312

1413
use SqlParser\Context;
@@ -17,13 +16,11 @@
1716
* Context for MySQL 5.7.
1817
*
1918
* @category Contexts
20-
* @package SqlParser
21-
* @subpackage Contexts
19+
*
2220
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
2321
*/
2422
class ContextMySql50700 extends Context
2523
{
26-
2724
/**
2825
* List of keywords.
2926
*
@@ -34,7 +31,6 @@ class ContextMySql50700 extends Context
3431
* @var array
3532
*/
3633
public static $KEYWORDS = array(
37-
3834
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
3935
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
4036
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
@@ -354,6 +350,5 @@ class ContextMySql50700 extends Context
354350
'CHAR' => 43,
355351
'BINARY' => 43,
356352
'INTERVAL' => 43,
357-
358353
);
359354
}

tools/ContextGenerator.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace SqlParser\Tools;
44

5-
require_once '../vendor/autoload.php';
5+
require_once __DIR__ . '/../vendor/autoload.php';
66

77
/**
88
* Used for context generation.
@@ -57,10 +57,9 @@ class ContextGenerator
5757
' *' . "\n" .
5858
' * This file was auto-generated.' . "\n" .
5959
' *' . "\n" .
60-
' * @package SqlParser' . "\n" .
61-
' * @subpackage Contexts' . "\n" .
62-
' * @link %3$s' . "\n" .
60+
' * @see %3$s' . "\n" .
6361
' */' . "\n" .
62+
'' . "\n" .
6463
'namespace SqlParser\\Contexts;' . "\n" .
6564
'' . "\n" .
6665
'use SqlParser\\Context;' . "\n" .
@@ -69,13 +68,11 @@ class ContextGenerator
6968
' * Context for %1$s.' . "\n" .
7069
' *' . "\n" .
7170
' * @category Contexts' . "\n" .
72-
' * @package SqlParser' . "\n" .
73-
' * @subpackage Contexts' . "\n" .
71+
' *' . "\n" .
7472
' * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+' . "\n" .
7573
' */' . "\n" .
7674
'class %2$s extends Context' . "\n" .
7775
'{' . "\n" .
78-
'' . "\n" .
7976
' /**' . "\n" .
8077
' * List of keywords.' . "\n" .
8178
' *' . "\n" .
@@ -86,7 +83,6 @@ class ContextGenerator
8683
' * @var array' . "\n" .
8784
' */' . "\n" .
8885
' public static $KEYWORDS = array(' . "\n" .
89-
'' . "\n" .
9086
'%4$s' .
9187
' );' . "\n" .
9288
'}' . "\n";
@@ -184,7 +180,9 @@ public static function readWords(array $files)
184180
*/
185181
public static function printWords($words, $spaces = 8, $line = 80)
186182
{
183+
$typesCount = count($words);
187184
$ret = '';
185+
$j = 0;
188186

189187
foreach ($words as $type => $wordsByType) {
190188
foreach ($wordsByType as $len => $wordsByLen) {
@@ -207,7 +205,9 @@ public static function printWords($words, $spaces = 8, $line = 80)
207205
}
208206
}
209207

210-
$ret .= "\n";
208+
if (++$j < $typesCount) {
209+
$ret .= "\n";
210+
}
211211
}
212212

213213
// Trim trailing spaces and return.

0 commit comments

Comments
 (0)