Skip to content

Commit

Permalink
Fix up lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Nov 1, 2023
1 parent 7892a7e commit 77d4056
Show file tree
Hide file tree
Showing 20 changed files with 97 additions and 96 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,14 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true
- name: Install doxygen
- name: Install doxygen and dependencies
run: |
sudo apt-get update
sudo apt-get install doxygen
sudo apt-get install doxygen graphviz
- name: Generate the templates
run: bundle exec rake templates
- name: Check ruby coverage
run: bundle exec rake rdoc:coverage
- name: Check C coverage
Expand Down
12 changes: 3 additions & 9 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,14 @@
# configuration file:
# doxygen -x [configFile]

# Non-default options
PROJECT_NAME = "Prism Ruby parser"
OUTPUT_DIRECTORY = doc
JAVADOC_AUTOBRIEF = YES
OPTIMIZE_OUTPUT_FOR_C = YES
INPUT = src src/enc src/util include include/prism include/prism/enc include/prism/util
HTML_OUTPUT = c
WARN_IF_UNDOCUMENTED = YES
WARN_NO_PARAMDOC = YES
WARN_AS_ERROR = FAIL_ON_WARNINGS
WARN_IF_UNDOC_ENUM_VAL = YES
SORT_MEMBER_DOCS = NO

# Default options we might want to edit in the future
HTML_STYLESHEET =
HTML_COLORSTYLE = AUTO_LIGHT
GENERATE_LATEX = NO
WARN_NO_PARAMDOC = YES
WARN_AS_ERROR = FAIL_ON_WARNINGS
DOT_GRAPH_MAX_NODES = 200
2 changes: 1 addition & 1 deletion ext/prism/api_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pack_encoding_to_ruby(pm_pack_encoding encoding) {
/**
* call-seq:
* Pack::parse(version, variant, source) -> Format
*
*
* Parse the given source and return a format object.
*/
static VALUE
Expand Down
8 changes: 4 additions & 4 deletions ext/prism/extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dump_input(pm_string_t *input, const char *filepath) {
/**
* call-seq:
* Prism::dump(source, filepath = nil) -> dumped
*
*
* Dump the AST corresponding to the given string to a string.
*/
static VALUE
Expand Down Expand Up @@ -115,7 +115,7 @@ dump(int argc, VALUE *argv, VALUE self) {
/**
* call-seq:
* Prism::dump_file(filepath) -> dumped
*
*
* Dump the AST corresponding to the given file to a string.
*/
static VALUE
Expand Down Expand Up @@ -373,7 +373,7 @@ parse_lex_input(pm_string_t *input, const char *filepath, bool return_nodes) {
/**
* call-seq:
* Prism::lex(source, filepath = nil) -> Array
*
*
* Return an array of Token instances corresponding to the given string.
*/
static VALUE
Expand All @@ -391,7 +391,7 @@ lex(int argc, VALUE *argv, VALUE self) {
/**
* call-seq:
* Prism::lex_file(filepath) -> Array
*
*
* Return an array of Token instances corresponding to the given file.
*/
static VALUE
Expand Down
20 changes: 10 additions & 10 deletions include/prism.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ PRISM_EXPORTED_FUNCTION const char * pm_token_type_to_str(pm_token_type_t token_
* visible.
*
* @section parsing Parsing
*
*
* In order to parse Ruby code, the structures and functions that you're going
* to want to use and be aware of are:
*
* * pm_parser_t - the main parser structure
* * pm_parser_init - initialize a parser
* * pm_parse - parse and return the root node
* * pm_node_destroy - deallocate the root node returned by `pm_parse`
* * pm_parser_free - free the internal memory of the parser
* * `pm_parser_t` - the main parser structure
* * `pm_parser_init` - initialize a parser
* * `pm_parse` - parse and return the root node
* * `pm_node_destroy` - deallocate the root node returned by `pm_parse`
* * `pm_parser_free` - free the internal memory of the parser
*
* Putting all of this together would look something like:
*
Expand Down Expand Up @@ -244,10 +244,10 @@ PRISM_EXPORTED_FUNCTION const char * pm_token_type_to_str(pm_token_type_t token_
* parse Ruby code. The structures and functions that you're going to want to
* use and be aware of are:
*
* * pm_buffer_t - a small buffer object that will hold the serialized AST
* * pm_buffer_free - free the memory associated with the buffer
* * pm_serialize - serialize the AST into a buffer
* * pm_parse_serialize - parse and serialize the AST into a buffer
* * `pm_buffer_t` - a small buffer object that will hold the serialized AST
* * `pm_buffer_free` - free the memory associated with the buffer
* * `pm_serialize` - serialize the AST into a buffer
* * `pm_parse_serialize` - parse and serialize the AST into a buffer
*
* Putting all of this together would look something like:
*
Expand Down
2 changes: 1 addition & 1 deletion include/prism/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <stdio.h>
#include <string.h>

/**
/**
* By default, we compile with -fvisibility=hidden. When this is enabled, we
* need to mark certain functions as being publically-visible. This macro does
* that in a compiler-agnostic way.
Expand Down
54 changes: 27 additions & 27 deletions include/prism/enc/pm_encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,32 +155,32 @@ extern const uint8_t pm_encoding_unicode_table[256];
// Below are the encodings that are supported by the parser. They are defined in
// their own files in the src/enc directory.

const extern pm_encoding_t pm_encoding_ascii;
const extern pm_encoding_t pm_encoding_ascii_8bit;
const extern pm_encoding_t pm_encoding_big5;
const extern pm_encoding_t pm_encoding_euc_jp;
const extern pm_encoding_t pm_encoding_gbk;
const extern pm_encoding_t pm_encoding_iso_8859_1;
const extern pm_encoding_t pm_encoding_iso_8859_2;
const extern pm_encoding_t pm_encoding_iso_8859_3;
const extern pm_encoding_t pm_encoding_iso_8859_4;
const extern pm_encoding_t pm_encoding_iso_8859_5;
const extern pm_encoding_t pm_encoding_iso_8859_6;
const extern pm_encoding_t pm_encoding_iso_8859_7;
const extern pm_encoding_t pm_encoding_iso_8859_8;
const extern pm_encoding_t pm_encoding_iso_8859_9;
const extern pm_encoding_t pm_encoding_iso_8859_10;
const extern pm_encoding_t pm_encoding_iso_8859_11;
const extern pm_encoding_t pm_encoding_iso_8859_13;
const extern pm_encoding_t pm_encoding_iso_8859_14;
const extern pm_encoding_t pm_encoding_iso_8859_15;
const extern pm_encoding_t pm_encoding_iso_8859_16;
const extern pm_encoding_t pm_encoding_koi8_r;
const extern pm_encoding_t pm_encoding_shift_jis;
const extern pm_encoding_t pm_encoding_utf_8;
const extern pm_encoding_t pm_encoding_utf8_mac;
const extern pm_encoding_t pm_encoding_windows_31j;
const extern pm_encoding_t pm_encoding_windows_1251;
const extern pm_encoding_t pm_encoding_windows_1252;
extern pm_encoding_t pm_encoding_ascii;
extern pm_encoding_t pm_encoding_ascii_8bit;
extern pm_encoding_t pm_encoding_big5;
extern pm_encoding_t pm_encoding_euc_jp;
extern pm_encoding_t pm_encoding_gbk;
extern pm_encoding_t pm_encoding_iso_8859_1;
extern pm_encoding_t pm_encoding_iso_8859_2;
extern pm_encoding_t pm_encoding_iso_8859_3;
extern pm_encoding_t pm_encoding_iso_8859_4;
extern pm_encoding_t pm_encoding_iso_8859_5;
extern pm_encoding_t pm_encoding_iso_8859_6;
extern pm_encoding_t pm_encoding_iso_8859_7;
extern pm_encoding_t pm_encoding_iso_8859_8;
extern pm_encoding_t pm_encoding_iso_8859_9;
extern pm_encoding_t pm_encoding_iso_8859_10;
extern pm_encoding_t pm_encoding_iso_8859_11;
extern pm_encoding_t pm_encoding_iso_8859_13;
extern pm_encoding_t pm_encoding_iso_8859_14;
extern pm_encoding_t pm_encoding_iso_8859_15;
extern pm_encoding_t pm_encoding_iso_8859_16;
extern pm_encoding_t pm_encoding_koi8_r;
extern pm_encoding_t pm_encoding_shift_jis;
extern pm_encoding_t pm_encoding_utf_8;
extern pm_encoding_t pm_encoding_utf8_mac;
extern pm_encoding_t pm_encoding_windows_31j;
extern pm_encoding_t pm_encoding_windows_1251;
extern pm_encoding_t pm_encoding_windows_1252;

#endif
2 changes: 1 addition & 1 deletion include/prism/util/pm_constant_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @file pm_constant_pool.h
*
* A data structure that stores a set of strings.
*
*
* Each string is assigned a unique id, which can be used to compare strings for
* equality. This comparison ends up being much faster than strcmp, since it
* only requires a single integer comparison.
Expand Down
18 changes: 10 additions & 8 deletions include/prism/util/pm_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@
*
* For example, if we want to store a list of integers, we can do the following:
*
* typedef struct {
* pm_list_node_t node;
* int value;
* } pm_int_node_t;
* ```c
* typedef struct {
* pm_list_node_t node;
* int value;
* } pm_int_node_t;
*
* pm_list_t list = { 0 };
* pm_int_node_t *node = malloc(sizeof(pm_int_node_t));
* node->value = 5;
* pm_list_t list = { 0 };
* pm_int_node_t *node = malloc(sizeof(pm_int_node_t));
* node->value = 5;
*
* pm_list_append(&list, &node->node);
* pm_list_append(&list, &node->node);
* ```
*
* The pm_list_t struct is used to represent the overall linked list. It
* contains a pointer to the head and tail of the list. This allows for easy
Expand Down
2 changes: 1 addition & 1 deletion include/prism/util/pm_strncasecmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Note that this is effectively our own implementation of strncasecmp, but it's
* not available on all of the platforms we want to support so we're rolling it
* here.
*
*
* @param string1 The first string to compare.
* @param string2 The second string to compare
* @param length The maximum number of characters to compare.
Expand Down
2 changes: 1 addition & 1 deletion src/enc/pm_big5.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pm_encoding_big5_isupper_char(const uint8_t *b, ptrdiff_t n) {
}

/** Big5 encoding */
const pm_encoding_t pm_encoding_big5 = {
pm_encoding_t pm_encoding_big5 = {
.name = "big5",
.char_width = pm_encoding_big5_char_width,
.alnum_char = pm_encoding_big5_alnum_char,
Expand Down
2 changes: 1 addition & 1 deletion src/enc/pm_euc_jp.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pm_encoding_euc_jp_isupper_char(const uint8_t *b, ptrdiff_t n) {
}

/** EUC-JP encoding */
const pm_encoding_t pm_encoding_euc_jp = {
pm_encoding_t pm_encoding_euc_jp = {
.name = "euc-jp",
.char_width = pm_encoding_euc_jp_char_width,
.alnum_char = pm_encoding_euc_jp_alnum_char,
Expand Down
2 changes: 1 addition & 1 deletion src/enc/pm_gbk.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pm_encoding_gbk_isupper_char(const uint8_t *b, ptrdiff_t n) {
}

/** GBK encoding */
const pm_encoding_t pm_encoding_gbk = {
pm_encoding_t pm_encoding_gbk = {
.name = "gbk",
.char_width = pm_encoding_gbk_char_width,
.alnum_char = pm_encoding_gbk_alnum_char,
Expand Down
2 changes: 1 addition & 1 deletion src/enc/pm_shift_jis.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pm_encoding_shift_jis_isupper_char(const uint8_t *b, ptrdiff_t n) {
}

/** Shift_JIS encoding */
const pm_encoding_t pm_encoding_shift_jis = {
pm_encoding_t pm_encoding_shift_jis = {
.name = "shift_jis",
.char_width = pm_encoding_shift_jis_char_width,
.alnum_char = pm_encoding_shift_jis_alnum_char,
Expand Down
Loading

0 comments on commit 77d4056

Please sign in to comment.