Req #70024 [Asn]: Add column information to AST

From: Date: Fri, 10 Jul 2015 00:37:38 +0000
Subject: Req #70024 [Asn]: Add column information to AST
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194270@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70024&edit=1

 ID:                 70024
 Updated by:         rasmus@php.net
 Reported by:        krblock at computer dot org
 Summary:            Add column information to AST
 Status:             Assigned
 Type:               Feature/Change Request
 Package:            *Compile Issues
 PHP Version:        7.0.0alpha2
 Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Performance-wise it doesn't make sense to add this to the regular build, but it might be
possible to add when PHP is compiled in debug mode. That means you would need a separate PHP build,
of course.


Previous Comments:
------------------------------------------------------------------------
[2015-07-09 13:18:35] krblock at computer dot org

Static Analysis is not run on every invocation of a compiler, so it is much more tolerant of
performance degradation. The column information could be stored in a data structure on the side that
could be generated on demand and could be correlated back to the AST. For example, when doing Java
Static Analysis, we run the compiler in debug mode to get debug symbol information.

To build tools like PHPDOC and PHPXREF, this information will probably be needed as well, and the
tools will also probably be tolerant of some performance degradation.

------------------------------------------------------------------------
[2015-07-09 09:42:25] nikic@php.net

Yeah, we currently only store the line number. Adding accurate position information would require an
additional 16 bytes per AST node. I'm not sure if this is worthwhile if we don't need this
info ourselves.

------------------------------------------------------------------------
[2015-07-09 07:41:22] kalle@php.net

I don't think we uses columns anywhere in the code to help identify errors, so we would have to
add it just for this feature, Nikita do you have any input on this? (Just unassign after if desired)

------------------------------------------------------------------------
[2015-07-08 14:47:10] krblock at computer dot org

Description:
------------
I am evaluating PHP Parsers to use in a Static Analysis tool. When defects are reported, we like to
pin point the location of the issue as precisely as possible. We also like to provide cross
reference information. It would be useful to have column location stored in the AST in addition to
line location. 

Test script:
---------------
I used the AST dumper provided here:

https://github.com/nikic/php-ast

RFC for AST is here:

https://wiki.php.net/rfc/abstract_syntax_tree

Both omit column information.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70024&edit=1


Thread (7 messages)

« previous php.bugs (#194270) next »