diff --git a/example.php b/example.php index 50e3491..ac5f3bb 100644 --- a/example.php +++ b/example.php @@ -13,4 +13,14 @@ abstract class Foo extends Bar implements Buz, Buzz { public function &test(bool $a, string $b = null): ?void { } -} \ No newline at end of file +} + +if ($a === true) { +} elseif ($a === false) { +} elseif ($a === null) { +} else { +} + +?> + + \ No newline at end of file diff --git a/scanner.go b/scanner.go index eb0249e..f91e40f 100644 --- a/scanner.go +++ b/scanner.go @@ -7715,7 +7715,7 @@ yyrule5: // \<\?= { l.begin(PHP) lval.token = string(l.TokenBytes(nil)) - return T_OPEN_TAG_WITH_ECHO + return T_ECHO goto yystate0 } yyrule6: // [ \t\n\r]+ @@ -7725,7 +7725,9 @@ yyrule6: // [ \t\n\r]+ } yyrule7: // \?\>{NEW_LINE}? { - l.begin(INITIAL) //lval.token = string(l.TokenBytes(nil)); return T_CLOSE_TAG; + l.begin(INITIAL) + lval.token = ";" + return rune2Class(';') goto yystate0 } yyrule8: // {DNUM}|{EXPONENT_DNUM} diff --git a/scanner.l b/scanner.l index 702a682..e51f1e2 100644 --- a/scanner.l +++ b/scanner.l @@ -96,10 +96,10 @@ NEW_LINE (\r|\n|\r\n) \<\?php([ \t]|{NEW_LINE}) l.begin(PHP);//lval.token = string(l.TokenBytes(nil)); return T_OPEN_TAG; \<\? l.begin(PHP);//lval.token = string(l.TokenBytes(nil)); return T_OPEN_TAG; -\<\?= l.begin(PHP);lval.token = string(l.TokenBytes(nil)); return T_OPEN_TAG_WITH_ECHO; +\<\?= l.begin(PHP);lval.token = string(l.TokenBytes(nil)); return T_ECHO; [ \t\n\r]+ //lval.token = string(l.TokenBytes(nil)); return T_WHITESPACE -\?\>{NEW_LINE}? l.begin(INITIAL);//lval.token = string(l.TokenBytes(nil)); return T_CLOSE_TAG; +\?\>{NEW_LINE}? l.begin(INITIAL);lval.token = ";"; return rune2Class(';'); {DNUM}|{EXPONENT_DNUM} lval.token = string(l.TokenBytes(nil)); return T_DNUMBER {BNUM}