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

Method parse

py/generate_bidi.py:1043–1070  ·  view source on GitHub ↗

Parse CDDL content and return modules.

(self)

Source from the content-addressed store, hash-verified

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

Callers 13

mainFunction · 0.95
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
oFunction · 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

no test coverage detected