mirror of
https://github.com/comby-tools/comby.git
synced 2024-09-11 13:25:36 +03:00
Use a single language module
This commit is contained in:
parent
639ec7d1df
commit
8d4fca6bcb
@ -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)
|
@ -1,11 +0,0 @@
|
||||
module Syntax = struct
|
||||
open Types
|
||||
include Generic.Syntax
|
||||
|
||||
let comment_parser =
|
||||
[ Multiline ("/*", "*/")
|
||||
; Until_newline "//"
|
||||
]
|
||||
end
|
||||
|
||||
include Matcher.Make(Syntax)
|
@ -1,4 +0,0 @@
|
||||
open Types
|
||||
|
||||
module Syntax : Syntax.S
|
||||
include Matcher.S
|
@ -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)
|
@ -1,4 +0,0 @@
|
||||
open Types
|
||||
|
||||
module Syntax : Syntax.S
|
||||
include Matcher.S
|
@ -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)
|
@ -1,4 +0,0 @@
|
||||
open Types
|
||||
|
||||
module Syntax : Syntax.S
|
||||
include Matcher.S
|
@ -1,9 +0,0 @@
|
||||
module Syntax = struct
|
||||
include C.Syntax
|
||||
|
||||
let raw_string_literals =
|
||||
[ ({|`|}, {|`|})
|
||||
]
|
||||
end
|
||||
|
||||
include Matcher.Make(Syntax)
|
@ -1,4 +0,0 @@
|
||||
open Types
|
||||
|
||||
module Syntax : Syntax.S
|
||||
include Matcher.S
|
@ -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
137
lib/matchers/languages.ml
Normal 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
|
@ -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)
|
@ -1,4 +0,0 @@
|
||||
open Types
|
||||
|
||||
module Syntax : Syntax.S
|
||||
include Matcher.S
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
Loading…
Reference in New Issue
Block a user