Skip to content

Commit

Permalink
Merge pull request apache#830 from junichi11/fix-php-heredoc-nowdoc-s…
Browse files Browse the repository at this point in the history
…yntaxes

Fix ASTPHP5Scanner (Heredoc & Nowdoc syntaxes)
  • Loading branch information
tmysik authored Sep 3, 2018
2 parents 4fe72ac + 3c6113a commit fc5673b
Show file tree
Hide file tree
Showing 34 changed files with 1,878 additions and 1,726 deletions.
2,887 changes: 1,486 additions & 1,401 deletions php/php.editor/src/org/netbeans/modules/php/editor/parser/ASTPHP5Scanner.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
<token id='T_VARIABLE' start='69' end='73'>
<text>$age</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='73' end='84'>
<text>&lt;br&gt;\nHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='73' end='78'>
<text>&lt;br&gt;\n</text>
</token>
<token id='T_END_HEREDOC' start='84' end='85'>
<text>C</text>
<token id='T_END_HEREDOC' start='78' end='85'>
<text>HEREDOC</text>
</token>
<token id='T_SEMICOLON' start='85' end='86'>
<text>;</text>
Expand All @@ -72,11 +72,11 @@
<token id='T_START_HEREDOC' start='108' end='124'>
<text>&lt;&lt;&lt;ENDOFHEREDOC\n</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='124' end='190'>
<text>This is another heredoc test.\nWith another line in it.\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='124' end='179'>
<text>This is another heredoc test.\nWith another line in it.\n</text>
</token>
<token id='T_END_HEREDOC' start='190' end='191'>
<text>C</text>
<token id='T_END_HEREDOC' start='179' end='191'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='191' end='192'>
<text>;</text>
Expand All @@ -90,11 +90,11 @@
<token id='T_START_HEREDOC' start='200' end='216'>
<text>&lt;&lt;&lt;ENDOFHEREDOC\n</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='303' end='335'>
<text>\nNow let&apos;s finish it\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='216' end='324'>
<text>This is a heredoc test.\nNOTREALLYEND;\nAnother line\nNOTENDEITHER;\nENDOFHEREDOCWILLBESOON\nNow let&apos;s finish it\n</text>
</token>
<token id='T_END_HEREDOC' start='335' end='336'>
<text>C</text>
<token id='T_END_HEREDOC' start='324' end='336'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='336' end='337'>
<text>;</text>
Expand Down Expand Up @@ -158,7 +158,7 @@
<Variable start='69' end='73' isDollared='true'>
<Identifier start='70' end='73' name='age'/>
</Variable>
<Scalar start='73' end='84' type='STRING' value='&lt;br&gt;\n'/>
<Scalar start='73' end='78' type='STRING' value='&lt;br&gt;\n'/>
</Expressions>
</Quote>
</EchoStatement>
Expand All @@ -177,7 +177,7 @@
</Variable>
<Quote start='108' end='191' type='HEREDOC'>
<Expressions>
<Scalar start='124' end='190' type='STRING' value='This is another heredoc test.\nWith another line in it.\n'/>
<Scalar start='124' end='179' type='STRING' value='This is another heredoc test.\nWith another line in it.\n'/>
</Expressions>
</Quote>
</Assignment>
Expand All @@ -189,7 +189,7 @@
</Variable>
<Quote start='200' end='336' type='HEREDOC'>
<Expressions>
<Scalar start='303' end='335' type='STRING' value='\nNow let&apos;s finish it\n'/>
<Scalar start='216' end='324' type='STRING' value='This is a heredoc test.\nNOTREALLYEND;\nAnother line\nNOTENDEITHER;\nENDOFHEREDOCWILLBESOON\nNow let&apos;s finish it\n'/>
</Expressions>
</Quote>
</Assignment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@
<token id='T_START_HEREDOC' start='31' end='42'>
<text>&lt;&lt;&lt;HEREDOC\n</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='42' end='49'>
<text>Name: \n</text>
</token>
<token id='EOF' start='49' end='49'>
<text></text>
</token>
</scanner>
<Program start='0' end='48'>
<Program start='0' end='42'>
<Comments>
</Comments>
<Statements>
Expand All @@ -57,7 +54,7 @@
<Scalar start='22' end='24' type='INT' value='10'/>
</Assignment>
</ExpressionStatement>
<ASTError start='26' end='48'/>
<ASTError start='26' end='42'/>
</Statements>
</Program>
</testresult>
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<token id='T_START_HEREDOC' start='80' end='96'>
<text>&lt;&lt;&lt;ENDOFHEREDOC\n</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='96' end='132'>
<text>This is a heredoc test.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='96' end='121'>
<text>This is a heredoc test.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='132' end='133'>
<text>C</text>
<token id='T_END_HEREDOC' start='121' end='133'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='133' end='134'>
<text>;</text>
Expand All @@ -36,11 +36,11 @@
<token id='T_START_HEREDOC' start='141' end='157'>
<text>&lt;&lt;&lt;ENDOFHEREDOC\n</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='157' end='199'>
<text>This is another heredoc test.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='157' end='188'>
<text>This is another heredoc test.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='199' end='200'>
<text>C</text>
<token id='T_END_HEREDOC' start='188' end='200'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='200' end='201'>
<text>;</text>
Expand Down Expand Up @@ -94,7 +94,7 @@
<Parameters>
<Quote start='80' end='133' type='HEREDOC'>
<Expressions>
<Scalar start='96' end='132' type='STRING' value='This is a heredoc test.\n\n'/>
<Scalar start='96' end='121' type='STRING' value='This is a heredoc test.\n\n'/>
</Expressions>
</Quote>
</Parameters>
Expand All @@ -107,7 +107,7 @@
</Variable>
<Quote start='141' end='200' type='HEREDOC'>
<Expressions>
<Scalar start='157' end='199' type='STRING' value='This is another heredoc test.\n\n'/>
<Scalar start='157' end='188' type='STRING' value='This is another heredoc test.\n\n'/>
</Expressions>
</Quote>
</Assignment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<token id='T_START_HEREDOC' start='87' end='104'>
<text>b&lt;&lt;&lt;ENDOFHEREDOC\n</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='104' end='140'>
<text>This is a heredoc test.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='104' end='129'>
<text>This is a heredoc test.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='140' end='141'>
<text>C</text>
<token id='T_END_HEREDOC' start='129' end='141'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='141' end='142'>
<text>;</text>
Expand All @@ -36,11 +36,11 @@
<token id='T_START_HEREDOC' start='149' end='166'>
<text>b&lt;&lt;&lt;ENDOFHEREDOC\n</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='166' end='208'>
<text>This is another heredoc test.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='166' end='197'>
<text>This is another heredoc test.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='208' end='209'>
<text>C</text>
<token id='T_END_HEREDOC' start='197' end='209'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='209' end='210'>
<text>;</text>
Expand Down Expand Up @@ -94,7 +94,7 @@
<Parameters>
<Quote start='87' end='141' type='HEREDOC'>
<Expressions>
<Scalar start='104' end='140' type='STRING' value='This is a heredoc test.\n\n'/>
<Scalar start='104' end='129' type='STRING' value='This is a heredoc test.\n\n'/>
</Expressions>
</Quote>
</Parameters>
Expand All @@ -107,7 +107,7 @@
</Variable>
<Quote start='149' end='209' type='HEREDOC'>
<Expressions>
<Scalar start='166' end='208' type='STRING' value='This is another heredoc test.\n\n'/>
<Scalar start='166' end='197' type='STRING' value='This is another heredoc test.\n\n'/>
</Expressions>
</Quote>
</Assignment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
<token id='T_VARIABLE' start='140' end='142'>
<text>$a</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='142' end='156'>
<text>.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='142' end='145'>
<text>.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='156' end='157'>
<text>C</text>
<token id='T_END_HEREDOC' start='145' end='157'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='157' end='158'>
<text>;</text>
Expand All @@ -48,11 +48,11 @@
<token id='T_VARIABLE' start='203' end='205'>
<text>$b</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='205' end='219'>
<text>.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='205' end='208'>
<text>.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='219' end='220'>
<text>C</text>
<token id='T_END_HEREDOC' start='208' end='220'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='220' end='221'>
<text>;</text>
Expand Down Expand Up @@ -110,7 +110,7 @@
<Variable start='140' end='142' isDollared='true'>
<Identifier start='141' end='142' name='a'/>
</Variable>
<Scalar start='142' end='156' type='STRING' value='.\n\n'/>
<Scalar start='142' end='145' type='STRING' value='.\n\n'/>
</Expressions>
</Quote>
</Parameters>
Expand All @@ -127,7 +127,7 @@
<Variable start='203' end='205' isDollared='true'>
<Identifier start='204' end='205' name='b'/>
</Variable>
<Scalar start='205' end='219' type='STRING' value='.\n\n'/>
<Scalar start='205' end='208' type='STRING' value='.\n\n'/>
</Expressions>
</Quote>
</Assignment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
<token id='T_CURLY_CLOSE' start='143' end='144'>
<text>}</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='144' end='158'>
<text>.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='144' end='147'>
<text>.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='158' end='159'>
<text>C</text>
<token id='T_END_HEREDOC' start='147' end='159'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='159' end='160'>
<text>;</text>
Expand All @@ -60,11 +60,11 @@
<token id='T_CURLY_CLOSE' start='208' end='209'>
<text>}</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='209' end='223'>
<text>.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='209' end='212'>
<text>.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='223' end='224'>
<text>C</text>
<token id='T_END_HEREDOC' start='212' end='224'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='224' end='225'>
<text>;</text>
Expand Down Expand Up @@ -124,7 +124,7 @@
<Identifier start='142' end='143' name='a'/>
</Variable>
</ReflectionVariable>
<Scalar start='144' end='158' type='STRING' value='.\n\n'/>
<Scalar start='144' end='147' type='STRING' value='.\n\n'/>
</Expressions>
</Quote>
</Parameters>
Expand All @@ -143,7 +143,7 @@
<Identifier start='207' end='208' name='b'/>
</Variable>
</ReflectionVariable>
<Scalar start='209' end='223' type='STRING' value='.\n\n'/>
<Scalar start='209' end='212' type='STRING' value='.\n\n'/>
</Expressions>
</Quote>
</Assignment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
<token id='T_STRING' start='177' end='178'>
<text>d</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='178' end='192'>
<text>.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='178' end='181'>
<text>.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='192' end='193'>
<text>C</text>
<token id='T_END_HEREDOC' start='181' end='193'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='193' end='194'>
<text>;</text>
Expand Down Expand Up @@ -108,11 +108,11 @@
<token id='T_STRING' start='266' end='267'>
<text>d</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='267' end='281'>
<text>.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='267' end='270'>
<text>.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='281' end='282'>
<text>C</text>
<token id='T_END_HEREDOC' start='270' end='282'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='282' end='283'>
<text>;</text>
Expand Down Expand Up @@ -162,13 +162,13 @@
<ASTError start='163' end='163'/>
<ASTError start='163' end='173'/>
<ASTError start='173' end='178'/>
<ASTError start='178' end='192'/>
<ASTError start='178' end='181'/>
<EmptyStatement start='193' end='194'/>
<ASTError start='196' end='252'/>
<ASTError start='252' end='252'/>
<ASTError start='252' end='262'/>
<ASTError start='262' end='267'/>
<ASTError start='267' end='281'/>
<ASTError start='267' end='270'/>
<EmptyStatement start='282' end='283'/>
<ExpressionStatement start='285' end='298'>
<FunctionInvocation start='285' end='297'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@
<token id='T_CURLY_CLOSE' start='183' end='184'>
<text>}</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='184' end='198'>
<text>.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='184' end='187'>
<text>.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='198' end='199'>
<text>C</text>
<token id='T_END_HEREDOC' start='187' end='199'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='199' end='200'>
<text>;</text>
Expand Down Expand Up @@ -162,11 +162,11 @@
<token id='T_CURLY_CLOSE' start='280' end='281'>
<text>}</text>
</token>
<token id='T_ENCAPSED_AND_WHITESPACE' start='281' end='295'>
<text>.\n\nENDOFHEREDO</text>
<token id='T_ENCAPSED_AND_WHITESPACE' start='281' end='284'>
<text>.\n\n</text>
</token>
<token id='T_END_HEREDOC' start='295' end='296'>
<text>C</text>
<token id='T_END_HEREDOC' start='284' end='296'>
<text>ENDOFHEREDOC</text>
</token>
<token id='T_SEMICOLON' start='296' end='297'>
<text>;</text>
Expand Down Expand Up @@ -260,7 +260,7 @@
</Field>
</FieldAccess>
</ReflectionVariable>
<Scalar start='184' end='198' type='STRING' value='.\n\n'/>
<Scalar start='184' end='187' type='STRING' value='.\n\n'/>
</Expressions>
</Quote>
</Parameters>
Expand Down Expand Up @@ -313,7 +313,7 @@
</Field>
</FieldAccess>
</ReflectionVariable>
<Scalar start='281' end='295' type='STRING' value='.\n\n'/>
<Scalar start='281' end='284' type='STRING' value='.\n\n'/>
</Expressions>
</Quote>
</Assignment>
Expand Down
Loading

0 comments on commit fc5673b

Please sign in to comment.