MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / parse

Method parse

py/generate_bidi.py:1053–1080  ·  view source on GitHub ↗

Parse CDDL content and return modules.

(self)

Source from the content-addressed store, hash-verified

1051 logger.info(f"Loaded CDDL file: {self.cddl_path}")
1052
1053 def parse(self) -> dict[str, CddlModule]:
1054 """Parse CDDL content and return modules."""
1055 # Remove comments
1056 content = self._remove_comments(self.content)
1057
1058 # Extract all definitions
1059 self._extract_definitions(content)
1060
1061 # Extract event names from event union definitions
1062 self._extract_event_names()
1063
1064 # Extract type definitions by module
1065 self._extract_types()
1066
1067 # Extract event definitions by module
1068 self._extract_events()
1069
1070 # Extract command definitions by module
1071 self._extract_commands()
1072
1073 # If no modules found, create a default one from the filename
1074 if not self.modules:
1075 module_name = self.cddl_path.stem
1076 default_module = CddlModule(name=module_name)
1077 self.modules[module_name] = default_module
1078 logger.warning(f"No modules found in CDDL, creating default: {module_name}")
1079
1080 return self.modules
1081
1082 def _remove_comments(self, content: str) -> str:
1083 """Remove comments from CDDL content."""

Callers 14

mainFunction · 0.95
_presence_ofFunction · 0.45
ZFunction · 0.45
sFunction · 0.45
tinymce.min.jsFile · 0.45
iFunction · 0.45
nFunction · 0.45
eFunction · 0.45
sFunction · 0.45
mFunction · 0.45
rFunction · 0.45

Calls 8

_remove_commentsMethod · 0.95
_extract_definitionsMethod · 0.95
_extract_event_namesMethod · 0.95
_extract_typesMethod · 0.95
_extract_eventsMethod · 0.95
_extract_commandsMethod · 0.95
CddlModuleClass · 0.85
warningMethod · 0.80

Tested by 1

_presence_ofFunction · 0.36