aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-02-18 14:28:47 +0100
committerMicael Karlberg <[email protected]>2011-02-18 14:28:47 +0100
commit21017ea91338cd3f14f3957869e4bba1780c39df (patch)
treedced047efe15c98fb5b46ddea44e1fc098dd3170
parent59bb06ecfad98e38a849740fc0388668bb9a1eeb (diff)
downloadotp-21017ea91338cd3f14f3957869e4bba1780c39df.tar.gz
otp-21017ea91338cd3f14f3957869e4bba1780c39df.tar.bz2
otp-21017ea91338cd3f14f3957869e4bba1780c39df.zip
Fixed mc_compliancepart rule (improper list).
-rw-r--r--lib/snmp/src/compile/snmpc_mib_gram.yrl190
1 files changed, 96 insertions, 94 deletions
diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl
index 8be8375280..b817b66df3 100644
--- a/lib/snmp/src/compile/snmpc_mib_gram.yrl
+++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -80,7 +80,7 @@ revisions
listofdefinitionsv2
mibid
last_updated
-oranization
+organization
contact_info
revision
revision_string
@@ -231,8 +231,8 @@ mib -> mibname 'DEFINITIONS' implies 'BEGIN'
defs = Defs}.
v1orv2 -> moduleidentity listofdefinitionsv2 :
- {v2_mib, ['$1'|lrev(v1orv2_mod, '$2')]}.
-v1orv2 -> listofdefinitions : {v1_mib, lrev(v1orv2_list, '$1')}.
+ {v2_mib, ['$1'|lreverse(v1orv2_mod, '$2')]}.
+v1orv2 -> listofdefinitions : {v1_mib, lreverse(v1orv2_list, '$1')}.
definition -> objectidentifier : '$1'.
definition -> objecttypev1 : '$1'.
@@ -250,7 +250,7 @@ imports -> imports_from_one_mib : ['$1'].
imports -> imports_from_one_mib imports : ['$1' | '$2'].
imports_from_one_mib -> listofimports 'FROM' variable :
- {{val('$3'), lrev(imports, '$1')}, line_of('$2')}.
+ {{val('$3'), lreverse(imports_from_one_mib, '$1')}, line_of('$2')}.
listofimports -> import_stuff : ['$1'].
listofimports -> listofimports ',' import_stuff : ['$3' | '$1'].
@@ -317,7 +317,7 @@ import_stuff -> 'TAddress'
traptype -> objectname 'TRAP-TYPE' 'ENTERPRISE' objectname varpart
description referpart implies integer :
- Trap = make_trap('$1', '$4', lrev(trap, '$5'),
+ Trap = make_trap('$1', '$4', lreverse(traptype, '$5'),
'$6', '$7', val('$9')),
{Trap, line_of('$2')}.
@@ -345,7 +345,7 @@ newtype -> newtypename implies syntax :
{NT, line_of('$2')}.
tableentrydefinition -> newtypename implies 'SEQUENCE' '{' fields '}' :
- Seq = make_sequence('$1', lrev(table_entry, '$5')),
+ Seq = make_sequence('$1', lreverse(tableentrydefinition, '$5')),
{Seq, line_of('$3')}.
% returns: list of {<fieldname>, <asn1_type>}
@@ -429,9 +429,9 @@ variables -> variables ',' objectname : ['$3' | '$1'].
implies -> '::=' : '$1'.
implies -> ':' ':' '=' : w("Sloppy asignment on line ~p", [line_of('$1')]), '$1'.
-descriptionfield -> string : lrev(descriptionfield, val('$1')).
+descriptionfield -> string : lreverse(descriptionfield, val('$1')).
descriptionfield -> '$empty' : undefined.
-description -> 'DESCRIPTION' string : lrev(description, val('$2')).
+description -> 'DESCRIPTION' string : lreverse(description, val('$2')).
description -> '$empty' : undefined.
displaypart -> 'DISPLAY-HINT' string : display_hint('$2') .
@@ -439,7 +439,7 @@ displaypart -> '$empty' : undefined .
% returns: {indexes, undefined}
% | {indexes, IndexList} where IndexList is a list of aliasnames.
-indexpartv1 -> 'INDEX' '{' indextypesv1 '}' : {indexes, lrev(index, '$3')}.
+indexpartv1 -> 'INDEX' '{' indextypesv1 '}' : {indexes, lreverse(indexpartv1, '$3')}.
indexpartv1 -> '$empty' : {indexes, undefined}.
indextypesv1 -> indextypev1 : ['$1'].
@@ -457,14 +457,16 @@ parentintegers -> atom '(' integer ')' parentintegers : [val('$3') | '$5'].
defvalpart -> 'DEFVAL' '{' integer '}' : {defval, val('$3')}.
defvalpart -> 'DEFVAL' '{' atom '}' : {defval, val('$3')}.
defvalpart -> 'DEFVAL' '{' '{' defbitsvalue '}' '}' : {defval, '$4'}.
-defvalpart -> 'DEFVAL' '{' quote atom '}'
- : {defval, make_defval_for_string(line_of('$1'), lrev(defval_atom, val('$3')),
- val('$4'))}.
-defvalpart -> 'DEFVAL' '{' quote variable '}'
- : {defval, make_defval_for_string(line_of('$1'), lrev(defval_variable, val('$3')),
- val('$4'))}.
-defvalpart -> 'DEFVAL' '{' string '}'
- : {defval, lrev(defval_string, val('$3'))}.
+defvalpart -> 'DEFVAL' '{' quote atom '}' :
+ {defval, make_defval_for_string(line_of('$1'),
+ lreverse(defvalpart_quote_atom, val('$3')),
+ val('$4'))}.
+defvalpart -> 'DEFVAL' '{' quote variable '}' :
+ {defval, make_defval_for_string(line_of('$1'),
+ lreverse(defvalpart_quote_variable, val('$3')),
+ val('$4'))}.
+defvalpart -> 'DEFVAL' '{' string '}' :
+ {defval, lreverse(defvalpart_string, val('$3'))}.
defvalpart -> '$empty' : undefined.
defbitsvalue -> defbitsnames : '$1'.
@@ -482,7 +484,7 @@ accessv1 -> atom: accessv1('$1').
statusv1 -> atom : statusv1('$1').
-referpart -> 'REFERENCE' string : lrev(refer, val('$2')).
+referpart -> 'REFERENCE' string : lreverse(referpart, val('$2')).
referpart -> '$empty' : undefined.
@@ -492,7 +494,7 @@ referpart -> '$empty' : undefined.
%%----------------------------------------------------------------------
moduleidentity -> mibid 'MODULE-IDENTITY'
'LAST-UPDATED' last_updated
- 'ORGANIZATION' oranization
+ 'ORGANIZATION' organization
'CONTACT-INFO' contact_info
'DESCRIPTION' descriptionfield
revisionpart nameassign :
@@ -501,20 +503,20 @@ moduleidentity -> mibid 'MODULE-IDENTITY'
{MI, line_of('$2')}.
mibid -> atom : val('$1').
-last_updated -> string : lrev(last_upd, val('$1')) .
-oranization -> string : lrev(org, val('$1')) .
-contact_info -> string : lrev(contact, val('$1')) .
+last_updated -> string : lreverse(last_updated, val('$1')) .
+organization -> string : lreverse(organization, val('$1')) .
+contact_info -> string : lreverse(contact_info, val('$1')) .
revisionpart -> '$empty' : [] .
-revisionpart -> revisions : lrev(revision, '$1') .
+revisionpart -> revisions : lreverse(revisionpart, '$1') .
revisions -> revision : ['$1'] .
revisions -> revisions revision : ['$2' | '$1'] .
revision -> 'REVISION' revision_string 'DESCRIPTION' revision_desc :
make_revision('$2', '$4') .
-revision_string -> string : lrev(revision_str, val('$1')) .
-revision_desc -> string : lrev(revision_desc, val('$1')) .
+revision_string -> string : lreverse(revision_string, val('$1')) .
+revision_desc -> string : lreverse(revision_desc, val('$1')) .
definitionv2 -> objectidentifier : '$1'.
definitionv2 -> objecttypev2 : '$1'.
@@ -558,19 +560,19 @@ notificationgroup -> objectname 'NOTIFICATION-GROUP' 'NOTIFICATIONS' '{'
modulecompliance -> objectname 'MODULE-COMPLIANCE' 'STATUS' statusv2
description referpart mc_modulepart nameassign :
- io:format("modulecompliance -> "
- "~n '$1': ~p"
- "~n '$4': ~p"
- "~n '$5': ~p"
- "~n '$6': ~p"
- "~n '$7': ~p"
- "~n '$8': ~p"
- "~n", ['$1', '$4', '$5', '$6', '$7', '$8']),
+%% io:format("modulecompliance -> "
+%% "~n '$1': ~p"
+%% "~n '$4': ~p"
+%% "~n '$5': ~p"
+%% "~n '$6': ~p"
+%% "~n '$7': ~p"
+%% "~n '$8': ~p"
+%% "~n", ['$1', '$4', '$5', '$6', '$7', '$8']),
MC = make_module_compliance('$1', '$4', '$5', '$6',
'$7', '$8'),
- io:format("modulecompliance -> "
- "~n MC: ~p"
- "~n", [MC]),
+%% io:format("modulecompliance -> "
+%% "~n MC: ~p"
+%% "~n", [MC]),
{MC, line_of('$2')}.
@@ -582,11 +584,11 @@ agentcapabilities -> objectname 'AGENT-CAPABILITIES'
'$8', '$9', '$10'),
{AC, line_of('$2')}.
-prodrel -> string : lrev(prodrel, val('$1')).
+prodrel -> string : lreverse(prodrel, val('$1')).
ac_status -> atom : ac_status('$1').
-ac_modulepart -> ac_modules : lrev(ac_module, '$1').
+ac_modulepart -> ac_modules : lreverse(ac_modulepart, '$1').
ac_modulepart -> '$empty' : [].
ac_modules -> ac_module : '$1'.
@@ -599,7 +601,7 @@ ac_modulenamepart -> mibname : '$1'.
ac_modulenamepart -> '$empty' : undefined.
ac_variationpart -> '$empty' : [].
-ac_variationpart -> ac_variations : lrev(ac_variation, '$1').
+ac_variationpart -> ac_variations : lreverse(ac_variationpart, '$1').
ac_variations -> ac_variation : '$1'.
ac_variations -> ac_variations ac_variation : ['$2' | ['$1']].
@@ -616,77 +618,88 @@ ac_accesspart -> '$empty' : undefined.
ac_access -> atom: ac_access('$1').
ac_creationpart -> 'CREATION-REQUIRES' '{' objects '}' :
- io:format("ac_creationpart -> $3: ~p~n", ['$3']),
- lrev(ac_creation, '$3').
+%% io:format("ac_creationpart -> $3: ~p~n", ['$3']),
+ lreverse(ac_creationpart, '$3').
ac_creationpart -> '$empty' :
[].
mc_modulepart -> '$empty' :
- io:format("mc_modulepart -> empty~n", []), [].
+%% io:format("mc_modulepart -> empty~n", []),
+ [].
mc_modulepart -> mc_modules :
- io:format("mc_modulepart -> $1: ~p~n", ['$1']),
- lrev(mc_modulepart, '$1').
+%% io:format("mc_modulepart -> $1: ~p~n", ['$1']),
+ lreverse(mc_modulepart, '$1').
mc_modules -> mc_module:
- io:format("mc_modules -> (module) $1: ~p~n", ['$1']),
+%% io:format("mc_modules -> (module) $1: ~p~n", ['$1']),
['$1'].
mc_modules -> mc_modules mc_module:
- io:format("mc_modules -> (modules module)"
- "~n $1: ~p"
- "~n $2: ~p"
- "~n", ['$1', '$2']),
+%% io:format("mc_modules -> (modules module)"
+%% "~n $1: ~p"
+%% "~n $2: ~p"
+%% "~n", ['$1', '$2']),
['$1' | ['$2']].
mc_module -> 'MODULE' mc_modulenamepart mc_mandatorypart mc_compliancepart :
- io:format("mc_module -> "
- "~n $2: ~p"
- "~n $3: ~p"
- "~n $4: ~p"
- "~n", ['$2', '$3', '$4']),
+%% io:format("mc_module -> "
+%% "~n $2: ~p"
+%% "~n $3: ~p"
+%% "~n $4: ~p"
+%% "~n", ['$2', '$3', '$4']),
make_mc_module('$2', '$3', '$4').
mc_modulenamepart -> mibname : '$1'.
mc_modulenamepart -> '$empty' : undefined.
mc_mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}' :
- io:format("mc_mandatorypart -> $3: ~p~n", ['$3']),
- lrev(mc_mandatorypart, '$3').
+%% io:format("mc_mandatorypart -> $3: ~p~n", ['$3']),
+ lreverse(mc_mandatorypart, '$3').
mc_mandatorypart -> '$empty' :
- io:format("mc_mandatorypart -> empty~n", []),
+%% io:format("mc_mandatorypart -> empty~n", []),
[].
mc_compliancepart -> mc_compliances :
- io:format("mc_compliancepart -> $1: ~p~n", ['$1']),
- lrev(mc_compliancepart, '$1').
+%% i("mc_compliancepart -> "
+%% "~n $1: ~p", ['$1']),
+ lreverse(mc_compliancepart, '$1').
mc_compliancepart -> '$empty' :
- io:format("mc_compliancepart -> empty~n", []),
+%% i("mc_compliancepart -> empty", []),
[].
-mc_compliances -> mc_compliance : '$1'.
-mc_compliances -> mc_compliances mc_compliance : ['$2' | ['$1']].
+mc_compliances -> mc_compliance :
+%% i("mc_compliances -> "
+%% "~n $1: ~p", ['$1']),
+ ['$1'].
+mc_compliances -> mc_compliance mc_compliances :
+%% i("mc_compliances -> "
+%% "~n $1: ~p"
+%% "~n $2: ~p", ['$1', '$2']),
+ ['$1' | '$2'].
mc_compliance -> mc_compliancegroup :
- io:format("mc_compliance -> (compliancegroup) ~p~n", ['$1']),
+%% i("mc_compliance -> "
+%% "~n [compliancegroup] $1: ~p", ['$1']),
'$1'.
mc_compliance -> mc_object :
- io:format("mc_compliance -> (object) ~p~n", ['$1']),
+%% i("mc_compliance -> "
+%% "~n [object] $1: ~p", ['$1']),
'$1'.
mc_compliancegroup -> 'GROUP' objectname description :
- io:format("mc_compliancegroup -> "
- "~n $2: ~p"
- "~n $3: ~p"
- "~n", ['$2', '$3']),
+%% i("mc_compliancegroup -> "
+%% "~n $2: ~p"
+%% "~n $3: ~p"
+%% "~n", ['$2', '$3']),
make_mc_compliance_group('$2', '$3').
mc_object -> 'OBJECT' objectname syntaxpart writesyntaxpart mc_accesspart description :
- io:format("mc_object -> "
- "~n $2: ~p"
- "~n $3: ~p"
- "~n $4: ~p"
- "~n $5: ~p"
- "~n $6: ~p"
- "~n", ['$2', '$3', '$4', '$5', '$6']),
+%% i("mc_object -> "
+%% "~n $2: ~p"
+%% "~n $3: ~p"
+%% "~n $4: ~p"
+%% "~n $5: ~p"
+%% "~n $6: ~p"
+%% "~n", ['$2', '$3', '$4', '$5', '$6']),
make_mc_object('$2', '$3', '$4', '$5', '$6').
syntaxpart -> 'SYNTAX' syntax : '$2'.
@@ -711,7 +724,7 @@ objecttypev2 -> objectname 'OBJECT-TYPE'
'$11', '$12', Kind, '$15'),
{OT, line_of('$2')}.
-indexpartv2 -> 'INDEX' '{' indextypesv2 '}' : {indexes, lrev(indexv2, '$3')}.
+indexpartv2 -> 'INDEX' '{' indextypesv2 '}' : {indexes, lreverse(indexpartv2, '$3')}.
indexpartv2 -> 'AUGMENTS' '{' entry '}' : {augments, '$3'}.
indexpartv2 -> '$empty' : {indexes, undefined}.
@@ -736,7 +749,7 @@ notification -> objectname 'NOTIFICATION-TYPE' objectspart
Not = make_notification('$1','$3','$5', '$7', '$8', '$9'),
{Not, line_of('$2')}.
-objectspart -> 'OBJECTS' '{' objects '}' : lrev(objects, '$3').
+objectspart -> 'OBJECTS' '{' objects '}' : lreverse(objectspart, '$3').
objectspart -> '$empty' : [].
objects -> objectname : ['$1'].
@@ -1175,23 +1188,12 @@ filter_v2imports(_,Type) -> {type, Type}.
w(F, A) ->
?vwarning(F, A).
-lrev(Tag, L) when is_list(L) ->
- io:format("lrev -> try reverse list ~p: "
- "~n ~p"
- "~n", [Tag, L]),
- case (catch lists:reverse(L)) of
- RevL when is_list(RevL) ->
- RevL;
- {'EXIT', Reason} ->
- io:format("lrev -> failed reversing list: "
- "~n ~p"
- "~n", [Reason]),
- exit({failed_reversing_list, Reason})
- end;
-lrev(Tag, X) ->
+lreverse(_Tag, L) when is_list(L) ->
+ lists:reverse(L);
+lreverse(Tag, X) ->
exit({bad_list, Tag, X}).
-%i(F, A) ->
-% io:format("~w:" ++ F ++ "~n", [?MODULE|A]).
+%% i(F, A) ->
+%% io:format("~w:" ++ F ++ "~n", [?MODULE|A]).