Skip to main content

A Python tool for Game Maker developers to convert JSDoc comments from GML files to JSON.

Project description

jsdoc2json

jsdoc2json is a Python tool designed for Game Maker developers. It serves to convert JSDoc comments from Game Maker Language (GML) files into a structured JSON format. With jsdoc2json, you can easily extract and transform JSDoc comments, making it easier to analyze and integrate their code documentation into other systems or workflows.

Table of Contents

  1. Installation
  2. Usage
  3. Example
  4. Project Structure
  5. Contributing
  6. License

Installation

Install jsdoc2json using the following command:

pip install jsdoc2json

Usage

Command-line usage:

jsdoc2json (-file FILE_PATH | -folder FOLDER_PATH) -output OUTPUT_PATH [-debug]

Code usage:

import jsdoc2json

jsdoc2json.convert(file_or_folder_path, output_path, debug)

Example

Single File Conversion

To convert a single GML file "Player.gml" and save it as "Player.json":

jsdoc2json -file Player.gml -output ./documentation_folder

Input: Player.gml

/**
 * @function                   player_move
 * @description                Move the player in the given direction
 * @param {Real}  a            The speed of the player
 * @param {Real}  b            The direction of the player
 * @return {Array<Real>}       The new coordinates
 */
function player_move(speed, direction) {
    player.x += speed * cos(player.direction);
    player.y += speed * sin(player.direction);
	return [player.x, player.y];
}

Output: Player.json

{
    "jsdoc": [
        {
            "function_tag": {
                "description": "player_move"
            },
            "description_tag": {
                "description": "Move the player in the given direction"
            },
            "param_tags": [
                {
                    "name": "a",
                    "type": "Real",
                    "description": "The speed of the player"
                },
                {
                    "name": "b",
                    "type": "Real",
                    "description": "The direction of the player"
                }
            ],
            "return_tag": {
                "type": "Array Real",
                "description": "The new coordinates"
            }
        }
    ]
}

Folder Conversion

To convert all GML files within a Game Maker project "My_project":

jsdoc2json -folder ./My_project -output ./documentation_folder

Project Structure

The jsdoc2json project directory structure:

jsdoc2json/
│
├── main.py
│
├── modules/
│   ├── jsdoc_data.py
│   ├── lexical_parser.py
│   ├── lexical_regex.py
│   ├── lexical_tokens.py
│   └── syntax_parser.py
│
└── data/
    ├── input/
    │   ├── test1.gml
    │   ├── test2.gml
    │   ├── Player.gml
    │   └── folder_containing_tests
    │       ├── test3.gml
    |       └── folder_containing_tests
    |           └── test4.gml
    └── output/
        ├── test1.json
        ├── test2.json
        └── Player.json

Contributing

Reporting Bugs

If you encounter a bug, please open an issue on our issue tracker and provide detailed information about the bug, including how to reproduce it.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsdoc2json-1.0.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsdoc2json-1.0.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file jsdoc2json-1.0.1.tar.gz.

File metadata

  • Download URL: jsdoc2json-1.0.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for jsdoc2json-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7a020f09278509d8a4df8d25288a1b59ad24ae8be1f2c0508847a55feddd815d
MD5 54277282d74ca28e3df1b91c4b7aeb9c
BLAKE2b-256 92b5c66f8f624eda49c5b43ad521d81f3ef98413a7d4e709bf3bbad9ec72adf2

See more details on using hashes here.

File details

Details for the file jsdoc2json-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: jsdoc2json-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for jsdoc2json-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2cc86d5e5c31b9ac54278362030a9f837c8d5ee065e44a0e145b5663bf4f021f
MD5 f3155cbda3967b3b1a0b88df361c4198
BLAKE2b-256 1b081aba0bd7143f9b15f8f8483149004f00caff6eb3e434939cb5fdec416ac4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page