/// BOF line comment /* BOF block comment */ class TestClass extends Actor abstract native; //nativereplication; /* One blank line follows to test has_blank_line_after() */ function int fuck_you(int a, float b, string c) { // ---- locals with an error to trigger recovery to comma/semicolon local int i, /* oops */ , k; local int a, b, c; // ---- builtins: valid + error + various initializers int a = 1, b, , c = 3; float f = (1.0 + 2.0) * 0.5; bool flag = true; string s = "hi\n\"ok\""; name tag; array nums; // ---- label + goto start: goto start2; // ---- if / else with tail-as-value and missing semicolons inside if (a + c > 0) { while (a < 5) { if (flag) { break; } a + 1; // ok continue } // missing ';' before '}' should be fine (SelfTerminating) } else { { a + 2; b // tail expression (no ';') becomes block tail } } // ---- for with header pieces using statement-as-value for (i; i < 10; i += 1) { j + i; i + j // no semicolon, next is '}' so this is a tail } // ---- assert with a block-as-value (statement-as-value) assert { i = i + 1; i // tail is the value of the block }; // ---- foreach (paren and no-paren forms) foreach (nums) { i++ } foreach nums { --i; // prefix and postfix in play j-- } // ---- do ... until (paren and no-paren) + semicolon handling do { i = i + 1 } until (i > 3); do i = i + 1; until i > 5; // ---- switch with multi-label case, recovery, and default switch (a + c) { case 0: case 1: a = a + 10 // missing ';' here forces recovery to next boundary (case/default/}) case 2: assert (a > 0); // regular statement break; case 3, 4: break; default: // some stray token sequence to poke "unexpected token in switch body" /* block comment with newlines */ a + ; // malformed expr; recover to boundary continue; // legal statement after recovery } // ---- second label target for goto start2: return a; // final return } // EOF trailing line comment /* EOF trailing block comment */