You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "junichi11 (via GitHub)" <gi...@apache.org> on 2023/04/05 05:30:21 UTC

[GitHub] [netbeans] junichi11 commented on a diff in pull request #5777: Fix the syntax error for Nowdoc #4345

junichi11 commented on code in PR #5777:
URL: https://github.com/apache/netbeans/pull/5777#discussion_r1158039338


##########
php/php.editor/tools/ASTPHP5Scanner.flex:
##########
@@ -1289,11 +1289,17 @@ NOWDOC_CHARS=({NEWLINE}*(([^a-zA-Z_\x7f-\xff\n\r][^\n\r]*)|({LABEL}[^a-zA-Z0-9_\
 
 
 <ST_NOWDOC> {
-    {NEWLINE}{TABS_AND_SPACES}{LABEL}";"?[^\n\r]*[\r\n]? {
-        /* <ST_NOWDOC>{NEWLINE}{TABS_AND_SPACES}{LABEL}";"?[^\n\r]*[\r\n]? */
+    {NEWLINE}+{TABS_AND_SPACES}{LABEL}";"?[^\n\r]*[\r\n]? {
+        /* <ST_NOWDOC>{NEWLINE}+{TABS_AND_SPACES}{LABEL}";"?[^\n\r]*[\r\n]? */
         if (isEndHereOrNowdoc(nowdoc)) {
             String yytext = yytext();
-            int newlineLength = yytext.startsWith("\r\n") ? 2 : 1;
+            int newlineLength = 0;
+            for (int i = 0; i < yylength(); i++) {
+                if (yytext.charAt(i) != '\n' && yytext.charAt(i) != '\r') {

Review Comment:
   Will change to the following. Thanks!
   ```java
                   char c = yytext.charAt(i);
                   if (c != '\n' && c != '\r') {
                       break;
                   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists