-
Notifications
You must be signed in to change notification settings - Fork 0
Update KIDL code to the most recent kb_sdk_plus version. #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,6 +1,20 @@ | ||
| # 0.2.0 | ||
|
|
||
| * Updated to code from `kb_sdk_plus` commit `166fe43`. | ||
| * It is intended that KIDL parser development now takes place in this repo rather than | ||
| `kb_sdk_plus`. | ||
| * `kb_sdk_plus`'s code was sourced from `kb_sdk` commit `80aebc4` and updated with the | ||
| following changes: | ||
| * The unused `async` keyword was removed. | ||
| * Code for generating template data structures was moved into `kb_sdk_plus` proper with | ||
| the rest of the templating code. | ||
| * Other code not involved in parsing KIDL was moved into `kb_sdk_plus` proper. | ||
| * For changes between `0.1.0` and `kb_sdk` `80aebc4`, see | ||
| the [history of KIDL development](./JKIDL_HISTORY.md). | ||
|
|
||
| # 0.1.0 | ||
|
|
||
| * Initial release | ||
| * Equivalent to commit `7863aef` of `java_type_compiler` | ||
| * Equivalent to jar `kbase-kidl-parser-1409261812-7863aef.jar` in the `kbase` folder in | ||
| https://github.com/kbase/jars | ||
| https://github.com/kbase/jars |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,3 @@ | ||
| * Update this code with the most recent code from kb_sdk. | ||
| * Before the update, the template data extraction code (e.g. the `forTemplates()` method | ||
| and dependencies) should be removed from the KIDL parser code. The code should be for parsing | ||
| and regenerating KIDL files, not handling templating. | ||
| * Similarly, the HTML generation code should be moved into the KIDL code, perhaps in | ||
| `kidlhtml` or `kidl.html`. | ||
| * Possibly move everything under the `kidl` namespace, including `jkidl`. | ||
| * Update the javacc jar to something from maven & add Gradle target to compile the spec parser. | ||
| * Compilation probably never needs to be done again, so it can wait. | ||
44 changes: 44 additions & 0 deletions
44
src/main/java/us/kbase/jkidl/MemoizingIncludeProvider.java
This file contains hidden or 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,44 @@ | ||
| package us.kbase.jkidl; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| import us.kbase.kidl.KbModule; | ||
| import us.kbase.kidl.KidlParseException; | ||
|
|
||
| /** Provides parsed structures for included KIDL specs and memoizes the | ||
| * structures. | ||
| * @author gaprice@lbl.gov | ||
| * | ||
| */ | ||
| public class MemoizingIncludeProvider implements IncludeProvider { | ||
|
|
||
| private final IncludeProvider wrapped; | ||
| private final Map<String, KbModule> seen = new HashMap<String, KbModule>(); | ||
|
|
||
| /** Construct the memoizing provider | ||
| * @param wrapped an IncludeProvider for which the results will be | ||
| * memoized. | ||
| */ | ||
| public MemoizingIncludeProvider(final IncludeProvider wrapped) { | ||
| this.wrapped = wrapped; | ||
| } | ||
|
|
||
| @Override | ||
| public Map<String, KbModule> parseInclude(String includeLine) | ||
| throws KidlParseException { | ||
| final Map<String, KbModule> parse = wrapped.parseInclude(includeLine); | ||
| seen.putAll(parse); | ||
| return parse; | ||
| } | ||
|
|
||
| /** Note that the Kb* classes are mutable and this function does not make | ||
| * a deep copy of the Map. | ||
| * @return A mapping of the service name (including the module name) to a | ||
| * module for each service encountered in an import. | ||
| */ | ||
| public Map<String, KbModule> getParsed() { | ||
| return new HashMap<String, KbModule>(seen); | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed my mind here, if anything it should be moved to its own package, but for now leaving it in the SDK is fine