From e3f6bd529f2c6d1ca902ef1adcd30fc4decedf28 Mon Sep 17 00:00:00 2001 From: Eric Evans Date: Mon, 10 Aug 2009 19:34:38 +0000 Subject: [PATCH] CASSANDRA-296 fix grammar breakage Changeset ada820 was an attempt to make hostname parsing less stupid, (i.e. don't allow underscores; do allow hyphens; allow IP addresses). It didn't entirely fix the problems it set out to and it broke parsing of anything that used the "Identifier" lexer, (for example the thrift {get,set} ... commands). This changeset partially reverts ada820 until a proper fix to hostname parsing can be found. git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@802908 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/cassandra/cli/Cli.g | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/java/org/apache/cassandra/cli/Cli.g b/src/java/org/apache/cassandra/cli/Cli.g index a61108599a..15a0b1b777 100644 --- a/src/java/org/apache/cassandra/cli/Cli.g +++ b/src/java/org/apache/cassandra/cli/Cli.g @@ -85,7 +85,7 @@ stmt connectStmt : K_CONNECT host SLASH port -> ^(NODE_CONNECT host port) - | K_CONNECT ip SLASH port -> ^(NODE_CONNECT ip port) + | K_CONNECT ipaddr SLASH port -> ^(NODE_CONNECT ipaddr port) ; helpStmt @@ -150,9 +150,9 @@ value: StringLiteral; columnOrSuperColumn: StringLiteral; -host: id+=HostIdentifier -> ^(NODE_ID_LIST $id+); +host: id+=Identifier (id+=DOT id+=Identifier)* -> ^(NODE_ID_LIST $id+); -ip: id+=IntegerLiteral id+=DOT id+=IntegerLiteral id+=DOT id+=IntegerLiteral id+=DOT id+=IntegerLiteral -> ^(NODE_ID_LIST $id+); +ipaddr: id+=IntegerLiteral id+=DOT id+=IntegerLiteral id+=DOT id+=IntegerLiteral id+=DOT id+=IntegerLiteral -> ^(NODE_ID_LIST $id+); port: IntegerLiteral; @@ -195,9 +195,15 @@ Digit : '0'..'9' ; +fragment +Alnum + : Letter + | Digit + ; + // syntactic Elements Identifier - : Letter ( Letter | Digit | '_')* + : Letter ( Alnum | '_' )* ; // literals @@ -206,14 +212,10 @@ StringLiteral '\'' (~'\'')* '\'' ( '\'' (~'\'')* '\'' )* ; + IntegerLiteral : Digit+; - -HostIdentifier - : ( Letter | Digit ) ( Letter | Digit | DOT | '-' )* ( Letter | Digit ) - ; - // // syntactic elements //