LuchianMihai commented on PR #15847:
URL: https://github.com/apache/nuttx/pull/15847#issuecomment-2672734068

   This will take a lot of work...
   I tried to avoid the following situation, but without refactoring it will 
not be possible.
   eg. switch should be checked explicitly for every valid syntax.
   ```c
            else if (strncmp(&line[indent], "switch ", 7) == 0)
              {
                bswitch = true;
              }
            else if (strncmp(&line[indent], "switch(", 7) == 0)
              {
                ERROR("Missing whitespace after keyword", lineno, n);
                bswitch = true;
              }
            else if (strncmp(&line[indent], "case ", 5) == 0)
              {
                bcase = true;
              }
            else if (strncmp(&line[indent], "case(", 5) == 0)
              {
                ERROR("Missing whitespace after keyword", lineno, n);
                bcase = true;
              }
            else if (strncmp(&line[indent], "default ", 8) == 0)
              {
                ERROR("Missing whitespace after keyword", lineno, n);
                bcase = true;
              }
            else if (strncmp(&line[indent], "default:", 8) == 0)
              {
                bcase = true;
              }
   ```
   So just by this example I can see that `default` keyword should be handled 
with one or more white spaces and colons else we face same problem if we use 
defaulting or similar words as part of names.  
   `break` faces similar problem, nxstyle will confuse it with breaking, 
breakage and others.
   
   Unfortunately nxstyle compares strings without tokenizing the file. 


-- 
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: commits-unsubscr...@nuttx.apache.org

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

Reply via email to