More languages

This commit is contained in:
Rijnard van Tonder 2019-04-23 16:11:41 -04:00 committed by GitHub
parent 8d4fca6bcb
commit b02b053ed2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,19 @@ module Latex = struct
include Matcher.Make(Syntax)
end
module Assembly = struct
module Syntax = struct
open Types
include Dyck.Syntax
let comment_parser =
[ Until_newline ";"
]
end
include Matcher.Make(Syntax)
end
module Generic = struct
module Syntax = struct
include Dyck.Syntax
@ -71,14 +84,29 @@ module Bash = struct
include Matcher.Make(Syntax)
end
module Python = struct
module Ruby = struct
module Syntax = struct
open Types
include Generic.Syntax
let raw_string_literals =
[ ({|"|}, {|"|})
]
let comment_parser =
[ Multiline ("=begin", "=end")
; Until_newline "#"
]
end
end
module Elixir = struct
module Syntax = struct
open Types
include Generic.Syntax
let raw_string_literals =
[ ({|"""|}, {|"""|})
; ({|'''|}, {|'''|})
]
let comment_parser =
@ -89,6 +117,20 @@ module Python = struct
include Matcher.Make(Syntax)
end
module Python = struct
module Syntax = struct
include Elixir.Syntax
let raw_string_literals =
Elixir.Syntax.raw_string_literals @
[ ({|'''|}, {|'''|})
]
end
include Matcher.Make(Syntax)
end
module Html = struct
module Syntax = struct
open Types
@ -107,6 +149,46 @@ module Html = struct
include Matcher.Make(Syntax)
end
module SQL = struct
module Syntax = struct
open Types
include Generic.Syntax
let comment_parser =
[ Multiline ("/*", "*/")
; Until_newline "--"
]
end
include Matcher.Make(Syntax)
end
module Clojure = struct
module Syntax = struct
open Types
include Generic.Syntax
let comment_parser =
[ Until_newline ";"
]
end
include Matcher.Make(Syntax)
end
module Erlang = struct
module Syntax = struct
open Types
include Generic.Syntax
let comment_parser =
[ Until_newline "%"
]
end
include Matcher.Make(Syntax)
end
module C = struct
module Syntax = struct
open Types
@ -122,7 +204,43 @@ module C = struct
end
module Java = C
module Javascript = C
module CSS = C
module Kotlin = C
module Scala = C
module Dart = C
(* TODO(RVT): model nested comments *)
module Swift = C
module Php = struct
module Syntax = struct
include C.Syntax
open Types
let comment_parser =
C.Syntax.comment_parser @
[ Until_newline "#"
]
end
end
(* TODO(RVT): model nested comments *)
module Lisp = struct
module Syntax = struct
include C.Syntax
open Types
let comment_parser =
C.Syntax.comment_parser @
[ Until_newline ";"
; Multiline ("#|", "|#")
]
end
end
module Go = struct
module Syntax = struct
@ -135,3 +253,52 @@ module Go = struct
include Matcher.Make(Syntax)
end
module Javascript = Go
(* TODO(RVT): model nested comments *)
module Rust = struct
module Syntax = struct
include C.Syntax
let raw_string_literals =
[ ({|r#|}, {|#|})
]
end
end
(* TODO(RVT): model nested comments *)
module OCaml = struct
module Syntax = struct
open Types
include Generic.Syntax
let raw_string_literals =
[ ("{|", "|}")
]
let comments =
[ Multiline ("(*", "*)")
]
end
end
module Haskell = struct
module Syntax = struct
open Types
include Generic.Syntax
let raw_string_literals =
[ ({|"""|}, {|"""|})
]
let comments =
[ Multiline ("{-", "-}")
; Until_newline "--"
]
end
include Matcher.Make(Syntax)
end
module Elm = Haskell