pax_global_header00006660000000000000000000000064143254770710014524gustar00rootroot0000000000000052 comment=8edb24c525431ff5083bc25ffe4d7a0d0f19ae41 lang-php-6.0.1/000077500000000000000000000000001432547707100132365ustar00rootroot00000000000000lang-php-6.0.1/.gitignore000066400000000000000000000001271432547707100152260ustar00rootroot00000000000000/node_modules package-lock.json /dist /test/*.js /test/*.d.ts /test/*.d.ts.map .tern-* lang-php-6.0.1/.npmignore000066400000000000000000000001001432547707100152240ustar00rootroot00000000000000/src /test /node_modules .tern-* rollup.config.js tsconfig.json lang-php-6.0.1/CHANGELOG.md000066400000000000000000000011151432547707100150450ustar00rootroot00000000000000## 6.0.1 (2022-10-24) ### Bug fixes Fix (non-)auto indentation in template strings and comments. Allow prefixed strings to be closed by `closeBrackets`. ## 6.0.0 (2022-06-08) ### Breaking changes Update dependencies to 6.0.0 ## 0.20.0 (2022-04-20) ### Bug fixes Fix missing highlighting info for the `declare`, `enddeclare`, and `interface` keywords. ## 0.19.1 (2021-09-04) ### Bug fixes Fix the `plain` option, which was accidentally ignored before. Improve indentation of colon block syntax constructs. ## 0.19.0 (2021-09-03) ### Breaking changes First numbered release. lang-php-6.0.1/LICENSE000066400000000000000000000021301432547707100142370ustar00rootroot00000000000000MIT License Copyright (C) 2018-2021 by Marijn Haverbeke and others 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. lang-php-6.0.1/README.md000066400000000000000000000055241432547707100145230ustar00rootroot00000000000000 # @codemirror/lang-php [![NPM version](https://img.shields.io/npm/v/@codemirror/lang-php.svg)](https://www.npmjs.org/package/@codemirror/lang-php) [ [**WEBSITE**](https://codemirror.net/) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/lang-php/blob/main/CHANGELOG.md) ] This package implements PHP language support for the [CodeMirror](https://codemirror.net/) code editor. The [project page](https://codemirror.net/) has more information, a number of [examples](https://codemirror.net/examples/) and the [documentation](https://codemirror.net/docs/). This code is released under an [MIT license](https://github.com/codemirror/lang-php/tree/main/LICENSE). We aim to be an inclusive, welcoming community. To make that explicit, we have a [code of conduct](http://contributor-covenant.org/version/1/1/0/) that applies to communication around the project. ## API Reference
php(config⁠?: Object = {}) → LanguageSupport

PHP language support.

config
baseLanguage⁠?: Language

By default, the parser will treat content outside of <? and ?> markers as HTML. You can pass a different language here to change that. Explicitly passing disables parsing of such content.

plain⁠?: boolean

By default, PHP parsing only starts at the first <? marker. When you set this to true, it starts immediately at the start of the document.

phpLanguage: LRLanguage

A language provider based on the Lezer PHP parser, extended with highlighting and indentation information.

lang-php-6.0.1/package.json000066400000000000000000000017361432547707100155330ustar00rootroot00000000000000{ "name": "@codemirror/lang-php", "version": "6.0.1", "description": "PHP language support for the CodeMirror code editor", "scripts": { "test": "cm-runtests", "prepare": "cm-buildhelper src/php.ts" }, "keywords": [ "editor", "code" ], "author": { "name": "Marijn Haverbeke", "email": "marijnh@gmail.com", "url": "http://marijnhaverbeke.nl" }, "type": "module", "main": "dist/index.cjs", "exports": { "import": "./dist/index.js", "require": "./dist/index.cjs" }, "types": "dist/index.d.ts", "module": "dist/index.js", "sideEffects": false, "license": "MIT", "dependencies": { "@codemirror/lang-html": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@lezer/common": "^1.0.0", "@lezer/php": "^1.0.0" }, "devDependencies": { "@codemirror/buildhelper": "^0.1.5" }, "repository": { "type": "git", "url": "https://github.com/codemirror/lang-php.git" } } lang-php-6.0.1/src/000077500000000000000000000000001432547707100140255ustar00rootroot00000000000000lang-php-6.0.1/src/README.md000066400000000000000000000020641432547707100153060ustar00rootroot00000000000000 # @codemirror/lang-php [![NPM version](https://img.shields.io/npm/v/@codemirror/lang-php.svg)](https://www.npmjs.org/package/@codemirror/lang-php) [ [**WEBSITE**](https://codemirror.net/6/) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/lang-php/blob/main/CHANGELOG.md) ] This package implements PHP language support for the [CodeMirror](https://codemirror.net/6/) code editor. The [project page](https://codemirror.net/6/) has more information, a number of [examples](https://codemirror.net/6/examples/) and the [documentation](https://codemirror.net/6/docs/). This code is released under an [MIT license](https://github.com/codemirror/lang-php/tree/main/LICENSE). We aim to be an inclusive, welcoming community. To make that explicit, we have a [code of conduct](http://contributor-covenant.org/version/1/1/0/) that applies to communication around the project. ## API Reference @php @phpLanguage lang-php-6.0.1/src/php.ts000066400000000000000000000055451432547707100151750ustar00rootroot00000000000000import {parser} from "@lezer/php" import {parseMixed} from "@lezer/common" import {html} from "@codemirror/lang-html" import {indentNodeProp, continuedIndent, delimitedIndent, foldNodeProp, foldInside, Language, LRLanguage, LanguageSupport} from "@codemirror/language" /// A language provider based on the [Lezer PHP /// parser](https://github.com/lezer-parser/php), extended with /// highlighting and indentation information. export const phpLanguage = LRLanguage.define({ name: "php", parser: parser.configure({ props: [ indentNodeProp.add({ IfStatement: continuedIndent({except: /^\s*({|else\b|elseif\b|endif\b)/}), TryStatement: continuedIndent({except: /^\s*({|catch\b|finally\b)/}), SwitchBody: context => { let after = context.textAfter, closed = /^\s*\}/.test(after), isCase = /^\s*(case|default)\b/.test(after) return context.baseIndent + (closed ? 0 : isCase ? 1 : 2) * context.unit }, ColonBlock: cx => cx.baseIndent + cx.unit, "Block EnumBody DeclarationList": delimitedIndent({closing: "}"}), ArrowFunction: cx => cx.baseIndent + cx.unit, "String BlockComment": () => null, Statement: continuedIndent({except: /^({|end(for|foreach|switch|while)\b)/}) }), foldNodeProp.add({ "Block EnumBody DeclarationList SwitchBody ArrayExpression ValueList": foldInside, ColonBlock(tree) { return {from: tree.from + 1, to: tree.to} }, BlockComment(tree) { return {from: tree.from + 2, to: tree.to - 2} } }) ] }), languageData: { commentTokens: {block: {open: "/*", close: "*/"}, line: "//"}, indentOnInput: /^\s*(?:case |default:|end(?:if|for(?:each)?|switch|while)|else(?:if)?|\{|\})$/, wordChars: "$", closeBrackets: {stringPrefixes: ["b", "B"]} } }) /// PHP language support. export function php(config: { /// By default, the parser will treat content outside of `` markers as HTML. You can pass a different language here to /// change that. Explicitly passing disables parsing of such content. baseLanguage?: Language | null, /// By default, PHP parsing only starts at the first ` { if (!node.type.isTop) return null return { parser: base!.parser, overlay: node => node.name == "Text" } }), top: config.plain ? "Program" : "Template" }), support) }