summaryrefslogtreecommitdiff
path: root/Zend/zend_language_parser.y
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-10-15 21:23:29 +0200
committerNikita Popov <nikic@php.net>2015-10-15 22:13:14 +0200
commit06f38d36a8df884775fc674d09f30cc7949c987d (patch)
treee29cc187e86a653915f7aa9a5fbb668bbe4e20a6 /Zend/zend_language_parser.y
parent88a69ffa58e8fdc8409bb567a2bd6b75b4232c41 (diff)
downloadphp-git-06f38d36a8df884775fc674d09f30cc7949c987d.tar.gz
Reindent zend_yytnamerr
Separating this whitespace change from the next diff.
Diffstat (limited to 'Zend/zend_language_parser.y')
-rw-r--r--Zend/zend_language_parser.y76
1 files changed, 37 insertions, 39 deletions
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index dde76351e9..a253a76eff 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -1281,46 +1281,44 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
if (!yyres) {
return yystrlen(yystr);
}
- {
- if (CG(parse_error) == 0) {
- char buffer[120];
- const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL;
- unsigned int len = 0, toklen = 0, yystr_len;
-
- CG(parse_error) = 1;
-
- if (LANG_SCNG(yy_text)[0] == 0 &&
- LANG_SCNG(yy_leng) == 1 &&
- memcmp(yystr, "\"end of file\"", sizeof("\"end of file\"") - 1) == 0) {
- yystpcpy(yyres, "end of file");
- return sizeof("end of file")-1;
- }
-
- str = LANG_SCNG(yy_text);
- end = memchr(str, '\n', LANG_SCNG(yy_leng));
- yystr_len = (unsigned int)yystrlen(yystr);
-
- if ((tok1 = memchr(yystr, '(', yystr_len)) != NULL
- && (tok2 = zend_memrchr(yystr, ')', yystr_len)) != NULL) {
- toklen = (tok2 - tok1) + 1;
- } else {
- tok1 = tok2 = NULL;
- toklen = 0;
- }
-
- if (end == NULL) {
- len = LANG_SCNG(yy_leng) > 30 ? 30 : LANG_SCNG(yy_leng);
- } else {
- len = (end - str) > 30 ? 30 : (end - str);
- }
- if (toklen) {
- snprintf(buffer, sizeof(buffer), "'%.*s' %.*s", len, str, toklen, tok1);
- } else {
- snprintf(buffer, sizeof(buffer), "'%.*s'", len, str);
- }
- yystpcpy(yyres, buffer);
- return len + (toklen ? toklen + 1 : 0) + 2;
+ if (CG(parse_error) == 0) {
+ char buffer[120];
+ const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL;
+ unsigned int len = 0, toklen = 0, yystr_len;
+
+ CG(parse_error) = 1;
+
+ if (LANG_SCNG(yy_text)[0] == 0 &&
+ LANG_SCNG(yy_leng) == 1 &&
+ memcmp(yystr, "\"end of file\"", sizeof("\"end of file\"") - 1) == 0) {
+ yystpcpy(yyres, "end of file");
+ return sizeof("end of file")-1;
}
+
+ str = LANG_SCNG(yy_text);
+ end = memchr(str, '\n', LANG_SCNG(yy_leng));
+ yystr_len = (unsigned int)yystrlen(yystr);
+
+ if ((tok1 = memchr(yystr, '(', yystr_len)) != NULL
+ && (tok2 = zend_memrchr(yystr, ')', yystr_len)) != NULL) {
+ toklen = (tok2 - tok1) + 1;
+ } else {
+ tok1 = tok2 = NULL;
+ toklen = 0;
+ }
+
+ if (end == NULL) {
+ len = LANG_SCNG(yy_leng) > 30 ? 30 : LANG_SCNG(yy_leng);
+ } else {
+ len = (end - str) > 30 ? 30 : (end - str);
+ }
+ if (toklen) {
+ snprintf(buffer, sizeof(buffer), "'%.*s' %.*s", len, str, toklen, tok1);
+ } else {
+ snprintf(buffer, sizeof(buffer), "'%.*s'", len, str);
+ }
+ yystpcpy(yyres, buffer);
+ return len + (toklen ? toklen + 1 : 0) + 2;
}
if (*yystr == '"') {
YYSIZE_T yyn = 0;