|
|
Author: elecharny
Date: Sat Jul 2 10:01:37 2005
New Revision: 208848
URL: http://svn.apache.org/viewcvs?rev=208848&view=rev
Log:
Rollback the changes as they break Gump build...
Modified:
directory/asn1/trunk/stub-compiler/src/antlr/asn1.g
Modified: directory/asn1/trunk/stub-compiler/src/antlr/asn1.g
URL:
http://svn.apache.org/viewcvs/directory/asn1/trunk/stub-compiler/src/antlr/asn1.g?rev=208848&r1=208847&r2=208848&view=diff
==============================================================================
--- directory/asn1/trunk/stub-compiler/src/antlr/asn1.g (original)
+++ directory/asn1/trunk/stub-compiler/src/antlr/asn1.g Sat Jul 2 10:01:37 2005
@@ -62,11 +62,10 @@
DefinitiveIdentifier did;
id = new ModuleIdentifier();
}
- : mr=module_reference { id.setModuleReference(mr); }
- (did=definitive_identifier { id.setDefinitiveIdentifier(did); } )?
+ : mr=module_reference { id.setModuleReference(mr); }
(did=definative_identifier { id.setDefinitiveIdentifier(did); } )?
;
-definitive_identifier returns [DefinitiveIdentifier id]
+definative_identifier returns [DefinitiveIdentifier id]
{ id = new DefinitiveIdentifier(); }
: LEFT_CURLY (definitive_obj_id_component[id])+ RIGHT_CURLY
;
@@ -88,16 +87,7 @@
;
module_body[Module module]
- : (exports[module])? (imports[module])? (assignment[module])+
- ;
-
-exports[Module module]
- : EXPORTS (SymbolsExported)? SEMICOLON
- | EXPORTS ALL SEMICOLON
- ;
-
-imports[Module module]
- : IMPORTS (SymbolsImported)? SEMICOLON
+ : (assignment[module])+
;
assignment[Module module]
@@ -432,24 +422,24 @@
modules : ( ABSENT );
-/* The ASN.1 2002 lexer (X.680) */
class ASN1Lexer extends Lexer;
options {
k=3;
-
- // RULE 11.14 ?
charVocabulary = '\3'..'\377' | '\u1000'..'\u1fff';
}
/*
- * X.680-0207 Rule 11.27
+ * X.680-0207
*/
tokens {
ABSENT = "ABSENT";
ABSTRACT_SYNTAX = "ABSTRACT-SYNTAX";
ALL = "ALL";
+ ANY = "ANY";
+ ARGUMENT = "ARGUMENT";
APPLICATION = "APPLICATION";
AUTOMATIC = "AUTOMATIC";
+ BASEDNUM = "BASEDNUM";
BEGIN = "BEGIN";
BIT = "BIT";
BMPSTRING = "BMPString";
@@ -458,16 +448,17 @@
CHARACTER = "CHARACTER";
CHOICE = "CHOICE";
CLASS = "CLASS";
- COMPONENT = "COMPONENT";
COMPONENTS = "COMPONENTS";
+ COMPONENT = "COMPONENT";
CONSTRAINED = "CONSTRAINED";
- CONTAINING = "CONTAINING";
DEFAULT = "DEFAULT";
+ DEFINED= "DEFINED";
DEFINITIONS = "DEFINITIONS";
EMBEDDED = "EMBEDDED";
- ENCODED = "ENCODED";
END = "END";
ENUMERATED = "ENUMERATED";
+ ERROR = "ERROR";
+ ERRORS = "ERRORS";
EXCEPT = "EXCEPT";
EXPLICIT = "EXPLICIT";
EXPORTS = "EXPORTS";
@@ -488,29 +479,32 @@
INTEGER = "INTEGER";
INTERSECTION = "INTERSECTION";
ISO646_STRING = "ISO646String";
+ LINKED = "LINKED";
MAX = "MAX";
- MIN = "MIN";
MINUS_INFINITY = "MINUSINFINITY";
+ MIN = "MIN";
NULL = "NULL";
NUMERIC_STRING = "NumericString";
- OBJECT = "OBJECT";
OBJECT_DESCRIPTOR = "ObjectDescriptor";
+ OBJECT = "OBJECT";
OCTET = "OCTET";
+ OPERATION = "OPERATION";
OF = "OF";
+ OID = "OID";
OPTIONAL = "OPTIONAL";
- PATTERN = "PATTERN";
+ PARAMETER = "PARAMETER";
PDV = "PDV";
- PLUS_INFINITY = "PLUS-INFINITY";
+ PLUS_INFINITY = "PLUSINFINITY";
PRESENT = "PRESENT";
PRINTABLE_STRING = "PrintableString";
PRIVATE = "PRIVATE";
REAL = "REAL";
- RELATIVE_OID = "RELATIVE-OID";
+ RELATIVE = "RELATIVE";
+ RESULT = "RESULT";
SEQUENCE = "SEQUENCE";
SET = "SET";
SIZE = "SIZE";
STRING = "STRING";
- SYNTAX = "SYNTAX";
T61_STRING = "T61String";
TAGS = "TAGS";
TELETEX_STRING = "TeletexString";
@@ -530,10 +524,41 @@
* X.680-0207
*/
- //REFERENCE = "Reference";
+ REFERENCE = "Reference";
}
-// Rule 10.1
+NEWLINE
+ : ((('\r''\n') => '\r''\n') | '\r' | '\n')
+ { newline(); $setType(Token.SKIP); }
+ ;
+
+WS : ( ' ' | '\t' | '\f' ) { $setType(Token.SKIP); } ;
+
+COMMENT : "--" ;
+
+SL_COMMENT
+ : COMMENT
+ ({ LA(2)!='-' }? '-' | ~('-'|'\n'|'\r'))*
+ (((('\r''\n') => '\r''\n') | '\r' | '\n') {newline();} | COMMENT)
+ { $setType(Token.SKIP); }
+ ;
+
+ASSIGNMENT : "::=";
+
+IDENTIFIER : SMALL_LETTER ( (HYPHEN)? (SMALL_LETTER | CAPITAL_LETTER | DIGIT)
)* ;
+TYPEREFERENCE : CAPITAL_LETTER ( (HYPHEN)? (SMALL_LETTER | CAPITAL_LETTER |
DIGIT) )* ;
+
+NUMBER : DIGITS (DOT (DIGIT)* (EXPONENT)? { $setType(REAL_NUMBER); } | {
$setType(INTEGER_NUMBER); } ) ;
+
+
+protected DIGITS : ( ('1'..'9') (DIGIT)* | '0' );
+
+protected EXPONENT
+ : ('e'|'E') ('+'|'-')? (DIGIT)+
+ ;
+
+NUMBER_STRING : "'" (HEX_DIGIT | WS)* ("'B" {$setType(BINARY_STRING);} | "'H"
{$setType(HEXADECIMAL_STRING);} );
+
protected CAPITAL_LETTER : 'A'..'Z';
protected SMALL_LETTER : 'a'..'z';
protected DIGIT : '0'..'9';
@@ -562,101 +587,6 @@
LEFT_CURLY : '{';
BAR : '|';
RIGHT_CURLY : '}';
-
-// Rule 11.1.6 (for newline)
-NEWLINE
- : ((('\r''\n') => '\r''\n') | '\r' | '\n' | '\u000B') // We have
Linux/W$ CR,
-
// and also Vertical Tabulation
- { newline(); $setType(Token.SKIP); }
- ;
-
-// Rule 11.1.6 (for white-space)
-// "NOTE - Any character or character sequence that is a valid newline is also
a valid WS"
-WS : ( NEWLINE | ' ' | '\t' | '\f' ) { $setType(Token.SKIP); } ;
-
-// Rules 11.2 & 11.5 (Module References and Type references are lexically the
same)
-TYPEREFERENCE : CAPITAL_LETTER ( (HYPHEN)? (SMALL_LETTER | CAPITAL_LETTER |
DIGIT) )* ;
-
-// Rules 11.3 & 11.4 (Identifiers and Value References are lexically the same)
-IDENTIFIER : SMALL_LETTER ( (HYPHEN)? (SMALL_LETTER | CAPITAL_LETTER | DIGIT)
)* ;
-
-// Rule 11.6
-COMMENT : "--" ;
-
-SL_COMMENT
- : COMMENT
- ({ LA(2)!='-' }? '-' | ~('-'|'\n'|'\r'))*
- (((('\r''\n') => '\r''\n') | '\r' | '\n') {newline();} | COMMENT)
- { $setType(Token.SKIP); }
- ;
-
-// Multi lines comment /* ... */. Actually, we are not dealing with the rule
-// 11.6.4, which states that if a /* is found into a ML comment, then we must
-// match it with a */ :
-// /* this is a comment /* this is a comment inside a comment */ we are
-// still in the first comment. This closes the comment ->*/
-ML_COMMENT
- : "/*"
- (
- { LA(2) != '/' }? '*'
- | NEWLINE { newline(); }
- | .
- )*
- "*/"
- { $setType( Token.SKIP ); }
- ;
-
-// Rule 11.7 EMPTY
-
-// Rule 11.8
-NUMBER : FIRST_DIGIT (DIGIT)* { $setType(INTEGER_NUMBER); } ;
-
-// Rule 11.9
-REAL_NUMBER : (DIGIT)+ DOT (DIGIT)* (EXPONENT)? { $setType(REAL_NUMBER); } ;
-
-protected FIRST_DIGIT : ('1'..'9') ;
-
-protected EXPONENT
- : ( 'e' | 'E' ) ( '+' | '-' )? ( DIGIT | ( FIRST_DIGIT ( DIGIT )+ ) )
- ;
-
-// Rule 11.10
-BINARY_STRINGS : '\'' ( '0' | '1' | WS )* "'B" {$setType(BINARY_STRING);};
-
-// Rule 11.11 TO BE DONE
-
-// Rule 11.12
-HEX_STRINGS : "'" (HEX_DIGIT | WS)* "'H" {$setType(HEXADECIMAL_STRING);} ;
-
-// Rule 11.13 TO BE DONE
-
-// Rule 11.15 TO BE DONE
-
-// Rule 11.16
-ASSIGNMENT : "::=";
-
-// Rule 11.17
RANGE : "..";
-
-// Rule 11.18
ELLIPSIS : "...";
-
-// Rule 11.19
-LEFT_VERSION_BRACKETS : "[[";
-
-// Rule 11.20
-RIGTH_VERSION_BRACKETS : "]]";
-
-// Rule 11.21 TO BE DONE
-
-// Rule 11.22 TO BE DONE
-
-// Rule 11.23 TO BE DONE
-
-// Rule 11.24 TO BE DONE
-
-// Rule 11.25 TO BE DONE
-
-
-
|
|