strongduanmu commented on code in PR #25620:
URL: https://github.com/apache/shardingsphere/pull/25620#discussion_r1193282339


##########
parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/Literals.g4:
##########
@@ -66,10 +66,15 @@ BIT_NUM_
     ;
 
 IDENTIFIER_
-    : 
[A-Za-z_$0-9\u0080-\uFFFF]*?[A-Za-z_$\u0080-\uFFFF]+?[A-Za-z_$0-9\u0080-\uFFFF]*
+    :  IP_ADDRESS

Review Comment:
   Following is ShardingSphere BaseRule.g4 content:
   
   ```
   textOrIdentifier
       : identifier | string_
       ;
       
   variable
       : userVariable | systemVariable
       ;
       
   userVariable
       : AT_ textOrIdentifier
       | textOrIdentifier
       ;
   ```



##########
parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/Literals.g4:
##########
@@ -66,10 +66,15 @@ BIT_NUM_
     ;
 
 IDENTIFIER_
-    : 
[A-Za-z_$0-9\u0080-\uFFFF]*?[A-Za-z_$\u0080-\uFFFF]+?[A-Za-z_$0-9\u0080-\uFFFF]*
+    :  IP_ADDRESS

Review Comment:
   Can you move ip address parse to BaseRule? You can refer mysql parse logic 
in sql_yacc.yy file.
   
   ```
   ident_or_text:
             ident           { $$=$1;}
           | TEXT_STRING_sys { $$=$1;}
           | LEX_HOSTNAME { $$=$1;}
           ;
   
   role_ident_or_text:
             role_ident
           | TEXT_STRING_sys
           | LEX_HOSTNAME
           ;
   
   user_ident_or_text:
             ident_or_text
             {
               if (!($$= LEX_USER::alloc(YYTHD, &$1, NULL)))
                 MYSQL_YYABORT;
             }
           | ident_or_text '@' ident_or_text
             {
               if (!($$= LEX_USER::alloc(YYTHD, &$1, &$3)))
                 MYSQL_YYABORT;
             }
           ;
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to