UNPKG

ace-code-editor

Version:

Ajax.org Code Editor is a full featured source code highlighting editor that powers the Cloud9 IDE

200 lines 3.87 kB
[[ "comment", ["comment","(*"] ],[ "comment", ["comment"," * Example of early return implementation taken from"] ],[ "comment", ["comment"," * http://ocaml.janestreet.com/?q=node/91"] ],[ "start", ["comment"," *)"] ],[ "start" ],[ "start", ["keyword","let"], ["text"," "], ["identifier","with_return"], ["text"," "], ["paren.lparen","("], ["keyword","type"], ["text"," "], ["identifier","t"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","("], ["identifier","f"], ["text"," : "], ["identifier","_"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["identifier","t"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","="] ],[ "start", ["text"," "], ["keyword","let"], ["text"," "], ["keyword","module"], ["text"," "], ["identifier","M"], ["text"," "], ["keyword.operator","="] ],[ "start", ["text"," "], ["keyword","struct"], ["text"," "], ["keyword","exception"], ["text"," "], ["identifier","Return"], ["text"," "], ["keyword","of"], ["text"," "], ["identifier","t"], ["text"," "], ["keyword","end"] ],[ "start", ["text"," "], ["keyword","in"] ],[ "start", ["text"," "], ["keyword","let"], ["text"," "], ["identifier","return"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"], ["text"," "], ["identifier","return"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["keyword","fun"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["support.function","raise"], ["text"," "], ["paren.lparen","("], ["identifier","M"], ["text","."], ["identifier","Return"], ["text"," "], ["identifier","x"], ["paren.rparen","))"], ["text","; "], ["paren.rparen","}"], ["text"," "], ["keyword","in"] ],[ "start", ["text"," "], ["keyword","try"], ["text"," "], ["identifier","f"], ["text"," "], ["identifier","return"], ["text"," "], ["keyword","with"], ["text"," "], ["identifier","M"], ["text","."], ["identifier","Return"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["identifier","x"] ],[ "start" ],[ "start" ],[ "start", ["comment","(* Function that uses the 'early return' functionality provided by `with_return` *)"] ],[ "start", ["keyword","let"], ["text"," "], ["identifier","sum_until_first_negative"], ["text"," "], ["support.function","list"], ["text"," "], ["keyword.operator","="] ],[ "start", ["text"," "], ["identifier","with_return"], ["text"," "], ["paren.lparen","("], ["keyword","fun"], ["text"," "], ["identifier","r"], ["text"," "], ["keyword.operator","->"] ],[ "start", ["text"," "], ["support.function","List"], ["text","."], ["support.function","fold"], ["text"," "], ["support.function","list"], ["text"," "], ["keyword.operator","~"], ["support.function","init"], ["text",":"], ["constant.numeric","0"], ["text"," "], ["keyword.operator","~"], ["identifier","f"], ["text",":"], ["paren.lparen","("], ["keyword","fun"], ["text"," "], ["identifier","acc"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","->"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator",">="], ["text"," "], ["constant.numeric","0"], ["text"," "], ["keyword","then"], ["text"," "], ["identifier","acc"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword","else"], ["text"," "], ["identifier","r"], ["text","."], ["identifier","return"], ["text"," "], ["identifier","acc"], ["paren.rparen","))"] ]]