add ocaml language

This commit is contained in:
Frederic Delbos 2016-04-19 23:15:36 +02:00
parent 6de115f8e6
commit 8b237edbee
9 changed files with 152 additions and 0 deletions

View File

@ -70,3 +70,6 @@ before_install:
# Elm # Elm
- curl -L -o /tmp/elm-format.tgz https://github.com/avh4/elm-format/releases/download/0.2.0-alpha/elm-format-0.2.0-alpha-mac-x64.tgz - curl -L -o /tmp/elm-format.tgz https://github.com/avh4/elm-format/releases/download/0.2.0-alpha/elm-format-0.2.0-alpha-mac-x64.tgz
- tar xvzf /tmp/elm-format.tgz -C /usr/local/bin - tar xvzf /tmp/elm-format.tgz -C /usr/local/bin
# OCaml
- brew install ocaml opam
- opam install ocp-indent

View File

@ -1,4 +1,5 @@
# dev # dev
- Add [ocp-indent](https://github.com/OCamlPro/ocp-indent) beautifier for the OCaml language.
- Add [elm-format](https://github.com/avh4/elm-format) beautifier for the Elm language. - Add [elm-format](https://github.com/avh4/elm-format) beautifier for the Elm language.
- Add [clang-format](http://clang.llvm.org/docs/ClangFormat.html) beautifier for C/C++/Obj-C languages. - Add [clang-format](http://clang.llvm.org/docs/ClangFormat.html) beautifier for C/C++/Obj-C languages.
- Add [yapf](http://github.com/google/yapf) beautifier for Python. - Add [yapf](http://github.com/google/yapf) beautifier for Python.

View File

@ -0,0 +1,51 @@
let f = function
| _ -> 0
;;
let f x = match x with
| _ -> 0
;;
let f =
function
| _ -> 0
;;
let f x =
match x with
| _ -> 0
;;
let f x =
begin match x with
| _ -> 0
end
;;
let check_price t = function
| { Exec.
trade_at_settlement = (None | Some false);
} -> ()
let check_price t = function
| simpler -> ()
| other -> ()
(* Sometimes we like to write big alternations like this, in which case the
comment should typically align with the following clause. *)
let 0 =
match x with
| A
(* a *)
-> a
let 0 =
match x with
A
(* a *)
-> a
let _ =
a
|| match a with
| a -> true
| b -> false

View File

@ -0,0 +1,51 @@
let f = function
| _ -> 0
;;
let f x = match x with
| _ -> 0
;;
let f =
function
| _ -> 0
;;
let f x =
match x with
| _ -> 0
;;
let f x =
begin match x with
| _ -> 0
end
;;
let check_price t = function
| { Exec.
trade_at_settlement = (None | Some false);
} -> ()
let check_price t = function
| simpler -> ()
| other -> ()
(* Sometimes we like to write big alternations like this, in which case the
comment should typically align with the following clause. *)
let 0 =
match x with
| A
(* a *)
-> a
let 0 =
match x with
A
(* a *)
-> a
let _ =
a
|| match a with
| a -> true
| b -> false

View File

@ -74,6 +74,10 @@
{ {
"name": "Dheepak Krishnamurthy", "name": "Dheepak Krishnamurthy",
"url": "https://github.com/kdheepak89" "url": "https://github.com/kdheepak89"
},
{
"name": "Frederic Delbos",
"url": "https://github.com/fdelbos"
} }
], ],
"engines": { "engines": {

View File

@ -48,6 +48,7 @@ module.exports = class Beautifiers extends EventEmitter
'fortran-beautifier' 'fortran-beautifier'
'js-beautify' 'js-beautify'
'jscs' 'jscs'
'ocp-indent'
'perltidy' 'perltidy'
'php-cs-fixer' 'php-cs-fixer'
'phpcbf' 'phpcbf'

View File

@ -0,0 +1,18 @@
###
Requires https://github.com/OCamlPro/ocp-indent
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class OCPIndent extends Beautifier
name: "ocp-indent"
options: {
OCaml: true
}
beautify: (text, language, options) ->
@run("ocp-indent", [
@tempFile("input", text)
])

View File

@ -43,6 +43,7 @@ module.exports = class Languages
'marko' 'marko'
"mustache" "mustache"
"objective-c" "objective-c"
"ocaml"
"pawn" "pawn"
"perl" "perl"
"php" "php"

View File

@ -0,0 +1,22 @@
module.exports = {
name: "OCaml"
namespace: "ocaml"
###
Supported Grammars
###
grammars: [
"OCaml"
]
###
Supported extensions
###
extensions: [
"ml"
]
options: []
}