Skip to content

made minor changes to ocaml.js #4203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions src/languages/ocaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,23 @@ export default function(hljs) {
/* missing support for heredoc-like string (OCaml 4.0.2+) */
return {
name: 'OCaml',
aliases: [ 'ml' ],
aliases: ['ml'],
keywords: {
$pattern: '[a-z_]\\w*!?',
keyword:
'and as assert asr begin class constraint do done downto else end '
+ 'exception external for fun function functor if in include '
+ 'inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method '
+ 'mod module mutable new object of open! open or private rec sig struct '
+ 'then to try type val! val virtual when while with '
'and as assert asr begin class constraint do done downto else end ' +
'exception external for fun function functor if in include ' +
'inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method ' +
'mod module mutable new object of open! open or private rec sig struct ' +
'then to try type val! val virtual when while with ' +
/* camlp4 */
+ 'parser value',
'parser value',
built_in:
/* built-in types */
'array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit '
'array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit ' +
/* (some) types in Pervasives */
+ 'in_channel out_channel ref',
literal:
'true false'
'in_channel out_channel ref',
literal: 'true false'
},
illegal: /\/\/|>>/,
contains: [
Expand All @@ -40,7 +39,7 @@ export default function(hljs) {
hljs.COMMENT(
'\\(\\*',
'\\*\\)',
{ contains: [ 'self' ] }
{ contains: ['self'] }
),
{ /* type variable */
className: 'symbol',
Expand Down Expand Up @@ -68,14 +67,16 @@ export default function(hljs) {
{
className: 'number',
begin:
'\\b(0[xX][a-fA-F0-9_]+[Lln]?|'
+ '0[oO][0-7_]+[Lln]?|'
+ '0[bB][01_]+[Lln]?|'
+ '[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',
'\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +
'0[oO][0-7_]+[Lln]?|' +
'0[bB][01_]+[Lln]?|' +
'[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',
relevance: 0
},
{ begin: /->/ // relevance booster
{
begin: /->/, // relevance booster for the arrow operator
relevance: 10 // Increase relevance to ensure it's highlighted
}
]
};
}
}