Browse Source

Cleanup

multi-byte
J. King 6 years ago
parent
commit
106167ab39
  1. 3
      .php_cs.dist
  2. 3
      RoboFile.php
  3. 2
      lib/Encoding/EUCKR.php
  4. 4
      tools/mkindex.php
  5. 1
      tools/mktest.php

3
.php_cs.dist

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/** @license MIT
* Copyright 2018 J. King et al.
* See LICENSE and AUTHORS files for details */
@ -15,9 +16,11 @@ $paths = [
BASE."lib",
BASE."perf",
BASE."tests",
BASE."tools",
];
$rules = [
'@PSR2' => true,
'declare_strict_types' => true,
'braces' => ['position_after_functions_and_oop_constructs' => "same"],
'function_declaration' => ['closure_function_spacing' => "none"],
];

3
RoboFile.php

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
use Robo\Result;
@ -68,7 +69,7 @@ class RoboFile extends \Robo\Tasks {
/** Runs the coding standards fixer */
public function clean($opts = ['demo|d' => false]): Result {
$t = $this->taskExec(realpath(self::BASE."vendor/bin/php-cs-fixer"));
$t->arg("fix");
$t->arg("fix")->arg("--allow-risky=yes");
if ($opts['demo']) {
$t->args("--dry-run", "--diff")->option("--diff-format", "udiff");
}

2
lib/Encoding/EUCKR.php

File diff suppressed because one or more lines are too long

4
tools/mkindex.php

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
$labels = [
'big5' => "big5",
'euc-jp' => "eucjp",
@ -46,7 +47,7 @@ if (!isset($labels[$label])) {
function single_byte(string $label) {
$entries = read_index($label, "https://encoding.spec.whatwg.org/index-$label.txt");
$dec_char = make_decoder_char_array($entries);
$dec_code = make_decoder_point_array($entires);
$dec_code = make_decoder_point_array($entries);
$enc = make_encoder_array($entries);
echo "const TABLE_DEC_CHAR = $dec_char;\n";
echo "const TABLE_DEC_CODE = $dec_code;\n";
@ -167,6 +168,7 @@ function make_decoder_point_array(array $entries): string {
function make_decoder_char_array(array $entries): string {
$out = [];
$i = 0;
foreach ($entries as $match) {
$index = (int) $match[1];
$code = $match[2];

1
tools/mktest.php

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
// this script generates a test series from the Web Platform test suite which exercises the index tables of multi-byte encodings with single characters
// they are pedantic sets of tests, and so the test suite itself only uses this series in optional tests

Loading…
Cancel
Save