Skip to content

fix: update markdown submodule link #503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2024
Merged

fix: update markdown submodule link #503

merged 1 commit into from
Apr 15, 2024

Conversation

maikol-solis
Copy link
Contributor

Fix #502

@jcs090218
Copy link
Member

@maikol-solis
Copy link
Contributor Author

🤔 Maybe the problem is the repo splits the parse into two components

https://github.com/tree-sitter-grammars/tree-sitter-markdown/tree/split_parser/tree-sitter-markdown

https://github.com/tree-sitter-grammars/tree-sitter-markdown/tree/split_parser/tree-sitter-markdown-inline

I can create the two submodules to see if it works.

@jcs090218
Copy link
Member

This part might help:

:paths (pcase lang-symbol
;; XXX
('csv '("csv" ("csv" . csv)))
('ocaml '("ocaml" ("interface" . ocaml-interface)))
('ocaml-interface '("interface" ("interface" . ocaml-interface)))
('typescript '("typescript" ("tsx" . tsx)))
('xml '("xml" ("dtd" . dtd)))
(_ '("")))))))

These parsers have similar project structure. :)

@maikol-solis
Copy link
Contributor Author

This part might help:

:paths (pcase lang-symbol
;; XXX
('csv '("csv" ("csv" . csv)))
('ocaml '("ocaml" ("interface" . ocaml-interface)))
('ocaml-interface '("interface" ("interface" . ocaml-interface)))
('typescript '("typescript" ("tsx" . tsx)))
('xml '("xml" ("dtd" . dtd)))
(_ '("")))))))

These parsers have similar project structure. :)

Ok, so let me see if I understand correctly. So I need to include the markdown case into this part to see if the checks run well.

In this case, it should be something like

 ('markdown '("markdown" ("tree-sitter-markdown" . markdown))) 
 ('markdown-inline '("markdown-inline" ("tree-sitter-markdown-inline" . markdown))) 

It is correct?

@jcs090218
Copy link
Member

It seems like their master branch is now split_parser. 🤔

@maikol-solis
Copy link
Contributor Author

It seems like their master branch is now split_parser. 🤔

I think the problem comes around this line.

(defun tree-sitter-langs--get-latest (type)

It seems that "origin/master" is hard-coded to get the parsers' repo.

This is a little beyond my understanding of the code, but for example, if in tree-sitter-langs--get-latest we add a new type called :branch, maybe it might work.

WDYT?

@maikol-solis
Copy link
Contributor Author

Oh I see. The problem comes from here instead

code="(tree-sitter-langs-compile-changed-or-all \"${POSITIONAL[1]:-origin/master}\" $target)"

The compilation file points out every time to "origin/master".

Would it be possible to change that?

@jcs090218
Copy link
Member

I think you just need to change the branch name in the .gitmodules file.

@maikol-solis
Copy link
Contributor Author

Yes, I didn't realize such a simple solution.

Just another question, the CI fails here https://github.com/emacs-tree-sitter/tree-sitter-langs/actions/runs/8589275704/job/23535215634?pr=503#step:12:76

Test lang/markdown backtrace:
  signal(error ("Cannot find shared library for language: markdown"))
  error("Cannot find shared library for language: %S" markdown)
  tree-sitter-load(markdown nil nil)
  tree-sitter-require(markdown)
  (lambda nil (tree-sitter-require 'markdown))()
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name lang/markdown :documentation nil :bod
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [... ... ... 
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit(nil)
  eval((ert-run-tests-batch-and-exit nil) t)
  command-line-1(("-l" "/home/runner/eask-snapshot/lisp/core/emacs.el"
  command-line()
  normal-top-level()
Test lang/markdown condition:
    (error "Cannot find shared library for language: markdown")
   FAILED   59/166  lang/markdown (0.000178 sec)

But I don't understand the failure. Is it related to these lines?

 ('markdown '("markdown" ("tree-sitter-markdown" . markdown))) 
 ('markdown-inline '("markdown-inline" ("tree-sitter-markdown-inline" . markdown))) 

@jcs090218
Copy link
Member

But I don't understand the failure. Is it related to these line?

The best way to find out is to try to build shared libraries locally. See https://github.com/emacs-tree-sitter/tree-sitter-langs?tab=readme-ov-file#building-grammars-from-source. 🤔

@maikol-solis
Copy link
Contributor Author

I tried to compile it locally, but I'm not understanding what is wrong

script/compile markdown
[tree-sitter-langs] Processing markdown
[tree-sitter-langs] Running (tree-sitter generate) in /Users/maikol/Downloads/tmp/tree-sitter-langs/repos/markdown/markdown/

Error: file-missing ("Setting current directory" "No such file or directory" "/Users/maikol/Downloads/tmp/tree-sitter-langs/repos/markdown/markdown/")
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd138046fa512f81>))
  debug-early-backtrace()
  debug-early(error (file-missing "Setting current directory" "No such file or directory" "/Users/maikol/Downloads/tmp/tree-sitter-langs/repos/markdown/markdown/"))
  make-process(:name "tree-sitter" :command ("tree-sitter" "generate") :filter (lambda (proc string) (princ string)))
  apply(make-process (:name "tree-sitter" :command ("tree-sitter" "generate") :filter (lambda (proc string) (princ string))))
  (let ((process-environment (cons (format "TREE_SITTER_DIR=%s" tree-sitter-langs-grammar-dir) process-environment))) (apply #'make-process (append base output)))
  (let* ((command (cons program args)) (_ (message "[tree-sitter-langs] Running %s in %s" command default-directory)) (base (list ':name program ':command command)) (output (if tree-sitter-langs--out (list ':buffer tree-sitter-langs--out) '(:filter (lambda (proc string) (princ string))))) (proc (let ((process-environment (cons (format "TREE_SITTER_DIR=%s" tree-sitter-langs-grammar-dir) process-environment))) (apply #'make-process (append base output)))) (exit-code (progn (while (not (memq (process-status proc) '(exit failed signal))) (sleep-for 0.1)) (process-exit-status proc))) (_ (accept-process-output proc))) (if (= exit-code 0) nil (error "Error calling %s, exit code is %s" command exit-code)))
  tree-sitter-langs--call("tree-sitter" "generate")
  (let* ((path (or (car-safe path-spec) path-spec)) (lang-symbol (or (cdr-safe path-spec) lang-symbol)) (default-directory (file-name-as-directory (concat dir path)))) (tree-sitter-langs--call "tree-sitter" "generate") (cond ((and (memq system-type '(gnu/linux)) (file-exists-p "src/scanner.cc")) (tree-sitter-langs--call "g++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-static-libgcc" "-static-libstdc++" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (target (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)))) ((memq system-type '(berkeley-unix)) (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))))) (:default (tree-sitter-langs--call "tree-sitter" "test"))))
  (let ((path-spec (car tail))) (let* ((path (or (car-safe path-spec) path-spec)) (lang-symbol (or (cdr-safe path-spec) lang-symbol)) (default-directory (file-name-as-directory (concat dir path)))) (tree-sitter-langs--call "tree-sitter" "generate") (cond ((and (memq system-type '(gnu/linux)) (file-exists-p "src/scanner.cc")) (tree-sitter-langs--call "g++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-static-libgcc" "-static-libstdc++" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (target (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)))) ((memq system-type '(berkeley-unix)) (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))))) (:default (tree-sitter-langs--call "tree-sitter" "test")))) (setq tail (cdr tail)))
  (while tail (let ((path-spec (car tail))) (let* ((path (or (car-safe path-spec) path-spec)) (lang-symbol (or (cdr-safe path-spec) lang-symbol)) (default-directory (file-name-as-directory (concat dir path)))) (tree-sitter-langs--call "tree-sitter" "generate") (cond ((and (memq system-type '(gnu/linux)) (file-exists-p "src/scanner.cc")) (tree-sitter-langs--call "g++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-static-libgcc" "-static-libstdc++" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (target (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)))) ((memq system-type '(berkeley-unix)) (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))))) (:default (tree-sitter-langs--call "tree-sitter" "test")))) (setq tail (cdr tail))))
  (let ((tail paths)) (while tail (let ((path-spec (car tail))) (let* ((path (or (car-safe path-spec) path-spec)) (lang-symbol (or (cdr-safe path-spec) lang-symbol)) (default-directory (file-name-as-directory (concat dir path)))) (tree-sitter-langs--call "tree-sitter" "generate") (cond ((and (memq system-type '(gnu/linux)) (file-exists-p "src/scanner.cc")) (tree-sitter-langs--call "g++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-static-libgcc" "-static-libstdc++" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (target (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)))) ((memq system-type '(berkeley-unix)) (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))))) (:default (tree-sitter-langs--call "tree-sitter" "test")))) (setq tail (cdr tail)))))
  (let ((default-directory dir) (langs-with-deps (mapcar #'car tree-sitter-langs--langs-with-deps)) (cmds (car (cdr (assoc lang-symbol tree-sitter-langs--langs-with-deps))))) (if (member lang-symbol langs-with-deps) (progn (tree-sitter-langs--call "npm" "set" "progress=false") (let ((tail cmds)) (while tail (let ((cmd (car tail))) (condition-case err (tree-sitter-langs--call "npm" "install" cmd) ((debug error) (message "Failed to run 'npm install XXX': %s" err) nil)) (setq tail (cdr tail))))) (condition-case err (tree-sitter-langs--call "npm" "install") ((debug error) (message "Failed to run 'npm install': %s" err) nil)))) (let ((tail paths)) (while tail (let ((path-spec (car tail))) (let* ((path (or (car-safe path-spec) path-spec)) (lang-symbol (or (cdr-safe path-spec) lang-symbol)) (default-directory (file-name-as-directory (concat dir path)))) (tree-sitter-langs--call "tree-sitter" "generate") (cond ((and (memq system-type '(gnu/linux)) (file-exists-p "src/scanner.cc")) (tree-sitter-langs--call "g++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-static-libgcc" "-static-libstdc++" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (target (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)))) ((memq system-type '(berkeley-unix)) (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))))) (:default (tree-sitter-langs--call "tree-sitter" "test")))) (setq tail (cdr tail))))) (let ((default-directory bin-dir)) (let ((tail (directory-files default-directory))) (while tail (let ((file (car tail))) (if (and (string-match "_" file) (cl-some #'(lambda (s) (string-suffix-p s file)) tree-sitter-langs--suffixes)) (progn (let ((new-name (replace-regexp-in-string "_" "-" file))) (if (file-exists-p new-name) (progn (delete-file new-name))) (rename-file file new-name)))) (setq tail (cdr tail)))))) (if (eq system-type 'darwin) (progn (let ((default-directory bin-dir)) (let ((tail (directory-files default-directory))) (while tail (let ((file (car tail))) (if (string-suffix-p ".so" file) (progn (let ((new-name (concat (file-name-base file) ".dylib"))) (if (file-exists-p new-name) (progn (delete-file new-name))) (rename-file file new-name)))) (setq tail (cdr tail)))))))) (if clean (progn (tree-sitter-langs--call "git" "reset" "--hard" "HEAD") (tree-sitter-langs--call "git" "clean" "-f"))))
  (let* ((source (tree-sitter-langs--source lang-symbol)) (dir (if source (file-name-as-directory (concat (tree-sitter-langs--repos-dir) (symbol-name lang-symbol))) (error "Unknown language `%s'" lang-symbol))) (sub-path (format "repos/%s" lang-symbol)) (status (tree-sitter-langs--repo-status lang-symbol)) (paths (plist-get source :paths)) (bin-dir (tree-sitter-langs--bin-dir)) (tree-sitter-langs--out (tree-sitter-langs--buffer (format "*tree-sitter-langs-compile %s*" lang-symbol)))) (let ((default-directory tree-sitter-langs-git-dir)) (cond ((eq status :uninitialized) (let nil (tree-sitter-langs--call "git" "submodule" "update" "--init" "--checkout" "--" sub-path))) ((eq status :modified) (let nil (if clean (progn (let ((default-directory dir)) (tree-sitter-langs--call "git" "stash" "push")) (tree-sitter-langs--call "git" "submodule" "update" "--init" "--checkout" "--force" "--" sub-path))))) ((eq status :conflicts) (let nil (error "Unresolved conflicts in %s" dir))) ((eq status :synchronized) 'nil) (t (let nil (error "Weird status from git-submodule '%s'" status))))) (let ((default-directory dir) (langs-with-deps (mapcar #'car tree-sitter-langs--langs-with-deps)) (cmds (car (cdr (assoc lang-symbol tree-sitter-langs--langs-with-deps))))) (if (member lang-symbol langs-with-deps) (progn (tree-sitter-langs--call "npm" "set" "progress=false") (let ((tail cmds)) (while tail (let ((cmd (car tail))) (condition-case err (tree-sitter-langs--call "npm" "install" cmd) ((debug error) (message "Failed to run 'npm install XXX': %s" err) nil)) (setq tail (cdr tail))))) (condition-case err (tree-sitter-langs--call "npm" "install") ((debug error) (message "Failed to run 'npm install': %s" err) nil)))) (let ((tail paths)) (while tail (let ((path-spec (car tail))) (let* ((path (or (car-safe path-spec) path-spec)) (lang-symbol (or (cdr-safe path-spec) lang-symbol)) (default-directory (file-name-as-directory (concat dir path)))) (tree-sitter-langs--call "tree-sitter" "generate") (cond ((and (memq system-type '(gnu/linux)) (file-exists-p "src/scanner.cc")) (tree-sitter-langs--call "g++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-static-libgcc" "-static-libstdc++" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (target (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol) "-target" target)))) ((memq system-type '(berkeley-unix)) (cond ((file-exists-p "src/scanner.cc") (tree-sitter-langs--call "c++" "-shared" "-fPIC" "-fno-exceptions" "-g" "-O2" "-I" "src" "src/scanner.cc" "-xc" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) ((file-exists-p "src/scanner.c") (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/scanner.c" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))) (:default (tree-sitter-langs--call "cc" "-shared" "-fPIC" "-g" "-O2" "-I" "src" "src/parser.c" "-o" (format "%sbin/%s.so" tree-sitter-langs-grammar-dir lang-symbol))))) (:default (tree-sitter-langs--call "tree-sitter" "test")))) (setq tail (cdr tail))))) (let ((default-directory bin-dir)) (let ((tail (directory-files default-directory))) (while tail (let ((file (car tail))) (if (and (string-match "_" file) (cl-some #'(lambda (s) (string-suffix-p s file)) tree-sitter-langs--suffixes)) (progn (let ((new-name (replace-regexp-in-string "_" "-" file))) (if (file-exists-p new-name) (progn (delete-file new-name))) (rename-file file new-name)))) (setq tail (cdr tail)))))) (if (eq system-type 'darwin) (progn (let ((default-directory bin-dir)) (let ((tail (directory-files default-directory))) (while tail (let ((file (car tail))) (if (string-suffix-p ".so" file) (progn (let ((new-name (concat (file-name-base file) ".dylib"))) (if (file-exists-p new-name) (progn (delete-file new-name))) (rename-file file new-name)))) (setq tail (cdr tail)))))))) (if clean (progn (tree-sitter-langs--call "git" "reset" "--hard" "HEAD") (tree-sitter-langs--call "git" "clean" "-f")))))
  tree-sitter-langs-compile(markdown nil nil)
  command-line-1(("--directory" "." "--load" "tree-sitter-langs-build" "--eval" "(tree-sitter-langs-compile 'markdown nil nil)"))
  command-line()
  normal-top-level()
Setting current directory: No such file or directory, /Users/maikol/Downloads/tmp/tree-sitter-langs/repos/markdown/markdown/

Add `markdown` and `markdown-inline` parsers.
@maikol-solis
Copy link
Contributor Author

maikol-solis commented Apr 15, 2024

I could compile markdown, but markdown-inline is a mystery to me. The problem is this part in tree-sitter-langs--source. There is no documentation in what I should put there:

('markdown '("tree-sitter-markdown" ("tree-sitter-markdown" . markdown)))
('markdown-inline '("tree-sitter-markdown-inline" ("tree-sitter-markdown-inline" . markdown)))
 

@jcs090218 jcs090218 merged commit 4aac8f8 into emacs-tree-sitter:master Apr 15, 2024
@jcs090218
Copy link
Member

It looks like it works! :D

@maikol-solis
Copy link
Contributor Author

Wow! This is a lucky coincidence. Thank you for your patience, @jcs090218. I learned a lot!

Best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maybe the Markdown parser should be updated
2 participants