From 417b427f6d6124be9d4c402b1479266d3016bd87 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Fri, 11 Sep 2020 20:26:51 +0300 Subject: [PATCH] Fix tree-sitter generation with make --- tools/lsp/squirrel/Makefile | 16 +++------------- tools/lsp/squirrel/grammar/Makefile | 7 +++++++ tools/lsp/squirrel/grammar/camligo/Makefile | 1 + tools/lsp/squirrel/grammar/parser.mk | 1 + tools/lsp/squirrel/grammar/pascaligo/Makefile | 5 +++++ tools/lsp/squirrel/grammar/pascaligo/test.ligo | 2 +- tools/lsp/squirrel/grammar/reasonligo/Makefile | 1 + 7 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 tools/lsp/squirrel/grammar/Makefile create mode 100644 tools/lsp/squirrel/grammar/camligo/Makefile create mode 100644 tools/lsp/squirrel/grammar/parser.mk create mode 100644 tools/lsp/squirrel/grammar/pascaligo/Makefile mode change 100644 => 120000 tools/lsp/squirrel/grammar/pascaligo/test.ligo create mode 100644 tools/lsp/squirrel/grammar/reasonligo/Makefile diff --git a/tools/lsp/squirrel/Makefile b/tools/lsp/squirrel/Makefile index aca9eb7f0..aebd834c3 100644 --- a/tools/lsp/squirrel/Makefile +++ b/tools/lsp/squirrel/Makefile @@ -1,7 +1,3 @@ -SITTER ?= tree-sitter - -DIRS := pascaligo reasonligo camligo - PACKAGE := squirrel STACK_DEV_OPTIONS = --fast --ghc-options -Wwarn --file-watch @@ -12,19 +8,13 @@ all: build FORCE: -generate: $(DIRS) - -$(DIRS): FORCE - # $(SITTER) generate # Generation is manual for now - # mkdir -p $(PACKAGE)/vendor/$@ - # cp grammar/$@/src/parser.c vendor/$@/parser.c - # cp -r grammar/$@/src/tree_sitter vendor/$@/tree_sitter +grammar: ; $(MAKE) -C $@ clean: $(RM) vendor/* stack clean -build: +build: grammar stack build $(STACK_DEV_OPTIONS) -.PHONY: all clean generate build FORCE +.PHONY: all clean grammar build FORCE diff --git a/tools/lsp/squirrel/grammar/Makefile b/tools/lsp/squirrel/grammar/Makefile new file mode 100644 index 000000000..e4d8f4c76 --- /dev/null +++ b/tools/lsp/squirrel/grammar/Makefile @@ -0,0 +1,7 @@ +DIRS = $(wildcard */.) + +generate: $(DIRS) + +$(DIRS): ; $(MAKE) -C $@ + +.PHONY: generate $(DIRS) diff --git a/tools/lsp/squirrel/grammar/camligo/Makefile b/tools/lsp/squirrel/grammar/camligo/Makefile new file mode 100644 index 000000000..b26b992e4 --- /dev/null +++ b/tools/lsp/squirrel/grammar/camligo/Makefile @@ -0,0 +1 @@ +include ../parser.mk diff --git a/tools/lsp/squirrel/grammar/parser.mk b/tools/lsp/squirrel/grammar/parser.mk new file mode 100644 index 000000000..e79410a43 --- /dev/null +++ b/tools/lsp/squirrel/grammar/parser.mk @@ -0,0 +1 @@ +src/parser.c: grammar.js; tree-sitter generate diff --git a/tools/lsp/squirrel/grammar/pascaligo/Makefile b/tools/lsp/squirrel/grammar/pascaligo/Makefile new file mode 100644 index 000000000..88a7080db --- /dev/null +++ b/tools/lsp/squirrel/grammar/pascaligo/Makefile @@ -0,0 +1,5 @@ +include ../parser.mk + +test: src/parser.c; tree-sitter parse test.ligo + +.PHONY: test diff --git a/tools/lsp/squirrel/grammar/pascaligo/test.ligo b/tools/lsp/squirrel/grammar/pascaligo/test.ligo deleted file mode 100644 index aa7189b09..000000000 --- a/tools/lsp/squirrel/grammar/pascaligo/test.ligo +++ /dev/null @@ -1 +0,0 @@ -Some(Unit) # Some(Foo(Bar, Unit)) \ No newline at end of file diff --git a/tools/lsp/squirrel/grammar/pascaligo/test.ligo b/tools/lsp/squirrel/grammar/pascaligo/test.ligo new file mode 120000 index 000000000..e3f100fc8 --- /dev/null +++ b/tools/lsp/squirrel/grammar/pascaligo/test.ligo @@ -0,0 +1 @@ +../../../../../src/test/examples/pascaligo/arithmetic-contract.ligo \ No newline at end of file diff --git a/tools/lsp/squirrel/grammar/reasonligo/Makefile b/tools/lsp/squirrel/grammar/reasonligo/Makefile new file mode 100644 index 000000000..b26b992e4 --- /dev/null +++ b/tools/lsp/squirrel/grammar/reasonligo/Makefile @@ -0,0 +1 @@ +include ../parser.mk