Last active
September 9, 2016 21:26
-
-
Save EclipseGc/6e9d6d4b58224aefa946042191fdf106 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$code = file_get_contents($file); | |
$tokens = token_get_all($code); | |
$tree = new \EclipseGc\Ast\Tree; | |
foreach ($tokens as $id => $token) { | |
if (is_array($token)) { | |
$tree->addNode($nodeDictionary->createInstance($token[0], $token[1], $id, $tokens); | |
} | |
else { | |
$tree->addNode($nodeDictionary->getInstance($token); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment