rfc:improved-parser-error-message

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

rfc:improved-parser-error-message [2011/08/06 19:27]
stas [Request for Comments: Improved parser error message]
rfc:improved-parser-error-message [2017/09/22 13:28]
Line 1: Line 1:
-====== Request for Comments: Improved parser error message ====== 
-  * Version: 1.0 
-  * Date: 2011-05-16 
-  * Author: Felipe Pena <felipe@php.net> 
-  * Status: Implemented 
-  * Discussion: [[http://markmail.org/thread/2vptpqr72xumbfsh|May 16, 2011]] 
- 
- 
-===== Introduction ===== 
- 
-The purpose of this RFC is to propose a naming of our tokens to have an crypto-less parser error messages. This is simply achieved by using an old Bison feature. 
- 
-==== BC ==== 
- 
-There is no BC break. The token_*() functions aren't affected by the patch. 
- 
-<code> 
-$ sapi/cli/php -r 'var_dump(token_name(318));' 
-string(6) "T_ECHO" 
-</code> 
- 
-==== Examples ==== 
- 
-<code> 
-$ sapi/cli/php -r 'class abc foo' 
-Patched: 
-Parse error: syntax error, unexpected 'foo' (T_STRING), expecting '{' in Command line code on line 1 
- 
-Current: 
-Parse error: syntax error, unexpected T_STRING, expecting '{' in Command line code on line 1 
-</code> 
- 
-<code> 
-$ sapi/cli/php -r 'function ""' 
-Patched: 
-Parse error: syntax error, unexpected '""' (T_CONSTANT_ENCAPSED_STRING), expecting identifier (T_STRING) or '(' in Command line code on line 1 
- 
-Current: 
-Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING or '(' in Command line code on line 1 
-</code> 
- 
-<code> 
-$ sapi/cli/php -r 'echo ::a;' 
-Patched: 
-Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) in Command line code on line 1 
-nexpected '::' in Command line code on line 1 
- 
-Current: 
-Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in Command line code on line 1 
-</code> 
- 
-<code> 
-$ sapi/cli/php -r 'echo <<=' 
-Patched: 
-Parse error: syntax error, unexpected '<<=' (T_SL_EQUAL) in Command line code on line 1 
- 
-Current: 
-Parse error: syntax error, unexpected T_SL_EQUAL in Command line code on line 1 
-</code> 
- 
-<code> 
-$ sapi/cli/php -r 'class ' 
-Patched: 
-Parse error: syntax error, unexpected end of file, expecting identifier (T_STRING) in Command line code on line 1 
- 
-Current: 
-Parse error: syntax error, unexpected $end, expecting T_STRING in Command line code on line 1 
-</code> 
-===== Patch ===== 
- 
-  * http://felipe.ath.cx/diff/improved-error-message.diff 
  
rfc/improved-parser-error-message.txt · Last modified: 2017/09/22 13:28 (external edit)