UNPKG

@inst/vscode-bin-darwin

Version:

BINARY ONLY - VSCode binary deployment for macOS

74 lines (73 loc) 9.13 kB
{ "_args": [ [ { "raw": "jsonc-parser@https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-0.3.1.tgz", "scope": null, "escapedName": "jsonc-parser", "name": "jsonc-parser", "rawSpec": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-0.3.1.tgz", "spec": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-0.3.1.tgz", "type": "remote" }, "/Users/code/tfs/agent3/_work/2/s/extensions/extension-editing" ] ], "_from": "jsonc-parser@>=0.3.1 <0.4.0", "_id": "jsonc-parser@0.3.1", "_inCache": true, "_location": "/jsonc-parser", "_phantomChildren": {}, "_requested": { "raw": "jsonc-parser@https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-0.3.1.tgz", "scope": null, "escapedName": "jsonc-parser", "name": "jsonc-parser", "rawSpec": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-0.3.1.tgz", "spec": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-0.3.1.tgz", "type": "remote" }, "_requiredBy": [ "/" ], "_resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-0.3.1.tgz", "_shasum": "6ebf5c75224368d4b07ef4c26f9434e657472e95", "_shrinkwrap": null, "_spec": "jsonc-parser@https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-0.3.1.tgz", "_where": "/Users/code/tfs/agent3/_work/2/s/extensions/extension-editing", "author": { "name": "Microsoft Corporation" }, "bugs": { "url": "https://github.com/Microsoft/node-jsonc-parser/issues" }, "dependencies": { "vscode-nls": "^2.0.2" }, "description": "Scanner and parser for JSON with comments.", "devDependencies": { "@types/mocha": "^2.2.32", "@types/node": "^6.0.46", "mocha": "^2.4.5", "typescript": "^2.1.5" }, "homepage": "https://github.com/Microsoft/node-jsonc-parser#readme", "license": "MIT", "main": "./lib/main.js", "name": "jsonc-parser", "optionalDependencies": {}, "readme": "# jsonc-parser\nScanner and parser for JSON with comments.\n\n[![npm Package](https://img.shields.io/npm/v/jsonc-parser.svg?style=flat-square)](https://www.npmjs.org/package/jsonc-parser)\n[![NPM Downloads](https://img.shields.io/npm/dm/jsonc-parser.svg)](https://npmjs.org/package/jsonc-parser)\n[![Build Status](https://travis-ci.org/Microsoft/node-jsonc-parser.svg?branch=master)](https://travis-ci.org/Microsoft/node-jsonc-parser)\n\nWhy?\n----\nJSONC is JSON with JavaScript style comments. This node module provides a scanner and fault tolerant parser that can process JSONC but is also useful for standard JSON.\n - the *scanner* tokenizes the input string into tokens and token offsets\n - the *parse* function evaluates the JavaScipt object represented by JSON string in a fault tolerant fashion.\n - the *visit* function implements a 'SAX' style parser with callbacks for the encountered properties and values\n\nInstallation\n------------\n\n npm install --save jsonc-parser\n \n \nAPI\n---\n\n### Scanner:\n```typescript\n\n/**\n * Creates a JSON scanner on the given text.\n * If ignoreTrivia is set, whitespaces or comments are ignored.\n */\nexport function createScanner(text:string, ignoreTrivia:boolean = false):JSONScanner;\n \n/**\n * The scanner object, representing a JSON scanner at a position in the input string.\n */\nexport interface JSONScanner {\n /**\n * Sets the scan position to a new offset. A call to 'scan' is needed to get the first token.\n */\n setPosition(pos: number): any;\n /**\n * Read the next token. Returns the tolen code.\n */\n scan(): SyntaxKind;\n /**\n * Returns the current scan position, which is after the last read token.\n */\n getPosition(): number;\n /**\n * Returns the last read token.\n */\n getToken(): SyntaxKind;\n /**\n * Returns the last read token value. The value for strings is the decoded string content. For numbers its of type number, for boolean it's true or false.\n */\n getTokenValue(): string;\n /**\n * The start offset of the last read token.\n */\n getTokenOffset(): number;\n /**\n * The length of the last read token.\n */\n getTokenLength(): number;\n /**\n * An error code of the last scan.\n */\n getTokenError(): ScanError;\n}\n```\n\n### Parser:\n```typescript\n\nexport interface ParseOptions {\n disallowComments?: boolean;\n}\n/**\n * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault lolerant as possible, but still return a result.\n * Therefore always check the errors list to find out if the input was valid.\n */\nexport declare function parse(text: string, errors?: {error: ParseErrorCode;}[], options?: ParseOptions): any;\n\n/**\n * Parses the given text and invokes the visitor functions for each object, array and literal reached.\n */\nexport declare function visit(text: string, visitor: JSONVisitor, options?: ParseOptions): any;\n\nexport interface JSONVisitor {\n /**\n * Invoked when an open brace is encountered and an object is started. The offset and length represent the location of the open brace.\n */\n onObjectBegin?: (offset: number, length: number) => void;\n /**\n * Invoked when a property is encountered. The offset and length represent the location of the property name.\n */\n onObjectProperty?: (property: string, offset: number, length: number) => void;\n /**\n * Invoked when a closing brace is encountered and an object is completed. The offset and length represent the location of the closing brace.\n */\n onObjectEnd?: (offset: number, length: number) => void;\n /**\n * Invoked when an open bracket is encountered. The offset and length represent the location of the open bracket.\n */\n onArrayBegin?: (offset: number, length: number) => void;\n /**\n * Invoked when a closing bracket is encountered. The offset and length represent the location of the closing bracket.\n */\n onArrayEnd?: (offset: number, length: number) => void;\n /**\n * Invoked when a literal value is encountered. The offset and length represent the location of the literal value.\n */\n onLiteralValue?: (value: any, offset: number, length: number) => void;\n /**\n * Invoked when a comma or colon separator is encountered. The offset and length represent the location of the separator.\n */\n onSeparator?: (charcter: string, offset: number, length: number) => void;\n /**\n * Invoked on an error.\n */\n onError?: (error: ParseErrorCode, offset: number, length: number) => void;\n}\n\n/**\n * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n */\nexport declare function parseTree(text: string, errors?: ParseError[], options?: ParseOptions): Node;\n\nexport declare type NodeType = \"object\" | \"array\" | \"property\" | \"string\" | \"number\" | \"boolean\" | \"null\";\nexport interface Node {\n type: NodeType;\n value?: any;\n offset: number;\n length: number;\n columnOffset?: number;\n parent?: Node;\n children?: Node[];\n}\n\n```\n\n### Utilities:\n```typescript\n/**\n * Takes JSON with JavaScript-style comments and remove\n * them. Optionally replaces every none-newline character\n * of comments with a replaceCharacter\n */\nexport declare function stripComments(text: string, replaceCh?: string): string;\n\n/**\n * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.\n */\nexport declare function getLocation(text: string, position: number): Location;\n\nexport declare type Segment = string | number;\nexport interface Location {\n /**\n * The previous property key or literal value (string, number, boolean or null) or undefined.\n */\n previousNode?: Node;\n /**\n * The path describing the location in the JSON document. The path consists of a sequence strings\n * representing an object property or numbers for array indices.\n */\n path: Segment[];\n /**\n * Matches the locations path against a pattern consisting of strings (for properties) and numbers (for array indices).\n * '*' will match a single segment, of any property name or index.\n * '**' will match a sequece of segments or no segment, of any property name or index.\n */\n matches: (patterns: Segment[]) => boolean;\n /**\n * If set, the location's offset is at a property key.\n */\n isAtPropertyKey: boolean;\n}\n\n\n\n```\n\n\nLicense\n-------\n\n(MIT License)\n\nCopyright 2016, Microsoft", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/Microsoft/node-jsonc-parser.git" }, "scripts": { "compile": "tsc -p ./src", "prepublish": "tsc -p ./src", "test": "tsc -p ./src && mocha", "watch": "tsc -w -p ./src" }, "typings": "./lib/main", "version": "0.3.1" }