function parseJsonFile($ast) { assert_ast_type($ast, NodeType::JSON_FILE); $value = ast_node_data($ast); $source = ast_node_source($ast); return new JsonFile($source, $value); }
function parseImport($ast) { assert_ast_type($ast, NodeType::IMPORT); $lib = parseIdentifier(ast_node_data($ast)); $source = ast_node_source($ast); $base_dir = getenv('GROKIT_INSTALLED_LIBRARY_PATH'); $parts = LibraryManager::SplitNamespace($lib); $file = $base_dir . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $parts) . '.php'; $result = (include_once $file); grokit_assert($result !== false, 'Failed to include library ' . $lib . ', no library file ' . $file . ' found ' . $source); }