switch partial explanation
This commit is contained in:
parent
75e3c031bf
commit
7b14d7ccb3
1 changed files with 4 additions and 0 deletions
|
@ -209,6 +209,10 @@ class Parser(sly.Parser):
|
||||||
|
|
||||||
@_('SWITCH "(" expression ")" "{" caselist DEFAULT ":" stmtlist "}"')
|
@_('SWITCH "(" expression ")" "{" caselist DEFAULT ":" stmtlist "}"')
|
||||||
def switch_stmt(self, p):
|
def switch_stmt(self, p):
|
||||||
|
# The way this works is, every caselist (and case) return a list of where to put the comparison and jump
|
||||||
|
# also, where to jump(as in, where is the next case)
|
||||||
|
# they also add a little jump over the next case check, which would probably be
|
||||||
|
# removed by the optimizer if there is a break (since we will have 2 jumps one after the other)
|
||||||
exp = p[2]
|
exp = p[2]
|
||||||
cases = p[5]
|
cases = p[5]
|
||||||
if exp.is_float:
|
if exp.is_float:
|
||||||
|
|
Loading…
Reference in a new issue