Alex Dowad
80598f1250
Syntax errors caused by unclosed {, [, ( mention specific location
...
Aside from a few very specific syntax errors for which detailed exceptions are
thrown, generally PHP just emits the default error messages generated by bison on syntax
error. These messages are very uninformative; they just say "Unexpected ... at line ...".
This is most problematic with constructs which can span an arbitrary number of lines, such
as blocks of code delimited by { }, 'if' conditions delimited by ( ), and so on. If a closing
delimiter is missed, the block will run for the entire remainder of the source file (which
could be thousands of lines), and then at the end, a parse error will be thrown with the
dreaded words: "Unexpected end of file".
Therefore, track the positions of opening and closing delimiters and ensure that they match
up correctly. If any mismatch or missing delimiter is detected, immediately throw a parse
error which points the user to the offending line. This is best done in the *lexer* and not
in the parser.
Thanks to Nikita Popov and George Peter Banyard for suggesting improvements.
Fixes bug #79368 .
Closes GH-5364.
2020-04-14 11:22:23 +02:00
..
2020-02-25 09:51:32 +01:00
2018-10-15 04:33:09 +02:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2018-10-14 12:07:20 -03:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2018-10-14 12:07:20 -03:00
2020-02-03 22:52:20 +01:00
2018-10-14 12:07:20 -03:00
2018-10-14 12:07:20 -03:00
2020-02-03 22:52:20 +01:00
2018-10-14 12:07:20 -03:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2018-02-10 19:20:23 +01:00
2018-02-10 19:20:23 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2018-10-14 12:07:20 -03:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2019-11-07 21:31:47 +01:00
2016-04-25 14:48:36 +03:00
2020-03-31 13:02:32 +02:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2019-01-30 09:19:02 +01:00
2020-03-31 13:02:32 +02:00
2020-02-03 22:52:20 +01:00
2018-10-14 12:07:20 -03:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2018-10-15 04:33:09 +02:00
2020-02-25 09:51:32 +01:00
2020-02-26 15:00:08 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-03-31 13:02:32 +02:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-03-09 11:29:40 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-03-09 11:29:40 +01:00
2019-09-27 15:49:18 +02:00
2020-02-03 22:52:20 +01:00
2018-10-14 12:07:20 -03:00
2018-10-14 12:07:20 -03:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2019-03-15 22:55:30 +01:00
2020-01-17 14:52:46 +01:00
2018-02-20 21:53:48 +01:00
2019-03-15 22:55:30 +01:00
2020-02-03 22:52:20 +01:00
2020-01-10 13:39:56 +01:00
2018-10-14 12:07:20 -03:00
2019-10-04 11:28:58 +02:00
2018-10-14 12:56:38 +02:00
2019-03-15 22:55:30 +01:00
2020-02-03 22:52:20 +01:00
2020-02-26 15:00:08 +01:00
2020-02-26 15:00:08 +01:00
2020-02-03 22:52:20 +01:00
2019-11-07 21:31:47 +01:00
2020-02-03 22:52:20 +01:00
2019-09-27 15:49:18 +02:00
2018-10-14 12:07:20 -03:00
2018-10-14 19:46:15 +02:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2018-10-14 12:07:20 -03:00
2019-11-07 21:31:47 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-03-09 11:29:40 +01:00
2020-02-03 22:52:20 +01:00
2016-11-20 22:31:24 +01:00
2016-11-20 22:31:24 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2018-10-14 12:07:20 -03:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-03-31 16:32:58 +02:00
2020-02-03 22:52:20 +01:00
2020-03-31 16:32:58 +02:00
2020-03-31 16:32:58 +02:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-03-31 16:32:58 +02:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2018-10-15 04:33:09 +02:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-07 13:36:52 +03:00
2020-03-31 13:02:32 +02:00
2020-02-03 22:52:20 +01:00
2020-03-31 13:02:32 +02:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-01-16 09:46:47 +01:00
2020-02-07 13:36:52 +03:00
2019-11-07 21:31:47 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-03-31 13:02:32 +02:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00
2019-11-07 21:31:47 +01:00
2020-04-14 11:22:23 +02:00
2019-11-07 21:31:47 +01:00
2020-02-03 22:52:20 +01:00
2020-02-26 15:00:08 +01:00
2020-02-03 22:52:20 +01:00
2020-02-03 22:52:20 +01:00