Skip to content

joernio/SwiftAstGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AST generator

This script creates Abstract Syntax Tree (AST) of all .swift files in JSON format. The AST is created by using SwiftSyntax.

Supported languages

Language Tool used Notes
Swift SwiftSyntax no types / call full names etc.

Building

> swift build

Testing

> swift test

Getting Help

> SwiftAstGen -h
USAGE: swift-ast-gen [--src <src>] [--output <output>] [--prettyPrint] [--scalaAstOnly]

OPTIONS:
  -i, --src <src>         Source directory (default: `.`).
  -o, --output <output>   Output directory for generated AST json files (default: `./ast_out`).
  -p, --prettyPrint       Pretty print the generated AST json files.
  -s, --scalaAstOnly      Only print the generated Scala SwiftSyntax AST nodes.
  -h, --help              Show help information.

Example

Navigate to the project and run SwiftAstGen.

> cd <path to project>
> SwiftAstGen

To specify the path to the project or the output directory.

> SwiftAstGen -i <path to project>
> SwiftAstGen -i <path to project> -o <path to output directory>