@codemirror/lang-cpp
Advanced tools
Comparing version
@@ -0,3 +1,13 @@ | ||
## 0.19.0 (2021-08-11) | ||
### Breaking changes | ||
Update dependencies to 0.19.0 | ||
## 0.18.0 (2021-03-03) | ||
### Breaking changes | ||
Update dependencies to 0.18. | ||
## 0.17.1 (2021-01-06) | ||
@@ -4,0 +14,0 @@ |
@@ -1,6 +0,14 @@ | ||
import { LezerLanguage, LanguageSupport } from '@codemirror/language'; | ||
import { LRLanguage, LanguageSupport } from '@codemirror/language'; | ||
declare const cppLanguage: LezerLanguage; | ||
/** | ||
A language provider based on the [Lezer C++ | ||
parser](https://github.com/lezer-parser/cpp), extended with | ||
highlighting and indentation information. | ||
*/ | ||
declare const cppLanguage: LRLanguage; | ||
/** | ||
Language support for C++. | ||
*/ | ||
declare function cpp(): LanguageSupport; | ||
export { cpp, cppLanguage }; |
@@ -1,24 +0,26 @@ | ||
import { parser } from 'lezer-cpp'; | ||
import { LezerLanguage, indentNodeProp, continuedIndent, flatIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language'; | ||
import { parser } from '@lezer/cpp'; | ||
import { LRLanguage, indentNodeProp, continuedIndent, flatIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language'; | ||
import { styleTags, tags } from '@codemirror/highlight'; | ||
/// A language provider based on the [Lezer C++ | ||
/// parser](https://github.com/lezer-parser/cpp), extended with | ||
/// highlighting and indentation information. | ||
const cppLanguage = LezerLanguage.define({ | ||
parser: parser.configure({ | ||
/** | ||
A language provider based on the [Lezer C++ | ||
parser](https://github.com/lezer-parser/cpp), extended with | ||
highlighting and indentation information. | ||
*/ | ||
const cppLanguage = /*@__PURE__*/LRLanguage.define({ | ||
parser: /*@__PURE__*/parser.configure({ | ||
props: [ | ||
indentNodeProp.add({ | ||
IfStatement: continuedIndent({ except: /^\s*({|else\b)/ }), | ||
TryStatement: continuedIndent({ except: /^\s*({|catch)\b/ }), | ||
/*@__PURE__*/indentNodeProp.add({ | ||
IfStatement: /*@__PURE__*/continuedIndent({ except: /^\s*({|else\b)/ }), | ||
TryStatement: /*@__PURE__*/continuedIndent({ except: /^\s*({|catch)\b/ }), | ||
LabeledStatement: flatIndent, | ||
CaseStatement: context => context.baseIndent + context.unit, | ||
BlockComment: () => -1, | ||
Statement: continuedIndent({ except: /^{/ }) | ||
Statement: /*@__PURE__*/continuedIndent({ except: /^{/ }) | ||
}), | ||
foldNodeProp.add({ | ||
/*@__PURE__*/foldNodeProp.add({ | ||
"DeclarationList CompoundStatement EnumeratorList FieldDeclarationList InitializerList": foldInside, | ||
BlockComment(tree) { return { from: tree.from + 2, to: tree.to - 2 }; } | ||
}), | ||
styleTags({ | ||
/*@__PURE__*/styleTags({ | ||
"typedef struct union enum class typename decltype auto template operator friend noexcept namespace using __attribute__ __declspec __based": tags.definitionKeyword, | ||
@@ -31,10 +33,10 @@ "extern MsCallModifier MsPointerModifier extern static register inline const volatile restrict _Atomic mutable constexpr virtual explicit VirtualSpecifier Access": tags.modifier, | ||
"True False": tags.bool, | ||
"TypeSize PrimitiveType": tags.standard(tags.typeName), | ||
"TypeSize PrimitiveType": /*@__PURE__*/tags.standard(tags.typeName), | ||
TypeIdentifier: tags.typeName, | ||
FieldIdentifier: tags.propertyName, | ||
"CallExpression/FieldExpression/FieldIdentifier": tags.function(tags.propertyName), | ||
"CallExpression/FieldExpression/FieldIdentifier": /*@__PURE__*/tags.function(tags.propertyName), | ||
StatementIdentifier: tags.labelName, | ||
Identifier: tags.variableName, | ||
"CallExpression/Identifier": tags.function(tags.variableName), | ||
"CallExpression/ScopedIdentifier/Identifier": tags.function(tags.variableName), | ||
"CallExpression/Identifier": /*@__PURE__*/tags.function(tags.variableName), | ||
"CallExpression/ScopedIdentifier/Identifier": /*@__PURE__*/tags.function(tags.variableName), | ||
DestructorName: tags.name, | ||
@@ -53,3 +55,3 @@ NamespaceIdentifier: tags.namespace, | ||
String: tags.string, | ||
"RawString SystemLibString": tags.special(tags.string), | ||
"RawString SystemLibString": /*@__PURE__*/tags.special(tags.string), | ||
CharLiteral: tags.character, | ||
@@ -59,3 +61,3 @@ EscapeSequence: tags.escape, | ||
"PreprocDirectiveName #include #ifdef #ifndef #if #define #else #endif #elif": tags.processingInstruction, | ||
MacroName: tags.special(tags.name), | ||
MacroName: /*@__PURE__*/tags.special(tags.name), | ||
"( )": tags.paren, | ||
@@ -75,3 +77,5 @@ "[ ]": tags.squareBracket, | ||
}); | ||
/// Language support for C++. | ||
/** | ||
Language support for C++. | ||
*/ | ||
function cpp() { | ||
@@ -78,0 +82,0 @@ return new LanguageSupport(cppLanguage); |
{ | ||
"name": "@codemirror/lang-cpp", | ||
"version": "0.18.0", | ||
"version": "0.19.0", | ||
"description": "C++ language support for the CodeMirror code editor", | ||
"scripts": { | ||
"test": "echo 'No tests'", | ||
"prepare": "tsc -p tsconfig.local.json && rollup -c" | ||
"test": "cm-runtests", | ||
"prepare": "cm-buildhelper src/cpp.ts" | ||
}, | ||
@@ -29,10 +29,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@codemirror/highlight": "^0.18.0", | ||
"@codemirror/language": "^0.18.0", | ||
"lezer-cpp": "^0.13.0" | ||
"@codemirror/highlight": "^0.19.0", | ||
"@codemirror/language": "^0.19.0", | ||
"@lezer/cpp": "^0.14.0" | ||
}, | ||
"devDependencies": { | ||
"rollup": "^2.35.1", | ||
"rollup-plugin-dts": "^2.0.1", | ||
"typescript": "^4.1.3" | ||
"@codemirror/buildhelper": "^0.1.0" | ||
}, | ||
@@ -39,0 +37,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
1
-66.67%2
-33.33%13485
-33.66%8
-20%173
-1.7%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated