Skip to content

Commit

Permalink
Documentation for defines, version, and prettyprint
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Nov 1, 2023
1 parent 16e0579 commit e2e29be
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/prism/defines.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef PRISM_DEFINES_H
#define PRISM_DEFINES_H

// This file should be included first by any *.h or *.c in prism
// This file should be included first by any *.h or *.c in prism.

#include <ctype.h>
#include <stdarg.h>
Expand Down
8 changes: 7 additions & 1 deletion include/prism/prettyprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
#include "prism/parser.h"
#include "prism/util/pm_buffer.h"

// Pretty-prints the AST represented by the given node to the given buffer.
/**
* Pretty-prints the AST represented by the given node to the given buffer.
*
* @param output_buffer The buffer to write the pretty-printed AST to.
* @param parser The parser that parsed the AST.
* @param node The root node of the AST to pretty-print.
*/
PRISM_EXPORTED_FUNCTION void pm_prettyprint(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm_node_t *node);

#endif
15 changes: 15 additions & 0 deletions include/prism/version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
/**
* The major version of the Prism library as an int.
*/
#define PRISM_VERSION_MAJOR 0

/**
* The minor version of the Prism library as an int.
*/
#define PRISM_VERSION_MINOR 16

/**
* The patch version of the Prism library as an int.
*/
#define PRISM_VERSION_PATCH 0

/**
* The version of the Prism library as a constant string.
*/
#define PRISM_VERSION "0.16.0"
4 changes: 3 additions & 1 deletion templates/src/prettyprint.c.erb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
}
}

// Pretty-prints the AST represented by the given node to the given buffer.
/**
* Pretty-prints the AST represented by the given node to the given buffer.
*/
PRISM_EXPORTED_FUNCTION void
pm_prettyprint(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm_node_t *node) {
pm_buffer_t prefix_buffer = { 0 };
Expand Down

0 comments on commit e2e29be

Please sign in to comment.