Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions AUTHORS.en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,4 @@ Contributors:
- Nicolas LLOBERA <[email protected]>
- Morten Piibeleht <[email protected]>
- Martin Clausen <[email protected]>
- Guillaume Maudoux <[email protected]>
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## Master (UNRELEASED)

New languages:

- *Oz* Esoteric general-purpose language by [Guillaume Maudoux][].

[Guillaume Maudoux]: https://github.com/layus

## Version 9.12.0

New language:
Expand Down
80 changes: 80 additions & 0 deletions src/languages/oz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
Language: Oz
Author: Guillaume Maudoux <[email protected]>
Category: misc
Home page: http://mozart.github.io/
Description: Oz is a multi-paradigm language that is designed for advanced,
concurrent, networked, soft real-time, and reactive applications. It combines
ongoing research in programming language design and implementation,
constraint logic programming, distributed computing, and human-computer
interfaces.
*/

function(hljs) {
var COMMENT = {
variants: [
hljs.COMMENT('%', '$'),
hljs.COMMENT( '/\\*', '\\*/', {relevance: 0})
]
};

var IDENTIFIER = {
className: 'title',
variants: [
{ begin: '[A-Z][A-Za-z]*' },
{ begin: '\\$' },
]
}

var OPERATOR = {
className: 'symbol',
variants: [
{ begin: '\\$|\\+|-|==|<=|>=|#|\\|', relevance: 0},
{ begin: '\\\\=|=<', relevance: 10 }
]
}

var FUNCTION = {
begin: '(fun|proc)( *lazy)?( *)?\\{',
returnBegin: true,
end: '}',
className: 'function',
relevance: 0,
keywords: {
keyword: 'fun proc',
meta: 'lazy'
},
contains: [
{ begin: '{ *', end: ' *', contains: [ IDENTIFIER ], relevance: 10 },
{ begin: '!|\\?', className: 'comment', relevance: 10},
OPERATOR,
]
};

return {
aliases: ['oz'],
keywords: {
keyword: 'andthen at attr case catch choice ' +
'class cond declare define dis do ' +
'div else elsecase elseif elseof end ' +
'export fail feat finally from for ' +
'functor if import in local ' +
'lock meth mod not of or orelse ' +
'prepare prop raise require ' +
'self skip suchthat then thread try',
literal: 'true false unit',
},
contains: [
COMMENT,
FUNCTION,
OPERATOR,
hljs.QUOTE_STRING_MODE,
{ className: 'keyword', begin: '\\[\\]' },
{ className: 'literal', begin: "'", end: "'", relevance: 0},
{ className: 'symbol', begin: '`', end: '`' },

// No markup, relevance booster
{ begin: '\\bnil\\b' },
]
};
}
17 changes: 17 additions & 0 deletions test/detect/oz/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
declare
proc {Test} %% lazy functions
fun lazy {Next X} X+1 end
A = {Next 42}
in
thread `A` = 43 end
end
{Browse "This is "#'okay'}

/* Take the head of each list */
fun {Heads LL}
case LL of nil then nil
[] nil|Ls then {Heads Ls}
[] (H|_)|Ls then H|{Heads Ls}
end
end
{Browse {Heads [ [a aa aaa] [b] nil [d dd] ]}}