Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

langium-cli

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

langium-cli - npm Package Compare versions

Comparing version 0.2.0-next.1f60202 to 0.2.0

langium-config-schema.json

6

lib/generate.js

@@ -41,5 +41,5 @@ "use strict";

const document = services.documents.LangiumDocuments.getOrCreateDocument(absGrammarPath);
const buildResult = services.documents.DocumentBuilder.build(document);
const buildResult = yield services.documents.DocumentBuilder.build(document);
const diagnostics = buildResult.diagnostics;
if (!(0, langium_1.isGrammar)(buildResult.parseResult.value)) {
if (!(0, langium_1.isGrammar)(document.parseResult.value)) {
console.error((0, util_1.getTime)() + 'Failed to parse the grammar file: ' + config.grammar);

@@ -65,3 +65,3 @@ return 'failure';

}
const grammar = buildResult.parseResult.value;
const grammar = document.parseResult.value;
// Create and validate the in-memory parser

@@ -68,0 +68,0 @@ const parserAnalysis = (0, parser_validation_1.validateParser)(grammar, config);

@@ -26,3 +26,3 @@ "use strict";

}
for (const primitiveRule of (0, langium_1.stream)(grammar.rules).filterType(langium_1.isParserRule).filter(e => (0, langium_1.isDataTypeRule)(e))) {
for (const primitiveRule of (0, langium_1.stream)(grammar.rules).filter(langium_1.isParserRule).filter(e => (0, langium_1.isDataTypeRule)(e))) {
fileNode.append(buildDatatype(primitiveRule), langium_1.NL, langium_1.NL);

@@ -37,3 +37,3 @@ }

if ((0, langium_1.isAlternatives)(rule.alternatives) && rule.alternatives.elements.every(e => (0, langium_1.isKeyword)(e))) {
return `export type ${rule.name} = ${(0, langium_1.stream)(rule.alternatives.elements).filterType(langium_1.isKeyword).map(e => `'${e.value}'`).join(' | ')}`;
return `export type ${rule.name} = ${(0, langium_1.stream)(rule.alternatives.elements).filter(langium_1.isKeyword).map(e => `'${e.value}'`).join(' | ')}`;
}

@@ -40,0 +40,0 @@ else {

@@ -72,3 +72,3 @@ "use strict";

const keywords = new Set();
for (const rule of (0, langium_1.stream)(grammar.rules).filterType(langium.isParserRule)) {
for (const rule of (0, langium_1.stream)(grammar.rules).filter(langium.isParserRule)) {
collectElementKeywords(rule.alternatives, keywords);

@@ -75,0 +75,0 @@ }

{
"name": "langium-cli",
"version": "0.2.0-next.1f60202",
"version": "0.2.0",
"description": "CLI for Langium - the language engineering tool",

@@ -19,3 +19,4 @@ "engines": {

"lib",
"src"
"src",
"langium-config-schema.json"
],

@@ -40,3 +41,3 @@ "bin": {

"jsonschema": "^1.4.0",
"langium": "0.2.0-next.1f60202",
"langium": "~0.2.0",
"lodash": "^4.17.21"

@@ -43,0 +44,0 @@ },

@@ -34,5 +34,5 @@ /******************************************************************************

const document = services.documents.LangiumDocuments.getOrCreateDocument(absGrammarPath);
const buildResult = services.documents.DocumentBuilder.build(document);
const buildResult = await services.documents.DocumentBuilder.build(document);
const diagnostics = buildResult.diagnostics;
if (!isGrammar(buildResult.parseResult.value)) {
if (!isGrammar(document.parseResult.value)) {
console.error(getTime() + 'Failed to parse the grammar file: ' + config.grammar);

@@ -55,3 +55,3 @@ return 'failure';

}
const grammar = buildResult.parseResult.value;
const grammar = document.parseResult.value;

@@ -58,0 +58,0 @@ // Create and validate the in-memory parser

@@ -33,3 +33,3 @@ /******************************************************************************

}
for (const primitiveRule of stream(grammar.rules).filterType(isParserRule).filter(e => isDataTypeRule(e))) {
for (const primitiveRule of stream(grammar.rules).filter(isParserRule).filter(e => isDataTypeRule(e))) {
fileNode.append(buildDatatype(primitiveRule), NL, NL);

@@ -45,3 +45,3 @@ }

if (isAlternatives(rule.alternatives) && rule.alternatives.elements.every(e => isKeyword(e))) {
return `export type ${rule.name} = ${stream(rule.alternatives.elements).filterType(isKeyword).map(e => `'${e.value}'`).join(' | ')}`;
return `export type ${rule.name} = ${stream(rule.alternatives.elements).filter(isKeyword).map(e => `'${e.value}'`).join(' | ')}`;
} else {

@@ -48,0 +48,0 @@ return `export type ${rule.name} = ${rule.type ?? 'string'}`;

@@ -50,3 +50,3 @@ /******************************************************************************

for (const rule of stream(grammar.rules).filterType(langium.isParserRule)) {
for (const rule of stream(grammar.rules).filter(langium.isParserRule)) {
collectElementKeywords(rule.alternatives, keywords);

@@ -53,0 +53,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc