Compare commits
No commits in common. "2b49f95b16b6ee905aa013098310a597085c0cbf" and "b21591e6d3b76e7b54cad989b92d505e9e84b430" have entirely different histories.
2b49f95b16
...
b21591e6d3
|
@ -4,9 +4,3 @@ build
|
|||
package-lock.json
|
||||
target
|
||||
Cargo.lock
|
||||
*.a
|
||||
*.dylib
|
||||
*.so
|
||||
*.o
|
||||
bindings/c/*.h
|
||||
bindings/c/*.pc
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "tree-sitter-html"
|
||||
description = "html grammar for the tree-sitter parsing library"
|
||||
version = "0.20.0"
|
||||
version = "0.19.0"
|
||||
keywords = ["incremental", "parsing", "html"]
|
||||
categories = ["parsing", "text-editors"]
|
||||
repository = "https://github.com/tree-sitter/tree-sitter-html"
|
||||
|
@ -19,7 +19,7 @@ include = [
|
|||
path = "bindings/rust/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
tree-sitter = "0.20"
|
||||
tree-sitter = "0.19"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
|
|
99
Makefile
99
Makefile
|
@ -1,99 +0,0 @@
|
|||
VERSION := 0.19.0
|
||||
|
||||
# Repository
|
||||
SRC_DIR := src
|
||||
|
||||
PARSER_REPO_URL ?= $(shell git -C $(SRC_DIR) remote get-url origin )
|
||||
# the # in the sed pattern has to be escaped or it will be interpreted as a comment
|
||||
PARSER_NAME ?= $(shell basename $(PARSER_REPO_URL) | cut -d '-' -f3 | sed 's\#.git\#\#')
|
||||
UPPER_PARSER_NAME := $(shell echo $(PARSER_NAME) | tr a-z A-Z )
|
||||
|
||||
# install directory layout
|
||||
PREFIX ?= /usr/local
|
||||
INCLUDEDIR ?= $(PREFIX)/include
|
||||
LIBDIR ?= $(PREFIX)/lib
|
||||
PCLIBDIR ?= $(LIBDIR)/pkgconfig
|
||||
|
||||
# collect C++ sources, and link if necessary
|
||||
CPPSRC := $(wildcard $(SRC_DIR)/*.cc)
|
||||
|
||||
ifeq (, $(CPPSRC))
|
||||
ADDITIONALLIBS :=
|
||||
else
|
||||
ADDITIONALLIBS := -lc++
|
||||
endif
|
||||
|
||||
# collect sources
|
||||
SRC := $(wildcard $(SRC_DIR)/*.c)
|
||||
SRC += $(CPPSRC)
|
||||
OBJ := $(addsuffix .o,$(basename $(SRC)))
|
||||
|
||||
# ABI versioning
|
||||
SONAME_MAJOR := 0
|
||||
SONAME_MINOR := 0
|
||||
|
||||
CFLAGS ?= -O3 -Wall -Wextra -I$(SRC_DIR)
|
||||
CXXFLAGS ?= -O3 -Wall -Wextra -I$(SRC_DIR)
|
||||
override CFLAGS += -std=gnu99 -fPIC
|
||||
override CXXFLAGS += -fPIC
|
||||
|
||||
# OS-specific bits
|
||||
ifeq ($(shell uname),Darwin)
|
||||
SOEXT = dylib
|
||||
SOEXTVER_MAJOR = $(SONAME_MAJOR).dylib
|
||||
SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).dylib
|
||||
LINKSHARED := $(LINKSHARED)-dynamiclib -Wl,
|
||||
ifneq ($(ADDITIONALLIBS),)
|
||||
LINKSHARED := $(LINKSHARED)$(ADDITIONALLIBS),
|
||||
endif
|
||||
LINKSHARED := $(LINKSHARED)-install_name,$(LIBDIR)/libtree-sitter-$(PARSER_NAME).$(SONAME_MAJOR).dylib,-rpath,@executable_path/../Frameworks
|
||||
else
|
||||
SOEXT = so
|
||||
SOEXTVER_MAJOR = so.$(SONAME_MAJOR)
|
||||
SOEXTVER = so.$(SONAME_MAJOR).$(SONAME_MINOR)
|
||||
LINKSHARED := $(LINKSHARED)-shared -Wl,
|
||||
ifneq ($(ADDITIONALLIBS),)
|
||||
LINKSHARED := $(LINKSHARED)$(ADDITIONALLIBS)
|
||||
endif
|
||||
LINKSHARED := $(LINKSHARED)-soname,libtree-sitter-$(PARSER_NAME).so.$(SONAME_MAJOR)
|
||||
endif
|
||||
ifneq (,$(filter $(shell uname),FreeBSD NetBSD DragonFly))
|
||||
PCLIBDIR := $(PREFIX)/libdata/pkgconfig
|
||||
endif
|
||||
|
||||
all: libtree-sitter-$(PARSER_NAME).a libtree-sitter-$(PARSER_NAME).$(SOEXTVER) bindings/c/$(PARSER_NAME).h
|
||||
|
||||
libtree-sitter-$(PARSER_NAME).a: $(OBJ)
|
||||
$(AR) rcs $@ $^
|
||||
|
||||
libtree-sitter-$(PARSER_NAME).$(SOEXTVER): $(OBJ)
|
||||
$(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@
|
||||
ln -sf $@ libtree-sitter-$(PARSER_NAME).$(SOEXT)
|
||||
ln -sf $@ libtree-sitter-$(PARSER_NAME).$(SOEXTVER_MAJOR)
|
||||
|
||||
bindings/c/$(PARSER_NAME).h:
|
||||
sed -e 's|@UPPER_PARSERNAME@|$(UPPER_PARSER_NAME)|' \
|
||||
-e 's|@PARSERNAME@|$(PARSER_NAME)|' \
|
||||
bindings/c/tree-sitter.h.in > $@
|
||||
|
||||
install: all
|
||||
install -d '$(DESTDIR)$(LIBDIR)'
|
||||
install -m755 libtree-sitter-$(PARSER_NAME).a '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).a
|
||||
install -m755 libtree-sitter-$(PARSER_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).$(SOEXTVER)
|
||||
ln -sf libtree-sitter-$(PARSER_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).$(SOEXTVER_MAJOR)
|
||||
ln -sf libtree-sitter-$(PARSER_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).$(SOEXT)
|
||||
install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter
|
||||
install -m644 bindings/c/$(PARSER_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/
|
||||
install -d '$(DESTDIR)$(PCLIBDIR)'
|
||||
sed -e 's|@LIBDIR@|$(LIBDIR)|;s|@INCLUDEDIR@|$(INCLUDEDIR)|;s|@VERSION@|$(VERSION)|' \
|
||||
-e 's|=$(PREFIX)|=$${prefix}|' \
|
||||
-e 's|@PREFIX@|$(PREFIX)|' \
|
||||
-e 's|@ADDITIONALLIBS@|$(ADDITIONALLIBS)|' \
|
||||
-e 's|@PARSERNAME@|$(PARSER_NAME)|' \
|
||||
-e 's|@PARSERREPOURL@|$(PARSER_REPO_URL)|' \
|
||||
bindings/c/tree-sitter.pc.in > '$(DESTDIR)$(PCLIBDIR)'/tree-sitter-$(PARSER_NAME).pc
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) libtree-sitter-$(PARSER_NAME).a libtree-sitter-$(PARSER_NAME).$(SOEXT) libtree-sitter-$(PARSER_NAME).$(SOEXTVER_MAJOR) libtree-sitter-$(PARSER_NAME).$(SOEXTVER) bindings/c/$(PARSER_NAME).h
|
||||
|
||||
.PHONY: all install clean
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef TREE_SITTER_@UPPER_PARSERNAME@_H_
|
||||
#define TREE_SITTER_@UPPER_PARSERNAME@_H_
|
||||
|
||||
#include <tree_sitter/parser.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern TSLanguage *tree_sitter_@PARSERNAME@();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TREE_SITTER_@UPPER_PARSERNAME@_H_
|
|
@ -1,11 +0,0 @@
|
|||
prefix=@PREFIX@
|
||||
libdir=@LIBDIR@
|
||||
includedir=@INCLUDEDIR@
|
||||
additionallibs=@ADDITIONALLIBS@
|
||||
|
||||
Name: tree-sitter-@PARSERNAME@
|
||||
Description: A tree-sitter grammar for the @PARSERNAME@ programming language.
|
||||
URL: @PARSERREPOURL@
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} ${additionallibs} -ltree-sitter-@PARSERNAME@
|
||||
Cflags: -I${includedir}
|
|
@ -35,7 +35,7 @@ pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
|
|||
|
||||
// Uncomment these to include any queries that this grammar contains
|
||||
|
||||
pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
|
||||
// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
|
||||
// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
|
||||
// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
|
||||
// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");
|
||||
|
|
|
@ -37,14 +37,13 @@ Nested tags
|
|||
<span>a</span>
|
||||
b
|
||||
<b>c</b>
|
||||
Multi-line
|
||||
text
|
||||
</div>
|
||||
---
|
||||
|
||||
(fragment
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
|
@ -103,10 +102,12 @@ Custom tags
|
|||
(fragment
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
(element
|
||||
(start_tag (tag_name) (attribute (attribute_name)))
|
||||
(text)
|
||||
(end_tag (tag_name)))
|
||||
(text)
|
||||
(end_tag (tag_name))))
|
||||
|
||||
==================================
|
||||
|
@ -122,9 +123,11 @@ Comments
|
|||
(fragment
|
||||
(comment)
|
||||
(comment)
|
||||
(text)
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(comment)
|
||||
(text)
|
||||
(end_tag (tag_name))))
|
||||
|
||||
==================================
|
||||
|
@ -152,14 +155,17 @@ Raw text elements
|
|||
(start_tag (tag_name))
|
||||
(raw_text)
|
||||
(end_tag (tag_name)))
|
||||
(text)
|
||||
(style_element
|
||||
(start_tag (tag_name))
|
||||
(raw_text)
|
||||
(end_tag (tag_name)))
|
||||
(text)
|
||||
(script_element
|
||||
(start_tag (tag_name))
|
||||
(raw_text)
|
||||
(end_tag (tag_name))))
|
||||
(end_tag (tag_name)))
|
||||
(text))
|
||||
|
||||
==================================
|
||||
All-caps doctype
|
||||
|
@ -193,6 +199,7 @@ LI elements without close tags
|
|||
(fragment
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
(element (start_tag (tag_name)) (text))
|
||||
(element (start_tag (tag_name)) (text))
|
||||
(end_tag (tag_name))))
|
||||
|
@ -212,6 +219,7 @@ DT and DL elements without close tags
|
|||
(fragment
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
(element (start_tag (tag_name)) (text))
|
||||
(element (start_tag (tag_name)) (text))
|
||||
(element (start_tag (tag_name)) (text))
|
||||
|
@ -232,6 +240,7 @@ P elements without close tags
|
|||
(fragment
|
||||
(element (start_tag (tag_name)) (text))
|
||||
(element (start_tag (tag_name)) (text) (end_tag (tag_name)))
|
||||
(text)
|
||||
(element (start_tag (tag_name)) (text))
|
||||
(element (start_tag (tag_name)) (text))
|
||||
(element (start_tag (tag_name)) (text) (end_tag (tag_name))))
|
||||
|
@ -269,8 +278,10 @@ COLGROUP elements without end tags
|
|||
(fragment
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
(element (start_tag
|
||||
(tag_name)
|
||||
(attribute (attribute_name) (quoted_attribute_value (attribute_value)))))
|
||||
|
@ -279,10 +290,15 @@ COLGROUP elements without end tags
|
|||
(attribute (attribute_name) (quoted_attribute_value (attribute_value))))))
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
(element (start_tag (tag_name)) (text) (end_tag (tag_name)))
|
||||
(text)
|
||||
(element (start_tag (tag_name)) (text) (end_tag (tag_name)))
|
||||
(text)
|
||||
(element (start_tag (tag_name)) (text) (end_tag (tag_name)))
|
||||
(text)
|
||||
(end_tag (tag_name)))
|
||||
(text)
|
||||
(end_tag (tag_name))))
|
||||
|
||||
=========================================
|
||||
|
@ -301,12 +317,15 @@ TR, TD, and TH elements without end tags
|
|||
(fragment
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
(element (start_tag (tag_name)) (text))
|
||||
(element (start_tag (tag_name)) (text)))
|
||||
(element
|
||||
(start_tag (tag_name))
|
||||
(text)
|
||||
(element (start_tag (tag_name)) (text))
|
||||
(element (start_tag (tag_name)) (text)))
|
||||
(end_tag (tag_name))))
|
||||
|
|
|
@ -120,6 +120,6 @@ module.exports = grammar({
|
|||
seq('"', optional(alias(/[^"]+/, $.attribute_value)), '"')
|
||||
),
|
||||
|
||||
text: $ => /[^<>\s]([^<>]*[^<>\s])?/
|
||||
text: $ => /[^<>]+/
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
{
|
||||
"name": "tree-sitter-html",
|
||||
"version": "0.20.0",
|
||||
"version": "0.16.0",
|
||||
"description": "HTML grammar for tree-sitter",
|
||||
"main": "bindings/node",
|
||||
"keywords": [
|
||||
"parser",
|
||||
"lexer"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tree-sitter/tree-sitter-html.git"
|
||||
},
|
||||
"authors": [
|
||||
"Max Brunsfeld <maxbrunsfeld@gmail.com>",
|
||||
"Ashi Krishnan <queerviolet@github.com>"
|
||||
|
@ -20,7 +16,7 @@
|
|||
"nan": "^2.14.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tree-sitter-cli": "^0.20.0"
|
||||
"tree-sitter-cli": "^0.19.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tree-sitter test && tree-sitter parse examples/*.html --quiet --time",
|
||||
|
|
|
@ -434,7 +434,7 @@
|
|||
},
|
||||
"text": {
|
||||
"type": "PATTERN",
|
||||
"value": "[^<>\\s]([^<>]*[^<>\\s])?"
|
||||
"value": "[^<>]+"
|
||||
}
|
||||
},
|
||||
"extras": [
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -102,8 +102,8 @@ struct TSLanguage {
|
|||
const uint16_t *small_parse_table;
|
||||
const uint32_t *small_parse_table_map;
|
||||
const TSParseActionEntry *parse_actions;
|
||||
const char * const *symbol_names;
|
||||
const char * const *field_names;
|
||||
const char **symbol_names;
|
||||
const char **field_names;
|
||||
const TSFieldMapSlice *field_map_slices;
|
||||
const TSFieldMapEntry *field_map_entries;
|
||||
const TSSymbolMetadata *symbol_metadata;
|
||||
|
@ -123,7 +123,6 @@ struct TSLanguage {
|
|||
unsigned (*serialize)(void *, char *);
|
||||
void (*deserialize)(void *, const char *, unsigned);
|
||||
} external_scanner;
|
||||
const TSStateId *primary_state_ids;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue