Attempt to fix CI tests
Some checks failed
timw4mail/php-kilo/pipeline/head There was a failure building this commit

This commit is contained in:
Timothy Warren 2021-03-03 20:23:12 -05:00
parent 02259f61a7
commit 6df5bda8f2
4 changed files with 21 additions and 16 deletions

View File

@ -3,4 +3,4 @@ FROM php:8-cli-alpine
RUN apk add --no-cache --virtual .persistent-deps libffi-dev \
&& docker-php-ext-configure ffi --with-ffi \
&& docker-php-ext-install ffi \
&& apk add --no-cache php8-phpdbg
&& apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ php8-phpdbg

View File

@ -19,4 +19,5 @@ class Highlight {
public const DELIMITER = 9;
public const INVALID = 10;
public const MATCH = 11;
public const IDENTIFIER = 12;
}

View File

@ -274,12 +274,13 @@ function syntax_to_color(int $hl): int
Highlight::KEYWORD1 => Color::FG_YELLOW,
Highlight::KEYWORD2 => Color::FG_GREEN,
Highlight::STRING => Color::FG_MAGENTA,
Highlight::NUMBER => Color::FG_RED,
Highlight::NUMBER => Color::FG_BRIGHT_RED,
Highlight::OPERATOR => Color::FG_BRIGHT_GREEN,
Highlight::VARIABLE => Color::FG_BRIGHT_CYAN,
Highlight::DELIMITER => Color::FG_BLUE,
Highlight::INVALID => Color::BG_BRIGHT_RED,
Highlight::MATCH => Color::INVERT,
Highlight::IDENTIFIER => Color::FG_BRIGHT_WHITE,
default => Color::FG_WHITE,
};
}
@ -386,16 +387,7 @@ function get_file_syntax_map(): array
'PHP',
['.php', 'kilo'],
[
'?php', '$this', '__halt_compiler', 'abstract', 'and', 'array', 'as', 'break',
'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare',
'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor',
'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends',
'final', 'finally', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements',
'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list',
'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once',
'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor',
'yield', 'yield from', '__CLASS__', '__DIR__', '__FILE__', '__FUNCTION__', '__LINE__',
'__METHOD__', '__NAMESPACE__', '__TRAIT__',
'?php', '$this', '__halt_compiler'
],
[
'int', 'float', 'bool', 'string', 'true', 'TRUE', 'false', 'FALSE', 'null', 'NULL',
@ -499,12 +491,17 @@ function php_token_to_highlight(int $token): int
T_END_HEREDOC => Highlight::DELIMITER,
// Number literals and magic constants
T_CLASS_C,
T_DIR,
T_TRAIT_C,
T_DNUMBER,
T_LNUMBER,
T_FILE,
T_FUNC_C => Highlight::NUMBER,
T_FUNC_C,
T_LINE,
T_METHOD_C,
T_NS_C,
T_NUM_STRING,
T_TRAIT_C => Highlight::NUMBER,
// String literals
T_CONSTANT_ENCAPSED_STRING, T_ENCAPSED_AND_WHITESPACE => Highlight::STRING,
@ -593,18 +590,24 @@ function php_token_to_highlight(int $token): int
T_INCLUDE,
T_INCLUDE_ONCE,
T_INTERFACE,
T_NAMESPACE,
T_ISSET,
T_LIST,
T_MATCH,
T_NAMESPACE,
T_NEW,
T_PRINT,
T_PRIVATE,
T_PUBLIC,
T_PROTECTED,
T_REQUIRE,
T_REQUIRE_ONCE,
T_RETURN,
T_STATIC,
T_SWITCH,
T_THROW,
T_TRAIT,
T_TRY,
T_UNSET,
T_USE,
T_VAR,
T_WHILE,
@ -612,7 +615,7 @@ function php_token_to_highlight(int $token): int
T_YIELD_FROM => Highlight::KEYWORD1,
// Not string literals, but identifiers, keywords, etc.
// T_STRING => Highlight::KEYWORD2,
T_STRING => Highlight::IDENTIFIER,
// Types and casts
T_ARRAY_CAST,

View File

@ -89,6 +89,7 @@ $y = [
];
// Multi-line ternary statement
#{Attribute]
$q = ($x !== 2)
? 'yes'
: 'no';