Skip to content

Commit

Permalink
fixing parser issue with hcl
Browse files Browse the repository at this point in the history
  • Loading branch information
davydotcom committed May 2, 2023
1 parent da08d33 commit a85553c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ Using gradle one can include the hcl4j dependency like so:

```groovy
dependencies {
compile "com.bertramlabs.plugins:hcl4j:0.7.0"
compile "com.bertramlabs.plugins:hcl4j:0.7.2"
}
```

## What's New

* **0.7.2** Handling nested Block types in a List as a non null value
* **0.7.1** Adding some parser exception safety and added slf4j dependency for logging errors
* **0.7.0** Adding some null safety on some of the base functions
* **0.6.9** Fixed some null pointer issues if content on base64encode was null and some exceptions on array traversal
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ext {


group = 'com.bertramlabs.plugins'
version = '0.7.1'
version = '0.7.2'

ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
sourceCompatibility = "1.8"
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/bertramlabs/plugins/hcl4j/HCLParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,19 @@ private Object processSymbolPass2(Object val, Map<String,Object> mapPosition) th
}
}
return nestedMap;
} else if(val instanceof HCLBlock) {
HCLBlock symbol = (HCLBlock)(val);
Map<String,Object> nestedMap = new LinkedHashMap<>();
if((symbol.getChildren() != null)) {
for(Symbol child : symbol.getChildren()) {
processSymbolPass2(child, nestedMap);
}
}
return nestedMap;
} else if(val instanceof HCLArray) {
HCLArray symbol = (HCLArray)(val);
if(symbol.getChildren() != null) {

List<Object> objectList = new ArrayList<>();
for(Symbol child : symbol.getChildren()) {
Map<String,Object> nestedMap = new LinkedHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ array_set = [{
println JsonOutput.prettyPrint(JsonOutput.toJson(results));
then:
results.array_set?.size() == 2
results.array_set[1].blah == "test2"
}

void "it should handle end of line comments with hyphens"() {
Expand Down

0 comments on commit a85553c

Please sign in to comment.