Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion RELEASE_NOTES.md
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
6 changes: 0 additions & 6 deletions TODO.md
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 src/main/java/us/kbase/jkidl/MemoizingIncludeProvider.java
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);
}

}
Loading