Skip to content

Commit

Permalink
Merge visitor methods
Browse files Browse the repository at this point in the history
The visitJson_object did not do much, so it was merged
with visitStruct_initialization.
  • Loading branch information
maxhoerstr authored and ptrdtznr committed Feb 7, 2023
1 parent 36caced commit 6486ec0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pfdl_scheduler/parser/pfdl_tree_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,13 @@ def visitParameter(self, ctx: PFDLParser.ParameterContext) -> Union[str, List[st
return self.visitAttribute_access(ctx.attribute_access())

def visitStruct_initialization(self, ctx: PFDLParser.Struct_initializationContext) -> Struct:
json_object_ctx = ctx.json_object()
json_string = self.visitJson_object(json_object_ctx)
json_string = ctx.json_object().getText()

struct = Struct.from_json(json_string, self.error_handler, ctx.json_object())
struct.name = ctx.STARTS_WITH_UPPER_C_STR().getText()
struct.context = ctx
return struct

def visitJson_object(self, ctx: PFDLParser.Json_objectContext) -> str:
return ctx.getText()

def visitTask_call(self, ctx: PFDLParser.Task_callContext) -> TaskCall:
task_call = TaskCall()
task_call.name = ctx.STARTS_WITH_LOWER_C_STR().getText()
Expand All @@ -244,6 +240,7 @@ def visitTask_call(self, ctx: PFDLParser.Task_callContext) -> TaskCall:

def visitParallel(self, ctx: PFDLParser.ParallelContext) -> Parallel:
parallel = Parallel()
parallel.context = ctx
for task_call_context in ctx.task_call():
task_call = self.visitTask_call(task_call_context)
parallel.task_calls.append(task_call)
Expand Down

0 comments on commit 6486ec0

Please sign in to comment.