LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 /* | 5 /* |
6 * Go language grammar. | 6 * Go language grammar. |
7 * | 7 * |
8 * The Go semicolon rules are: | 8 * The Go semicolon rules are: |
9 * | 9 * |
10 * 1. all statements and declarations are terminated by semicolons. | 10 * 1. all statements and declarations are terminated by semicolons. |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 $$->op = OSWITCH; | 666 $$->op = OSWITCH; |
667 $$->list = $5; | 667 $$->list = $5; |
668 typesw = typesw->left; | 668 typesw = typesw->left; |
669 popdcl(); | 669 popdcl(); |
670 } | 670 } |
671 | 671 |
672 select_stmt: | 672 select_stmt: |
673 LSELECT | 673 LSELECT |
674 { | 674 { |
675 markdcl(); | 675 markdcl(); |
| 676 typesw = nod(OXXX, typesw, N); |
676 } | 677 } |
677 switch_body | 678 switch_body |
678 { | 679 { |
679 $$ = nod(OSELECT, N, N); | 680 $$ = nod(OSELECT, N, N); |
680 $$->list = $3; | 681 $$->list = $3; |
| 682 typesw = typesw->left; |
681 popdcl(); | 683 popdcl(); |
682 } | 684 } |
683 | 685 |
684 /* | 686 /* |
685 * expressions | 687 * expressions |
686 */ | 688 */ |
687 expr: | 689 expr: |
688 uexpr | 690 uexpr |
689 | expr LOROR expr | 691 | expr LOROR expr |
690 { | 692 { |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1943 static void | 1945 static void |
1944 fixlbrace(int lbr) | 1946 fixlbrace(int lbr) |
1945 { | 1947 { |
1946 // If the opening brace was an LBODY, | 1948 // If the opening brace was an LBODY, |
1947 // set up for another one now that we're done. | 1949 // set up for another one now that we're done. |
1948 // See comment in lex.c about loophack. | 1950 // See comment in lex.c about loophack. |
1949 if(lbr == LBODY) | 1951 if(lbr == LBODY) |
1950 loophack = 1; | 1952 loophack = 1; |
1951 } | 1953 } |
1952 | 1954 |
LEFT | RIGHT |