Skip to content

Commit

Permalink
Add support for including IDD \group in the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Myoldmopar committed Dec 15, 2020
1 parent 9d6116a commit 3605a82
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions scripts/dev/generate_epJSON_schema/idd_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class Data:
def parse_idd(data):
root = {'$schema': "http://json-schema.org/draft-04/schema#", 'properties': {}}
data.file_size = len(data.file)
current_group_name = "**ungrouped**"

while data.index < data.file_size:
token = look_ahead(data)
Expand All @@ -110,15 +111,15 @@ def parse_idd(data):
elif token == TOKEN_EXCLAMATION:
eat_comment(data)
elif token == TOKEN_GROUP:
next_token(data)
eat_comment(data)
current_group_name = parse_group(data).replace('\\group ', '')
else:
obj_name = parse_string(data)
if obj_name is None or obj_name == "":
return root
obj_data = parse_obj(data)
root['properties'][obj_name] = {}
root['properties'][obj_name]['patternProperties'] = {}
root['properties'][obj_name]['group'] = current_group_name

name_pattern_properties = '.*'
if 'name' in obj_data:
Expand Down Expand Up @@ -725,6 +726,18 @@ def eat_whitespace(data):
break


def parse_group(data):
eat_whitespace(data)
s = ""
while data.index < data.file_size:
c = data.file[data.index]
if c == '\n':
data.index += 1
return s
s += c
data.index += 1


def eat_comment(data):
if data.file[data.index] == '\n':
data.index += 1
Expand Down

5 comments on commit 3605a82

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AddGroupToSchema (Myoldmopar) - x86_64-MacOS-10.15-clang-11.0.0: OK (2997 of 2997 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AddGroupToSchema (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3037 of 3037 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AddGroupToSchema (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2254 of 2254 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AddGroupToSchema (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1563 of 1563 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AddGroupToSchema (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (720 of 721 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 720
  • Timeout: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.