@sap/cds-compiler 5.7.0 → 5.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/lib/gen/CdlParser.js +2357 -2360
- package/lib/parsers/AstBuildingParser.js +10 -1
- package/lib/parsers/CdlGrammar.g4 +4 -2
- package/lib/render/utils/delta.js +1 -3
- package/package.json +1 -1
|
@@ -48,7 +48,7 @@ const PRECEDENCE_OF_IN_PREDICATE = 10;
|
|
|
48
48
|
const PRECEDENCE_OF_EQUAL = 10;
|
|
49
49
|
|
|
50
50
|
class AstBuildingParser extends BaseParser {
|
|
51
|
-
leanConditions = { afterBrace: true };
|
|
51
|
+
leanConditions = { afterBrace: true, fail: true };
|
|
52
52
|
|
|
53
53
|
constructor( lexer, keywords, table, options, messageFunctions ) {
|
|
54
54
|
super( lexer, keywords, table ); // lexer has file
|
|
@@ -503,6 +503,15 @@ class AstBuildingParser extends BaseParser {
|
|
|
503
503
|
return this.tokens[this.tokenIdx + 1]?.text !== ':';
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
+
fail( mode ) {
|
|
507
|
+
// TODO TOOL: the following test belongs to the BaseParser.js:
|
|
508
|
+
if (this.conditionTokenIdx === this.tokenIdx && // tested on same
|
|
509
|
+
this.conditionStackLength == null && // after error recover
|
|
510
|
+
mode !== 'M')
|
|
511
|
+
return false;
|
|
512
|
+
return true; // mode !== 'Y';
|
|
513
|
+
}
|
|
514
|
+
|
|
506
515
|
// Space handling etc, locations ----------------------------------------------
|
|
507
516
|
|
|
508
517
|
// Use the following method for language constructs which we (currently) do
|
|
@@ -128,7 +128,7 @@ usingDeclaration[ source ] locals[ decl = { kind: 'using' } ] // TODO: XsnArtifa
|
|
|
128
128
|
'{' { $decl.usings = this.createArray(); }
|
|
129
129
|
( usingProxy[ $decl, { kind: 'using' } ]
|
|
130
130
|
( ',' | <exitLoop> )
|
|
131
|
-
)
|
|
131
|
+
)*
|
|
132
132
|
'}'<prepare=afterBrace>
|
|
133
133
|
{ this.finalizeDictOrArray( $decl.usings ); }
|
|
134
134
|
( FROM String
|
|
@@ -1929,6 +1929,7 @@ annoAssignParen[ art ]
|
|
|
1929
1929
|
:
|
|
1930
1930
|
'('<prepare=annoInSameLine>
|
|
1931
1931
|
( annoAssignBase[ $art ]
|
|
1932
|
+
//( annoAssignErrorRecoveryHelper )?
|
|
1932
1933
|
( ',' | <exitLoop> )
|
|
1933
1934
|
)*
|
|
1934
1935
|
')'
|
|
@@ -2018,7 +2019,8 @@ annoValue returns[ default value = {} ]
|
|
|
2018
2019
|
if ($value.$flatten) $value.$flatten.push( $sub );
|
|
2019
2020
|
else this.addDef( $sub, $value, 'struct', null, $sub.name );
|
|
2020
2021
|
}
|
|
2021
|
-
( ',' | <exitLoop> )
|
|
2022
|
+
( ',' | <exitLoop> | <guard=fail, repeatLoop, restrict=Id> )
|
|
2023
|
+
// <guard=fail, repeatLoop>` for better error recovery for input `foo@bar`
|
|
2022
2024
|
)*
|
|
2023
2025
|
// TODO TOOL: allow:
|
|
2024
2026
|
// ( <guard=arrayAnno, …> '}' | <error> ) // TODO TOOL - workaround:
|
|
@@ -74,9 +74,7 @@ class DeltaRenderer {
|
|
|
74
74
|
alterColumns(artifactName, columnName, delta, definitionsStr, _eltName, _env) {
|
|
75
75
|
if (Array.isArray(definitionsStr)) {
|
|
76
76
|
const prefix = `ALTER TABLE ${this.scopedFunctions.renderArtifactName(artifactName)} ALTER (`;
|
|
77
|
-
|
|
78
|
-
for (let i = 0; i < prefix.length; i++)
|
|
79
|
-
padding += ' ';
|
|
77
|
+
const padding = ' '.repeat(prefix.length);
|
|
80
78
|
const body = definitionsStr.map(s => padding + s).join(',\n').slice(padding.length); // no padding for first part
|
|
81
79
|
const postfix = ');';
|
|
82
80
|
return [ prefix + body + postfix ];
|