Use a single language module

This commit is contained in:
Rijnard van Tonder 2019-04-23 13:14:40 -04:00 committed by GitHub
parent 639ec7d1df
commit 8d4fca6bcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 139 additions and 154 deletions

View File

@ -1,15 +0,0 @@
module Syntax = struct
open Types
include Generic.Syntax
let user_defined_delimiters =
Dyck.Syntax.user_defined_delimiters @
[ ("if", "fi")
; ("case", "esac")
]
let comment_parser =
[ Until_newline "#" ]
end
include Matcher.Make(Syntax)

View File

@ -1,11 +0,0 @@
module Syntax = struct
open Types
include Generic.Syntax
let comment_parser =
[ Multiline ("/*", "*/")
; Until_newline "//"
]
end
include Matcher.Make(Syntax)

View File

@ -1,4 +0,0 @@
open Types
module Syntax : Syntax.S
include Matcher.S

View File

@ -1,18 +0,0 @@
module Syntax = struct
let user_defined_delimiters =
[ ("(", ")")
; ("{", "}")
; ("[", "]")
]
let escapable_string_literals = []
let escape_char =
'\\'
let raw_string_literals = []
let comment_parser = []
end
include Matcher.Make(Syntax)

View File

@ -1,4 +0,0 @@
open Types
module Syntax : Syntax.S
include Matcher.S

View File

@ -1,14 +0,0 @@
(** Dyck with common string literals. *)
module Syntax = struct
include Dyck.Syntax
let escapable_string_literals =
[ {|"|}
; {|'|}
]
let escape_char =
'\\'
end
include Matcher.Make(Syntax)

View File

@ -1,4 +0,0 @@
open Types
module Syntax : Syntax.S
include Matcher.S

View File

@ -1,9 +0,0 @@
module Syntax = struct
include C.Syntax
let raw_string_literals =
[ ({|`|}, {|`|})
]
end
include Matcher.Make(Syntax)

View File

@ -1,4 +0,0 @@
open Types
module Syntax : Syntax.S
include Matcher.S

View File

@ -1,24 +0,0 @@
module Syntax = struct
open Types
let user_defined_delimiters =
Dyck.Syntax.user_defined_delimiters @
[ ("<", ">")
]
let escapable_string_literals =
[ {|"|}
; {|'|}
]
let raw_string_literals = []
let escape_char =
'\\'
let comment_parser =
[ Multiline ("<!--", "-->")
]
end
include Matcher.Make(Syntax)

137
lib/matchers/languages.ml Normal file
View File

@ -0,0 +1,137 @@
module Dyck = struct
module Syntax = struct
let user_defined_delimiters =
[ ("(", ")")
; ("{", "}")
; ("[", "]")
]
let escapable_string_literals = []
let escape_char =
'\\'
let raw_string_literals = []
let comment_parser = []
end
include Matcher.Make(Syntax)
end
module Latex = struct
module Syntax = struct
open Types
include Dyck.Syntax
let user_defined_delimiters =
Dyck.Syntax.user_defined_delimiters @
[ ({|\if|}, {|\fi|})
]
let comment_parser =
[ Until_newline "%"
]
end
include Matcher.Make(Syntax)
end
module Generic = struct
module Syntax = struct
include Dyck.Syntax
let escapable_string_literals =
[ {|"|}
; {|'|}
]
let escape_char =
'\\'
end
include Matcher.Make(Syntax)
end
module Bash = struct
module Syntax = struct
open Types
include Generic.Syntax
let user_defined_delimiters =
Dyck.Syntax.user_defined_delimiters @
[ ("if", "fi")
; ("case", "esac")
]
let comment_parser =
[ Until_newline "#" ]
end
include Matcher.Make(Syntax)
end
module Python = struct
module Syntax = struct
open Types
include Generic.Syntax
let raw_string_literals =
[ ({|"""|}, {|"""|})
; ({|'''|}, {|'''|})
]
let comment_parser =
[ Until_newline "#"
]
end
include Matcher.Make(Syntax)
end
module Html = struct
module Syntax = struct
open Types
include Generic.Syntax
let user_defined_delimiters =
Dyck.Syntax.user_defined_delimiters @
[ ("<", ">")
]
let comment_parser =
[ Multiline ("<!--", "-->")
]
end
include Matcher.Make(Syntax)
end
module C = struct
module Syntax = struct
open Types
include Generic.Syntax
let comment_parser =
[ Multiline ("/*", "*/")
; Until_newline "//"
]
end
include Matcher.Make(Syntax)
end
module Java = C
module Javascript = C
module Go = struct
module Syntax = struct
include C.Syntax
let raw_string_literals =
[ ({|`|}, {|`|})
]
end
include Matcher.Make(Syntax)
end

View File

@ -1,15 +0,0 @@
module Syntax = struct
open Types
include Dyck.Syntax
let user_defined_delimiters =
Dyck.Syntax.user_defined_delimiters @
[ ({|\if|}, {|\fi|})
]
let comment_parser =
[ Until_newline "%"
]
end
include Matcher.Make(Syntax)

View File

@ -1,4 +0,0 @@
open Types
module Syntax : Syntax.S
include Matcher.S

View File

@ -1,10 +1,4 @@
module Generic = Generic
module C = C
module Go = Go
module Python = Python
module Bash = Bash
module Html = Html
module Latex = Latex
include Languages
module Configuration = Configuration

View File

@ -1,10 +1,4 @@
module Generic = Generic
module C = C
module Go = Go
module Python = Python
module Bash = Bash
module Html = Html
module Latex = Latex
include module type of Languages
module Configuration = Configuration

View File

@ -1,14 +0,0 @@
module Python = struct
open Types
include Generic.Syntax
let raw_string_literals =
[ ({|"""|}, {|"""|})
]
let comment_parser =
[ Until_newline "#"
]
end
include Matcher.Make(Python)