From 913cd6c309a8cf26db5f1874c2743967077e70a8 Mon Sep 17 00:00:00 2001 From: Trey Deitch Date: Thu, 8 May 2014 13:21:57 -0700 Subject: [PATCH 01/15] Add support for Cool This change includes a brief (non-sensical) sample program I wrote to illustrate many of Cool's language constructs, as well as a simple rule to distinguish Cool files from Common Lisp or OpenCL (it has a line that starts with the word 'class'). Further, it includes a second example program adapted from an example contained in the Cool distribution (list.cl), which contains a few further language constructs and captures the style of a Cool program. --- lib/linguist/heuristics.rb | 3 +- lib/linguist/languages.yml | 6 +++ lib/linguist/samples.json | 101 +++++++++++++++++++++++++++++++++++-- samples/Cool/list.cl | 26 ++++++++++ samples/Cool/sample.cl | 71 ++++++++++++++++++++++++++ 5 files changed, 203 insertions(+), 4 deletions(-) create mode 100644 samples/Cool/list.cl create mode 100644 samples/Cool/sample.cl diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index c1116780..420cafc7 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -25,7 +25,7 @@ module Linguist if languages.all? { |l| ["TypeScript", "XML"].include?(l) } disambiguate_ts(data, languages) end - if languages.all? { |l| ["Common Lisp", "OpenCL"].include?(l) } + if languages.all? { |l| ["Common Lisp", "Cool", "OpenCL"].include?(l) } disambiguate_cl(data, languages) end if languages.all? { |l| ["Rebol", "R"].include?(l) } @@ -72,6 +72,7 @@ module Linguist def self.disambiguate_cl(data, languages) matches = [] matches << Language["Common Lisp"] if data.include?("(defun ") + matches << Language["Cool"] if /^class/x.match(data) matches << Language["OpenCL"] if /\/\* |\/\/ |^\}/.match(data) matches end diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 7350bb2a..b9e4102a 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -429,6 +429,12 @@ Common Lisp: - clisp - ecl +Cool: + type: programming + lexer: Text only + extensions: + - .cl + Coq: type: programming extensions: diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index dfabe80e..18885205 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -91,6 +91,9 @@ ".cl", ".lisp" ], + "Cool": [ + ".cl" + ], "Coq": [ ".v" ], @@ -702,8 +705,8 @@ ".gemrc" ] }, - "tokens_total": 607168, - "languages_total": 739, + "tokens_total": 607535, + "languages_total": 741, "tokens": { "ABAP": { "*/**": 1, @@ -15134,6 +15137,96 @@ "line": 2, "After": 1 }, + "Cool": { + "class": 7, + "List": 8, + "{": 27, + "isNil": 2, + "(": 30, + ")": 30, + "Bool": 5, + "true": 2, + "}": 27, + ";": 40, + "head": 2, + "Int": 15, + "abort": 2, + "tail": 2, + "self": 3, + "cons": 1, + "i": 7, + "new": 3, + "Cons": 2, + ".init": 1, + "inherits": 4, + "car": 3, + "-": 19, + "The": 2, + "element": 1, + "in": 3, + "this": 1, + "list": 2, + "cell": 1, + "cdr": 3, + "rest": 3, + "of": 2, + "the": 1, + "false": 3, + "init": 1, + "<": 9, + "Exhibit": 1, + "various": 1, + "language": 1, + "constructs": 1, + "Sample": 5, + "testCondition": 1, + "x": 3, + "if": 3, + "then": 3, + "else": 3, + "+": 1, + "*": 3, + "fi": 2, + "testLoop": 1, + "y": 7, + "while": 1, + "loop": 1, + "not": 1, + "condition": 1, + "/": 2, + "pool": 1, + "testAssign": 1, + "z": 2, + "testCase": 1, + "var": 2, + "SELF_TYPE": 2, + "io": 1, + "IO": 3, + "<->": 1, + "case": 1, + "a": 4, + "A": 3, + "io.out_string": 4, + "b": 3, + "B": 2, + "s": 1, + "o": 1, + "Object": 1, + "esac": 1, + "testLet": 1, + "let": 2, + "c": 2, + "Used": 1, + "to": 1, + "test": 1, + "subclasses": 1, + "C": 1, + "main": 2, + ".testLet": 1, + "example": 1, + "Main": 1, + "out_string": 1 + }, "Coq": { "Inductive": 41, "day": 9, @@ -65508,6 +65601,7 @@ "COBOL": 90, "CoffeeScript": 2951, "Common Lisp": 2186, + "Cool": 367, "Coq": 18259, "Creole": 134, "Crystal": 1506, @@ -65689,6 +65783,7 @@ "COBOL": 4, "CoffeeScript": 9, "Common Lisp": 3, + "Cool": 2, "Coq": 12, "Creole": 1, "Crystal": 3, @@ -65845,5 +65940,5 @@ "YAML": 2, "Zephir": 2 }, - "md5": "dfced8ef9ddd9813d2982dc25a5468fa" + "md5": "ee1f12dec040474f3864dfc0af301d17" } \ No newline at end of file diff --git a/samples/Cool/list.cl b/samples/Cool/list.cl new file mode 100644 index 00000000..3d44813e --- /dev/null +++ b/samples/Cool/list.cl @@ -0,0 +1,26 @@ +(* This simple example of a list class is adapted from an example in the + Cool distribution. *) + +class List { + isNil() : Bool { true }; + head() : Int { { abort(); 0; } }; + tail() : List { { abort(); self; } }; + cons(i : Int) : List { + (new Cons).init(i, self) + }; +}; + +class Cons inherits List { + car : Int; -- The element in this list cell + cdr : List; -- The rest of the list + isNil() : Bool { false }; + head() : Int { car }; + tail() : List { cdr }; + init(i : Int, rest : List) : List { + { + car <- i; + cdr <- rest; + self; + } + }; +}; diff --git a/samples/Cool/sample.cl b/samples/Cool/sample.cl new file mode 100644 index 00000000..e8884990 --- /dev/null +++ b/samples/Cool/sample.cl @@ -0,0 +1,71 @@ +(* Refer to Alex Aiken, "The Cool Reference Manual": + http://theory.stanford.edu/~aiken/software/cool/cool-manual.pdf + for language specification. +*) + +-- Exhibit various language constructs +class Sample { + testCondition(x: Int): Bool { + if x = 0 + then false + else + if x < (1 + 2) * 3 + then true + else false + fi + fi + }; + + testLoop(y: Int): Bool { + while y > 0 loop + { + if not condition(y) + then y <- y / 2 + else y <- y - 1; + } + pool + }; + + testAssign(z: Int): Bool { + i : Int; + i <- ~z; + }; + + testCase(var: Sample): SELF_TYPE { + io : IO <- new IO; + case var of + a : A => io.out_string("Class type is A\n"); + b : B => io.out_string("Class type is B\n"); + s : Sample => io.out_string("Class type is Sample\n"); + o : Object => io.out_string("Class type is object\n"); + esac + }; + + testLet(i: Int): Int { + let (a: Int in + let(b: Int <- 3, c: Int <- 4 in + { + a <- 2; + a * b * 2 / c; + } + ) + ) + }; +}; + +-- Used to test subclasses +class A inherits Sample {}; +class B inherits A {}; + +class C { + main() : Int { + (new Sample).testLet(1) + }; +}; + +-- "Hello, world" example +class Main inherits IO { + main(): SELF_TYPE { + out_string("Hello, World.\n") + }; +}; From 410aace222d701f87dd875271e3c22ccf1cf424d Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Sun, 24 Aug 2014 17:00:37 -0400 Subject: [PATCH 02/15] Adding Google Apps Script (.gs) as a JavaScript extension. --- lib/linguist/heuristics.rb | 9 + lib/linguist/languages.yml | 1 + lib/linguist/samples.json | 357 ++++++++++++++++++++------ samples/Gosu/Ronin.gs | 238 +++++++++++++++++ samples/JavaScript/chart_composers.gs | 78 ++++++ samples/JavaScript/itau.gs | 150 +++++++++++ 6 files changed, 759 insertions(+), 74 deletions(-) create mode 100644 samples/Gosu/Ronin.gs create mode 100644 samples/JavaScript/chart_composers.gs create mode 100644 samples/JavaScript/itau.gs diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index c1116780..5a82759d 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -31,6 +31,9 @@ module Linguist if languages.all? { |l| ["Rebol", "R"].include?(l) } disambiguate_r(data, languages) end + if languages.all? { |l| ["Gosu", "JavaScript"].include?(l) } + disambiguate_gosu(data, languages) + end end end @@ -83,6 +86,12 @@ module Linguist matches end + def self.disambiguate_gosu(data, languages) + matches = [] + matches << Language["Gosu"] if /^uses java\./.match(data) + matches + end + def self.active? !!ACTIVE end diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index b306aea5..964da8c8 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1142,6 +1142,7 @@ JavaScript: - .bones - .es6 - .frag + - .gs - .jake - .jsfl - .jsm diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index dd234ab0..6742d008 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -288,6 +288,7 @@ ], "JavaScript": [ ".frag", + ".gs", ".js", ".script!", ".xsjs", @@ -839,8 +840,8 @@ "exception.zep.php" ] }, - "tokens_total": 654479, - "languages_total": 898, + "tokens_total": 655811, + "languages_total": 901, "tokens": { "ABAP": { "*/**": 1, @@ -26433,46 +26434,46 @@ "in": 3, "Hello": 2, "gst": 1, - "<": 1, + "<": 2, "%": 2, "@": 1, "params": 1, - "(": 53, + "(": 122, "users": 2, "Collection": 1, "": 1, - ")": 54, + ")": 123, "<%>": 2, "for": 2, "user": 1, - "{": 28, + "{": 72, "user.LastName": 1, - "}": 28, + "}": 72, "user.FirstName": 1, "user.Department": 1, - "package": 2, + "package": 3, "example": 2, "enhancement": 1, - "String": 6, - "function": 11, + "String": 14, + "function": 16, "toPerson": 1, "Person": 7, - "var": 10, + "var": 17, "vals": 4, "this.split": 1, - "return": 4, - "new": 6, + "return": 17, + "new": 8, "[": 4, "]": 4, - "as": 3, + "as": 7, "int": 2, "Relationship.valueOf": 2, "hello": 1, "print": 3, - "uses": 2, + "uses": 8, "java.util.*": 1, "java.io.File": 1, - "class": 1, + "class": 2, "extends": 1, "Contact": 1, "implements": 1, @@ -26488,24 +26489,24 @@ "delegate": 1, "_emailHelper": 2, "represents": 1, - "enum": 1, + "enum": 2, "FRIEND": 1, "FAMILY": 1, "BUSINESS_CONTACT": 1, - "static": 7, + "static": 26, "ALL_PEOPLE": 2, "HashMap": 1, "": 1, - "construct": 1, - "name": 4, + "construct": 2, + "name": 12, "age": 4, "relationship": 2, "EmailHelper": 1, "this": 1, - "property": 2, - "get": 1, + "property": 13, + "get": 11, "Name": 3, - "set": 1, + "set": 2, "override": 1, "getEmailName": 1, "incrementAge": 1, @@ -26514,10 +26515,10 @@ "printPersonInfo": 1, "addPerson": 4, "p": 5, - "if": 4, + "if": 19, "ALL_PEOPLE.containsKey": 2, ".Name": 1, - "throw": 1, + "throw": 5, "IllegalArgumentException": 1, "p.Name": 2, "addAllPeople": 1, @@ -26525,7 +26526,7 @@ "List": 1, "": 1, "contact": 3, - "typeis": 1, + "typeis": 2, "and": 1, "not": 1, "contact.Name": 1, @@ -26551,7 +26552,7 @@ "result.getInt": 1, "loadFromFile": 1, "file": 3, - "File": 2, + "File": 3, "file.eachLine": 1, "line": 1, "line.HasContent": 1, @@ -26560,7 +26561,123 @@ "writer": 2, "FileWriter": 1, "PersonCSVTemplate.renderToString": 1, - "PersonCSVTemplate.render": 1 + "PersonCSVTemplate.render": 1, + "ronin": 1, + "gw.util.concurrent.LockingLazyVar": 1, + "gw.lang.reflect.*": 1, + "java.lang.*": 1, + "java.io.*": 1, + "ronin.config.*": 1, + "org.slf4j.*": 1, + "Ronin": 1, + "_CONFIG": 13, + "IRoninConfig": 2, + "Config": 1, + "_CURRENT_REQUEST": 1, + "ThreadLocal": 1, + "": 1, + ";": 1, + "private": 1, + "internal": 2, + "init": 1, + "servlet": 3, + "RoninServlet": 3, + "m": 3, + "ApplicationMode": 2, + "src": 2, + "null": 15, + "cfg": 2, + "TypeSystem.getByFullNameIfValid": 2, + "defaultWarning": 3, + "false": 1, + "ctor": 2, + "cfg.TypeInfo.getConstructor": 1, + "ronin.config.ApplicationMode": 1, + "ronin.RoninServlet": 1, + "ctor.Constructor.newInstance": 1, + "else": 9, + "DefaultRoninConfig": 1, + "true": 2, + "roninLogger": 2, + "roninLogger.TypeInfo.getMethod": 1, + "ronin.config.LogLevel": 1, + ".CallHandler.handleCall": 1, + "LogLevel": 5, + "log": 2, + "level": 7, + "WARN": 2, + "Quartz.maybeStart": 1, + "ReloadManager.setSourceRoot": 1, + "CurrentRequest": 3, + "req": 2, + "RoninRequest": 2, + "_CURRENT_REQUEST.set": 1, + "//": 2, + "CurrentTrace": 1, + "Trace": 1, + ".Trace": 1, + "_CURRENT_REQUEST.get": 1, + "Mode": 1, + ".Mode": 1, + "TESTING": 1, + ".LogLevel": 1, + "DEBUG": 2, + "TraceEnabled": 1, + "boolean": 1, + "_CONFIG.TraceEnabled": 1, + "DefaultAction": 1, + ".DefaultAction": 1, + "DefaultController": 1, + "Type": 1, + ".DefaultController": 1, + ".RoninServlet": 1, + "ErrorHandler": 1, + "IErrorHandler": 1, + ".ErrorHandler": 1, + "LogHandler": 1, + "ILogHandler": 1, + ".LogHandler": 2, + "msg": 4, + "Object": 1, + "component": 7, + "exception": 7, + "java.lang.Throwable": 1, + "INFO": 2, + "msgStr": 9, + "block": 3, + "_CONFIG.LogHandler.log": 1, + "switch": 1, + "case": 6, + "TRACE": 1, + "LoggerFactory.getLogger": 5, + "Logger.ROOT_LOGGER_NAME": 5, + ".trace": 1, + "break": 5, + ".debug": 1, + ".info": 1, + ".warn": 1, + "ERROR": 1, + "FATAL": 1, + ".error": 1, + "CacheStore": 3, + "REQUEST": 3, + "SESSION": 3, + "APPLICATION": 3, + "cache": 1, + "": 2, + "value": 4, + "T": 2, + "store": 10, + "or": 2, + "_CONFIG.RequestCache.getValue": 1, + "_CONFIG.SessionCache.getValue": 1, + "_CONFIG.ApplicationCache.getValue": 1, + "invalidate": 1, + "_CONFIG.RequestCache.invalidate": 1, + "_CONFIG.SessionCache.invalidate": 1, + "_CONFIG.ApplicationCache.invalidate": 1, + "loadChanges": 1, + "ReloadManager.detectAndReloadChangedResources": 1 }, "Grace": { "method": 10, @@ -29432,15 +29549,15 @@ ".internalBuildGeneratedFileFrom": 1 }, "JavaScript": { - "function": 1214, - "(": 8528, - ")": 8536, - "{": 2742, - ";": 4066, + "function": 1235, + "(": 8618, + ")": 8626, + "{": 2780, + ";": 4151, "//": 410, "jshint": 1, "_": 9, - "var": 916, + "var": 944, "Modal": 2, "content": 5, "options": 56, @@ -29451,20 +29568,20 @@ ".proxy": 1, "this.hide": 1, "this": 578, - "}": 2718, + "}": 2756, "Modal.prototype": 1, "constructor": 8, "toggle": 10, - "return": 947, - "[": 1461, + "return": 962, + "[": 1476, "this.isShown": 3, - "]": 1458, + "]": 1473, "show": 10, "that": 33, "e": 663, ".Event": 1, "element.trigger": 1, - "if": 1230, + "if": 1243, "||": 648, "e.isDefaultPrevented": 2, ".addClass": 1, @@ -29473,7 +29590,7 @@ "backdrop.call": 1, "transition": 1, ".support.transition": 1, - "&&": 1017, + "&&": 1021, "that.": 3, "element.hasClass": 1, "element.parent": 1, @@ -29486,7 +29603,7 @@ "hide": 8, "body": 22, "modal": 4, - "-": 706, + "-": 719, "open": 2, "fade": 4, "hidden": 12, @@ -29508,6 +29625,36 @@ "target.modal": 1, "option": 12, "window.jQuery": 7, + "TagsTotalPerMonth": 4, + "TagsTotalPerMonth.getDatasource": 1, + "category": 6, + "months": 8, + "values": 20, + "new": 91, + "CategoryMonthlyExpenseBarChartDataSource": 1, + "TagsTotalPerMonth.getType": 1, + "Charts.ChartType.COLUMN": 2, + "TagsTotalPerMonthWithMean": 4, + "TagsTotalPerMonthWithMean.getDatasource": 1, + "CategoryMonthlyWithMeanExpenseDataSource": 1, + "TagsTotalPerMonthWithMean.getType": 1, + "Charts.ChartType.LINE": 1, + "TagsAccumulatedPerMonth": 4, + "TagsAccumulatedPerMonth.getDatasource": 1, + "CategoryMonthlyAccumulated": 1, + "TagsAccumulatedPerMonth.getType": 1, + "Charts.ChartType.AREA": 1, + "MonthTotalsPerTags": 4, + "MonthTotalsPerTags.getDatasource": 1, + "month": 3, + "tags": 2, + "CategoryExpenseDataSource": 1, + "MonthTotalsPerTags.getType": 1, + "Charts.ChartType.PIE": 1, + "SavingsFlowChartComposer": 3, + "SavingsFlowChartComposer.getDatasource": 1, + "SavingsFlowDataSource": 1, + "SavingsFlowChartComposer.getType": 1, "Animal": 12, "Horse": 12, "Snake": 12, @@ -29518,7 +29665,7 @@ "__extends": 6, "child": 17, "parent": 15, - "for": 262, + "for": 264, "key": 85, "__hasProp.call": 2, "ctor": 6, @@ -29526,14 +29673,13 @@ "ctor.prototype": 3, "parent.prototype": 6, "child.prototype": 4, - "new": 86, "child.__super__": 3, "name": 161, "this.name": 7, "Animal.prototype.move": 2, "meters": 4, "alert": 11, - "+": 1136, + "+": 1155, "Snake.__super__.constructor.apply": 2, "arguments": 83, "Snake.prototype.move": 2, @@ -29552,7 +29698,7 @@ "console.log": 3, "hanaMath": 1, ".import": 1, - "x": 41, + "x": 46, "parseFloat": 32, ".request.parameters.get": 2, "y": 109, @@ -29588,11 +29734,11 @@ "process.env.NODE_DEBUG": 2, "/http/.test": 1, "console.error": 3, - "else": 307, + "else": 309, "parserOnHeaders": 2, "headers": 41, "this.maxHeaderPairs": 2, - "<": 209, + "<": 211, "this._headers.length": 1, "this._headers": 13, "this._headers.concat": 1, @@ -29613,11 +29759,11 @@ "info.versionMinor": 2, "parser.incoming.httpVersion": 1, "parser.incoming.url": 1, - "n": 874, + "n": 875, "headers.length": 2, "parser.maxHeaderPairs": 4, "Math.min": 5, - "i": 853, + "i": 857, "k": 302, "v": 135, "parser.incoming._addHeaderLine": 2, @@ -29748,7 +29894,7 @@ "IncomingMessage.prototype._emitEnd": 1, "IncomingMessage.prototype._addHeaderLine": 1, "field": 36, - "value": 98, + "value": 103, "dest": 12, "field.toLowerCase": 1, "switch": 30, @@ -29859,7 +30005,7 @@ "DTRACE_HTTP_CLIENT_REQUEST": 1, "OutgoingMessage.prototype._flush": 1, "this.socket.writable": 2, - "XXX": 1, + "XXX": 2, "Necessary": 1, "this.socket.write": 1, "req": 32, @@ -30169,7 +30315,87 @@ "this.length": 41, "app": 3, "angular.module": 1, - "A": 24, + "sendToGoogleDrive": 1, + "gmailLabels": 2, + "driveFolder": 3, + "spreadsheetName": 3, + "archiveLabel": 4, + "itauNotificationEmail": 2, + "filter": 12, + "moveToLabel": 4, + "GmailApp.getUserLabelByName": 1, + "GmailApp.createLabel": 1, + "folders": 1, + "DriveApp.getFoldersByName": 1, + "folder": 3, + "folders.hasNext": 1, + "folders.next": 1, + "DriveApp.createFolder": 1, + "files": 1, + "folder.getFilesByName": 1, + "file": 10, + "doc": 7, + "files.hasNext": 1, + "files.next": 1, + "SpreadsheetApp.openById": 1, + "file.getId": 1, + "SpreadsheetApp.create": 1, + "DriveApp.getFileById": 1, + "doc.getId": 1, + "folder.addFile": 1, + "DriveApp.removeFile": 1, + "sheet": 1, + "doc.getSheets": 1, + "sheet.getLastRow": 1, + "sheet.appendRow": 2, + "message": 7, + "messages": 3, + "account": 5, + "operation": 7, + "date": 7, + "hour": 6, + "emailID": 4, + "plainBody": 9, + "accountRegex": 1, + "/Conta": 1, + "/": 298, + "operationRegex": 1, + "/Tipo": 1, + "de": 3, + "opera": 5, + "o": 323, + "A": 26, + "Z": 7, + "paymentRegex": 1, + "/Pagamento": 1, + "Za": 3, + "z": 22, + "valueRegex": 1, + "/Valor": 1, + "R": 3, + ".": 92, + "dateRegex": 1, + "/Data": 1, + "hourRegex": 1, + "/Hora": 1, + "emailIDRegex": 1, + "/E": 1, + "mail": 1, + "threads": 3, + "GmailApp.search": 1, + "threads.length": 1, + ".getMessages": 1, + "messages.length": 1, + "message.getPlainBody": 1, + "accountRegex.test": 1, + "RegExp.": 10, + "operationRegex.test": 1, + "valueRegex.test": 1, + "dateRegex.test": 1, + "hourRegex.test": 1, + "emailIDRegex.test": 1, + "paymentRegex.test": 1, + ".addLabel": 1, "w": 110, "ma": 3, "c.isReady": 4, @@ -30191,13 +30417,11 @@ "X": 6, "f": 666, "a.length": 23, - "o": 322, "c.isFunction": 9, "d.call": 3, "J": 5, ".getTime": 3, "Y": 3, - "Z": 6, "na": 1, ".type": 2, "c.event.handle.apply": 1, @@ -30236,7 +30460,6 @@ "j.handleObj.origHandler.apply": 1, "pa": 1, "b.replace": 3, - "/": 290, "./g": 2, ".replace": 38, "/g": 37, @@ -30283,7 +30506,6 @@ "|": 206, "#": 13, "Ua": 1, - ".": 91, "Va": 1, "S/": 4, "Wa": 2, @@ -30300,7 +30522,6 @@ "aa": 1, "ba": 3, "Array.prototype.push": 4, - "R": 2, "ya": 2, "Array.prototype.indexOf": 4, "c.fn": 2, @@ -30436,7 +30657,6 @@ "webkit": 6, "w.": 17, "/.exec": 4, - "opera": 4, ".*version": 4, "msie": 4, "/compatible/.test": 1, @@ -30561,7 +30781,6 @@ "Aa": 3, "t": 436, "ca": 6, - "Za": 2, "r/g": 2, "/href": 1, "src": 7, @@ -30705,7 +30924,6 @@ "_change_data": 6, "focusout": 11, "change": 16, - "file": 5, ".specialChange": 4, "focusin": 9, "bind": 3, @@ -30753,7 +30971,6 @@ "expr": 2, "p.pop": 4, "set": 22, - "z": 21, "h.parentNode": 3, "D": 9, "k.error": 2, @@ -30815,7 +31032,6 @@ "CLASS": 1, "HTML": 9, "find": 7, - "filter": 10, "nextSibling": 3, "iframe": 3, "": 1, @@ -30952,7 +31168,6 @@ "jQuery.fn": 4, "jQuery.prototype": 2, "match": 30, - "doc": 4, "Handle": 14, "DOMElement": 2, "selector.nodeType": 2, @@ -31000,7 +31215,6 @@ "Only": 5, "deal": 2, "null/undefined": 2, - "values": 10, "Extend": 2, "base": 2, "Prevent": 2, @@ -32430,7 +32644,6 @@ "bt": 42, "bu": 11, "bv": 2, - "de": 1, "bw": 2, "bz": 7, "bA": 3, @@ -32468,7 +32681,6 @@ "a.currentStyle": 4, "a.currentStyle.filter": 1, "a.style.filter": 1, - "RegExp.": 1, "c.zoom": 1, "b*100": 1, "d.filter": 1, @@ -32503,10 +32715,8 @@ "/mg": 1, "bJ": 1, "color": 4, - "date": 1, "datetime": 1, "email": 2, - "month": 1, "range": 2, "search": 5, "tel": 2, @@ -35329,7 +35539,6 @@ "RE_OCT_NUMBER.test": 1, "RE_DEC_NUMBER.test": 1, "JS_Parse_Error": 2, - "message": 5, "this.col": 2, "ex": 3, "ex.name": 1, @@ -72585,7 +72794,7 @@ "GLSL": 4076, "Game Maker Language": 13310, "Gnuplot": 1023, - "Gosu": 410, + "Gosu": 1008, "Grace": 1381, "Grammatical Framework": 10607, "Groovy": 93, @@ -72608,7 +72817,7 @@ "JSONiq": 151, "Jade": 3, "Java": 8987, - "JavaScript": 77056, + "JavaScript": 77790, "Julia": 247, "KRL": 25, "Kit": 6, @@ -72796,7 +73005,7 @@ "GLSL": 7, "Game Maker Language": 13, "Gnuplot": 6, - "Gosu": 4, + "Gosu": 5, "Grace": 2, "Grammatical Framework": 41, "Groovy": 5, @@ -72819,7 +73028,7 @@ "JSONiq": 2, "Jade": 1, "Java": 6, - "JavaScript": 24, + "JavaScript": 26, "Julia": 1, "KRL": 1, "Kit": 1, @@ -72949,5 +73158,5 @@ "fish": 3, "wisp": 1 }, - "md5": "b7e3e6804093f11267b22f781f54de75" + "md5": "37d31e7fbe17f173ee31e228d9928be6" } \ No newline at end of file diff --git a/samples/Gosu/Ronin.gs b/samples/Gosu/Ronin.gs new file mode 100644 index 00000000..dfbdee7b --- /dev/null +++ b/samples/Gosu/Ronin.gs @@ -0,0 +1,238 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + */ + +package ronin + +uses gw.util.concurrent.LockingLazyVar +uses gw.lang.reflect.* +uses java.lang.* +uses java.io.* +uses ronin.config.* +uses org.slf4j.* + +/** + * The central location for Ronin utility methods. Controllers and templates should generally access the + * methods and properties they inherit from {@link ronin.IRoninUtils} instead of using the methods and + * properties here. + */ +class Ronin { + + // One static field to rule the all... + static var _CONFIG : IRoninConfig as Config + + // And one thread local to bind them + static var _CURRENT_REQUEST = new ThreadLocal(); + + // That's inconstructable + private construct() {} + + internal static function init(servlet : RoninServlet, m : ApplicationMode, src : File) { + if(_CONFIG != null) { + throw "Cannot initialize a Ronin application multiple times!" + } + var cfg = TypeSystem.getByFullNameIfValid("config.RoninConfig") + var defaultWarning = false + if(cfg != null) { + var ctor = cfg.TypeInfo.getConstructor({ronin.config.ApplicationMode, ronin.RoninServlet}) + if(ctor == null) { + throw "config.RoninConfig must have a constructor with the same signature as ronin.config.RoninConfig" + } + _CONFIG = ctor.Constructor.newInstance({m, servlet}) as IRoninConfig + } else { + _CONFIG = new DefaultRoninConfig(m, servlet) + defaultWarning = true + } + var roninLogger = TypeSystem.getByFullNameIfValid("ronin.RoninLoggerFactory") + if(roninLogger != null) { + roninLogger.TypeInfo.getMethod("init", {ronin.config.LogLevel}).CallHandler.handleCall(null, {LogLevel}) + } + if(defaultWarning) { + log("No configuration was found at config.RoninConfig, using the default configuration...", :level=WARN) + } + Quartz.maybeStart() + ReloadManager.setSourceRoot(src) + } + + internal static property set CurrentRequest(req : RoninRequest) { + _CURRENT_REQUEST.set(req) + } + + //============================================ + // Public API + //============================================ + + /** + * The trace handler for the current request. + */ + static property get CurrentTrace() : Trace { + return CurrentRequest?.Trace + } + + /** + * Ronin's representation of the current request. + */ + static property get CurrentRequest() : RoninRequest { + return _CURRENT_REQUEST.get() + } + + /** + * The mode in which this application is running. + */ + static property get Mode() : ApplicationMode { + return _CONFIG?.Mode ?: TESTING + } + + /** + * The log level at and above which log messages should be displayed. + */ + static property get LogLevel() : LogLevel { + return _CONFIG?.LogLevel ?: DEBUG + } + + /** + * Whether or not to display detailed trace information on each request. + */ + static property get TraceEnabled() : boolean { + return _CONFIG != null ? _CONFIG.TraceEnabled : true + } + + /** + * The default controller method to call when no method name is present in the request URL. + */ + static property get DefaultAction() : String { + return _CONFIG?.DefaultAction + } + + /** + * The default controller to call when no controller name is present in the request URL. + */ + static property get DefaultController() : Type { + return _CONFIG?.DefaultController + } + + /** + * The servlet responsible for handling Ronin requests. + */ + static property get RoninServlet() : RoninServlet { + return _CONFIG?.RoninServlet + } + + /** + * The handler for request processing errors. + */ + static property get ErrorHandler() : IErrorHandler { + return _CONFIG?.ErrorHandler + } + + /** + * The custom handler for logging messages. + */ + static property get LogHandler() : ILogHandler { + return _CONFIG?.LogHandler + } + + /** + * Logs a message using the configured log handler. + * @param msg The text of the message to log, or a block which returns said text. + * @param level (Optional) The level at which to log the message. + * @param component (Optional) The logical component from whence the message originated. + * @param exception (Optional) An exception to associate with the message. + */ + static function log(msg : Object, level : LogLevel = null, component : String = null, exception : java.lang.Throwable = null) { + if(level == null) { + level = INFO + } + if(LogLevel <= level) { + var msgStr : String + if(msg typeis block():String) { + msgStr = (msg as block():String)() + } else { + msgStr = msg as String + } + if(_CONFIG?.LogHandler != null) { + _CONFIG.LogHandler.log(msgStr, level, component, exception) + } else { + switch(level) { + case TRACE: + LoggerFactory.getLogger(component?:Logger.ROOT_LOGGER_NAME).trace(msgStr, exception) + break + case DEBUG: + LoggerFactory.getLogger(component?:Logger.ROOT_LOGGER_NAME).debug(msgStr, exception) + break + case INFO: + LoggerFactory.getLogger(component?:Logger.ROOT_LOGGER_NAME).info(msgStr, exception) + break + case WARN: + LoggerFactory.getLogger(component?:Logger.ROOT_LOGGER_NAME).warn(msgStr, exception) + break + case ERROR: + case FATAL: + LoggerFactory.getLogger(component?:Logger.ROOT_LOGGER_NAME).error(msgStr, exception) + break + } + } + } + } + + /** + * The caches known to Ronin. + */ + static enum CacheStore { + REQUEST, + SESSION, + APPLICATION + } + + /** + * Retrieves a value from a cache, or computes and stores it if it is not in the cache. + * @param value A block which will compute the desired value. + * @param name (Optional) A unique identifier for the value. Default is null, which means one will be + * generated from the type of the value. + * @param store (Optional) The cache store used to retrieve or store the value. Default is the request cache. + * @return The retrieved or computed value. + */ + static function cache(value : block():T, name : String = null, store : CacheStore = null) : T { + if(store == null or store == REQUEST) { + return _CONFIG.RequestCache.getValue(value, name) + } else if (store == SESSION) { + return _CONFIG.SessionCache.getValue(value, name) + } else if (store == APPLICATION) { + return _CONFIG.ApplicationCache.getValue(value, name) + } else { + throw "Don't know about CacheStore ${store}" + } + } + + /** + * Invalidates a cached value in a cache. + * @param name The unique identifier for the value. + * @param store The cache store in which to invalidate the value. + */ + static function invalidate(name : String, store : CacheStore) { + if(store == null or store == REQUEST) { + _CONFIG.RequestCache.invalidate(name) + } else if (store == SESSION) { + _CONFIG.SessionCache.invalidate(name) + } else if (store == APPLICATION) { + _CONFIG.ApplicationCache.invalidate(name) + } else { + throw "Don't know about CacheStore ${store}" + } + } + + + /** + * Detects changes made to resources in the Ronin application and + * reloads them. This function should only be called when Ronin is + * in development mode. + */ + static function loadChanges() { + ReloadManager.detectAndReloadChangedResources() + } + +} diff --git a/samples/JavaScript/chart_composers.gs b/samples/JavaScript/chart_composers.gs new file mode 100644 index 00000000..3b6f4400 --- /dev/null +++ b/samples/JavaScript/chart_composers.gs @@ -0,0 +1,78 @@ +/* +License +Copyright [2013] [Farruco Sanjurjo Arcay] + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +*/ + +var TagsTotalPerMonth; + +TagsTotalPerMonth = (function(){ + function TagsTotalPerMonth(){}; + + TagsTotalPerMonth.getDatasource = function (category, months, values){ + return new CategoryMonthlyExpenseBarChartDataSource(category, months, values); + }; + + TagsTotalPerMonth.getType = function (){ return Charts.ChartType.COLUMN}; + + return TagsTotalPerMonth; +})(); + + +var TagsTotalPerMonthWithMean; + +TagsTotalPerMonthWithMean = (function(){ + function TagsTotalPerMonthWithMean(){}; + + TagsTotalPerMonthWithMean.getDatasource = function (category, months, values){ + return new CategoryMonthlyWithMeanExpenseDataSource(category, months, values); + }; + + TagsTotalPerMonthWithMean.getType = function (){ return Charts.ChartType.LINE}; + + return TagsTotalPerMonthWithMean; +})(); + + +var TagsAccumulatedPerMonth; + +TagsAccumulatedPerMonth = (function(){ + function TagsAccumulatedPerMonth(){}; + + TagsAccumulatedPerMonth.getDatasource = function (category, months, values){ + return new CategoryMonthlyAccumulated(category, months, values); + }; + + TagsAccumulatedPerMonth.getType = function (){ return Charts.ChartType.AREA}; + + return TagsAccumulatedPerMonth; +})(); + +var MonthTotalsPerTags; + +MonthTotalsPerTags = (function(){ + function MonthTotalsPerTags(){}; + + MonthTotalsPerTags.getDatasource = function (month, tags, values){ + return new CategoryExpenseDataSource(tags, month, values); + }; + + MonthTotalsPerTags.getType = function (){ return Charts.ChartType.PIE; }; + + return MonthTotalsPerTags; +})(); + +var SavingsFlowChartComposer = (function(){ + function SavingsFlowChartComposer(){}; + + SavingsFlowChartComposer.getDatasource = function(months, values){ + return new SavingsFlowDataSource(months, values); + }; + + SavingsFlowChartComposer.getType = function(){ return Charts.ChartType.COLUMN; }; + + return SavingsFlowChartComposer; +})(); diff --git a/samples/JavaScript/itau.gs b/samples/JavaScript/itau.gs new file mode 100644 index 00000000..d745a3fb --- /dev/null +++ b/samples/JavaScript/itau.gs @@ -0,0 +1,150 @@ +/* +The MIT License (MIT) + +Copyright (c) 2014 Thiago Brandão Damasceno + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +// based on http://ctrlq.org/code/19053-send-to-google-drive +function sendToGoogleDrive() { + + var gmailLabels = 'inbox'; + var driveFolder = 'Itaú Notifications'; + var spreadsheetName = 'itau'; + var archiveLabel = 'itau.processed'; + var itauNotificationEmail = 'comunicacaodigital@itau-unibanco.com.br'; + var filter = "from: " + + itauNotificationEmail + + " -label:" + + archiveLabel + + " label:" + + gmailLabels; + + // Create label for 'itau.processed' if it doesn't exist + var moveToLabel = GmailApp.getUserLabelByName(archiveLabel); + + if (!moveToLabel) { + moveToLabel = GmailApp.createLabel(archiveLabel); + } + + // Create folder 'Itaú Notifications' if it doesn't exist + var folders = DriveApp.getFoldersByName(driveFolder); + var folder; + + if (folders.hasNext()) { + folder = folders.next(); + } else { + folder = DriveApp.createFolder(driveFolder); + } + + // Create spreadsheet file 'itau' if it doesn't exist + var files = folder.getFilesByName(spreadsheetName); + + // File is in DriveApp + // Doc is in SpreadsheetApp + // They are not interchangeable + var file, doc; + + // Confusing :\ + // As per: https://code.google.com/p/google-apps-script-issues/issues/detail?id=3578 + if (files.hasNext()){ + file = files.next(); + doc = SpreadsheetApp.openById(file.getId()); + } else { + doc = SpreadsheetApp.create(spreadsheetName); + file = DriveApp.getFileById(doc.getId()); + folder.addFile(file); + DriveApp.removeFile(file); + } + + var sheet = doc.getSheets()[0]; + + // Append header if first line + if(sheet.getLastRow() == 0){ + sheet.appendRow(['Conta', 'Operação', 'Valor', 'Data', 'Hora', 'Email ID']); + } + + var message, messages, account, operation, value, date, hour, emailID, plainBody; + var accountRegex = /Conta: (XXX[0-9\-]+)/; + var operationRegex = /Tipo de operação: ([A-Z]+)/; + var paymentRegex = /Pagamento de ([0-9A-Za-z\-]+)\ ?([0-9]+)?/; + var valueRegex = /Valor: R\$ ([0-9\,\.]+)/; + var dateRegex = /Data: ([0-9\/]+)/; + var hourRegex = /Hora: ([0-9\:]+)/; + var emailIDRegex = /E-mail nº ([0-9]+)/; + + var threads = GmailApp.search(filter, 0, 100); + + for (var x = 0; x < threads.length; x++) { + messages = threads[x].getMessages(); + + for (var i = 0; i < messages.length; i++) { + account, operation, value, date, hour, emailID = []; + + message = messages[i]; + + plainBody = message.getPlainBody(); + + if(accountRegex.test(plainBody)) { + account = RegExp.$1; + } + + if(operationRegex.test(plainBody)) { + operation = RegExp.$1; + } + + if(valueRegex.test(plainBody)) { + value = RegExp.$1; + } + + if(dateRegex.test(plainBody)) { + date = RegExp.$1; + } + + if(hourRegex.test(plainBody)) { + hour = RegExp.$1; + } + + if(emailIDRegex.test(plainBody)){ + emailID = RegExp.$1; + } + + if(paymentRegex.test(plainBody)){ + operation = RegExp.$1; + if(RegExp.$2){ + operation += ' ' + RegExp.$2 + } + date = hour = ' - '; + } + + if(account && operation && value && date && hour){ + sheet.appendRow([account, operation, value, date, hour, emailID]); + } + + // Logger.log(account); + // Logger.log(operation); + // Logger.log(value); + // Logger.log(date); + // Logger.log(hour); + } + + threads[x].addLabel(moveToLabel); + } +} From 42e9131b4fcb4ade401f1fb381e25d00b16e638a Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Thu, 6 Nov 2014 11:47:00 -0600 Subject: [PATCH 03/15] Add RAML support --- lib/linguist/languages.yml | 9 +++++++++ samples/RAML/api.raml | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 samples/RAML/api.raml diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 3521a2bd..923587de 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -2043,6 +2043,15 @@ R: interpreters: - Rscript +RAML: + type: data + lexer: YAML + ace_mode: yaml + tm_scope: source.yaml + color: "#77d9fb" + extensions: + - .raml + RDoc: type: prose lexer: Rd diff --git a/samples/RAML/api.raml b/samples/RAML/api.raml new file mode 100644 index 00000000..518779de --- /dev/null +++ b/samples/RAML/api.raml @@ -0,0 +1,39 @@ +#%RAML 0.8 + +title: World Music API +baseUri: http://example.api.com/{version} +version: v1 +traits: + - paged: + queryParameters: + pages: + description: The number of pages to return + type: number + - secured: !include http://raml-example.com/secured.yml +/songs: + is: [ paged, secured ] + get: + queryParameters: + genre: + description: filter the songs by genre + post: + /{songId}: + get: + responses: + 200: + body: + application/json: + schema: | + { "$schema": "http://json-schema.org/schema", + "type": "object", + "description": "A canonical song", + "properties": { + "title": { "type": "string" }, + "artist": { "type": "string" } + }, + "required": [ "title", "artist" ] + } + application/xml: + delete: + description: | + This method will *delete* an **individual song** From 95777055d11b2287bc60c6fe17e29e296c7030b1 Mon Sep 17 00:00:00 2001 From: Sebastian Godelet Date: Tue, 11 Nov 2014 23:28:07 +0800 Subject: [PATCH 04/15] languages.yml: added an interpreter entry to Mercury section --- lib/linguist/languages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index edabb499..7111437b 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1622,6 +1622,8 @@ Mercury: color: "#abcdef" lexer: Prolog ace_mode: prolog + interpreters: + - mmi extensions: - .m - .moo From d725e8e385f8d89fa9c89fb20a248d5293a647c3 Mon Sep 17 00:00:00 2001 From: Antoine Paris Date: Fri, 28 Nov 2014 17:16:32 +0100 Subject: [PATCH 05/15] Add Oz to languages.yml --- lib/linguist/languages.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 699301aa..082a0d96 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -2932,3 +2932,9 @@ xBase: extensions: - .prg tm_scope: none + +Oz: + type:programming + color: "#fcaf3e" + extensions: + - .oz From d60241cc864fb4d45773e16fa7cadd1aadb51992 Mon Sep 17 00:00:00 2001 From: Antoine Paris Date: Fri, 28 Nov 2014 17:28:22 +0100 Subject: [PATCH 06/15] Add grammar for Oz --- grammars.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grammars.yml b/grammars.yml index 10361eef..fe64608a 100644 --- a/grammars.yml +++ b/grammars.yml @@ -408,3 +408,5 @@ https://github.com/vmg/zephir-sublime: - source.php.zephir https://github.com/whitequark/llvm.tmbundle: - source.llvm +https://github.com/sujithps/oz: +- source.oz From 57b0739219c1e2d763f25c553ef6edb5b9a595d1 Mon Sep 17 00:00:00 2001 From: Antoine Paris Date: Fri, 28 Nov 2014 17:40:49 +0100 Subject: [PATCH 07/15] Add some examples for Oz --- samples/Oz/example.oz | 52 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 samples/Oz/example.oz diff --git a/samples/Oz/example.oz b/samples/Oz/example.oz new file mode 100644 index 00000000..49e5d65a --- /dev/null +++ b/samples/Oz/example.oz @@ -0,0 +1,52 @@ +% You can get a lot of information about Oz by following theses links : +% - http://mozart.github.io/ +% - http://en.wikipedia.org/wiki/Oz_(programming_language) +% The is also a well known book that uses Oz for pedagogical reason : +% - http://mitpress.mit.edu/books/concepts-techniques-and-models-computer-programming +% And there are two courses on edX about 'Paradigms of Computer Programming' that also uses Oz for pedagocial reason : +% - https://www.edx.org/node/2751#.VHijtfl5OSo +% - https://www.edx.org/node/4436#.VHijzfl5OSo +% +% Here is an example of some code written with Oz. + +declare +% Computes the sum of square of the N first integers. +fun {Sum N} + local SumAux in + fun {SumAux N Acc} + if N==0 then Acc + else + {Sum N-1 Acc} + end + end + {SumAux N 0} + end +end + +% Returns true if N is a prime and false otherwize +fun {Prime N} + local PrimeAcc in + fun {PrimeAcc N Acc} + if(N == 1) then false + elseif(Acc == 1) then true + else + if (N mod Acc) == 0 then false + else + {PrimeAcc N Acc-1} + end + end + end + {PrimeAcc N (N div 2)} + end +end + +% Reverse a list using cells and for loop (instead of recursivity) +fun {Reverse L} + local RevList in + RevList = {NewCell nil} + for E in L do + RevList := E|@RevList + end + @RevList + end +end From 71e1bd9af2af036252c7aac898a91b2e9fcea2c6 Mon Sep 17 00:00:00 2001 From: Antoine Paris Date: Fri, 28 Nov 2014 17:42:54 +0100 Subject: [PATCH 08/15] Misspelling correction --- samples/Oz/example.oz | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Oz/example.oz b/samples/Oz/example.oz index 49e5d65a..e7438056 100644 --- a/samples/Oz/example.oz +++ b/samples/Oz/example.oz @@ -3,7 +3,7 @@ % - http://en.wikipedia.org/wiki/Oz_(programming_language) % The is also a well known book that uses Oz for pedagogical reason : % - http://mitpress.mit.edu/books/concepts-techniques-and-models-computer-programming -% And there are two courses on edX about 'Paradigms of Computer Programming' that also uses Oz for pedagocial reason : +% And there are two courses on edX about 'Paradigms of Computer Programming' that also uses Oz for pedagogical reason : % - https://www.edx.org/node/2751#.VHijtfl5OSo % - https://www.edx.org/node/4436#.VHijzfl5OSo % From 4ed58c743dfcdda69d64cc2897183b01420f4ce7 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Fri, 28 Nov 2014 23:00:35 -0500 Subject: [PATCH 09/15] Support for gradle files --- grammars.yml | 2 ++ lib/linguist/languages.yml | 6 ++++++ samples/Gradle/build.gradle | 18 ++++++++++++++++++ samples/Gradle/builder.gradle | 20 ++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 samples/Gradle/build.gradle create mode 100644 samples/Gradle/builder.gradle diff --git a/grammars.yml b/grammars.yml index 10361eef..cc5cb6eb 100644 --- a/grammars.yml +++ b/grammars.yml @@ -137,6 +137,8 @@ https://github.com/fsharp/fsharpbinding: - source.fsharp https://github.com/gingerbeardman/monkey.tmbundle: - source.monkey +https://github.com/alkemist/gradle.tmbundle: +- source.groovy.gradle https://github.com/guillermooo/dart-sublime-bundle/raw/master/Dart.tmLanguage: - source.dart https://github.com/harrism/sublimetext-cuda-cpp/raw/master/cuda-c%2B%2B.tmLanguage: diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index cc124e04..afaf689a 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -968,6 +968,12 @@ Grace: - .grace tm_scope: none +Gradle: + type: data + extensions: + - .gradle + tm_scope: source.groovy.gradle + Grammatical Framework: type: programming aliases: diff --git a/samples/Gradle/build.gradle b/samples/Gradle/build.gradle new file mode 100644 index 00000000..190eb3f6 --- /dev/null +++ b/samples/Gradle/build.gradle @@ -0,0 +1,18 @@ +apply plugin: GreetingPlugin + +greeting.message = 'Hi from Gradle' + +class GreetingPlugin implements Plugin { + void apply(Project project) { + // Add the 'greeting' extension object + project.extensions.create("greeting", GreetingPluginExtension) + // Add a task that uses the configuration + project.task('hello') << { + println project.greeting.message + } + } +} + +class GreetingPluginExtension { + def String message = 'Hello from GreetingPlugin' +} diff --git a/samples/Gradle/builder.gradle b/samples/Gradle/builder.gradle new file mode 100644 index 00000000..342be2fd --- /dev/null +++ b/samples/Gradle/builder.gradle @@ -0,0 +1,20 @@ +apply plugin: GreetingPlugin + +greeting { + message = 'Hi' + greeter = 'Gradle' +} + +class GreetingPlugin implements Plugin { + void apply(Project project) { + project.extensions.create("greeting", GreetingPluginExtension) + project.task('hello') << { + println "${project.greeting.message} from ${project.greeting.greeter}" + } + } +} + +class GreetingPluginExtension { + String message + String greeter +} From ca76802ee4cac83200970b26cda1e8e8680f369f Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Sun, 30 Nov 2014 07:55:55 -0600 Subject: [PATCH 10/15] Removing Mercury directory from vendor.yml --- lib/linguist/vendor.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/linguist/vendor.yml b/lib/linguist/vendor.yml index 31ff7ce7..a68f0a81 100644 --- a/lib/linguist/vendor.yml +++ b/lib/linguist/vendor.yml @@ -232,9 +232,6 @@ # .DS_Store's - .[Dd][Ss]_[Ss]tore$ -# Mercury --use-subdirs -- Mercury/ - # R packages - ^vignettes/ - ^inst/extdata/ From b7a98437703b45ee8459c1782db1b653b06290a2 Mon Sep 17 00:00:00 2001 From: Antoine Paris Date: Sun, 30 Nov 2014 21:18:23 +0100 Subject: [PATCH 11/15] Corrections by @pchaigno --- lib/linguist/languages.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 082a0d96..cc2f8031 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1843,6 +1843,13 @@ Oxygene: extensions: - .oxygene tm_scope: none + +Oz: + type: programming + color: "#fcaf3e" + extensions: + - .oz + tm_scope: source.oz PAWN: type: programming @@ -2932,9 +2939,3 @@ xBase: extensions: - .prg tm_scope: none - -Oz: - type:programming - color: "#fcaf3e" - extensions: - - .oz From da96e11b37b31d8fe0a4ac8a8a981217d7318101 Mon Sep 17 00:00:00 2001 From: Antoine Paris Date: Sun, 30 Nov 2014 22:01:39 +0100 Subject: [PATCH 12/15] Add grammar for Oz --- grammars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars.yml b/grammars.yml index fe64608a..35c66ebb 100644 --- a/grammars.yml +++ b/grammars.yml @@ -408,5 +408,5 @@ https://github.com/vmg/zephir-sublime: - source.php.zephir https://github.com/whitequark/llvm.tmbundle: - source.llvm -https://github.com/sujithps/oz: +https://github.com/eregon/oz-tmbundle: - source.oz From 4495e15fa7331ed586ae44dd116bfd979d83715f Mon Sep 17 00:00:00 2001 From: Antoine Paris Date: Sun, 30 Nov 2014 22:07:55 +0100 Subject: [PATCH 13/15] Misspelling correction --- samples/Oz/example.oz | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Oz/example.oz b/samples/Oz/example.oz index e7438056..21c206a2 100644 --- a/samples/Oz/example.oz +++ b/samples/Oz/example.oz @@ -1,7 +1,7 @@ % You can get a lot of information about Oz by following theses links : % - http://mozart.github.io/ % - http://en.wikipedia.org/wiki/Oz_(programming_language) -% The is also a well known book that uses Oz for pedagogical reason : +% There is also a well known book that uses Oz for pedagogical reason : % - http://mitpress.mit.edu/books/concepts-techniques-and-models-computer-programming % And there are two courses on edX about 'Paradigms of Computer Programming' that also uses Oz for pedagogical reason : % - https://www.edx.org/node/2751#.VHijtfl5OSo From 648596dbb21ee0dbab298891f15f57027639afdc Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Sun, 30 Nov 2014 15:24:33 -0600 Subject: [PATCH 14/15] Be explicit about tm_scope --- lib/linguist/languages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 36c04f14..5a1c0a2d 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -531,6 +531,7 @@ Cool: type: programming extensions: - .cl + tm_scope: none Coq: type: programming From 0154c21c3debbafe351814b616037278a599c119 Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Sun, 30 Nov 2014 20:45:24 -0600 Subject: [PATCH 15/15] Adding Cool grammar --- grammars.yml | 2 ++ lib/linguist/languages.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/grammars.yml b/grammars.yml index 10361eef..35dedbe9 100644 --- a/grammars.yml +++ b/grammars.yml @@ -63,6 +63,8 @@ https://github.com/Varriount/NimLime: - source.nimrodcfg https://github.com/angryant0007/VBDotNetSyntax: - source.vbnet +https://github.com/anunayk/cool-tmbundle: +- source.cool https://github.com/aroben/ada.tmbundle/raw/c45eed4d5f98fe3bcbbffbb9e436601ab5bbde4b/Syntaxes/Ada.plist: - source.ada https://github.com/aroben/ruby.tmbundle@4636a3023153c3034eb6ffc613899ba9cf33b41f: diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 5a1c0a2d..3eb6cabb 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -531,7 +531,7 @@ Cool: type: programming extensions: - .cl - tm_scope: none + tm_scope: source.cool Coq: type: programming