Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15399301
D12295.id29498.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
715 B
Referenced Files
None
Subscribers
None
D12295.id29498.diff
View Options
diff --git a/src/parser/aast/api/AASTNode.php b/src/parser/aast/api/AASTNode.php
--- a/src/parser/aast/api/AASTNode.php
+++ b/src/parser/aast/api/AASTNode.php
@@ -236,6 +236,21 @@
return implode('', mpull($tokens, 'getValue'));
}
+ public function getIndentation() {
+ $tokens = $this->getTokens();
+ $left = head($tokens);
+
+ while ($left && (!$left->isAnyWhitespace() || strpos($left->getValue(), "\n") === false)) {
+ $left = $left->getPrevToken();
+ }
+
+ if (!$left) {
+ return null;
+ }
+
+ return str_replace("\n", '', $left->getValue());
+ }
+
public function getDescription() {
$concrete = $this->getConcreteString();
if (strlen($concrete) > 75) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 18, 3:51 AM (3 w, 23 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7709338
Default Alt Text
D12295.id29498.diff (715 B)
Attached To
Mode
D12295: Add a method to get the indentation for an XHPASTNode
Attached
Detach File
Event Timeline
Log In to Comment