From fb5dd66bee578cfc5a1d0474d6a433f2c175d30d Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Wed, 4 Dec 2019 10:54:15 -0500 Subject: [PATCH] Replace inline ANSI escapes with constants and static methods --- src/ANSI.php | 97 + src/Editor.php | 45 +- src/Row.php | 17 +- src/Termios.php | 7 +- src/ffi.h | 7 + tests/EditorTest.php | 30 +- .../EditorTest__testOpenPHP__1.json | 4397 +++++++++++++ .../EditorTest__testOpen__1.json | 5743 +++++------------ 8 files changed, 6281 insertions(+), 4062 deletions(-) create mode 100644 src/ANSI.php create mode 100644 tests/__snapshots__/EditorTest__testOpenPHP__1.json diff --git a/src/ANSI.php b/src/ANSI.php new file mode 100644 index 0000000..921e7f1 --- /dev/null +++ b/src/ANSI.php @@ -0,0 +1,97 @@ +ab .= "\x1b[7m"; + $this->ab .= ANSI::color(Color::INVERT); $this->ab .= $sym; - $this->ab .= "\x1b[m"; + $this->ab .= ANSI::RESET_TEXT; if ($currentColor !== -1) { - $this->ab .= sprintf("\x1b%dm", $currentColor); + $this->ab .= ANSI::color($currentColor); } } else if ($hl[$i] === Highlight::NORMAL) { if ($currentColor !== -1) { - $this->ab .= "\x1b[0m"; // Reset background color - $this->ab .= "\x1b[39m"; // Reset foreground color + $this->ab .= ANSI::RESET_TEXT; + $this->ab .= ANSI::color(Color::FG_WHITE); $currentColor = -1; } $this->ab .= $c[$i]; @@ -628,25 +629,25 @@ class Editor { if ($color !== $currentColor) { $currentColor = $color; - $this->ab .= "\x1b[0m"; // Reset background color - $this->ab .= sprintf("\x1b[%dm", $color); + $this->ab .= ANSI::RESET_TEXT; + $this->ab .= ANSI::color($color); } $this->ab .= $c[$i]; } } - $this->ab .= "\x1b[0m"; - $this->ab .= "\x1b[39m"; + $this->ab .= ANSI::RESET_TEXT; + $this->ab .= ANSI::color(Color::FG_WHITE); } - $this->ab .= "\x1b[K"; // Clear the current line + $this->ab .= ANSI::CLEAR_LINE; $this->ab .= "\r\n"; } } protected function drawStatusBar(): void { - $this->ab .= "\x1b[7m"; + $this->ab .= ANSI::color(Color::INVERT); $statusFilename = $this->filename !== '' ? $this->filename : '[No Name]'; $syntaxType = ($this->syntax !== NULL) ? $this->syntax->filetype : 'no ft'; @@ -671,13 +672,13 @@ class Editor { $this->ab .= ' '; $len++; } - $this->ab .= "\x1b[m"; + $this->ab .= ANSI::RESET_TEXT; $this->ab .= "\r\n"; } protected function drawMessageBar(): void { - $this->ab .= "\x1b[K"; + $this->ab .= ANSI::CLEAR_LINE; $len = strlen($this->statusMsg); if ($len > $this->screenCols) { @@ -696,20 +697,20 @@ class Editor { $this->ab = ''; - $this->ab .= "\x1b[?25l"; // Hide the cursor - $this->ab .= "\x1b[H"; // Reposition cursor to top-left + $this->ab .= ANSI::HIDE_CURSOR; + $this->ab .= ANSI::RESET_CURSOR; $this->drawRows(); $this->drawStatusBar(); $this->drawMessageBar(); // Specify the current cursor position - $this->ab .= sprintf("\x1b[%d;%dH", + $this->ab .= ANSI::moveCursor( ($this->cursorY - $this->rowOffset) + 1, ($this->renderX - $this->colOffset) + 1 ); - $this->ab .= "\x1b[?25h"; // Show the cursor + $this->ab .= ANSI::SHOW_CURSOR; echo $this->ab; } @@ -855,8 +856,8 @@ class Editor { $quit_times--; return ''; } - write_stdout("\x1b[2J"); // Clear the screen - write_stdout("\x1b[H"); // Reposition cursor to top-left + write_stdout(ANSI::CLEAR_SCREEN); + write_stdout(ANSI::RESET_CURSOR); return NULL; break; diff --git a/src/Row.php b/src/Row.php index a9988ed..229c269 100644 --- a/src/Row.php +++ b/src/Row.php @@ -319,11 +319,6 @@ class Row { $char = $this->render[$i]; $prevHl = ($i > 0) ? $this->hl[$i - 1] : Highlight::NORMAL; - if ($this->parent->syntax === NULL) - { - return; - } - // Single-line comments if ($scsLen > 0 && $inString === '' && $inComment === FALSE && substr($this->render, $i, $scsLen) === $scs) @@ -384,7 +379,7 @@ class Row { continue; } - if ( $char === '""' || $char === '\'') + if ( $char === '"' || $char === '\'') { $inString = $char; $this->hl[$i] = Highlight::STRING; @@ -441,7 +436,9 @@ class Row { $this->hlOpenComment = $inComment; if ($changed && $this->idx + 1 < $this->parent->numRows) { + // @codeCoverageIgnoreStart $this->parent->rows[$this->idx + 1]->updateSyntax(); + // @codeCoverageIgnoreEnd } } @@ -456,7 +453,9 @@ class Row { $this->idx < $this->parent->numRows )) { + // @codeCoverageIgnoreStart return; + // @codeCoverageIgnoreEnd } $tokens = $this->parent->tokens[$rowNum]; @@ -471,7 +470,9 @@ class Row { { if ($offset >= $this->rsize) { + // @codeCoverageIgnoreStart break; + // @codeCoverageIgnoreEnd } // A multi-line comment can end in the middle of a line... @@ -497,7 +498,9 @@ class Row { $charLen = strlen($char); if ($charLen === 0 || $offset >= $this->rsize) { + // @codeCoverageIgnoreStart continue; + // @codeCoverageIgnoreEnd } $charStart = strpos($this->render, $char, $offset); if ($charStart === FALSE) @@ -581,7 +584,9 @@ class Row { $this->hlOpenComment = $inComment; if ($changed && $this->idx + 1 < $this->parent->numRows) { + // @codeCoverageIgnoreStart $this->parent->rows[$this->idx + 1]->updateSyntax(); + // @codeCoverageIgnoreEnd } } } diff --git a/src/Termios.php b/src/Termios.php index cf692dd..bbdaae1 100644 --- a/src/Termios.php +++ b/src/Termios.php @@ -80,9 +80,10 @@ class Termios { { $instance = self::getInstance(); - write_stdout("\x1b[2J"); // Clear the screen - write_stdout("\x1b[H"); // Reposition cursor to top-left - echo "\n"; + // Cleanup + write_stdout(ANSI::CLEAR_SCREEN); + write_stdout(ANSI::RESET_CURSOR); + write_stdout("\n"); // New line, please $res = get_ffi()->tcsetattr(C::STDIN_FILENO, C::TCSAFLUSH, FFI::addr($instance->originalTermios)); diff --git a/src/ffi.h b/src/ffi.h index 0d5c51a..8137c40 100644 --- a/src/ffi.h +++ b/src/ffi.h @@ -11,6 +11,13 @@ #define FFI_SCOPE "terminal" #define FFI_LIB "libc.so.6" +// Nonsense for a test with a single quote +// Ignored by PHP due to the octothorpe (#) +#if 0 +# char* x = "String with \" escape char"; +# char y = 'q'; +#endif + // ----------------------------------------------------------------------------- //! // ----------------------------------------------------------------------------- diff --git a/tests/EditorTest.php b/tests/EditorTest.php index ecd79b5..f83d719 100644 --- a/tests/EditorTest.php +++ b/tests/EditorTest.php @@ -5,6 +5,17 @@ namespace Aviat\Kilo\Tests\Traits; use Aviat\Kilo\Editor; use PHPUnit\Framework\TestCase; use Spatie\Snapshots\MatchesSnapshots; +use function Aviat\Kilo\get_window_size; + +class MockEditor extends Editor { + public function __set(string $key, $value): void + { + if (property_exists($this, $key)) + { + $this->$key = $value; + } + } +} class EditorTest extends TestCase { use MatchesSnapshots; @@ -15,7 +26,10 @@ class EditorTest extends TestCase { { parent::setUp(); - $this->editor = Editor::new(); + // Mock the screen size, since that can vary widely + $this->editor = MockEditor::new(); + $this->editor->__set('screenRows', 23); + $this->editor->__set('screenCols', 80); } public function testSanity(): void @@ -26,14 +40,22 @@ class EditorTest extends TestCase { public function test__debugInfo(): void { - $state = json_encode($this->editor->__debugInfo()); + $state = json_encode($this->editor->__debugInfo(), JSON_THROW_ON_ERROR); + $this->assertMatchesJsonSnapshot($state); + } + + public function testOpenPHP(): void + { + $this->editor->open('test.php'); + $state = json_encode($this->editor, JSON_THROW_ON_ERROR); + $this->assertMatchesJsonSnapshot($state); } public function testOpen(): void { - $this->editor->open('test.php'); - $state = json_encode($this->editor); + $this->editor->open('src/ffi.h'); + $state = json_encode($this->editor, JSON_THROW_ON_ERROR); $this->assertMatchesJsonSnapshot($state); } diff --git a/tests/__snapshots__/EditorTest__testOpenPHP__1.json b/tests/__snapshots__/EditorTest__testOpenPHP__1.json new file mode 100644 index 0000000..eaf6dc0 --- /dev/null +++ b/tests/__snapshots__/EditorTest__testOpenPHP__1.json @@ -0,0 +1,4397 @@ +{ + "rows": [ + { + "render": "doNothing();", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 8, + 8, + 7, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 9, + 9, + 7 + ], + "idx": 31 + }, + { + "render": "", + "hl": [], + "idx": 32 + }, + { + "render": " $c = $a + $b;", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 0, + 7, + 0, + 8, + 8, + 0, + 7, + 0, + 8, + 8, + 7 + ], + "idx": 33 + }, + { + "render": " $a = $c - $b;", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 0, + 7, + 0, + 8, + 8, + 0, + 7, + 0, + 8, + 8, + 7 + ], + "idx": 34 + }, + { + "render": "", + "hl": [], + "idx": 35 + }, + { + "render": " $c = $a * $b;", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 0, + 7, + 0, + 8, + 8, + 0, + 7, + 0, + 8, + 8, + 7 + ], + "idx": 36 + }, + { + "render": " $b = (int) ($c \/ $a);", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 0, + 7, + 0, + 4, + 4, + 4, + 4, + 4, + 0, + 9, + 8, + 8, + 0, + 7, + 0, + 8, + 8, + 9, + 7 + ], + "idx": 37 + }, + { + "render": "", + "hl": [], + "idx": 38 + }, + { + "render": " return $c;", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 8, + 8, + 7 + ], + "idx": 39 + }, + { + "render": " }", + "hl": [ + 0, + 0, + 0, + 0, + 9 + ], + "idx": 40 + }, + { + "render": "}", + "hl": [ + 9 + ], + "idx": 41 + }, + { + "render": "", + "hl": [], + "idx": 42 + }, + { + "render": "\/*", + "hl": [ + 2, + 2 + ], + "idx": 43 + }, + { + "render": " * Multi-line comment", + "hl": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "idx": 44 + }, + { + "render": " *\/", + "hl": [ + 2, + 2, + 2 + ], + "idx": 45 + }, + { + "render": "$foobar = new FooBar();", + "hl": [ + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 0, + 7, + 0, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 9, + 9, + 7 + ], + "idx": 46 + }, + { + "render": "", + "hl": [], + "idx": 47 + }, + { + "render": "$baz = ['a' => 'b'];", + "hl": [ + 8, + 8, + 8, + 8, + 0, + 7, + 0, + 9, + 5, + 5, + 5, + 0, + 7, + 7, + 0, + 5, + 5, + 5, + 9, + 7 + ], + "idx": 48 + }, + { + "render": "", + "hl": [], + "idx": 49 + }, + { + "render": "\/\/ C++ style comment", + "hl": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "idx": 50 + }, + { + "render": "$x = 3;", + "hl": [ + 8, + 8, + 0, + 7, + 0, + 6, + 7 + ], + "idx": 51 + }, + { + "render": "", + "hl": [], + "idx": 52 + }, + { + "render": "# Perl-style comment", + "hl": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "idx": 53 + }, + { + "render": "$y = [", + "hl": [ + 8, + 8, + 0, + 7, + 0, + 9 + ], + "idx": 54 + }, + { + "render": " 1,", + "hl": [ + 0, + 0, + 0, + 0, + 6, + 7 + ], + "idx": 55 + }, + { + "render": " 2,", + "hl": [ + 0, + 0, + 0, + 0, + 6, + 7 + ], + "idx": 56 + }, + { + "render": " 3", + "hl": [ + 0, + 0, + 0, + 0, + 6 + ], + "idx": 57 + }, + { + "render": "];", + "hl": [ + 9, + 7 + ], + "idx": 58 + }, + { + "render": "", + "hl": [], + "idx": 59 + }, + { + "render": "\/\/ Multi-line ternary statement", + "hl": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "idx": 60 + }, + { + "render": "$q = ($x !== 2)", + "hl": [ + 8, + 8, + 0, + 7, + 0, + 9, + 8, + 8, + 0, + 7, + 7, + 7, + 0, + 6, + 9 + ], + "idx": 61 + }, + { + "render": " ? 'yes'", + "hl": [ + 0, + 0, + 0, + 0, + 7, + 0, + 5, + 5, + 5, + 5, + 5 + ], + "idx": 62 + }, + { + "render": " : 'no';", + "hl": [ + 0, + 0, + 0, + 0, + 7, + 0, + 5, + 5, + 5, + 5, + 7 + ], + "idx": 63 + }, + { + "render": "", + "hl": [], + "idx": 64 + }, + { + "render": "\/*", + "hl": [ + 2, + 2 + ], + "idx": 65 + }, + { + "render": "Heredoc", + "hl": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "idx": 66 + }, + { + "render": "*\/$z = $x + $y;", + "hl": [ + 2, + 2, + 8, + 8, + 0, + 7, + 0, + 8, + 8, + 0, + 7, + 0, + 8, + 8, + 7 + ], + "idx": 67 + }, + { + "render": "$sql = <<{x}<\/foo>", + "hl": [ + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5 + ], + "idx": 74 + }, + { + "render": "TEMPLATE;", + "hl": [ + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 7 + ], + "idx": 75 + }, + { + "render": "", + "hl": [], + "idx": 76 + }, + { + "render": "?>", + "hl": [ + 9, + 9 + ], + "idx": 77 + }, + { + "render": "", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "idx": 78 + }, + { + "render": "", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0 + ], + "idx": 79 + }, + { + "render": "

<\/h1>", + "hl": [ + 0, + 0, + 0, + 0, + 9, + 9, + 9, + 0, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 9, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 9, + 0, + 9, + 9, + 0, + 0, + 0, + 0, + 0 + ], + "idx": 80 + }, + { + "render": "<\/body>", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "idx": 81 + }, + { + "render": "<\/html>", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "idx": 82 + }, + { + "render": "", + "hl": [ + 9, + 9, + 9, + 9, + 9, + 9, + 0, + 0, + 0, + 0, + 9, + 9, + 7, + 0, + 9, + 9 + ], + "idx": 83 + } + ], + "dirty": 0, + "filename": "test.php", + "syntax": { + "filetype": "PHP", + "filematch": [ + ".php", + "kilo" + ], + "singleLineCommentStart": "\/\/", + "multiLineCommentStart": "\/*", + "multiLineCommentEnd": "*\/", + "keywords1": [ + "?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__" + ], + "keywords2": [ + "int", + "float", + "bool", + "string", + "true", + "TRUE", + "false", + "FALSE", + "null", + "NULL", + "void", + "iterable", + "object", + "strict_types" + ], + "tokens": [], + "flags": 3 + }, + "tokens": { + "1": [ + { + "type": 382, + "typeName": "T_OPEN_TAG", + "char": "", + "line": 32 + }, + { + "type": 311, + "typeName": "T_STRING", + "char": "doNothing", + "line": 32 + }, + { + "type": -1, + "typeName": "RAW", + "char": "(" + }, + { + "type": -1, + "typeName": "RAW", + "char": ")" + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n\n ", + "line": 32 + } + ], + "33": [], + "34": [ + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$c", + "line": 34 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 34 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 34 + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$a", + "line": 34 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 34 + }, + { + "type": -1, + "typeName": "RAW", + "char": "+" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 34 + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$b", + "line": 34 + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n ", + "line": 34 + } + ], + "35": [ + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$a", + "line": 35 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 35 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 35 + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$c", + "line": 35 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 35 + }, + { + "type": -1, + "typeName": "RAW", + "char": "-" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 35 + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$b", + "line": 35 + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n\n ", + "line": 35 + } + ], + "36": [], + "37": [ + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$c", + "line": 37 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 37 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 37 + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$a", + "line": 37 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 37 + }, + { + "type": -1, + "typeName": "RAW", + "char": "*" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 37 + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$b", + "line": 37 + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n ", + "line": 37 + } + ], + "38": [ + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$b", + "line": 38 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 38 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 38 + }, + { + "type": 296, + "typeName": "T_INT_CAST", + "char": "(int)", + "line": 38 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 38 + }, + { + "type": -1, + "typeName": "RAW", + "char": "(" + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$c", + "line": 38 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 38 + }, + { + "type": -1, + "typeName": "RAW", + "char": "\/" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 38 + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$a", + "line": 38 + }, + { + "type": -1, + "typeName": "RAW", + "char": ")" + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n\n ", + "line": 38 + } + ], + "39": [], + "40": [ + { + "type": 345, + "typeName": "T_RETURN", + "char": "return", + "line": 40 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 40 + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$c", + "line": 40 + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n ", + "line": 40 + } + ], + "41": [ + { + "type": -1, + "typeName": "RAW", + "char": "}" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n", + "line": 41 + } + ], + "42": [ + { + "type": -1, + "typeName": "RAW", + "char": "}" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n\n", + "line": 42 + } + ], + "43": [], + "44": [ + { + "type": 380, + "typeName": "T_COMMENT", + "char": "\/*", + "line": 44, + "original": { + "string": "\/*\n * Multi-line comment\n *\/", + "lines": [ + "\/*", + " * Multi-line comment", + " *\/" + ] + } + } + ], + "45": [ + { + "type": -1, + "typeName": "RAW", + "char": " * Multi-line comment" + } + ], + "46": [ + { + "type": -1, + "typeName": "RAW", + "char": " *\/" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n", + "line": 46 + } + ], + "47": [ + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$foobar", + "line": 47 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 47 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 47 + }, + { + "type": 304, + "typeName": "T_NEW", + "char": "new", + "line": 47 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 47 + }, + { + "type": 311, + "typeName": "T_STRING", + "char": "FooBar", + "line": 47 + }, + { + "type": -1, + "typeName": "RAW", + "char": "(" + }, + { + "type": -1, + "typeName": "RAW", + "char": ")" + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n\n", + "line": 47 + } + ], + "48": [], + "49": [ + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$baz", + "line": 49 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 49 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 49 + }, + { + "type": -1, + "typeName": "RAW", + "char": "[" + }, + { + "type": 315, + "typeName": "T_CONSTANT_ENCAPSED_STRING", + "char": "'a'", + "line": 49 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 49 + }, + { + "type": 268, + "typeName": "T_DOUBLE_ARROW", + "char": "=>", + "line": 49 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 49 + }, + { + "type": 315, + "typeName": "T_CONSTANT_ENCAPSED_STRING", + "char": "'b'", + "line": 49 + }, + { + "type": -1, + "typeName": "RAW", + "char": "]" + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n\n", + "line": 49 + } + ], + "50": [], + "51": [ + { + "type": 380, + "typeName": "T_COMMENT", + "char": "\/\/ C++ style comment", + "line": 51, + "original": { + "string": "\/\/ C++ style comment\n", + "lines": [ + "\/\/ C++ style comment", + "" + ] + } + } + ], + "52": [ + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$x", + "line": 52 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 52 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 52 + }, + { + "type": 309, + "typeName": "T_LNUMBER", + "char": "3", + "line": 52 + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n\n", + "line": 52 + } + ], + "53": [], + "54": [ + { + "type": 380, + "typeName": "T_COMMENT", + "char": "# Perl-style comment", + "line": 54, + "original": { + "string": "# Perl-style comment\n", + "lines": [ + "# Perl-style comment", + "" + ] + } + } + ], + "55": [ + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$y", + "line": 55 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 55 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 55 + }, + { + "type": -1, + "typeName": "RAW", + "char": "[" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n ", + "line": 55 + } + ], + "56": [ + { + "type": 309, + "typeName": "T_LNUMBER", + "char": "1", + "line": 56 + }, + { + "type": -1, + "typeName": "RAW", + "char": "," + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n ", + "line": 56 + } + ], + "57": [ + { + "type": 309, + "typeName": "T_LNUMBER", + "char": "2", + "line": 57 + }, + { + "type": -1, + "typeName": "RAW", + "char": "," + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n ", + "line": 57 + } + ], + "58": [ + { + "type": 309, + "typeName": "T_LNUMBER", + "char": "3", + "line": 58 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n", + "line": 58 + } + ], + "59": [ + { + "type": -1, + "typeName": "RAW", + "char": "]" + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n\n", + "line": 59 + } + ], + "60": [], + "61": [ + { + "type": 380, + "typeName": "T_COMMENT", + "char": "\/\/ Multi-line ternary statement", + "line": 61, + "original": { + "string": "\/\/ Multi-line ternary statement\n", + "lines": [ + "\/\/ Multi-line ternary statement", + "" + ] + } + } + ], + "62": [ + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$q", + "line": 62 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 62 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 62 + }, + { + "type": -1, + "typeName": "RAW", + "char": "(" + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$x", + "line": 62 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 62 + }, + { + "type": 289, + "typeName": "T_IS_NOT_IDENTICAL", + "char": "!==", + "line": 62 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 62 + }, + { + "type": 309, + "typeName": "T_LNUMBER", + "char": "2", + "line": 62 + }, + { + "type": -1, + "typeName": "RAW", + "char": ")" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n ", + "line": 62 + } + ], + "63": [ + { + "type": -1, + "typeName": "RAW", + "char": "?" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 63 + }, + { + "type": 315, + "typeName": "T_CONSTANT_ENCAPSED_STRING", + "char": "'yes'", + "line": 63 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n ", + "line": 63 + } + ], + "64": [ + { + "type": -1, + "typeName": "RAW", + "char": ":" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 64 + }, + { + "type": 315, + "typeName": "T_CONSTANT_ENCAPSED_STRING", + "char": "'no'", + "line": 64 + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n\n", + "line": 64 + } + ], + "65": [], + "66": [ + { + "type": 380, + "typeName": "T_COMMENT", + "char": "\/*", + "line": 66, + "original": { + "string": "\/*\nHeredoc\n*\/", + "lines": [ + "\/*", + "Heredoc", + "*\/" + ] + } + } + ], + "67": [ + { + "type": -1, + "typeName": "RAW", + "char": "Heredoc" + } + ], + "68": [ + { + "type": -1, + "typeName": "RAW", + "char": "*\/" + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$z", + "line": 68 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 68 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 68 + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$x", + "line": 68 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 68 + }, + { + "type": -1, + "typeName": "RAW", + "char": "+" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 68 + }, + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$y", + "line": 68 + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n", + "line": 68 + } + ], + "69": [ + { + "type": 312, + "typeName": "T_VARIABLE", + "char": "$sql", + "line": 69 + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 69 + }, + { + "type": -1, + "typeName": "RAW", + "char": "=" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": " ", + "line": 69 + }, + { + "type": 386, + "typeName": "T_START_HEREDOC", + "char": "<<{x}<\/foo>", + "line": 75, + "original": { + "string": " {x}<\/foo>\n", + "lines": [ + " {x}<\/foo>", + "" + ] + } + } + ], + "76": [ + { + "type": 387, + "typeName": "T_END_HEREDOC", + "char": "TEMPLATE", + "line": 76 + }, + { + "type": -1, + "typeName": "RAW", + "char": ";" + }, + { + "type": 385, + "typeName": "T_WHITESPACE", + "char": "\n\n", + "line": 76 + } + ], + "77": [], + "78": [ + { + "type": 384, + "typeName": "T_CLOSE_TAG", + "char": "?>", + "line": 78, + "original": { + "string": "?>\n", + "lines": [ + "?>", + "" + ] + } + } + ], + "79": [ + { + "type": 313, + "typeName": "T_INLINE_HTML", + "char": "", + "line": 79, + "original": { + "string": "\n\n

", + "lines": [ + "", + "", + "

" + ] + } + } + ], + "80": [ + { + "type": -1, + "typeName": "RAW", + "char": "" + } + ], + "81": [ + { + "type": -1, + "typeName": "RAW", + "char": "

" + }, + { + "type": 383, + "typeName": "T_OPEN_TAG_WITH_ECHO", + "char": "", + "line": 81 + }, + { + "type": 313, + "typeName": "T_INLINE_HTML", + "char": "<\/h1>", + "line": 81, + "original": { + "string": "<\/h1>\n<\/body>\n<\/html>\n", + "lines": [ + "<\/h1>", + "<\/body>", + "<\/html>", + "" + ] + } + } + ], + "82": [ + { + "type": -1, + "typeName": "RAW", + "char": "<\/body>" + } + ], + "83": [ + { + "type": -1, + "typeName": "RAW", + "char": "<\/html>" + } + ], + "84": [ + { + "type": 382, + "typeName": "T_OPEN_TAG", + "char": "", + "line": 84 + } + ] + } +} diff --git a/tests/__snapshots__/EditorTest__testOpen__1.json b/tests/__snapshots__/EditorTest__testOpen__1.json index eaf6dc0..5d09002 100644 --- a/tests/__snapshots__/EditorTest__testOpen__1.json +++ b/tests/__snapshots__/EditorTest__testOpen__1.json @@ -1,436 +1,5 @@ { "rows": [ - { - "render": "", "hl": [ - 0, - 0, - 0, - 0, - 3, - 3, - 3, - 3, - 3, - 3, - 0, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 0, - 0, - 0, - 0, - 9, - 4, - 4, - 4, - 0, - 8, - 8, - 7, - 0, - 4, - 4, - 4, - 4, - 4, - 0, - 8, - 8, - 7, - 0, - 9, - 9, - 9, - 9, - 9, - 0, - 8, - 8, - 7, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 8, - 8, - 7, - 0, - 4, - 4, - 4, - 4, - 4, - 4, - 0, - 8, - 8, - 0, - 7, - 0, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 9, - 7, - 0, - 4, - 4, - 4, - 4, - 4, - 4 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 ], "idx": 21 }, { - "render": " {", + "render": "\/\/ -----------------------------------------------------------------------------", "hl": [ - 0, - 0, - 0, - 0, - 9 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 ], "idx": 22 }, { - "render": " $cstr = print_r($c, TRUE);", - "hl": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 8, - 8, - 8, - 8, - 8, - 0, - 7, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 9, - 8, - 8, - 7, - 0, - 4, - 4, - 4, - 4, - 9, - 7 - ], + "render": "", + "hl": [], "idx": 23 }, { - "render": " $d();", + "render": "\/* Type of terminal control flag masks. *\/", "hl": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 8, - 8, - 9, - 9, - 7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 ], "idx": 24 }, { - "render": "", - "hl": [], + "render": "typedef unsigned long int tcflag_t;", + "hl": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 0, + 4, + 4, + 4, + 4, + 0, + 4, + 4, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], "idx": 25 }, { - "render": " return \"{$a}, ${b}, \" . $cstr;", - "hl": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 3, - 3, - 3, - 3, - 3, - 3, - 0, - 9, - 9, - 8, - 8, - 9, - 5, - 5, - 9, - 9, - 8, - 9, - 5, - 5, - 9, - 0, - 7, - 0, - 8, - 8, - 8, - 8, - 8, - 7 - ], + "render": "", + "hl": [], "idx": 26 }, { - "render": " }", + "render": "\/* Type of control characters. *\/", "hl": [ - 0, - 0, - 0, - 0, - 9 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 ], "idx": 27 }, { - "render": "", - "hl": [], + "render": "typedef unsigned char cc_t;", + "hl": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 0, + 4, + 4, + 4, + 4, + 0, + 0, + 0, + 0, + 0, + 0 + ], "idx": 28 }, { - "render": " private function operations(int $a, int $b): int", - "hl": [ - 0, - 0, - 0, - 0, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 0, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 3, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 9, - 4, - 4, - 4, - 0, - 8, - 8, - 7, - 0, - 4, - 4, - 4, - 0, - 8, - 8, - 9, - 7, - 0, - 4, - 4, - 4 - ], + "render": "", + "hl": [], "idx": 29 }, { - "render": " {", + "render": "\/* Type of baud rate specifiers. *\/", "hl": [ - 0, - 0, - 0, - 0, - 9 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 ], "idx": 30 }, { - "render": " $this->doNothing();", + "render": "typedef long int speed_t;", "hl": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 4, + 4, + 4, + 4, + 0, + 4, + 4, + 4, 0, 0, 0, @@ -838,25 +1036,7 @@ 0, 0, 0, - 8, - 8, - 8, - 8, - 8, - 7, - 7, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 9, - 9, - 7 + 0 ], "idx": 31 }, @@ -866,35 +1046,54 @@ "idx": 32 }, { - "render": " $c = $a + $b;", + "render": "\/* Terminal control structure. *\/", "hl": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 8, - 8, - 0, - 7, - 0, - 8, - 8, - 0, - 7, - 0, - 8, - 8, - 7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 ], "idx": 33 }, { - "render": " $a = $c - $b;", + "render": "struct termios", "hl": [ + 3, + 3, + 3, + 3, + 3, + 3, 0, 0, 0, @@ -902,57 +1101,46 @@ 0, 0, 0, - 0, - 8, - 8, - 0, - 7, - 0, - 8, - 8, - 0, - 7, - 0, - 8, - 8, - 7 + 0 ], "idx": 34 }, { - "render": "", - "hl": [], + "render": "{", + "hl": [ + 0 + ], "idx": 35 }, { - "render": " $c = $a * $b;", + "render": " \/* Input modes. *\/", "hl": [ 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, - 8, - 8, - 0, - 7, - 0, - 8, - 8, - 0, - 7, - 0, - 8, - 8, - 7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 ], "idx": 36 }, { - "render": " $b = (int) ($c \/ $a);", + "render": " tcflag_t c_iflag;", "hl": [ 0, 0, @@ -962,27 +1150,17 @@ 0, 0, 0, - 8, - 8, 0, - 7, 0, - 4, - 4, - 4, - 4, - 4, 0, - 9, - 8, - 8, 0, - 7, 0, - 8, - 8, - 9, - 7 + 0, + 0, + 0, + 0, + 0, + 0 ], "idx": 37 }, @@ -992,90 +1170,143 @@ "idx": 38 }, { - "render": " return $c;", + "render": " \/* Output modes. *\/", "hl": [ 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, - 3, - 3, - 3, - 3, - 3, - 3, - 0, - 8, - 8, - 7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 ], "idx": 39 }, { - "render": " }", + "render": " tcflag_t c_oflag;", "hl": [ 0, 0, 0, 0, - 9 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 ], "idx": 40 }, { - "render": "}", - "hl": [ - 9 - ], + "render": "", + "hl": [], "idx": 41 }, { - "render": "", - "hl": [], + "render": " \/* Control modes. *\/", + "hl": [ + 0, + 0, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], "idx": 42 }, { - "render": "\/*", + "render": " tcflag_t c_cflag;", "hl": [ - 2, - 2 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 ], "idx": 43 }, { - "render": " * Multi-line comment", - "hl": [ - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2 - ], + "render": "", + "hl": [], "idx": 44 }, { - "render": " *\/", + "render": " \/* Local modes. *\/", "hl": [ + 0, + 0, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, 2, 2, 2 @@ -1083,21 +1314,8 @@ "idx": 45 }, { - "render": "$foobar = new FooBar();", + "render": " tcflag_t c_lflag;", "hl": [ - 8, - 8, - 8, - 8, - 8, - 8, - 8, - 0, - 7, - 0, - 3, - 3, - 3, 0, 0, 0, @@ -1105,9 +1323,18 @@ 0, 0, 0, - 9, - 9, - 7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 ], "idx": 46 }, @@ -1117,83 +1344,365 @@ "idx": 47 }, { - "render": "$baz = ['a' => 'b'];", + "render": " \/* Control characters. *\/", "hl": [ - 8, - 8, - 8, - 8, 0, - 7, 0, - 9, - 5, - 5, - 5, - 0, - 7, - 7, - 0, - 5, - 5, - 5, - 9, - 7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 ], "idx": 48 }, { - "render": "", - "hl": [], + "render": " cc_t c_cc[20];", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 6, + 6, + 0, + 0 + ], "idx": 49 }, { - "render": "\/\/ C++ style comment", - "hl": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ], + "render": "", + "hl": [], "idx": 50 }, { - "render": "$x = 3;", + "render": " \/* Input and output baud rates. *\/", "hl": [ - 8, - 8, 0, - 7, 0, - 6, - 7 + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 ], "idx": 51 }, { - "render": "", - "hl": [], + "render": " speed_t __ispeed, __ospeed;", + "hl": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], "idx": 52 }, { - "render": "# Perl-style comment", + "render": "};", "hl": [ + 0, + 0 + ], + "idx": 53 + }, + { + "render": "", + "hl": [], + "idx": 54 + }, + { + "render": "int tcgetattr (int fd, struct termios *termios_p);", + "hl": [ + 4, + 4, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 4, + 4, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "idx": 55 + }, + { + "render": "int tcsetattr (int fd, int optional_actions, const struct termios *termios_p);", + "hl": [ + 4, + 4, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 4, + 4, + 0, + 0, + 0, + 0, + 0, + 4, + 4, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "idx": 56 + }, + { + "render": "", + "hl": [], + "idx": 57 + }, + { + "render": "\/\/ -----------------------------------------------------------------------------", + "hl": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, 1, 1, 1, @@ -1215,71 +1724,83 @@ 1, 1 ], - "idx": 53 - }, - { - "render": "$y = [", - "hl": [ - 8, - 8, - 0, - 7, - 0, - 9 - ], - "idx": 54 - }, - { - "render": " 1,", - "hl": [ - 0, - 0, - 0, - 0, - 6, - 7 - ], - "idx": 55 - }, - { - "render": " 2,", - "hl": [ - 0, - 0, - 0, - 0, - 6, - 7 - ], - "idx": 56 - }, - { - "render": " 3", - "hl": [ - 0, - 0, - 0, - 0, - 6 - ], - "idx": 57 - }, - { - "render": "];", - "hl": [ - 9, - 7 - ], "idx": 58 }, { - "render": "", - "hl": [], + "render": "\/\/! ", + "hl": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], "idx": 59 }, { - "render": "\/\/ Multi-line ternary statement", + "render": "\/\/ -----------------------------------------------------------------------------", "hl": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, 1, 1, 1, @@ -1315,3083 +1836,251 @@ "idx": 60 }, { - "render": "$q = ($x !== 2)", + "render": "struct winsize {", "hl": [ - 8, - 8, + 3, + 3, + 3, + 3, + 3, + 3, 0, - 7, 0, - 9, - 8, - 8, 0, - 7, - 7, - 7, 0, - 6, - 9 + 0, + 0, + 0, + 0, + 0, + 0 ], "idx": 61 }, { - "render": " ? 'yes'", + "render": " unsigned short ws_row;", "hl": [ 0, 0, 0, 0, - 7, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, 0, - 5, - 5, - 5, - 5, - 5 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 ], "idx": 62 }, { - "render": " : 'no';", + "render": " unsigned short ws_col;", "hl": [ 0, 0, 0, 0, - 7, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, 0, - 5, - 5, - 5, - 5, - 7 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 ], "idx": 63 }, { - "render": "", - "hl": [], + "render": " unsigned short ws_xpixel;", + "hl": [ + 0, + 0, + 0, + 0, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], "idx": 64 }, { - "render": "\/*", + "render": " unsigned short ws_ypixel;", "hl": [ - 2, - 2 + 0, + 0, + 0, + 0, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 ], "idx": 65 }, { - "render": "Heredoc", + "render": "};", "hl": [ - 2, - 2, - 2, - 2, - 2, - 2, - 2 + 0, + 0 ], "idx": 66 }, { - "render": "*\/$z = $x + $y;", + "render": "int ioctl (int, int, ...);", "hl": [ - 2, - 2, - 8, - 8, + 4, + 4, + 4, 0, - 7, 0, - 8, - 8, 0, - 7, 0, - 8, - 8, - 7 + 0, + 0, + 0, + 0, + 4, + 4, + 4, + 0, + 0, + 4, + 4, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 0 ], "idx": 67 - }, - { - "render": "$sql = <<{x}<\/foo>", - "hl": [ - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5 - ], - "idx": 74 - }, - { - "render": "TEMPLATE;", - "hl": [ - 9, - 9, - 9, - 9, - 9, - 9, - 9, - 9, - 7 - ], - "idx": 75 - }, - { - "render": "", - "hl": [], - "idx": 76 - }, - { - "render": "?>", - "hl": [ - 9, - 9 - ], - "idx": 77 - }, - { - "render": "", - "hl": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "idx": 78 - }, - { - "render": "", - "hl": [ - 0, - 0, - 0, - 0, - 0, - 0 - ], - "idx": 79 - }, - { - "render": "

<\/h1>", - "hl": [ - 0, - 0, - 0, - 0, - 9, - 9, - 9, - 0, - 8, - 8, - 8, - 8, - 8, - 8, - 8, - 8, - 9, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 5, - 9, - 0, - 9, - 9, - 0, - 0, - 0, - 0, - 0 - ], - "idx": 80 - }, - { - "render": "<\/body>", - "hl": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "idx": 81 - }, - { - "render": "<\/html>", - "hl": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "idx": 82 - }, - { - "render": "", - "hl": [ - 9, - 9, - 9, - 9, - 9, - 9, - 0, - 0, - 0, - 0, - 9, - 9, - 7, - 0, - 9, - 9 - ], - "idx": 83 } ], "dirty": 0, - "filename": "test.php", + "filename": "src\/ffi.h", "syntax": { - "filetype": "PHP", + "filetype": "C", "filematch": [ - ".php", - "kilo" + ".c", + ".h", + ".cpp" ], "singleLineCommentStart": "\/\/", "multiLineCommentStart": "\/*", "multiLineCommentEnd": "*\/", "keywords1": [ - "?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", + "typedef", + "switch", "return", "static", - "switch", - "throw", - "trait", - "try", - "unset", - "use", - "var", "while", - "xor", - "yield", - "yield from", - "__CLASS__", - "__DIR__", - "__FILE__", - "__FUNCTION__", - "__LINE__", - "__METHOD__", - "__NAMESPACE__", - "__TRAIT__" + "break", + "struct", + "union", + "class", + "else", + "enum", + "for", + "case", + "if" ], "keywords2": [ - "int", + "#include", + "unsigned", + "#define", + "#ifndef", + "double", + "signed", + "#endif", + "#ifdef", "float", - "bool", - "string", - "true", - "TRUE", - "false", - "FALSE", - "null", - "NULL", + "#error", + "#undef", + "long", + "char", + "int", "void", - "iterable", - "object", - "strict_types" + "#if" ], "tokens": [], "flags": 3 }, - "tokens": { - "1": [ - { - "type": 382, - "typeName": "T_OPEN_TAG", - "char": "", - "line": 32 - }, - { - "type": 311, - "typeName": "T_STRING", - "char": "doNothing", - "line": 32 - }, - { - "type": -1, - "typeName": "RAW", - "char": "(" - }, - { - "type": -1, - "typeName": "RAW", - "char": ")" - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n\n ", - "line": 32 - } - ], - "33": [], - "34": [ - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$c", - "line": 34 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 34 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 34 - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$a", - "line": 34 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 34 - }, - { - "type": -1, - "typeName": "RAW", - "char": "+" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 34 - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$b", - "line": 34 - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n ", - "line": 34 - } - ], - "35": [ - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$a", - "line": 35 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 35 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 35 - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$c", - "line": 35 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 35 - }, - { - "type": -1, - "typeName": "RAW", - "char": "-" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 35 - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$b", - "line": 35 - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n\n ", - "line": 35 - } - ], - "36": [], - "37": [ - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$c", - "line": 37 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 37 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 37 - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$a", - "line": 37 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 37 - }, - { - "type": -1, - "typeName": "RAW", - "char": "*" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 37 - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$b", - "line": 37 - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n ", - "line": 37 - } - ], - "38": [ - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$b", - "line": 38 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 38 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 38 - }, - { - "type": 296, - "typeName": "T_INT_CAST", - "char": "(int)", - "line": 38 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 38 - }, - { - "type": -1, - "typeName": "RAW", - "char": "(" - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$c", - "line": 38 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 38 - }, - { - "type": -1, - "typeName": "RAW", - "char": "\/" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 38 - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$a", - "line": 38 - }, - { - "type": -1, - "typeName": "RAW", - "char": ")" - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n\n ", - "line": 38 - } - ], - "39": [], - "40": [ - { - "type": 345, - "typeName": "T_RETURN", - "char": "return", - "line": 40 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 40 - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$c", - "line": 40 - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n ", - "line": 40 - } - ], - "41": [ - { - "type": -1, - "typeName": "RAW", - "char": "}" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n", - "line": 41 - } - ], - "42": [ - { - "type": -1, - "typeName": "RAW", - "char": "}" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n\n", - "line": 42 - } - ], - "43": [], - "44": [ - { - "type": 380, - "typeName": "T_COMMENT", - "char": "\/*", - "line": 44, - "original": { - "string": "\/*\n * Multi-line comment\n *\/", - "lines": [ - "\/*", - " * Multi-line comment", - " *\/" - ] - } - } - ], - "45": [ - { - "type": -1, - "typeName": "RAW", - "char": " * Multi-line comment" - } - ], - "46": [ - { - "type": -1, - "typeName": "RAW", - "char": " *\/" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n", - "line": 46 - } - ], - "47": [ - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$foobar", - "line": 47 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 47 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 47 - }, - { - "type": 304, - "typeName": "T_NEW", - "char": "new", - "line": 47 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 47 - }, - { - "type": 311, - "typeName": "T_STRING", - "char": "FooBar", - "line": 47 - }, - { - "type": -1, - "typeName": "RAW", - "char": "(" - }, - { - "type": -1, - "typeName": "RAW", - "char": ")" - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n\n", - "line": 47 - } - ], - "48": [], - "49": [ - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$baz", - "line": 49 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 49 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 49 - }, - { - "type": -1, - "typeName": "RAW", - "char": "[" - }, - { - "type": 315, - "typeName": "T_CONSTANT_ENCAPSED_STRING", - "char": "'a'", - "line": 49 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 49 - }, - { - "type": 268, - "typeName": "T_DOUBLE_ARROW", - "char": "=>", - "line": 49 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 49 - }, - { - "type": 315, - "typeName": "T_CONSTANT_ENCAPSED_STRING", - "char": "'b'", - "line": 49 - }, - { - "type": -1, - "typeName": "RAW", - "char": "]" - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n\n", - "line": 49 - } - ], - "50": [], - "51": [ - { - "type": 380, - "typeName": "T_COMMENT", - "char": "\/\/ C++ style comment", - "line": 51, - "original": { - "string": "\/\/ C++ style comment\n", - "lines": [ - "\/\/ C++ style comment", - "" - ] - } - } - ], - "52": [ - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$x", - "line": 52 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 52 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 52 - }, - { - "type": 309, - "typeName": "T_LNUMBER", - "char": "3", - "line": 52 - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n\n", - "line": 52 - } - ], - "53": [], - "54": [ - { - "type": 380, - "typeName": "T_COMMENT", - "char": "# Perl-style comment", - "line": 54, - "original": { - "string": "# Perl-style comment\n", - "lines": [ - "# Perl-style comment", - "" - ] - } - } - ], - "55": [ - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$y", - "line": 55 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 55 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 55 - }, - { - "type": -1, - "typeName": "RAW", - "char": "[" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n ", - "line": 55 - } - ], - "56": [ - { - "type": 309, - "typeName": "T_LNUMBER", - "char": "1", - "line": 56 - }, - { - "type": -1, - "typeName": "RAW", - "char": "," - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n ", - "line": 56 - } - ], - "57": [ - { - "type": 309, - "typeName": "T_LNUMBER", - "char": "2", - "line": 57 - }, - { - "type": -1, - "typeName": "RAW", - "char": "," - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n ", - "line": 57 - } - ], - "58": [ - { - "type": 309, - "typeName": "T_LNUMBER", - "char": "3", - "line": 58 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n", - "line": 58 - } - ], - "59": [ - { - "type": -1, - "typeName": "RAW", - "char": "]" - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n\n", - "line": 59 - } - ], - "60": [], - "61": [ - { - "type": 380, - "typeName": "T_COMMENT", - "char": "\/\/ Multi-line ternary statement", - "line": 61, - "original": { - "string": "\/\/ Multi-line ternary statement\n", - "lines": [ - "\/\/ Multi-line ternary statement", - "" - ] - } - } - ], - "62": [ - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$q", - "line": 62 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 62 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 62 - }, - { - "type": -1, - "typeName": "RAW", - "char": "(" - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$x", - "line": 62 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 62 - }, - { - "type": 289, - "typeName": "T_IS_NOT_IDENTICAL", - "char": "!==", - "line": 62 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 62 - }, - { - "type": 309, - "typeName": "T_LNUMBER", - "char": "2", - "line": 62 - }, - { - "type": -1, - "typeName": "RAW", - "char": ")" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n ", - "line": 62 - } - ], - "63": [ - { - "type": -1, - "typeName": "RAW", - "char": "?" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 63 - }, - { - "type": 315, - "typeName": "T_CONSTANT_ENCAPSED_STRING", - "char": "'yes'", - "line": 63 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n ", - "line": 63 - } - ], - "64": [ - { - "type": -1, - "typeName": "RAW", - "char": ":" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 64 - }, - { - "type": 315, - "typeName": "T_CONSTANT_ENCAPSED_STRING", - "char": "'no'", - "line": 64 - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n\n", - "line": 64 - } - ], - "65": [], - "66": [ - { - "type": 380, - "typeName": "T_COMMENT", - "char": "\/*", - "line": 66, - "original": { - "string": "\/*\nHeredoc\n*\/", - "lines": [ - "\/*", - "Heredoc", - "*\/" - ] - } - } - ], - "67": [ - { - "type": -1, - "typeName": "RAW", - "char": "Heredoc" - } - ], - "68": [ - { - "type": -1, - "typeName": "RAW", - "char": "*\/" - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$z", - "line": 68 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 68 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 68 - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$x", - "line": 68 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 68 - }, - { - "type": -1, - "typeName": "RAW", - "char": "+" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 68 - }, - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$y", - "line": 68 - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n", - "line": 68 - } - ], - "69": [ - { - "type": 312, - "typeName": "T_VARIABLE", - "char": "$sql", - "line": 69 - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 69 - }, - { - "type": -1, - "typeName": "RAW", - "char": "=" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": " ", - "line": 69 - }, - { - "type": 386, - "typeName": "T_START_HEREDOC", - "char": "<<{x}<\/foo>", - "line": 75, - "original": { - "string": " {x}<\/foo>\n", - "lines": [ - " {x}<\/foo>", - "" - ] - } - } - ], - "76": [ - { - "type": 387, - "typeName": "T_END_HEREDOC", - "char": "TEMPLATE", - "line": 76 - }, - { - "type": -1, - "typeName": "RAW", - "char": ";" - }, - { - "type": 385, - "typeName": "T_WHITESPACE", - "char": "\n\n", - "line": 76 - } - ], - "77": [], - "78": [ - { - "type": 384, - "typeName": "T_CLOSE_TAG", - "char": "?>", - "line": 78, - "original": { - "string": "?>\n", - "lines": [ - "?>", - "" - ] - } - } - ], - "79": [ - { - "type": 313, - "typeName": "T_INLINE_HTML", - "char": "", - "line": 79, - "original": { - "string": "\n\n

", - "lines": [ - "", - "", - "

" - ] - } - } - ], - "80": [ - { - "type": -1, - "typeName": "RAW", - "char": "" - } - ], - "81": [ - { - "type": -1, - "typeName": "RAW", - "char": "

" - }, - { - "type": 383, - "typeName": "T_OPEN_TAG_WITH_ECHO", - "char": "", - "line": 81 - }, - { - "type": 313, - "typeName": "T_INLINE_HTML", - "char": "<\/h1>", - "line": 81, - "original": { - "string": "<\/h1>\n<\/body>\n<\/html>\n", - "lines": [ - "<\/h1>", - "<\/body>", - "<\/html>", - "" - ] - } - } - ], - "82": [ - { - "type": -1, - "typeName": "RAW", - "char": "<\/body>" - } - ], - "83": [ - { - "type": -1, - "typeName": "RAW", - "char": "<\/html>" - } - ], - "84": [ - { - "type": 382, - "typeName": "T_OPEN_TAG", - "char": "", - "line": 84 - } - ] - } + "tokens": [] }