From a633dd8c794314ab64fc72ddb4274eb3463bace2 Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Thu, 19 Dec 2013 14:13:23 +0400 Subject: [PATCH] adding JSON5 support --- lib/linguist/languages.yml | 5 +++++ samples/JSON5/example.json5 | 29 +++++++++++++++++++++++++++++ samples/JSON5/package.json5 | 28 ++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 samples/JSON5/example.json5 create mode 100644 samples/JSON5/package.json5 diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 22437c70..d2794e53 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -785,6 +785,11 @@ JSON: - .jshintrc - composer.lock +JSON5: + type: data + lexer: JavaScript + primary_extension: .json5 + Jade: group: HTML type: markup diff --git a/samples/JSON5/example.json5 b/samples/JSON5/example.json5 new file mode 100644 index 00000000..95f12408 --- /dev/null +++ b/samples/JSON5/example.json5 @@ -0,0 +1,29 @@ +/* + * The following is a contrived example, but it illustrates most of the features: + */ + +{ + foo: 'bar', + while: true, + + this: 'is a \ +multi-line string', + + // this is an inline comment + here: 'is another', // inline comment + + /* this is a block comment + that continues on another line */ + + hex: 0xDEADbeef, + half: .5, + delta: +10, + to: Infinity, // and beyond! + + finally: 'a trailing comma', + oh: [ + "we shouldn't forget", + 'arrays can have', + 'trailing commas too', + ], +} diff --git a/samples/JSON5/package.json5 b/samples/JSON5/package.json5 new file mode 100644 index 00000000..9e52ed24 --- /dev/null +++ b/samples/JSON5/package.json5 @@ -0,0 +1,28 @@ +// This file is written in JSON5 syntax, naturally, but npm needs a regular +// JSON file, so compile via `npm run build`. Be sure to keep both in sync! + +{ + name: 'json5', + version: '0.2.0', + description: 'JSON for the ES5 era.', + keywords: ['json', 'es5'], + author: 'Aseem Kishore ', + contributors: [ + 'Max Nanasy ', + ], + main: 'lib/json5.js', + bin: 'lib/cli.js', + dependencies: {}, + devDependencies: { + mocha: '~1.0.3', + }, + scripts: { + build: './lib/cli.js -c package.json5', + test: 'mocha --ui exports --reporter spec', + }, + homepage: 'http://json5.org/', + repository: { + type: 'git', + url: 'https://github.com/aseemk/json5.git', + }, +}