Merge branch 'jeanSapristi-master'

This commit is contained in:
Joshua Peek
2012-07-24 11:51:54 -05:00
11 changed files with 12796 additions and 5495 deletions

View File

@@ -634,8 +634,6 @@ JSON:
ace_mode: json
searchable: false
primary_extension: .json
extensions:
- .json
Java:
type: programming
@@ -757,13 +755,15 @@ Matlab:
extensions:
- .matlab
Max/MSP:
Max:
type: programming
color: "#ce279c"
lexer: Text only
aliases:
- max/msp
- maxmsp
search_term: max/msp
primary_extension: .mxt
extensions:
- .mxt
MiniD: # Legacy
searchable: false

File diff suppressed because it is too large Load Diff

View File

@@ -64,19 +64,27 @@ module Linguist
# Skip single or double quoted strings
elsif s.scan(/"/)
s.skip_until(/[^\\]"/)
if s.peek(1) == "\""
s.getch
else
s.skip_until(/[^\\]"/)
end
elsif s.scan(/'/)
s.skip_until(/[^\\]'/)
if s.peek(1) == "'"
s.getch
else
s.skip_until(/[^\\]'/)
end
# Skip number literals
elsif s.scan(/(0x)?\d+/)
elsif s.scan(/(0x)?\d(\d|\.)*/)
# SGML style brackets
elsif token = s.scan(/<[^\s<>][^<>]*>/)
extract_sgml_tokens(token).each { |t| tokens << t }
# Common programming punctuation
elsif token = s.scan(/;|\{|\}|\(|\)/)
elsif token = s.scan(/;|\{|\}|\(|\)|\[|\]/)
tokens << token
# Regular token

367
samples/JSON/Hello.maxhelp Normal file
View File

@@ -0,0 +1,367 @@
{
"patcher" : {
"fileversion" : 1,
"appversion" : {
"major" : 5,
"minor" : 1,
"revision" : 9
}
,
"rect" : [ 198.0, 92.0, 365.0, 407.0 ],
"bglocked" : 0,
"defrect" : [ 198.0, 92.0, 365.0, 407.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 14.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 20.0, 20.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"boxes" : [ {
"box" : {
"maxclass" : "button",
"patching_rect" : [ 260.0, 260.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"id" : "obj-22"
}
}
, {
"box" : {
"maxclass" : "button",
"patching_rect" : [ 240.0, 260.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"id" : "obj-20"
}
}
, {
"box" : {
"maxclass" : "button",
"patching_rect" : [ 220.0, 260.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"id" : "obj-18"
}
}
, {
"box" : {
"maxclass" : "button",
"patching_rect" : [ 200.0, 260.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"id" : "obj-16"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "route 0 1 2 3",
"patching_rect" : [ 200.0, 220.0, 99.0, 23.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 5,
"outlettype" : [ "", "", "", "", "" ],
"fontsize" : 14.0,
"id" : "obj-14"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r jojo",
"patching_rect" : [ 200.0, 180.0, 41.0, 23.0 ],
"numinlets" : 0,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 14.0,
"color" : [ 0.827451, 0.737255, 0.835294, 1.0 ],
"id" : "obj-13"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "s jojo",
"patching_rect" : [ 20.0, 340.0, 43.0, 23.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 0,
"fontsize" : 14.0,
"color" : [ 0.827451, 0.737255, 0.835294, 1.0 ],
"id" : "obj-12"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "append toto",
"patching_rect" : [ 20.0, 300.0, 84.0, 23.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 14.0,
"id" : "obj-11"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "% 4",
"patching_rect" : [ 20.0, 260.0, 35.0, 23.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "int" ],
"fontsize" : 14.0,
"id" : "obj-10"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "counter",
"patching_rect" : [ 20.0, 220.0, 73.0, 23.0 ],
"numinlets" : 5,
"fontname" : "Arial",
"numoutlets" : 4,
"outlettype" : [ "int", "", "", "int" ],
"fontsize" : 14.0,
"id" : "obj-9"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "metro 250",
"patching_rect" : [ 20.0, 180.0, 74.0, 23.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"fontsize" : 14.0,
"id" : "obj-8"
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 20.0, 140.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-7"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t 0",
"patching_rect" : [ 140.0, 80.0, 26.0, 23.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "int" ],
"fontsize" : 14.0,
"id" : "obj-5"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t 1",
"patching_rect" : [ 20.0, 80.0, 26.0, 23.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "int" ],
"fontsize" : 14.0,
"id" : "obj-4"
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "Goodbye World !",
"patching_rect" : [ 140.0, 40.0, 115.0, 21.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 14.0,
"id" : "obj-3"
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "Hello World !",
"patching_rect" : [ 20.0, 40.0, 90.0, 21.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 14.0,
"id" : "obj-2"
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ 149.5, 121.0, 29.5, 121.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-7", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 1 ],
"destination" : [ "obj-18", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 2 ],
"destination" : [ "obj-20", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 3 ],
"destination" : [ "obj-22", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
}

368
samples/JSON/Hello.maxpat Normal file
View File

@@ -0,0 +1,368 @@
{
"patcher" : {
"fileversion" : 1,
"appversion" : {
"major" : 5,
"minor" : 1,
"revision" : 9
}
,
"rect" : [ 198.0, 92.0, 365.0, 407.0 ],
"bglocked" : 0,
"defrect" : [ 198.0, 92.0, 365.0, 407.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 14.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 20.0, 20.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"boxes" : [ {
"box" : {
"maxclass" : "button",
"patching_rect" : [ 260.0, 260.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"id" : "obj-22"
}
}
, {
"box" : {
"maxclass" : "button",
"patching_rect" : [ 240.0, 260.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"id" : "obj-20"
}
}
, {
"box" : {
"maxclass" : "button",
"patching_rect" : [ 220.0, 260.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"id" : "obj-18"
}
}
, {
"box" : {
"maxclass" : "button",
"patching_rect" : [ 200.0, 260.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"id" : "obj-16"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "route 0 1 2 3",
"patching_rect" : [ 200.0, 220.0, 99.0, 23.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 5,
"outlettype" : [ "", "", "", "", "" ],
"fontsize" : 14.0,
"id" : "obj-14"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r jojo",
"patching_rect" : [ 200.0, 180.0, 41.0, 23.0 ],
"numinlets" : 0,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 14.0,
"color" : [ 0.827451, 0.737255, 0.835294, 1.0 ],
"id" : "obj-13"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "s jojo",
"patching_rect" : [ 20.0, 340.0, 43.0, 23.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 0,
"fontsize" : 14.0,
"color" : [ 0.827451, 0.737255, 0.835294, 1.0 ],
"id" : "obj-12"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "append toto",
"patching_rect" : [ 20.0, 300.0, 84.0, 23.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 14.0,
"id" : "obj-11"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "% 4",
"patching_rect" : [ 20.0, 260.0, 35.0, 23.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "int" ],
"fontsize" : 14.0,
"id" : "obj-10"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "counter",
"patching_rect" : [ 20.0, 220.0, 73.0, 23.0 ],
"numinlets" : 5,
"fontname" : "Arial",
"numoutlets" : 4,
"outlettype" : [ "int", "", "", "int" ],
"fontsize" : 14.0,
"id" : "obj-9"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "metro 250",
"patching_rect" : [ 20.0, 180.0, 74.0, 23.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"fontsize" : 14.0,
"id" : "obj-8"
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 20.0, 140.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-7"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t 0",
"patching_rect" : [ 140.0, 80.0, 26.0, 23.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "int" ],
"fontsize" : 14.0,
"id" : "obj-5"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t 1",
"patching_rect" : [ 20.0, 80.0, 26.0, 23.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "int" ],
"fontsize" : 14.0,
"id" : "obj-4"
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "Goodbye World !",
"patching_rect" : [ 140.0, 40.0, 115.0, 21.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 14.0,
"presentation_rect" : [ 137.0, 42.0, 0.0, 0.0 ],
"id" : "obj-3"
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "Hello World !",
"patching_rect" : [ 20.0, 40.0, 90.0, 21.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 14.0,
"id" : "obj-2"
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-14", 3 ],
"destination" : [ "obj-22", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 2 ],
"destination" : [ "obj-20", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 1 ],
"destination" : [ "obj-18", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-7", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ 149.5, 121.0, 29.5, 121.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
}

23
samples/JSON/person.json Normal file
View File

@@ -0,0 +1,23 @@
{
"firstName": "John",
"lastName" : "Smith",
"age" : 25,
"address" :
{
"streetAddress": "21 2nd Street",
"city" : "New York",
"state" : "NY",
"postalCode" : "10021"
},
"phoneNumber":
[
{
"type" : "home",
"number": "212 555-1234"
},
{
"type" : "fax",
"number": "646 555-4567"
}
]
}

View File

@@ -0,0 +1,7 @@
{
"id": 1,
"name": "Foo",
"price": 123,
"tags": ["Bar","Eek"],
"stock": { "warehouse":300, "retail":20 }
}

47
samples/JSON/schema.json Normal file
View File

@@ -0,0 +1,47 @@
{
"name":"Product",
"properties":
{
"id":
{
"type":"number",
"description":"Product identifier",
"required":true
},
"name":
{
"type":"string",
"description":"Name of the product",
"required":true
},
"price":
{
"type":"number",
"minimum":0,
"required":true
},
"tags":
{
"type":"array",
"items":
{
"type":"string"
}
},
"stock":
{
"type":"object",
"properties":
{
"warehouse":
{
"type":"number"
},
"retail":
{
"type":"number"
}
}
}
}
}

1
samples/Max/Hello.mxt Normal file
View File

@@ -0,0 +1 @@
max v2;

View File

@@ -165,7 +165,7 @@ class TestLanguage < Test::Unit::TestCase
assert_equal 'ruby', Language['Ruby'].search_term
assert_equal 'common-lisp', Language['Common Lisp'].search_term
assert_equal 'html+erb', Language['HTML+ERB'].search_term
assert_equal 'max/msp', Language['Max/MSP'].search_term
assert_equal 'max/msp', Language['Max'].search_term
assert_equal 'puppet', Language['Puppet'].search_term
assert_equal 'pure-data', Language['Pure Data'].search_term
@@ -310,7 +310,6 @@ class TestLanguage < Test::Unit::TestCase
assert_equal 'C%2B%2B', Language['C++'].escaped_name
assert_equal 'Objective-C', Language['Objective-C'].escaped_name
assert_equal 'Common%20Lisp', Language['Common Lisp'].escaped_name
assert_equal 'Max%2FMSP', Language['Max/MSP'].escaped_name
end
def test_error_without_name

View File

@@ -20,12 +20,17 @@ class TestTokenizer < Test::Unit::TestCase
assert_equal %w(print), tokenize("print 'Josh'")
assert_equal %w(print), tokenize('print "Hello \"Josh\""')
assert_equal %w(print), tokenize("print 'Hello \\'Josh\\''")
assert_equal %w(print), tokenize("print \"Hello\", \"Josh\"")
assert_equal %w(print), tokenize("print 'Hello', 'Josh'")
assert_equal %w(print), tokenize("print \"Hello\", \"\", \"Josh\"")
assert_equal %w(print), tokenize("print 'Hello', '', 'Josh'")
end
def test_skip_number_literals
assert_equal %w(+), tokenize('1 + 1')
assert_equal %w(add \( \)), tokenize('add(123, 456)')
assert_equal %w(|), tokenize('0x01 | 0x10')
assert_equal %w(*), tokenize('500.42 * 1.0')
end
def test_skip_comments
@@ -77,13 +82,17 @@ class TestTokenizer < Test::Unit::TestCase
def test_objective_c_tokens
assert_equal %w(#import <Foundation/Foundation.h> @interface Foo NSObject { } @end), tokenize(:"Objective-C/Foo.h")
assert_equal %w(#import @implementation Foo @end), tokenize(:"Objective-C/Foo.m")
assert_equal %w(#import <Cocoa/Cocoa.h> int main \( int argc char *argv \) { NSLog \( @ \) ; return ; }), tokenize(:"Objective-C/hello.m")
assert_equal %w(#import <Cocoa/Cocoa.h> int main \( int argc char *argv [ ] \) { NSLog \( @ \) ; return ; }), tokenize(:"Objective-C/hello.m")
end
def test_javascript_tokens
assert_equal %w( \( function \( \) { console.log \( \) ; } \) .call \( this \) ;), tokenize(:"JavaScript/hello.js")
end
def test_json_tokens
assert_equal %w( { [ ] { } } ), tokenize(:"JSON/product.json")
end
def test_ruby_tokens
assert_equal %w(module Foo end), tokenize(:"Ruby/foo.rb")
assert_equal %w(# /usr/bin/env ruby puts), tokenize(:"Ruby/script.rb")