
I use libsmi 0.4.5. When I have a textual convention like this one:
1) NiceString1 ::= TEXTUAL-CONVENTION DISPLAY-HINT "2d" STATUS current DESCRIPTION "doc" SYNTAX OCTET STRING (SIZE (2))
the pattern which "dumpsmi -f xsd" translates the display hint into is:
((0|[1-9]([0-9]{0,5}))
which has unbalanced parentheses.
I think that line 655 smiAsprintf( &ret, "%s(0|[1-9]([0-9]{0,%d})", should be smiAsprintf( &ret, "%s(0|[1-9]([0-9]{0,%d}))",
2) Similar problem here:
NiceString2 ::= TEXTUAL-CONVENTION DISPLAY-HINT "4d" STATUS current DESCRIPTION "doc" SYNTAX OCTET STRING (SIZE (0..2 | 4..5))
The pattern: (((0|[1-9]([0-9]{0,5}))|((0|[1-9]([0-9]{0,10})))
I think that line 726 if( ! lengths[ i - 2 ] ) { should be if( ! lengths[0] ) {
(The fix from problem 2 is needed too here.)
3) A third problem with patterns from display hints is that a period (.) is not always escaped with a backslash (.) (for example with the display hint "1x."). My suggested fix is to use a two-character char array for 'separator', and insert the '' already when the separator is set from the hint. Then no tests are needed further down, but the %c changed to %s.