Header parsing and HTML generating utilities for SwiftDoc.org

Overview

swiftdoc-parser

This project is no longer maintained. We're now using swift-doc to generate the SwiftDoc.org website.


Installation

These utilities are built on Node.js and use Graphviz for creating inheritance graphs. To install and run the utilities with these prerequisites:

  1. Clone or download the project.
  2. Install dependencies with npm install.
  3. Use the parser to convert a Swift header to JSON with ./index.js --json-only <filename>.

Other options:

$ ./index.js --help
Usage: node ./index.js [options] [file names...]

Options:
  --json-only   Output parsed headers as JSON only
  --config      Location of a configuration file  
  --output-dir  Output directory                    [default: "./output"]
  --url-prefix  URL prefix for generated links      [default: "/"]

Contributions

Issues and pull requests should be filed in this repository for problems relating to:

  • incorrect or missing declarations
  • truncated or missing comments
  • errors in hierarchy graphs

For errors in the SwiftDoc.org site itself, see the site's repository instead.

Contact

Follow @SwiftDocOrg on Twitter.

License

All code is available under the MIT License. Autogenerated documentation is © 2015 Apple, Inc. All other content is released under the Creative Commons BY-NC License.

Comments
  • Enable parsing of headers from third-party Swift frameworks

    Enable parsing of headers from third-party Swift frameworks

    When I try to parse this header I get the error message Error: couldn't find 'NSFileHandle' for extension.. If I add empty declarations for all the types the parser can't find, like so:

    class NSFileHandle {}
    
    struct String {}
    
    protocol Streamable {}
    protocol OutputStreamType {}
    

    I get the error message

    
    events.js:72
            throw er; // Unhandled 'error' event
                  ^
    Error: write EPIPE
        at errnoException (net.js:904:11)
        at Object.afterWrite (net.js:720:19)
    
    opened by kareman 8
  • Errors running `npm install`

    Errors running `npm install`

    I get the following errors at the end of running nom install

    npm ERR! Darwin 14.3.0
    npm ERR! argv "node" "/usr/local/bin/npm" "install"
    npm ERR! node v0.12.2
    npm ERR! npm  v2.7.4
    npm ERR! code ELIFECYCLE
    
    npm ERR! [email protected] install: `node-gyp rebuild`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
    npm ERR! This is most likely a problem with the pcre package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     node-gyp rebuild
    npm ERR! You can get their info via:
    npm ERR!     npm owner ls pcre
    npm ERR! There is likely additional logging output above.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /Users/travis/Development/swiftdoc-parser/npm-debug.log
    

    There's a ton of other messages that look iffy as well. Here's a link to my terminal output: https://www.dropbox.com/s/c3uifbsabdsrdsk/terminalOutput.txt?dl=0

    Here's a link to the npm log: https://www.dropbox.com/s/5yog82jpyn3mc9h/npm-debug.log?dl=0

    opened by traviskirton 4
  • node-gyp issues when running npm install

    node-gyp issues when running npm install

    I upgraded node and npm but still no go. Partial capture of error message below.

    make: *** [Release/obj.target/shell/execsync.o] Error 1 gyp ERR! build error gyp ERR! stack Error:make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:192:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Darwin 16.3.0 gyp ERR! command "/usr/local/Cellar/node/7.5.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/jchulani/Developer/tools/swiftdoc-parser/node_modules/execsyncs gyp ERR! node -v v7.5.0 gyp ERR! node-gyp -v v3.5.0 gyp ERR! not ok npm ERR! Darwin 16.3.0 npm ERR! argv "/usr/local/Cellar/node/7.5.0/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v7.5.0 npm ERR! npm v4.1.2 npm ERR! code ELIFECYCLE

    npm ERR! [email protected] install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the execsyncs package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs execsyncs npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls execsyncs npm ERR! There is likely additional logging output above.`

    opened by hackin247 2
  • Building error on `SinkType`

    Building error on `SinkType`

    http://swiftdoc.org/protocol/SinkType/

    Original:

    ///   func f(g: (X)->Void) { ... g(a) ...}
    ///
    /// the following generates better code::
    

    is converted to:

    | func f(g: (X)->Void) { .**g(a) ...}
     the following generates better code:**
    

    Maybe it caused by following: https://github.com/SwiftDocOrg/swiftdoc-parser/blob/master/lib%2Fswiftdoc-builder.js#L106

                    .replace(/\.\. ([^:]+)::/g, '**$1:**')       // incorrect format for inline header?
    

    Is excluding line ending needed?

    opened by norio-nomura 2
  • Support for Swift Package Manager supported project with C ModuleMaps

    Support for Swift Package Manager supported project with C ModuleMaps

    I am having difficulty having my Swift Package Manager-based Linux Swift project work with the swiftdoc-parser. We use C Modulemaps for adding support for C libraries. When I use index.js for producing the documentation, I get the following error:

    module.js:340
        throw err;
              ^
    Error: Cannot find module '../build/Release/pcre'
        at Function.Module._resolveFilename (module.js:338:15)
        at Function.Module._load (module.js:280:25)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at Object.<anonymous> (/home/rfdickerson/mil/swiftdoc-parser/node_modules/pcre/lib/pcre.js:1:74)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:364:17)
    

    At this point, does swiftdoc-parser work for Swift.org projects or just XCode?

    opened by rfdickerson 1
  • Cocoa and other framework support

    Cocoa and other framework support

    Great project! The information is presented in a much nicer way than apple does with their website. Any thoughts of extending this interface to the cocoa frameworks with an emphasis on interacting with swift?

    opened by weaksauce 1
  • Handle empty declarations with no line break between braces

    Handle empty declarations with no line break between braces

    As seen in Issue #2, using opening and closing braces on one line breaks the parser:

    class NSFileHandle {}
    struct String {}
    // etc
    

    leads to this error:

    events.js:72
         throw er; // Unhandled 'error' event
               ^
    Error: write EPIPE
         at errnoException (net.js:904:11)
         at Object.afterWrite (net.js:720:19)
    
    opened by natecook1000 1
  • Fix incorrect comment parsing for stride function

    Fix incorrect comment parsing for stride function

    This comments for this declaration:

    func stride<T : Strideable>(from start: T, through end: T, by stride: T.Stride) -> StrideThrough<T>
    

    are currently:

    Return the sequence of values (start, start + stride, start + stride + stride, .**last) where last is the last value in the progression less than or equal to end.

    .. Note:** There is no guarantee that end is an element of the sequence.

    opened by natecook1000 0
Owner
SwiftDoc
Documentation and resources for the Swift community
SwiftDoc
The Objective-C block utilities you always wish you had.

BlocksKit Blocks in C and Objective-C are downright magical. They make coding easier and potentially quicker, not to mention faster on the front end w

BlocksKit 6.9k Dec 28, 2022
Lightweight utilities for making OSLog more pleasant

UnifiedLoggingPlus Lightweight utilities for making OSLog more pleasant. Integration Swift Package Manager

Chime 10 Oct 26, 2022
A Swift micro library for generating Sunrise and Sunset times.

Solar A Swift helper for generating Sunrise and Sunset times. Solar performs its calculations locally using an algorithm from the United States Naval

Chris Howell 493 Dec 25, 2022
A command-line tool and Swift Package for generating class diagrams powered by PlantUML

SwiftPlantUML Generate UML class diagrams from swift code with this Command Line Interface (CLI) and Swift Package. Use one or more Swift files as inp

null 374 Jan 3, 2023
Scaffold is a tool for generating code from Stencil templates, similar to rails gen.

?? Scaffold Scaffold is a tool for generating code from Stencil templates, similar to rails gen. It happens to be written in Swift, but it can output

Joshua Kaplan 33 Apr 5, 2022
Support library of BudouX.swift to handle HTML

HTMLBudouX.swift HTMLBudouX.swift is a support library of BudouX.swift to handle HTML. Detail about BudouX.swift is here Usage You can translate an HT

griffin-stewie 1 Dec 31, 2021
Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Apple 2k Dec 28, 2022
Parsing indeterminate types with Decodable and Either enum using Swift

Decodable + Either Parsing indeterminate types with Decodable and Either enum us

Alonso Alvarez 1 Jan 9, 2022
Framework for easily parsing your JSON data directly to Swift object.

Server sends the all JSON data in black and white format i.e. its all strings & we make hard efforts to typecast them into their respective datatypes

Mukesh 11 Oct 17, 2022
Zip - A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip.

Zip A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip. Usage Import Zip at the top of the Swift file

Roy Marmelstein 2.3k Jan 3, 2023
Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects

SwiftyPick ?? ?? Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects. Purpose The idea behind t

Manu Herrera 19 May 12, 2022
Validate iOS, Android, and Mac localizations. Find errors in .strings, .stringsdict, and strings.xml files.

Locheck An Xcode and Android localization file validator. Make sure your .strings, .stringsdict, and strings.xml files do not have any errors! What do

Asana 73 Dec 13, 2022
Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer documentation.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer docum

Apple 833 Jan 3, 2023
Customize and resize sheets in SwiftUI with SheeKit. Utilise the power of `UISheetPresentationController` and other UIKit features.

SheeKit Customize and resize sheets in SwiftUI with SheeKit. Utilise the power of UISheetPresentationController and other UIKit features. Overview She

Eugene Dudnyk 67 Dec 31, 2022
A handy collection of Swift method and Tools to build project faster and more efficient.

SwifterKnife is a collection of Swift extension method and some tools that often use in develop project, with them you might build project faster and

李阳 4 Dec 29, 2022
Tools and helpers to make building apps faster and safer.

The UBFoundation framework provides a set of useful tools and helpers to make building apps faster and safer.

Ubique 7 Dec 19, 2022
Paul Hudson redesigned and remastered the original MoonshotApp. And so I followed the tutorial

Moonshot App for iOS. parsing some json files, using generics, and creating multi page app. Application provides simple informations from the Apollo m

Pavel Surový 0 Dec 7, 2021
Easy CBOR encoding and decoding for iOS, macOS, tvOS and watchOS.

CBORCoding CBORCoding is a lightweight framework containing a coder pair for encoding and decoding Codable conforming types to and from CBOR document

Joe Newton 23 Nov 8, 2022