Skip to content

Commit

Permalink
further error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
remzi-arpacidusseau committed Jun 29, 2020
1 parent 5e4b7ab commit ef63700
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cpu-api/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ def parse(self):
tokens = program.split()
action_list = [] # add actions understood by generators here
curr = 0 # where we are in list of tokens
done = False #
brace_count = 0 # ensures matching number of braces
wait_count = {} # tracks, per fork-nesting level, that enough waits are added
fork_level = 0 # tracks level of forks
Expand All @@ -340,10 +339,10 @@ def parse(self):
wait_count[fork_level] += 1
fork_level += 1
wait_count[fork_level] = 0
assert(len(tokens) >= curr + 2)
self.abort_if(len(tokens) < curr + 2, 'malformed program: fork needs process name,sleep length plus {description} of what the forked process should do')
args = tokens[curr + 1]
args_split = args.split(',')
assert(len(args_split) == 2)
self.abort_if(len(args_split) != 2, 'not enough args to fork (process name, sleep time)')
lbrace = tokens[curr + 2]
self.abort_if(lbrace != '{', 'must have {} following fork')
action_list.append('fork %s %s' % (args_split[0], args_split[1]))
Expand Down

0 comments on commit ef63700

Please sign in to comment.