Skip to content

Commit

Permalink
✨ ocaml syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
emillon committed Jul 26, 2024
1 parent 8c72631 commit 4bc4832
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = grammar({
extras: ($) => [$.comment, /\s+/],

rules: {
source_file: ($) => repeat($.stanza),
source_file: ($) => choice($.ocaml_syntax, repeat($.stanza)),
ocaml_syntax: ($) => seq("(* -*- tuareg -*- *)", repeat(/.+/)),
sexp: ($) => choice($._atom_or_qs, $.list),
sexps1: ($) => repeat1($.sexp),
_atom_or_qs: ($) => choice($.atom, $.quoted_string, $.multiline_string),
Expand Down
17 changes: 17 additions & 0 deletions test/corpus/lexical.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,20 @@ multiline strings
(multiline_string))
(sexp
(multiline_string))))))))

============
ocaml syntax
============

(* -*- tuareg -*- *)

let () = Jbuild_plugin.V1.send {|
(alias
(name runtest)
(action (echo "ocaml syntax")))
|}

---

(source_file
(ocaml_syntax))

0 comments on commit 4bc4832

Please sign in to comment.