# #line C macro equivalent in php ?

- Thread: https://externals.io/message/23239
- Original archive: https://news-web.php.net/php.internals/23239
- Started by William Candillon on 2006-05-11T07:31:49+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #23239 — William Candillon — 2006-05-11T07:31:49+00:00

URL: https://externals.io/message/23239#23239

Hello,

I'd like to know, if it's possible to create a php function in C which
modify the line number and the php interpreter. It will be very useful
for tools generating php code (lex, yacc, smarty etc).
For exemple:
echo __FILE__//show parser.php
__setLine(8);__setFile('parser.y');
toto();
Will show the following warning:
Call to undefined function: toto() in parser.y at line 9

Best regards,

William

-- 
William Candillon
Telecom Lille Student
E-mail: wcandillon@elv.enic.fr
Tel: +33(0) 6 67 99 13 16
CV: http://wcandillon.netcv.org
Resume: http://wcandillon.en.netcv.org

---

## #23240 — Xuefer — 2006-05-11T08:46:54+00:00

URL: https://externals.io/message/23239#23240 · In reply to: #23239

i'll second that idea, but not the syntax.
template engine such smarty, and compiler compiler, need it really.

---

## #23256 — Marcus Boerger — 2006-05-11T18:19:09+00:00

URL: https://externals.io/message/23239#23256 · In reply to: #23239

Hello William,

  as long as php has no goto no such generator is capable of generating php
code. When that changes we want to have something alike of course. But
actuall it is already in HEAD ... So then....Why not cimply go with this:
#line <file> <line>
to simple becuase the tools in question would already do that?

Thursday, May 11, 2006, 9:31:49 AM, you wrote:

> Hello,

> I'd like to know, if it's possible to create a php function in C which
> modify the line number and the php interpreter. It will be very useful
> for tools generating php code (lex, yacc, smarty etc).
> For exemple:
> echo __FILE__//show parser.php
> __setLine(8);__setFile('parser.y');
> toto();
> Will show the following warning:
> Call to undefined function: toto() in parser.y at line 9

> Best regards,

> William

> -- 
> William Candillon
> Telecom Lille Student
> E-mail: wcandillon@elv.enic.fr
> Tel: +33(0) 6 67 99 13 16
> CV: http://wcandillon.netcv.org
> Resume: http://wcandillon.en.netcv.org




Best regards,
 Marcus
