drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [29/45] drill git commit: DRILL-3987: (CLEANUP) Delete unused files
Date Fri, 13 Nov 2015 02:37:59 GMT
DRILL-3987: (CLEANUP) Delete unused files


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/363bf33d
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/363bf33d
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/363bf33d

Branch: refs/heads/master
Commit: 363bf33d1323157818582ad66a3d3b37eadeaa77
Parents: 62353a6
Author: Jacques Nadeau <jacques@apache.org>
Authored: Sun Nov 8 08:20:19 2015 -0800
Committer: Jacques Nadeau <jacques@apache.org>
Committed: Thu Nov 12 17:00:48 2015 -0800

----------------------------------------------------------------------
 .../drill/common/storage/proto/ProtoLexer.g.bk  | 287 ---------
 .../drill/common/storage/proto/ProtoParser.g.bk | 605 -------------------
 2 files changed, 892 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/363bf33d/common/src/main/antlr3/org/apache/drill/common/storage/proto/ProtoLexer.g.bk
----------------------------------------------------------------------
diff --git a/common/src/main/antlr3/org/apache/drill/common/storage/proto/ProtoLexer.g.bk
b/common/src/main/antlr3/org/apache/drill/common/storage/proto/ProtoLexer.g.bk
deleted file mode 100644
index 81b3e03..0000000
--- a/common/src/main/antlr3/org/apache/drill/common/storage/proto/ProtoLexer.g.bk
+++ /dev/null
@@ -1,287 +0,0 @@
-//========================================================================
-//Copyright 2007-2009 David Yu dyuproject@gmail.com
-//------------------------------------------------------------------------
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at 
-//http://www.apache.org/licenses/LICENSE-2.0
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
-//========================================================================
-
-/** Apache Drill notes: Based off r1586 of protostuff **/
-
-lexer grammar ProtoLexer;
-
-options {
-   language=Java;  // Default
-}
-
-@header {
-    package org.apache.drill.common.storage.proto;
-}
-    
-ASSIGN
-    :   '='
-    ;
-    
-AT
-    :   '@'
-    ;
-    
-LEFTCURLY
-    :   '{'
-    ;
-    
-RIGHTCURLY
-    :   '}'
-    ;
-    
-LEFTPAREN
-    :   '('
-    ;
-    
-RIGHTPAREN
-    :   ')'
-    ;
-    
-LEFTSQUARE
-    :   '['
-    ;
-    
-RIGHTSQUARE
-    :   ']'
-    ;
-
-SEMICOLON
-    :   ';'
-    ;
-    
-COMMA
-    :   ','
-    ;
-    
-PLUS
-    :   '+'
-    ;
-    
-MINUS
-    :   '-'
-    ;
-    
-TO
-    :   'to'
-    ;
-
-TRUE
-    :   'true'
-    ;
-    
-FALSE
-    :   'false'
-    ;
-    
-PKG 
-    :   'package'
-    ;
-
-SYNTAX
-    :   'syntax'
-    ;
-    
-IMPORT
-    :   'import'
-    ;
-    
-OPTION
-    :   'option'
-    ;
-    
-MESSAGE
-    :   'message'
-    ;
-
-SERVICE
-    :   'service'
-    ;
-    
-ENUM
-    :   'enum'
-    ;
-
-REQUIRED
-    :   'required'
-    ;
-    
-OPTIONAL
-    :   'optional'
-    ;
-
-REPEATED
-    :   'repeated'
-    ;
-    
-EXTENSIONS
-    :   'extensions'
-    ;
-    
-EXTEND
-    :   'extend'
-    ;
-    
-GROUP
-    :   'group'
-    ;
-    
-RPC
-    :   'rpc'
-    ;
-    
-RETURNS
-    :   'returns'
-    ;
-    
-INT32
-    :   'int32'
-    ;
-    
-INT64
-    :   'int64'
-    ;
-    
-UINT32
-    :   'uint32'
-    ;
-    
-UINT64
-    :   'uint64'
-    ;
-    
-SINT32
-    :   'sint32'
-    ;
-    
-SINT64
-    :   'sint64'
-    ;
-    
-FIXED32
-    :   'fixed32'
-    ;
-    
-FIXED64
-    :   'fixed64'
-    ;
-    
-SFIXED32
-    :   'sfixed32'
-    ;
-    
-SFIXED64
-    :   'sfixed64'
-    ;
-    
-FLOAT
-    :   'float'
-    ;
-    
-DOUBLE
-    :   'double'
-    ;
-    
-BOOL
-    :   'bool'
-    ;
-    
-STRING
-    :   'string'
-    ;
-    
-BYTES
-    :   'bytes'
-    ;
-    
-DEFAULT
-    :   'default'
-    ;
-
-MAX
-    :   'max'
-    ;    
-
-VOID
-    :   'void'
-    ;
-
-FULL_ID
-    : ID ('.' ID)+
-    ;
-
-ID  
-    :   ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
-    ;
-    
-EXP
-    :   NUMINT ('e'|'E') NUMINT
-    ;
-    
-NUMDOUBLE
-    :   (NUMFLOAT|NUMINT)
-        'e' '0'..'9'+
-    ;
-
-NUMFLOAT
-    :   NUMINT '.' '0'..'9'+ 'f'?
-    ;
- 
-NUMINT
-    :   '0' | MINUS? '1'..'9' '0'..'9'*
-    ;
-    
-HEX
-    :   MINUS? '0' ('x'|'X') HEX_DIGIT+
-    ;
-    
-OCTAL
-    :   '0' ('0'..'7')+
-    ;
-    
-COMMENT
-    :   '//' ~('\n'|'\r')* '\r'? '\n' {skip();}
-    |   '/*' ( options {greedy=false;} : . )* '*/' {skip();}
-    ;
-
-WS  :   ( ' '
-        | '\t'
-        | '\r'
-        | '\n'
-        ) {skip();}
-    ;
-    
-STRING_LITERAL
-    :   '"' ( ESC_SEQ | ~('\\'|'"') )* '"'
-    ;
-
-fragment HEX_DIGIT
-    :   ('0'..'9'|'a'..'f'|'A'..'F')
-    ;
-
-fragment ESC_SEQ
-    :   '\\' ('a'|'v'|'b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
-    |   '\\' ('x'|'X') HEX_DIGIT HEX_DIGIT
-    |   UNICODE_ESC
-    |   OCTAL_ESC
-    ;
-
-fragment OCTAL_ESC
-    :   '\\' ('0'..'3') ('0'..'7') ('0'..'7')
-    |   '\\' ('0'..'7') ('0'..'7')
-    |   '\\' ('0'..'7')
-    ;
-
-fragment UNICODE_ESC
-    :   '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
-    ;

http://git-wip-us.apache.org/repos/asf/drill/blob/363bf33d/common/src/main/antlr3/org/apache/drill/common/storage/proto/ProtoParser.g.bk
----------------------------------------------------------------------
diff --git a/common/src/main/antlr3/org/apache/drill/common/storage/proto/ProtoParser.g.bk
b/common/src/main/antlr3/org/apache/drill/common/storage/proto/ProtoParser.g.bk
deleted file mode 100644
index 81b6eb6..0000000
--- a/common/src/main/antlr3/org/apache/drill/common/storage/proto/ProtoParser.g.bk
+++ /dev/null
@@ -1,605 +0,0 @@
-//========================================================================
-//Copyright 2007-2009 David Yu dyuproject@gmail.com
-//------------------------------------------------------------------------
-//Licensed under the Apache License, Version 2.0 (the "License");
-//you may not use this file except in compliance with the License.
-//You may obtain a copy of the License at 
-//http://www.apache.org/licenses/LICENSE-2.0
-//Unless required by applicable law or agreed to in writing, software
-//distributed under the License is distributed on an "AS IS" BASIS,
-//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//See the License for the specific language governing permissions and
-//limitations under the License.
-//========================================================================
-
-/** Apache Drill notes: Based off r1586 of protostuff **/
-
-parser grammar ProtoParser;
-
-options {
-    language  = Java;
-    output    = AST;
-    tokenVocab = ProtoLexer;
-}
-
-@header {
-    package org.apache.drill.common.storage.proto;
-}
-
-parse [Proto proto]
-    :   (statement[proto])+ EOF! {
-            if(!proto.annotations.isEmpty())
-                throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
-            
-            proto.postParse();
-        }
-    ;
-    
-statement [Proto proto]
-    :   header_syntax[proto]
-    |   header_package[proto]
-    |   header_import[proto]
-    |   message_block[proto, null]
-    |   enum_block[proto, null]
-    |   extend_block[proto, null]
-    |   service_block[proto]
-    |   annotation_entry[proto]
-    |   option_entry[proto, proto]
-    ;
-
-// some keywords that might possibly be used as a variable
-var
-    :   ID | TO | PKG | SYNTAX | IMPORT | OPTION | MESSAGE | SERVICE | ENUM |  
-        REQUIRED | OPTIONAL | REPEATED | EXTENSIONS | EXTEND | GROUP | RPC | 
-        RETURNS | INT32 | INT64 | UINT32 | UINT64 | SINT32 | SINT64 | 
-        FIXED32 | FIXED64 | SFIXED32 | SFIXED64 | FLOAT | DOUBLE | BOOL | 
-        STRING | BYTES | DEFAULT | MAX | VOID
-    ;
-
-annotation_entry [Proto proto]
-@init {
-    Annotation annotation = null;
-}
-    :   AT var { annotation = new Annotation($var.text); }
-        (LEFTPAREN 
-        annotation_keyval[proto, annotation] (COMMA annotation_keyval[proto, annotation])*

-        RIGHTPAREN)? {
-            proto.add(annotation);
-        }
-    ;
-
-annotation_keyval [Proto proto, Annotation annotation]
-    :   k=var ASSIGN (
-                ID { annotation.putRef($k.text, $ID.text); }
-            |   fid=FULL_ID { annotation.putRef($k.text, $fid.text); }
-            |   NUMFLOAT { annotation.put($k.text, Float.valueOf($NUMFLOAT.text)); }
-            |   NUMINT { annotation.put($k.text, Integer.valueOf($NUMINT.text)); }
-            |   NUMDOUBLE { annotation.put($k.text, Double.valueOf($NUMDOUBLE.text)); }
-            |   TRUE { annotation.put($k.text, Boolean.TRUE); }
-            |   FALSE { annotation.put($k.text, Boolean.FALSE); }
-            |   STRING_LITERAL { annotation.put($k.text, getStringFromStringLiteral($STRING_LITERAL.text));
}
-            |   v=var { annotation.put($k.text, $v.text); }
-        )
-    ;
-
-header_syntax [Proto proto]
-    :   SYNTAX ASSIGN STRING_LITERAL SEMICOLON! {
-            if(!"proto2".equals(getStringFromStringLiteral($STRING_LITERAL.text))) {
-                throw new IllegalStateException("Syntax isn't proto2: '" +
-                  getStringFromStringLiteral($STRING_LITERAL.text)+"'");
-            }
-                  
-            if(!proto.annotations.isEmpty())
-                throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
-        }
-    ;
-
-header_package [Proto proto] // ignore
-    :   PKG (FULL_ID  | var ) SEMICOLON! 
-    ;
-    
-header_import [Proto proto]
-    :   IMPORT STRING_LITERAL SEMICOLON! {
-            proto.importProto(getStringFromStringLiteral($STRING_LITERAL.text));
-            
-            if(!proto.annotations.isEmpty())
-                throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
-        }
-    ;
-
-option_entry [Proto proto, HasOptions ho]
-    :   OPTION LEFTPAREN? k=(ID|FULL_ID) RIGHTPAREN? ASSIGN (
-                id=ID { ho.putStandardOption($k.text, $id.text); }
-            |   fid=FULL_ID { ho.putStandardOption($k.text, $fid.text); }
-            |   NUMFLOAT { ho.putExtraOption($k.text, Float.valueOf($NUMFLOAT.text)); }
-            |   NUMINT { ho.putExtraOption($k.text, Integer.valueOf($NUMINT.text)); }
-            |   NUMDOUBLE { ho.putExtraOption($k.text, Double.valueOf($NUMDOUBLE.text));
}
-            |   TRUE { ho.putExtraOption($k.text, Boolean.TRUE); }
-            |   FALSE { ho.putExtraOption($k.text, Boolean.FALSE); }
-            |   STRING_LITERAL { ho.putExtraOption($k.text, getStringFromStringLiteral($STRING_LITERAL.text));
}
-        ) SEMICOLON! {
-            if(!proto.annotations.isEmpty())
-                throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
-        }
-    ;
-    
-message_block [Proto proto, Message parent]
-@init {
-    Message message = null;
-}
-    :   MESSAGE ID { 
-            message = new Message($ID.text);
-            if(parent==null)
-                proto.addMessage(message);
-            else
-                parent.addNestedMessage(message);
-                
-            proto.addAnnotationsTo(message);
-        } 
-        LEFTCURLY (message_body[proto, message])* RIGHTCURLY {
-            if(!proto.annotations.isEmpty())
-                throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
-        }
-    ;
-
-message_body [Proto proto, Message message]
-    :   message_block[proto, message]
-    |   message_field[proto, message]
-    |   enum_block[proto, message]
-    |   extend_block[proto, message]
-    |   extensions_range[proto, message]
-    |   annotation_entry[proto]
-    |   option_entry[proto, message]
-    ;
-    
-extensions_range [Proto proto, Message message]
-@init {
-  int first = -1;
-  int last = -1;
-}
-    :   EXTENSIONS f=NUMINT { first = Integer.parseInt($f.text); last = first;}
-        ( TO ( l=NUMINT { last = Integer.parseInt($l.text); } | MAX {last = 536870911; }
) )?
-        SEMICOLON! {
-            message.defineExtensionRange(first, last);
-        }
-    ;
-    
-message_field [Proto proto, HasFields message]
-@init {
-    Field.Modifier modifier = null;
-    FieldHolder fieldHolder = null;
-}
-    :   (OPTIONAL { modifier = Field.Modifier.OPTIONAL;  } 
-        |   REQUIRED { modifier = Field.Modifier.REQUIRED; } 
-        |   REPEATED { modifier = Field.Modifier.REPEATED; }) {
-            fieldHolder = new FieldHolder();
-        }
-        field_type[proto, message, fieldHolder] 
-        var ASSIGN NUMINT {
-            if(fieldHolder.field != null) {
-                fieldHolder.field.modifier = modifier;
-                fieldHolder.field.name = $var.text;
-                fieldHolder.field.number = Integer.parseInt($NUMINT.text);
-            }
-        } 
-        (field_options[proto, message, fieldHolder.field])? {
-            if(fieldHolder.field != null) {
-                proto.addAnnotationsTo(fieldHolder.field, message.getEnclosingNamespace());
-                message.addField(fieldHolder.field);
-            }
-        }
-        (SEMICOLON! | ignore_block)
-    ;
-    
-field_type [Proto proto, HasFields message, FieldHolder fieldHolder]
-    :   INT32 { fieldHolder.setField(new Field.Int32()); }
-    |   UINT32 { fieldHolder.setField(new Field.UInt32()); }
-    |   SINT32 { fieldHolder.setField(new Field.SInt32()); }
-    |   FIXED32 { fieldHolder.setField(new Field.Fixed32()); }
-    |   SFIXED32 { fieldHolder.setField(new Field.SFixed32()); }
-    |   INT64 { fieldHolder.setField(new Field.Int64()); }
-    |   UINT64 { fieldHolder.setField(new Field.UInt64()); }
-    |   SINT64 { fieldHolder.setField(new Field.SInt64()); }
-    |   FIXED64 { fieldHolder.setField(new Field.Fixed64()); }
-    |   SFIXED64 { fieldHolder.setField(new Field.SFixed64()); }
-    |   FLOAT { fieldHolder.setField(new Field.Float()); }
-    |   DOUBLE { fieldHolder.setField(new Field.Double()); }
-    |   BOOL { fieldHolder.setField(new Field.Bool()); }
-    |   STRING { fieldHolder.setField(new Field.String()); }
-    |   BYTES { fieldHolder.setField(new Field.Bytes()); }
-    |   GROUP {
-            String suffix = proto.getFile()==null ? "" : " of " + proto.getFile().getName();
-            warn("'group' not supported @ line " + $GROUP.line + suffix);
-        }
-    |   FULL_ID {
-            String fullType = $FULL_ID.text;
-            int lastDot = fullType.lastIndexOf('.');
-            String packageName = fullType.substring(0, lastDot); 
-            String type = fullType.substring(lastDot+1);
-            fieldHolder.setField(new Field.Reference(packageName, type, message));
-        }
-    |   ID { 
-            String type = $ID.text;
-            fieldHolder.setField(new Field.Reference(null, type, message));
-        }
-    ;
-    
-field_options [Proto proto, HasFields message, Field field]
-    :   LEFTSQUARE field_options_keyval[proto, message, field] 
-        (COMMA field_options_keyval[proto, message, field])* RIGHTSQUARE
-    ;
-    
-field_options_keyval [Proto proto, HasFields message, Field field]
-    :   key=(DEFAULT|ID) ASSIGN (STRING_LITERAL {
-            if("default".equals($key.text)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-                
-                if(field instanceof Field.String)
-                    field.defaultValue = getStringFromStringLiteral($STRING_LITERAL.text);
-                else if(field instanceof Field.Bytes)
-                    field.defaultValue = getBytesFromStringLiteral($STRING_LITERAL.text);
-                else
-                    throw new IllegalStateException("Invalid string default value for the
field: " + field.getClass().getSimpleName() + " " + field.name);
-            }
-            
-            field.putExtraOption($key.text, getStringFromStringLiteral($STRING_LITERAL.text));
-        } 
-    |   NUMFLOAT {
-            if("default".equals($key.text)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-                
-                if(field instanceof Field.Float)
-                    field.defaultValue = Float.valueOf($NUMFLOAT.text);
-                else if(field instanceof Field.Double) 
-                    field.defaultValue = Double.valueOf($NUMFLOAT.text);
-                else
-                    throw new IllegalStateException("Invalid float default value for the
field: " + field.getClass().getSimpleName() + " " + field.name);
-            }
-            
-            field.putExtraOption($key.text, Float.valueOf($NUMFLOAT.text));
-        } 
-    |   NUMINT {
-            if("default".equals($key.text)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-                
-                if(field instanceof Field.Number) {
-                    if(field.getClass().getSimpleName().endsWith("32"))
-                        field.defaultValue = Integer.valueOf($NUMINT.text);
-                    else if(field.getClass().getSimpleName().endsWith("64"))
-                        field.defaultValue = Long.valueOf($NUMINT.text);
-                    else if(field instanceof Field.Float)
-                        field.defaultValue = Float.valueOf($NUMINT.text);
-                    else if(field instanceof Field.Double) 
-                        field.defaultValue = Double.valueOf($NUMINT.text);
-                    else
-                        throw new IllegalStateException("Invalid numeric default value for
the field: " + field.getClass().getSimpleName() + " " + field.name);
-                }
-                else
-                    throw new IllegalStateException("Invalid numeric default value for the
field: " + field.getClass().getSimpleName() + " " + field.name);
-            }
-            
-            field.putExtraOption($key.text, Integer.valueOf($NUMINT.text));
-        }
-    |   NUMDOUBLE {
-            if("default".equals($key.text)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-
-                if(field instanceof Field.Float)
-                    field.defaultValue = Float.valueOf($NUMDOUBLE.text);
-                else if(field instanceof Field.Double) 
-                    field.defaultValue = Double.valueOf($NUMDOUBLE.text);
-                else
-                    throw new IllegalStateException("Invalid numeric default value for the
field: " + field.getClass().getSimpleName() + " " + field.name);
-            }
-            
-            field.putExtraOption($key.text, Double.valueOf($NUMDOUBLE.text));
-        }
-    |   HEX {
-            if("default".equals($key.text)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-                
-                if(field instanceof Field.Number) {
-                    if(field instanceof Field.Int32)
-                        field.defaultValue = new Integer(TextFormat.parseInt32($HEX.text));
-                    else if(field instanceof Field.UInt32)
-                        field.defaultValue = new Integer(TextFormat.parseUInt32($HEX.text));
-                    else if(field instanceof Field.Int64)
-                        field.defaultValue = new Long(TextFormat.parseInt64($HEX.text));
-                    else if(field instanceof Field.UInt64)
-                        field.defaultValue = new Long(TextFormat.parseUInt64($HEX.text));
-                    else if(field instanceof Field.Float)
-                        field.defaultValue = new Float(Long.decode($HEX.text).floatValue());
-                    else if(field instanceof Field.Double) 
-                        field.defaultValue = new Double(Long.decode($HEX.text).doubleValue());
-                }
-                else if(field instanceof Field.Bytes) {
-                    field.defaultValue = getBytesFromHexString($HEX.text);
-                }
-                else
-                    throw new IllegalStateException("Invalid numeric default value for the
field: " + field.getClass().getSimpleName() + " " + field.name);
-                
-            }
-            
-            field.putExtraOption($key.text, $HEX.text);
-        }
-    |   OCTAL {
-            if("default".equals($key.text)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-                
-                if(field instanceof Field.Number) {
-                    if(field instanceof Field.Int32)
-                        field.defaultValue = new Integer(TextFormat.parseInt32($OCTAL.text));
-                    else if(field instanceof Field.UInt32)
-                        field.defaultValue = new Integer(TextFormat.parseUInt32($OCTAL.text));
-                    else if(field instanceof Field.Int64)
-                        field.defaultValue = new Long(TextFormat.parseInt64($OCTAL.text));
-                    else if(field instanceof Field.UInt64)
-                        field.defaultValue = new Long(TextFormat.parseUInt64($OCTAL.text));
-                    else if(field instanceof Field.Float)
-                        field.defaultValue = new Float(Long.decode($OCTAL.text).floatValue());
-                    else if(field instanceof Field.Double) 
-                        field.defaultValue = new Double(Long.decode($OCTAL.text).doubleValue());
-                }
-                else
-                    throw new IllegalStateException("Invalid numeric default value for the
field: " + field.getClass().getSimpleName() + " " + field.name);
-            }
-            
-            field.putExtraOption($key.text, $OCTAL.text);
-        }
-    |   TRUE {
-            if("default".equals($key.text)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-                
-                if(field instanceof Field.Bool)
-                    field.defaultValue = Boolean.TRUE;
-                else
-                    throw new IllegalStateException("invalid boolean default value for the
non-boolean field: " + field.getClass().getSimpleName() + " " + field.name);
-            }
-            
-            field.putExtraOption($key.text, Boolean.TRUE);
-        }    
-    |   FALSE {
-            if("default".equals($key.text)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-                
-                if(field instanceof Field.Bool)
-                    field.defaultValue = Boolean.FALSE;
-                else
-                    throw new IllegalStateException("invalid boolean default value for the
non-boolean field: " + field.getClass().getSimpleName() + " " + field.name);
-            }
-            
-            field.putExtraOption($key.text, Boolean.FALSE);
-        }
-    |   val=ID {
-            boolean refOption = false;
-            if("default".equals($key.text)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-                
-                String refName = $val.text;
-                if(field instanceof Field.Reference)
-                    field.defaultValue = refName;
-                else if(field instanceof Field.Float) {
-                    if("inf".equals(refName)) {
-                        field.defaultValue = Float.POSITIVE_INFINITY;
-                        field.defaultValueConstant = "Float.POSITIVE_INFINITY";
-                    }
-                    else if("nan".equals(refName)) {
-                        field.defaultValue = Float.NaN;
-                        field.defaultValueConstant = "Float.NaN";
-                    }
-                    else
-                        throw new IllegalStateException("Invalid float default value for
the field: " + field.getClass().getSimpleName() + " " + field.name);
-                }
-                else if(field instanceof Field.Double) {
-                    if("inf".equals(refName)) {
-                        field.defaultValue = Double.POSITIVE_INFINITY;
-                        field.defaultValueConstant = "Double.POSITIVE_INFINITY";
-                    }
-                    else if("nan".equals(refName)) {
-                        field.defaultValue = Double.NaN;
-                        field.defaultValueConstant = "Double.NaN";
-                    }
-                    else
-                        throw new IllegalStateException("Invalid double default value for
the field: " + field.getClass().getSimpleName() + " " + field.name);
-                }   
-                else {
-                    refOption = true;
-                    //throw new IllegalStateException("invalid field value '" + refName +
"' for the field: " + field.getClass().getSimpleName() + " " + field.name);
-                }
-            }
-            else {
-                refOption = true;
-            }
-            
-            if(refOption)
-                field.putStandardOption($key.text, $val.text);
-            else
-                field.putExtraOption($key.text, $val.text);
-        }
-    |   FULL_ID {
-            field.putStandardOption($key.text, $FULL_ID.text);
-        }
-    |   EXP {
-            if("default".equals($key.text)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-                
-                if(field instanceof Field.Float)
-                    field.defaultValue = Float.valueOf($EXP.text);
-                else if(field instanceof Field.Double) 
-                    field.defaultValue = Double.valueOf($EXP.text);
-                else
-                    throw new IllegalStateException("Invalid float default value for the
field: " + field.getClass().getSimpleName() + " " + field.name);
-            }
-            
-            field.putExtraOption($key.text, $EXP.text);
-        }
-    |   signed_constant[proto, message, field, $key.text] {
-            field.putExtraOption($key.text, $signed_constant.text);
-        }
-        )
-    ;
-    
-signed_constant [Proto proto, HasFields message, Field field, String key]
-    :   MINUS ID {
-            if("default".equals(key)) {
-                if(field.defaultValue!=null || field.modifier == Field.Modifier.REPEATED)
-                    throw new IllegalStateException("a field can only have a single default
value");
-                
-                String refName = $ID.text;
-                if(field instanceof Field.Float) {
-                    if("inf".equals(refName)) {
-                        field.defaultValue = Float.NEGATIVE_INFINITY;
-                        field.defaultValueConstant = "Float.NEGATIVE_INFINITY";
-                    }
-                    else
-                        throw new IllegalStateException("Invalid float default value for
the field: " + field.getClass().getSimpleName() + " " + field.name);
-                }
-                else if(field instanceof Field.Double) {
-                    if("inf".equals(refName)) {
-                        field.defaultValue = Double.NEGATIVE_INFINITY;
-                        field.defaultValueConstant = "Double.NEGATIVE_INFINITY";
-                    }
-                    else
-                        throw new IllegalStateException("Invalid double default value for
the field: " + field.getClass().getSimpleName() + " " + field.name);
-                }   
-                else
-                    throw new IllegalStateException("invalid field value '" + refName + "'
for the field: " + field.getClass().getSimpleName() + " " + field.name);
-            }
-        }
-    ;
-    
-enum_block [Proto proto, Message message]
-@init {
-    EnumGroup enumGroup = null;
-}
-    :   ENUM ID { 
-            enumGroup = new EnumGroup($ID.text); 
-            if(message==null)
-                proto.addEnumGroup(enumGroup);
-            else
-                message.addNestedEnumGroup(enumGroup);
-            
-            proto.addAnnotationsTo(enumGroup);
-        } 
-        LEFTCURLY (enum_body[proto, message, enumGroup])* RIGHTCURLY {
-            if(!proto.annotations.isEmpty())
-                throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
-        } (SEMICOLON?)!
-    ;
-    
-enum_body [Proto proto, Message message, EnumGroup enumGroup]
-    :   enum_field[proto, message, enumGroup]
-    |   annotation_entry[proto]
-    |   option_entry[proto, enumGroup]
-    ;
-
-enum_field [Proto proto, Message message, EnumGroup enumGroup]
-    :   ID ASSIGN NUMINT SEMICOLON! {
-            EnumGroup.Value v = new EnumGroup.Value($ID.text, Integer.parseInt($NUMINT.text));
-            enumGroup.add(v);
-            proto.addAnnotationsTo(v);
-        }
-    ;
-    
-service_block [Proto proto]
-@init {
-    Service service = null;
-}
-    :   SERVICE ID { 
-            service = new Service($ID.text, proto); 
-            proto.addAnnotationsTo(service);
-        } LEFTCURLY
-        (service_body[proto, service])+ RIGHTCURLY (SEMICOLON?)! {
-            if(service.rpcMethods.isEmpty())
-                throw new IllegalStateException("Empty Service block: " + service.getName());
-                
-            if(!proto.annotations.isEmpty())
-                throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
-        }
-    ;
-    
-service_body [Proto proto, Service service]
-    :   rpc_block[proto, service]
-    |   annotation_entry[proto]
-    |   option_entry[proto, service]
-    ;
-    
-rpc_block [Proto proto, Service service]
-@init {
-    String argName = null, argPackage = null, retName = null, retPackage = null;
-    Service.RpcMethod rm = null;
-}
-    :   RPC n=ID LEFTPAREN (ap=FULL_ID {  
-            String argFull = $ap.text;
-            int lastDot = argFull.lastIndexOf('.');
-            argPackage = argFull.substring(0, lastDot); 
-            argName = argFull.substring(lastDot+1);
-        } | a=(VOID|ID) { argName = $a.text; }) RIGHTPAREN 
-        RETURNS LEFTPAREN (rp=FULL_ID {  
-            String retFull = $rp.text;
-            int lastDot = retFull.lastIndexOf('.');
-            retPackage = retFull.substring(0, lastDot); 
-            retName = retFull.substring(lastDot+1);
-        } | r=(VOID|ID) { retName = $r.text; }) RIGHTPAREN {
-            rm = service.addRpcMethod($n.text, argName, argPackage, retName, retPackage);
-            proto.addAnnotationsTo(rm);
-        } rpc_body_block[proto, rm]? SEMICOLON!
-    ;
-    
-rpc_body_block [Proto proto, Service.RpcMethod rm]
-    :   LEFTCURLY option_entry[proto, rm]* RIGHTCURLY {
-            if(!proto.annotations.isEmpty())
-                throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
-        }
-    ;
-    
-extend_block [Proto proto, Message parent]
-@init {
-    Extension extension = null;
-}
-    :   EXTEND (
-        FULL_ID {
-            String fullType = $FULL_ID.text;
-            int lastDot = fullType.lastIndexOf('.');
-            String packageName = fullType.substring(0, lastDot); 
-            String type = fullType.substring(lastDot+1);
-            extension = new Extension(proto, parent, packageName, type);
-        } | ID { extension = new Extension(proto, parent, null, $ID.text); } ) {
-            if(parent==null)
-                proto.addExtension(extension);
-            else
-                parent.addNestedExtension(extension);
-                
-            proto.addAnnotationsTo(extension);
-        }
-        LEFTCURLY (extend_body[proto, extension])* RIGHTCURLY {
-            if(!proto.annotations.isEmpty())
-                throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
-                
-        } (SEMICOLON?)!
-    ;
-    
-extend_body [Proto proto, Extension extension]
-    :   message_field[proto, extension]
-    |   annotation_entry[proto]
-    ;
-    
-ignore_block
-    :   LEFTCURLY ignore_block_body* RIGHTCURLY
-    ;
-    
-ignore_block_body
-    :   (LEFTCURLY)=> ignore_block
-    |   ~RIGHTCURLY
-    ;
-    


Mime
View raw message