File Manager Lite
Dir:
/home/codewavebd/public_html/vendor/psy/psysh/src/Readline/Interactive/Actions
Upload
[..]
AcceptSuggestionAction.php (1.12 KB)
Edit
Rename
Del
AcceptSuggestionWordAction.php (1.43 KB)
Edit
Rename
Del
ActionInterface.php (848 B)
Edit
Rename
Del
ClearBufferAction.php (2.12 KB)
Edit
Rename
Del
ClearScreenAction.php (975 B)
Edit
Rename
Del
DedentLeadingIndentationAction.php (1.99 KB)
Edit
Rename
Del
DeleteBackwardCharAction.php (818 B)
Edit
Rename
Del
DeleteBracketPairAction.php (1016 B)
Edit
Rename
Del
DeleteForwardAction.php (815 B)
Edit
Rename
Del
ExitIfEmptyAction.php (965 B)
Edit
Rename
Del
ExpandHistoryOnTabAction.php (1.41 KB)
Edit
Rename
Del
FallbackAction.php (1.85 KB)
Edit
Rename
Del
HistoryExpansionAction.php (9.65 KB)
Edit
Rename
Del
InsertCloseBracketAction.php (2.26 KB)
Edit
Rename
Del
InsertIndentOnTabAction.php (1.23 KB)
Edit
Rename
Del
InsertLineBreakAction.php (1.56 KB)
Edit
Rename
Del
InsertLineBreakOnIncompleteStatementAction.php (1.53 KB)
Edit
Rename
Del
InsertLineBreakOnUnclosedBracketsAction.php (1.46 KB)
Edit
Rename
Del
InsertOpenBracketAction.php (2.78 KB)
Edit
Rename
Del
InsertQuoteAction.php (1.3 KB)
Edit
Rename
Del
KillLineAction.php (801 B)
Edit
Rename
Del
KillTokenAction.php (993 B)
Edit
Rename
Del
KillWholeLineAction.php (816 B)
Edit
Rename
Del
KillWordAction.php (803 B)
Edit
Rename
Del
MoveLeftAction.php (789 B)
Edit
Rename
Del
MoveRightAction.php (793 B)
Edit
Rename
Del
MoveToEndAction.php (824 B)
Edit
Rename
Del
MoveToStartAction.php (1.33 KB)
Edit
Rename
Del
MoveTokenLeftAction.php (1.03 KB)
Edit
Rename
Del
MoveTokenRightAction.php (1.02 KB)
Edit
Rename
Del
MoveWordLeftAction.php (880 B)
Edit
Rename
Del
MoveWordRightAction.php (875 B)
Edit
Rename
Del
NextHistoryAction.php (1.74 KB)
Edit
Rename
Del
PreviousHistoryAction.php (2.12 KB)
Edit
Rename
Del
RejectSyntaxErrorAction.php (2.23 KB)
Edit
Rename
Del
ReverseSearchAction.php (1.21 KB)
Edit
Rename
Del
SelfInsertAction.php (1.01 KB)
Edit
Rename
Del
SubmitLineAction.php (1.21 KB)
Edit
Rename
Del
TabAction.php (16.99 KB)
Edit
Rename
Del
Edit: RejectSyntaxErrorAction.php
<?php /* * This file is part of Psy Shell. * * (c) 2012-2026 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Psy\Readline\Interactive\Actions; use Psy\Readline\Interactive\Input\Buffer; use Psy\Readline\Interactive\Readline; use Psy\Readline\Interactive\Terminal; /** * Reject submit when the buffer has an unrecoverable syntax error. * * Sets the input frame to error mode and rings the bell so the user can * fix the error in-place, rather than inserting a newline or submitting. */ class RejectSyntaxErrorAction implements ActionInterface { /** * {@inheritdoc} */ public function execute(Buffer $buffer, Terminal $terminal, Readline $readline): bool { if (!$buffer->hasUnrecoverableSyntaxError()) { return false; } $line = $buffer->getText(); if ($readline->isCommand($line) && !$readline->isInOpenStringOrComment($line)) { return false; } // Don't reject when there are truly unclosed brackets before // cursor (more opens than closes). In that case, the user is // still typing inside a bracket pair and the unclosed-brackets // action should handle continuation instead. if ($this->hasOpenBracketsBeforeCursor($buffer)) { return false; } $readline->setInputFrameError(true); $terminal->bell(); return true; } /** * Check if text before cursor has more opening brackets than closing. */ private function hasOpenBracketsBeforeCursor(Buffer $buffer): bool { $text = $buffer->getBeforeCursor(); if (\trim($text) === '') { return false; } $tokens = @\token_get_all('<?php '.$text); $depth = 0; $pairs = ['(' => 1, ')' => -1, '[' => 1, ']' => -1, '{' => 1, '}' => -1]; foreach ($tokens as $token) { if (\is_string($token) && isset($pairs[$token])) { $depth += $pairs[$token]; } } return $depth > 0; } /** * {@inheritdoc} */ public function getName(): string { return 'reject-syntax-error'; } }
Simpan