Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14047354
D12295.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
747 B
Referenced Files
None
Subscribers
None
D12295.id.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
@@ -239,6 +239,23 @@
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 preg_replace("/^.*\n/s", '', $left->getValue());
+ }
+
public function getDescription() {
$concrete = $this->getConcreteString();
if (strlen($concrete) > 75) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 3:37 AM (12 h, 55 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6719877
Default Alt Text
D12295.id.diff (747 B)
Attached To
Mode
D12295: Add a method to get the indentation for an XHPASTNode
Attached
Detach File
Event Timeline
Log In to Comment