Page MenuHomePhabricator

Align PHPAST lexer to PHP 5.5.8
ClosedPublic

Authored by epriestley on Jan 21 2014, 8:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 12:11 AM
Unknown Object (File)
Mon, Apr 8, 2:09 AM
Unknown Object (File)
Mar 17 2024, 3:22 PM
Unknown Object (File)
Mar 12 2024, 12:41 AM
Unknown Object (File)
Mar 10 2024, 8:09 AM
Unknown Object (File)
Feb 10 2024, 5:12 PM
Unknown Object (File)
Feb 8 2024, 10:04 AM
Unknown Object (File)
Feb 7 2024, 9:24 PM
Subscribers

Details

Summary

Ref T4334. This aligns the lexer (but not the parser) with PHP 5.5.8. It also applies the patch on T3512. This has these positive effects:

  • Fixes binary literals.
  • Fixes empty heredoc.
  • Corrects T_BINARY_CAST into T_STRING_CAST (consistent with 5.5.8).
  • Removes T_UNICODE_CAST (not in 5.5.8).
  • Recognizes keywords trait, __trait__, yield, insteadof, callable.

...these sideways effects:

  • Slightly improves terminal heredocs (previously: parse error; now: bad parse).

...and these negative effects:

  • Breaks the callable test, since callable is now recognized as a keyword but the parser doesn't yet support it.
Test Plan

Rebuilt xhpast, ran unit tests.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

src/parser/xhpast/__tests__/data/php-syntax.php.expect
10848

This is (binary) now being parsed as T_STRING_CAST (like PHP 5.5.8).