Questions tagged [php-parser]

73 questions
15
votes
2 answers

Limitations of PEG grammar & parser generators?

I was enjoying using YARD a lot: http://www.ootl.org/yard/ http://code.google.com/p/yardparser/ http://www.codeproject.com/KB/recipes/yard-tokenizer.aspx I was able to construct fully functional calculator. I'm evaluating YARD to do PHP parser.…
Viet
  • 17,944
  • 33
  • 103
  • 135
6
votes
1 answer

Laravel 4 using nikic phpparser : Going out of memory when sending email

Just learned that Laravel using nikic phpparser internally. I modified my code to sending emails on one of the conditions & it started dying. The PHP logs showed this : [Sat Oct 03 21:18:23 2015] [error] [client xx.xx.xx.xx] PHP Fatal error: …
PlanetUnknown
  • 3,956
  • 4
  • 49
  • 67
4
votes
1 answer

How to use PHP-Parser to get the global variables name and change it

I want to use PHP-Parser library to get the global method (_POST, _GET, _REQUEST) to get values in PHP. I'm using PHP-Parser where I want to check the node name if it equal to (_POST, _GET, _REQUEST). I'm still beginner in PHP-Parser and not figure…
4
votes
2 answers

Convert HTML table rows into PHP array and save it to database?

I'm trying to save a html table rows into php array and then save the array in database.
Irfan
  • 4,882
  • 12
  • 52
  • 62
3
votes
2 answers

Why embedding functions inside of strings is different than variables

I've asked a question like this before but this one is different, this is more about parsing logic. My previous questions was about how to embed a function inside of a string (double-quoted) and I received this answer: $date = "date"; echo "This…
Tarik
  • 79,711
  • 83
  • 236
  • 349
3
votes
1 answer

What is Laravel using PHPParser(nikic) for?

I'm facing an issue where the parser is going out of memory - /nikic/php-parser/lib/PHPParser/Node/Expr/Identical.php on line 25 /nikic/php-parser/lib/PHPParser/Parser.php on line 1044 And this is happening when I'm sending an email at that too…
PlanetUnknown
  • 3,956
  • 4
  • 49
  • 67
3
votes
1 answer

Is it possible to parse PHP using PEG?

The question is very straightforward: Is it possible to parse PHP using PEG? I want to use a PEG parser-generator to parse PHP. Please kindly advise. Thank you!
Viet
  • 17,944
  • 33
  • 103
  • 135
2
votes
0 answers

How to use Nikic/PHP-parser to extract HTML tags from PHP files

Now I need a Visitor to extract the HTML tag from the PHP file. At first, I thought I would just extract the Value of a Node of type InLineHTML. Just like this if ($node instanceof Node\Stmt\InlineHTML) { self::$result[] =…
L2ksy0d
  • 83
  • 4
2
votes
1 answer

INSERT node into PHP AST with nikic/PHP-Parser

Im using https://github.com/nikic/PHP-Parser. What is a good strategy when wanting to INSERT a node in the AST? With the traverser I can UPDATE and DELETE nodes easily using a NodeTraverser class. But how can I "INSERT before" or "INSERT after" a…
ajthinking
  • 3,386
  • 8
  • 45
  • 75
2
votes
1 answer

Markdown - PHP parser

Do you know about some markdown PHP parser, with code highlight, etc, like the GitHub markdown parser or https://stackedit.io/editor? If it is available via Composer then better. I've…
Angel
  • 611
  • 2
  • 10
  • 18
2
votes
0 answers

Parsing conditions in a custom DSL using a tokenizer

I am trying to parse a "rules string" provided over an API in PHP. Given that I have an array of items such as $items = [41, 42, 51, 54, 65, 12]; I wish to evaluate this expression ({41} AND {51}) OR ({31} AND {42}) In this instance it should…
Simon Bowen
  • 31
  • 1
  • 3
2
votes
3 answers

PHP- HTML parsing :: How can be taken charset value of webpage with simple html dom parser?

PHP:: How can be taken charset value of webpage with simple html dom parser (utf-8, windows-255, etc..)? remark: its have to be done with html dom parser http://simplehtmldom.sourceforge.net Example1 webpage charset input:
Ben
  • 25,389
  • 34
  • 109
  • 165
2
votes
4 answers

Parsing JSON Feed

I have a json feed in a URL that contains following data. [{"ID":1123,"OrderNumber":"1394","ProjectType":"Postcard","Template":"WtlossStudy…
LSN
  • 328
  • 2
  • 14
2
votes
0 answers

How can we solve this composer installation issue with php-parser

I am using Ubuntu 14 and Nginx. I'm getting this error when trying to install PHP-Parser. composer install Loading composer repositories with package information Installing dependencies (including require-dev) Your requirements could not be resolved…
2
votes
1 answer

php get contents of function - regexp possible?

I have a regex for finding all function definitions. What I want to do now is to get also the contents in the functions e.g. as third field in $matches is that possible using regex or do I need some push-pop machine because of the nesting of {}…
Karl Adler
  • 15,780
  • 10
  • 70
  • 88
1
2 3 4 5