Author: ctian Date: Mon Sep 17 04:26:03 2007 New Revision: 43
Modified: trunk/asn.1/asn.1.zb trunk/asn.1/mib.lisp trunk/asn.1/test/1.asn Log: Continue Fixing ASN.1 Syntax
Modified: trunk/asn.1/asn.1.zb ============================================================================== --- trunk/asn.1/asn.1.zb (original) +++ trunk/asn.1/asn.1.zb Mon Sep 17 04:26:03 2007 @@ -1,4 +1,4 @@ -;;;; -*- Mode: Lisp -*- +;;;; -*- Mode: Text -*-
(:name "ASN.1" :domain-file "asn.1-domain.lisp" @@ -11,18 +11,21 @@ :case-sensitive t :lex-cats ((Type-Reference "[A-Z][a-zA-Z0-9-]*") (Signed-Number "-?[0-9]+") - (Any-Thing "[^ ]+"))) + (Anything "[^ ]+")))
;; Domain Definitions
Module-Definition := kb-domain: [(identifier) (body)]; Module-Body := kb-domain: [(exports) (imports) (assignment-list kb-sequence)]; -KB-List := kb-domain: [(list kb-sequence)]; -KB-Item := kb-domain: [(item)]; +Exports := kb-domain: [(list kb-sequence) (all-exports)]; +Imports := kb-domain: [(list kb-sequence) (valid)]; Symbols-From-Module := kb-domain: [(symbols) (global-module-reference)]; Assignment := kb-domain: [(type) (value)]; -Obj-Id-Components-List := kb-domain: [(-list kb-sequence)]; -Value-Assignment := kb-domain: [(-value-reference) (-type) (-value)]; +Value-Assignment := kb-domain: [(name) (type) (value)]; +Object-Type-Assignment := + Value-Assignment: [(syntax) (max-access) (status) (description) (index)]; +Type := kb-domain: []; +Object-Identifier-Value := kb-domain: [(value)];
;; Rule Definitions Module-Definition --> @@ -38,18 +41,20 @@ (exports Exports) (imports Imports)] } | ;
-Exports --> "EXPORTS" Symbol* "," ";" { KB-List:[(list Symbol*)] } - | "EXPORTS" "ALL" ";" { KB-Item:[(item :all)] } +Exports --> "EXPORTS" Symbol* "," ";" { Exports:[(list Symbol*)] } + | "EXPORTS" "ALL" ";" { Exports:[(all-exports t)] } | ;
Symbol --> Reference;
-Imports --> "IMPORTS" Symbols-From-Module* " " ";" { KB-List:[(list Symbols-From-Module*)] } +Imports --> "IMPORTS" Symbols-From-Module* " " ";" + { Imports:[(valid t) (list Symbols-From-Module*)] } | ;
Symbols-From-Module --> Symbol+ "," "FROM" Global-Module-Reference { Symbols-From-Module:[(symbols Symbol+) - (global-module-reference Global-Module-Reference)] }; + (global-module-reference + Global-Module-Reference)] }; Global-Module-Reference --> Module-Reference;
Reference --> Type-Reference | Value-Reference; @@ -59,14 +64,15 @@ | Value-Assignment {Assignment:[(type :value) (value Value-Assignment)]};
Type-Assignment --> Type-Reference "::=" Type - | Type-Reference "MACRO" "::=" "BEGIN" Garbage+ " " "END"; + | Type-Reference "MACRO" "::=" "BEGIN" Garbage+ " " "END" + ;
-Garbage --> Any-Thing; +Garbage --> Anything;
Value-Assignment --> Value-Reference Type "::=" Value - { Value-Assignment:[(-value-reference Value-Reference) - (-type Type) - (-value Value)] } + { Value-Assignment:[(name Value-Reference) + (type Type) + (value Value)] }
| Value-Reference "OBJECT-IDENTITY" "STATUS" Identifier @@ -83,11 +89,18 @@
| Value-Reference "OBJECT-TYPE" "SYNTAX" Type - "MAX-ACCESS" Identifier - "STATUS" Identifier + "MAX-ACCESS" Object-Type-Access + "STATUS" Object-Type-Status "DESCRIPTION" String Object-Type-Index "::=" Object-Identifier-Value + { Object-Type-Assignment:[(name Value-Reference) + (type :object-type) + (syntax Type) + (max-access Object-Type-Access) + (status Object-Type-Status) + (index Object-Type-Index) + (value Object-Identifier-Value)] }
| Value-Reference "NOTIFICATION-TYPE" "STATUS" Identifier @@ -112,8 +125,11 @@ "STATUS" Identifier "DESCRIPTION" String "::=" Object-Identifier-Value + ;
+Object-Type-Access --> Identifier; +Object-Type-Status --> Identifier; Module-Revision --> "REVISION" String "DESCRIPTION" String; Object-Type-Index --> "INDEX" Object-Identifier-Value |; Module-Compliance-Group --> "GROUP" Identifier "DESCRIPTION" String; @@ -126,20 +142,29 @@ | Integer-Type | Sequence-Of-Type | Sequence-Type + | Textual-Convention-Type | Tagged-Type;
Named-Type --> Type-Reference;
+Textual-Convention-Type --> "TEXTUAL-CONVENTION" + Textual-Convention-Display-Hint + "STATUS" Identifier + "DESCRIPTION" String + Textual-Convention-Reference + "SYNTAX" Type; + +Textual-Convention-Display-Hint --> "DISPLAY-HINT" String | ; +Textual-Convention-Reference --> "REFERENCE" String | ; + Object-Identifier-Type --> "OBJECT" "IDENTIFIER";
Value --> Builtin-Value;
Builtin-Value --> Object-Identifier-Value;
-Object-Identifier-Value --> "{" Obj-Id-Components-List "}"; - -Obj-Id-Components-List --> Obj-Id-Components+ " " - { Obj-Id-Components-List:[(-list Obj-Id-Components+)] }; +Object-Identifier-Value --> "{" Obj-Id-Components+ " " "}" + { Object-Identifier-Value:[(value Obj-Id-Components+)] };
Obj-Id-Components --> Name-And-Number-Form | Name-Form | Number-Form;
Modified: trunk/asn.1/mib.lisp ============================================================================== --- trunk/asn.1/mib.lisp (original) +++ trunk/asn.1/mib.lisp Mon Sep 17 04:26:03 2007 @@ -65,8 +65,8 @@ :directory '(:relative "asn.1")) (asdf:component-pathname (asdf:find-system :net-snmp))))
-(defun parse-mib (file) +(defun parse-mib (file &key (verbose nil)) (let ((zb:*comment-start* "--") (zb:*comment-brackets* '(("/*" . "*/")))) - (zb:file-parser file :grammar (zb:find-grammar "ASN.1") :verbose t))) + (zb:file-parser file :grammar (zb:find-grammar "ASN.1") :verbose verbose)))
Modified: trunk/asn.1/test/1.asn ============================================================================== --- trunk/asn.1/test/1.asn (original) +++ trunk/asn.1/test/1.asn Mon Sep 17 04:26:03 2007 @@ -1,48 +1,9 @@ RFC1155-SMI DEFINITIONS ::= BEGIN
-EXPORTS -- EVERYTHING - internet, directory, mgmt, - experimental, private, enterprises, - OBJECT-TYPE, ObjectName, ObjectSyntax, SimpleSyntax, - ApplicationSyntax, NetworkAddress, IpAddress, - Counter, Gauge, TimeTicks, Opaque; - - -- the path to the root - - internet OBJECT IDENTIFIER ::= { iso org(3) dod(6) 1 } - - directory OBJECT IDENTIFIER ::= { internet 1 } - - mgmt OBJECT IDENTIFIER ::= { internet 2 } - - experimental OBJECT IDENTIFIER ::= { internet 3 } - - private OBJECT IDENTIFIER ::= { internet 4 } - enterprises OBJECT IDENTIFIER ::= { private 1 } - - -- definition of object types - - - -- names of objects in the MIB - - ObjectName ::= OBJECT IDENTIFIER - - OBJECT-TYPE MACRO ::= - BEGIN - TYPE NOTATION ::= "SYNTAX" type (TYPE ObjectSyntax) - "ACCESS" Access - "STATUS" Status - VALUE NOTATION ::= value (VALUE ObjectName) - - Access ::= "read-only" - | "read-write" - | "write-only" - | "not-accessible" - Status ::= "mandatory" - | "optional" - | "obsolete" - END +END
- -- names of objects in the MIB +RFC1155-SMI DEFINITIONS ::= BEGIN
END + + A-- CC