[Opalvoip-svn] SF.net SVN: opalvoip: [18756] ptlib/trunk/tools/asnparser
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2007-10-23 07:04:58
|
Revision: 18756 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=18756&view=rev Author: rjongbloed Date: 2007-10-23 00:04:58 -0700 (Tue, 23 Oct 2007) Log Message: ----------- Applied patch 1517435 Update to ASN Parser. Thanks, dave moss - mothslayer Modified Paths: -------------- ptlib/trunk/tools/asnparser/asn_grammar.y ptlib/trunk/tools/asnparser/asn_lex.l ptlib/trunk/tools/asnparser/main.h Modified: ptlib/trunk/tools/asnparser/asn_grammar.y =================================================================== --- ptlib/trunk/tools/asnparser/asn_grammar.y 2007-10-23 06:46:12 UTC (rev 18755) +++ ptlib/trunk/tools/asnparser/asn_grammar.y 2007-10-23 07:04:58 UTC (rev 18756) @@ -194,6 +194,7 @@ %token OCTET %token OF_t %token OPTIONAL_t +%token PATTERN_t %token PDV %token PLUS_INFINITY %token PRESENT @@ -318,6 +319,7 @@ %type <tval> NullType %type <tval> ObjectClassFieldType %type <tval> ObjectIdentifierType +%type <tval> PatternType %type <tval> OctetStringType %type <tval> RealType %type <tval> SequenceType ComponentType ComponentTypeLists @@ -688,6 +690,7 @@ | ObjectClassFieldType | ObjectIdentifierType | OctetStringType + | PatternType | RealType | SequenceType | SequenceOfType @@ -727,7 +730,8 @@ ExternalTypeReference : MODULEREFERENCE '.' TYPEREFERENCE { - *$1 += *$3; +// *$1 += *$3; + *$1 = *$3; delete $3; } ; @@ -1021,6 +1025,14 @@ ; +PatternType + : PATTERN_t CSTRING + { + $$ = new OctetStringType; + } + ; + + RealType : REAL { @@ -1267,7 +1279,7 @@ $$ = $2; } ; - + ConstraintSpec : ElementSetSpecs | GeneralConstraint Modified: ptlib/trunk/tools/asnparser/asn_lex.l =================================================================== --- ptlib/trunk/tools/asnparser/asn_lex.l 2007-10-23 06:46:12 UTC (rev 18755) +++ ptlib/trunk/tools/asnparser/asn_lex.l 2007-10-23 07:04:58 UTC (rev 18756) @@ -99,6 +99,7 @@ int LexEcho = FALSE; #define YY_USER_ACTION if (LexEcho) cout << yytext << flush; +extern ModuleDefinition * Module; int ReferenceTokenContext = MODULEREFERENCE; int IdentifierTokenContext = IDENTIFIER; @@ -124,6 +125,7 @@ %option nounput nodefault never-interactive %x comment_line +%x cstyle_comment_line %% @@ -182,6 +184,7 @@ "OCTET" { return OCTET; } "OF" { return OF_t; } "OPTIONAL" { return OPTIONAL_t; } +"PATTERN" { return PATTERN_t; } "PDV" { return PDV; } "PLUS-INFINITY" { return PLUS_INFINITY; } "PRESENT" { return PRESENT; } @@ -251,6 +254,22 @@ } +"/*" { + BEGIN(cstyle_comment_line); +} + +<cstyle_comment_line>\n { + lineNumber++; +} + +<cstyle_comment_line>"*/" { + BEGIN(INITIAL); +} + +<cstyle_comment_line>. { +} + + "@" { return '@'; } "{" { return BraceTokenContext; } @@ -341,9 +360,20 @@ ([A-Z]|([A-Z][a-zA-Z0-9_-]*[a-zA-Z0-9_])) { /* See X.680 section 9.2 */ yylval.sval = new PString(yytext); + + if( Module != NULL ) + { + if( Module->IsImportModule( *yylval.sval ) ) + { + return MODULEREFERENCE; + } + } if (CurrentImportList != NULL && CurrentImportList->GetValuesIndex(SearchType(*yylval.sval)) != P_MAX_INDEX) + { + PError << "IMPORT_IDENTIFIER" << endl; return IMPORT_IDENTIFIER; + } return ReferenceTokenContext; } Modified: ptlib/trunk/tools/asnparser/main.h =================================================================== --- ptlib/trunk/tools/asnparser/main.h 2007-10-23 06:46:12 UTC (rev 18755) +++ ptlib/trunk/tools/asnparser/main.h 2007-10-23 07:04:58 UTC (rev 18756) @@ -1170,8 +1170,8 @@ void GenerateCplusplus(ostream & hdr, ostream & cxx); + PString fullModuleName; protected: - PString fullModuleName; PString shortModuleName; PString filename; PString directoryPrefix; @@ -1194,6 +1194,16 @@ void SetExportAll(); void SetExports(TypesList * syms); + bool IsImportModule( const PString & name ) const + { + for( PINDEX i = 0; i < imports.GetSize(); ++i ) + { + if( imports[i].fullModuleName == name ) + return true; + } + return false; + } + void AddImport(ImportModule * mod) { imports.Append(mod); } void AddType(TypeBase * type) { types.Append(type); } void AddValue(ValueBase * val) { values.Append(val); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |