-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: alias Import rules added (#855)
* feat: Alias Import rules added * Rules for AliasedIdentifier and Types added. * aliasedTypes filtered in callback of ImportTypes Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat: Grammar rules updated - as token defined for aliasing types in the import statements - as is defined local reserved word - AST made backward compatible Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat: Printer updated - Printer now handles the aliased types. - Test case added for parser and printer. Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias import): Printer and parser test cases - Test case added containing alias import Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias import): test cases for updated grammar - test cases added for both parser and printer - bad test cases added as well for the parser Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias import): PR changes - renamed the Types rule to IdentifierTypeExpression - Indentation fixed - Extra white spaces removed Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias): Minor fixes - Code changes made on suggestion. Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias): disabled aliasing to primitive types Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias): handle pr comments - Test cases added - pr comments handled Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias): variables renamed and code cleaned Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias import): printer code refactored - printer code refactored - coverage 100% tested locally Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias import): Updated concerto-metamodel version Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias import): Pr suggestion : code refactor Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias):package-lock.json fixed Signed-off-by: Jaskeerat Singh Saluja <[email protected]> * feat(alias): fixing pr Signed-off-by: Jaskeerat Singh Saluja <[email protected]> --------- Signed-off-by: Jaskeerat Singh Saluja <[email protected]>
- Loading branch information
1 parent
731b2f1
commit 032bd75
Showing
8 changed files
with
858 additions
and
559 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace test.aliasing | ||
|
||
import org.accordproject.{doc1 as d1,doc2 as d2} | ||
import org.accordproject.files.{file1,file2 as f2,file3} | ||
import [email protected].{baz1 as bar1} | ||
import [email protected].{baz2 as bar2} from https://com.example.co.uk/models/com.example.foo.cto | ||
import [email protected].{tee,baz as bar,lorem,ipsum,dolor as freq} | ||
import [email protected].{As as as,as as as} | ||
import [email protected].{baz} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"$class": "[email protected]", | ||
"decorators": [], | ||
"namespace": "test.aliasing", | ||
"imports": [ | ||
{ | ||
"$class": "[email protected]", | ||
"namespace": "org.accordproject", | ||
"types": ["doc1", "doc2"], | ||
"aliasedTypes": [ | ||
{ | ||
"$class": "[email protected]", | ||
"name": "doc1", | ||
"aliasedName": "d1" | ||
}, | ||
{ | ||
"$class": "[email protected]", | ||
"name": "doc2", | ||
"aliasedName": "d2" | ||
} | ||
] | ||
}, | ||
{ | ||
"$class": "[email protected]", | ||
"namespace": "org.accordproject.files", | ||
"types": ["file1", "file2", "file3"], | ||
"aliasedTypes": [ | ||
{ | ||
"$class": "[email protected]", | ||
"name": "file2", | ||
"aliasedName": "f2" | ||
} | ||
] | ||
}, | ||
{ | ||
"$class": "[email protected]", | ||
"namespace": "[email protected]", | ||
"types": ["baz1"], | ||
"aliasedTypes": [ | ||
{ | ||
"$class": "[email protected]", | ||
"name": "baz1", | ||
"aliasedName": "bar1" | ||
} | ||
] | ||
}, | ||
{ | ||
"$class": "[email protected]", | ||
"namespace": "[email protected]", | ||
"types": ["baz2"], | ||
"aliasedTypes": [ | ||
{ | ||
"$class": "[email protected]", | ||
"name": "baz2", | ||
"aliasedName": "bar2" | ||
} | ||
], | ||
"uri": "https://com.example.co.uk/models/com.example.foo.cto" | ||
}, | ||
{ | ||
"$class": "[email protected]", | ||
"namespace": "[email protected]", | ||
"types": ["tee", "baz", "lorem", "ipsum", "dolor"], | ||
"aliasedTypes": [ | ||
{ | ||
"$class": "[email protected]", | ||
"name": "baz", | ||
"aliasedName": "bar" | ||
}, | ||
{ | ||
"$class": "[email protected]", | ||
"name": "dolor", | ||
"aliasedName": "freq" | ||
} | ||
] | ||
}, | ||
{ | ||
"$class": "[email protected]", | ||
"namespace": "[email protected]", | ||
"types": ["As", "as"], | ||
"aliasedTypes": [ | ||
{ | ||
"$class": "[email protected]", | ||
"name": "As", | ||
"aliasedName": "as" | ||
}, | ||
{ | ||
"$class": "[email protected]", | ||
"name": "as", | ||
"aliasedName": "as" | ||
} | ||
] | ||
}, | ||
{ | ||
"$class": "[email protected]", | ||
"namespace": "[email protected]", | ||
"types": ["baz"] | ||
} | ||
], | ||
"declarations": [] | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/concerto-cto/test/cto/bad/aliasImport.bad.alias-missing.cto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace [email protected] | ||
|
||
import ns.{doc as} | ||
|
4 changes: 4 additions & 0 deletions
4
packages/concerto-cto/test/cto/bad/aliasImport.bad.single.cto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace [email protected] | ||
|
||
//Bad Import : without paranthesis | ||
import [email protected] as bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters