File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package directory
33import (
44 "fmt"
55 "regexp"
6+ "slices"
67 "strconv"
78 "strings"
89 "time"
@@ -164,8 +165,8 @@ func parseObjectClass(input string) (*ObjectClass, error) {
164165 `(?:DESC\s+'([^']+)')?\s*` +
165166 `(?:SUP\s+(?:([\w\-]+)|\(\s*([^)]+(?:\s+'[^)]+)*)\s*\)))?\s*` +
166167 `(STRUCTURAL|ABSTRACT|AUXILIARY)?\s*` +
167- `(?:MUST\s+\(\s*([^()]+)\s*\))?\s*` +
168- `(?:MAY\s+\(\s*([^()]+)\s*\))?\s*` +
168+ `(?:MUST\s+\(* \s*([^()]+)\s*\)* )?\s*` +
169+ `(?:MAY\s+\(* \s*([^()]+)\s*\)* )?\s*` +
169170 `\)` )
170171 matches := re .FindStringSubmatch (input )
171172
@@ -203,6 +204,10 @@ func parseObjectClass(input string) (*ObjectClass, error) {
203204 if matches [8 ] != "" {
204205 c .Must = strings .Fields (strings .ReplaceAll (matches [8 ], "$" , " " ))
205206 }
207+ if i := slices .Index (c .Must , "MAY" ); i != - 1 {
208+ c .May = c .Must [i + 1 :]
209+ c .Must = c .Must [:i ]
210+ }
206211 if matches [9 ] != "" {
207212 c .May = strings .Fields (strings .ReplaceAll (matches [9 ], "$" , " " ))
208213 }
You can’t perform that action at this time.
0 commit comments