Skip to content

Commit

Permalink
Updates before publishing to crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
stsewd committed Aug 26, 2022
1 parent 3fc88d2 commit 25e6328
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
/log.html
build/
/target/
59 changes: 59 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
[package]
name = "tree-sitter-rst"
description = "rst grammar for the tree-sitter parsing library"
version = "0.0.1"
description = "reStructuredText grammar for the tree-sitter parsing library"
version = "0.1.0"
keywords = ["incremental", "parsing", "rst"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/stsewd/tree-sitter-rst"
homepage = "https://stsewd.dev/tree-sitter-rst/"
edition = "2018"
license = "MIT"
readme = "README.md"

build = "bindings/rust/build.rs"
include = [
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! ```
//! let code = "";
//! let mut parser = tree_sitter::Parser::new();
//! parser.set_language(tree_sitter_javascript::language()).expect("Error loading rst grammar");
//! parser.set_language(tree_sitter_rst::language()).expect("Error loading rst grammar");
//! let tree = parser.parse(code, None).unwrap();
//! ```
//!
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"nan": "^2.14.2"
},
"devDependencies": {
"tree-sitter-cli": "^0.20.1"
"tree-sitter-cli": "^0.20.6"
},
"tree-sitter": [
{
Expand Down
19 changes: 2 additions & 17 deletions src/tree_sitter_rst/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ bool parse_underline(RSTScanner* scanner)
bool parse_char_bullet(RSTScanner* scanner)
{
const bool* valid_symbols = scanner->valid_symbols;
TSLexer* lexer = scanner->lexer;

if (!is_char_bullet(scanner->lookahead) || !valid_symbols[T_CHAR_BULLET]) {
return false;
Expand Down Expand Up @@ -401,7 +400,6 @@ bool parse_inner_numeric_bullet(RSTScanner* scanner, bool parenthesized)

bool parse_explict_markup_start(RSTScanner* scanner)
{
TSLexer* lexer = scanner->lexer;
const bool* valid_symbols = scanner->valid_symbols;

if (scanner->lookahead != '.' || !valid_symbols[T_EXPLICIT_MARKUP_START]) {
Expand Down Expand Up @@ -689,9 +687,6 @@ int parse_inner_label_name(RSTScanner* scanner)

bool parse_inner_alphanumeric_label(RSTScanner* scanner)
{
const bool* valid_symbols = scanner->valid_symbols;
TSLexer* lexer = scanner->lexer;

if (!(is_alphanumeric(scanner->lookahead)
|| is_internal_reference_char(scanner->lookahead))) {
return false;
Expand Down Expand Up @@ -885,7 +880,6 @@ bool parse_substitution_mark(RSTScanner* scanner)
bool parse_literal_block_mark(RSTScanner* scanner)
{
const bool* valid_symbols = scanner->valid_symbols;
TSLexer* lexer = scanner->lexer;

if (scanner->lookahead != ':'
|| !(valid_symbols[T_LITERAL_INDENTED_BLOCK_MARK] || valid_symbols[T_LITERAL_QUOTED_BLOCK_MARK])) {
Expand Down Expand Up @@ -1000,7 +994,6 @@ bool parse_quoted_literal_block(RSTScanner* scanner)
bool parse_line_block_mark(RSTScanner* scanner)
{
const bool* valid_symbols = scanner->valid_symbols;
TSLexer* lexer = scanner->lexer;

if (scanner->lookahead != '|' || !valid_symbols[T_LINE_BLOCK_MARK]) {
return false;
Expand All @@ -1018,7 +1011,6 @@ bool parse_line_block_mark(RSTScanner* scanner)
bool parse_attribution_mark(RSTScanner* scanner)
{
const bool* valid_symbols = scanner->valid_symbols;
TSLexer* lexer = scanner->lexer;

if (!is_attribution_mark(scanner->lookahead) || !valid_symbols[T_ATTRIBUTION_MARK]) {
return false;
Expand Down Expand Up @@ -1271,7 +1263,6 @@ bool parse_inner_inline_markup(RSTScanner* scanner, unsigned type)
bool parse_reference(RSTScanner* scanner)
{
const bool* valid_symbols = scanner->valid_symbols;
TSLexer* lexer = scanner->lexer;

if (is_space(scanner->lookahead) || is_internal_reference_char(scanner->lookahead) || !valid_symbols[T_REFERENCE]) {
return false;
Expand All @@ -1282,7 +1273,6 @@ bool parse_reference(RSTScanner* scanner)

bool parse_inner_reference(RSTScanner* scanner)
{
const bool* valid_symbols = scanner->valid_symbols;
TSLexer* lexer = scanner->lexer;

bool internal_symbol = is_internal_reference_char(scanner->previous);
Expand All @@ -1304,8 +1294,8 @@ bool parse_inner_reference(RSTScanner* scanner)
scanner->advance(scanner);
}

// Only an annonymous reference can contain
// and end with two consecutives '_'.
// Only an anonymous reference can contain
// and end with two consecutive '_'.
if (scanner->lookahead == '_' && scanner->previous == '_') {
scanner->advance(scanner);
}
Expand All @@ -1321,7 +1311,6 @@ bool parse_inner_reference(RSTScanner* scanner)

bool parse_standalone_hyperlink(RSTScanner* scanner)
{
TSLexer* lexer = scanner->lexer;
const bool* valid_symbols = scanner->valid_symbols;

if (!is_abc(scanner->lookahead) || !valid_symbols[T_STANDALONE_HYPERLINK]) {
Expand All @@ -1334,7 +1323,6 @@ bool parse_standalone_hyperlink(RSTScanner* scanner)
bool parse_inner_standalone_hyperlink(RSTScanner* scanner)
{
TSLexer* lexer = scanner->lexer;
const bool* valid_symbols = scanner->valid_symbols;

const unsigned MAX_SCHEMA_LEN = 20;
char* schema = malloc(sizeof(char) * MAX_SCHEMA_LEN);
Expand Down Expand Up @@ -1518,9 +1506,6 @@ bool parse_inner_role(RSTScanner* scanner)
/// This function assumes the previous token was `:` and it's already consumed.
bool parse_role_name(RSTScanner* scanner)
{
const bool* valid_symbols = scanner->valid_symbols;
TSLexer* lexer = scanner->lexer;

if (!is_alphanumeric(scanner->lookahead)) {
return false;
}
Expand Down

0 comments on commit 25e6328

Please sign in to comment.