[ruby/prism] Documentation for defines, version, and prettyprint

https://github.com/ruby/prism/commit/e2e29bef2d
This commit is contained in:
Kevin Newton 2023-10-31 11:38:06 -04:00
parent 1de05631b5
commit f791db4433
4 changed files with 26 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#ifndef PRISM_DEFINES_H #ifndef PRISM_DEFINES_H
#define 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 <ctype.h>
#include <stdarg.h> #include <stdarg.h>

View File

@ -9,7 +9,13 @@
#include "prism/parser.h" #include "prism/parser.h"
#include "prism/util/pm_buffer.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); PRISM_EXPORTED_FUNCTION void pm_prettyprint(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm_node_t *node);
#endif #endif

View File

@ -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 PRISM_EXPORTED_FUNCTION void
pm_prettyprint(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm_node_t *node) { pm_prettyprint(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm_node_t *node) {
pm_buffer_t prefix_buffer = { 0 }; pm_buffer_t prefix_buffer = { 0 };

View File

@ -1,4 +1,19 @@
/**
* The major version of the Prism library as an int.
*/
#define PRISM_VERSION_MAJOR 0 #define PRISM_VERSION_MAJOR 0
/**
* The minor version of the Prism library as an int.
*/
#define PRISM_VERSION_MINOR 16 #define PRISM_VERSION_MINOR 16
/**
* The patch version of the Prism library as an int.
*/
#define PRISM_VERSION_PATCH 0 #define PRISM_VERSION_PATCH 0
/**
* The version of the Prism library as a constant string.
*/
#define PRISM_VERSION "0.16.0" #define PRISM_VERSION "0.16.0"