langium-cli
Advanced tools
Comparing version 0.2.0-next.1f60202 to 0.2.0
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
169592
55
2678
1
+ Added@chevrotain/types@9.1.0(transitive)
+ Added@chevrotain/utils@9.1.0(transitive)
+ Addedchevrotain@9.1.0(transitive)
+ Addedlangium@0.2.0(transitive)
- Removedchevrotain@7.1.2(transitive)
- Removedlangium@0.2.0-next.1f60202(transitive)
Updatedlangium@~0.2.0