Catch multiple {else} errors in shippy

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1932 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2011-01-18 06:57:51 +00:00
parent 6b8958bd39
commit 5be61fe005
1 changed files with 7 additions and 0 deletions

View File

@ -91,6 +91,10 @@ def parseComment(line, line_num, enabled_flags):
print 'Fatal Error: {else} found without {if} on line ' + str(line_num) print 'Fatal Error: {else} found without {if} on line ' + str(line_num)
print line print line
quit() quit()
if inside_if == 'else':
print 'Fatal Error: Multiple {else} clauses found in the same if on line ' + str(line_num)
print line
quit()
if last_if_true: if last_if_true:
line = '<!--{else}>' line = '<!--{else}>'
@ -100,6 +104,9 @@ def parseComment(line, line_num, enabled_flags):
# invert the logic so the endif clause is closed properly # invert the logic so the endif clause is closed properly
last_if_true = not last_if_true last_if_true = not last_if_true
# ensure we don't have two else statements in the same if
inside_if = 'else'
elif statement == 'endif': elif statement == 'endif':
if inside_if == False: if inside_if == False:
print 'Fatal Error: {endif} found without {if} on line ' + str(line_num) print 'Fatal Error: {endif} found without {if} on line ' + str(line_num)