Skip to content

Commit ce27ef2

Browse files
yanns1oaubert
authored andcommitted
Handle inline comments for enum values
Closes #285 Signed-off-by: Olivier Aubert <[email protected]>
1 parent bb979da commit ce27ef2

File tree

2 files changed

+45
-31
lines changed

2 files changed

+45
-31
lines changed

generated/3.0/vlc.py

+28-28
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@
5252

5353
logger = logging.getLogger(__name__)
5454

55-
__version__ = "3.0.21201"
55+
__version__ = "3.0.21202"
5656
__libvlc_version__ = "3.0.21"
57-
__generator_version__ = "2.1"
58-
build_date = "Sun Oct 6 22:05:11 2024 3.0.21"
57+
__generator_version__ = "2.2"
58+
build_date = "Mon Oct 7 14:14:00 2024 3.0.21"
5959

6060
# The libvlc doc states that filenames are expected to be in UTF8, do
6161
# not rely on sys.getfilesystemencoding() which will be confused,
@@ -4109,10 +4109,10 @@ class LogLevel(_Enum):
41094109
.. note:: Future LibVLC versions may define new levels.
41104110
41114111
Defined symbols:
4112-
* ``vlc.LogLevel.DEBUG``
4113-
* ``vlc.LogLevel.NOTICE`` < Debug message
4114-
* ``vlc.LogLevel.WARNING`` < Important informational message
4115-
* ``vlc.LogLevel.ERROR`` < Warning (potential error) message
4112+
* ``vlc.LogLevel.DEBUG`` < Debug message
4113+
* ``vlc.LogLevel.NOTICE`` < Important informational message
4114+
* ``vlc.LogLevel.WARNING`` < Warning (potential error) message
4115+
* ``vlc.LogLevel.ERROR`` < Error message
41164116
"""
41174117

41184118
_enum_names_ = {
@@ -4221,16 +4221,16 @@ class MediaPlayerRole(_Enum):
42214221
See :func:`libvlc_media_player_set_role`.
42224222
42234223
Defined symbols:
4224-
* ``vlc.MediaPlayerRole._None``
4225-
* ``vlc.MediaPlayerRole.Music`` < Don't use a media player role
4226-
* ``vlc.MediaPlayerRole.Video`` < Music (or radio) playback
4227-
* ``vlc.MediaPlayerRole.Communication`` < Video playback
4228-
* ``vlc.MediaPlayerRole.Game`` < Speech, real-time communication
4229-
* ``vlc.MediaPlayerRole.Notification`` < Video game
4230-
* ``vlc.MediaPlayerRole.Animation`` < User interaction feedback
4231-
* ``vlc.MediaPlayerRole.Production`` < Embedded animation (e.g. in web page)
4232-
* ``vlc.MediaPlayerRole.Accessibility`` < Audio editting/production
4233-
* ``vlc.MediaPlayerRole.Test`` < Accessibility
4224+
* ``vlc.MediaPlayerRole._None`` < Don't use a media player role
4225+
* ``vlc.MediaPlayerRole.Music`` < Music (or radio) playback
4226+
* ``vlc.MediaPlayerRole.Video`` < Video playback
4227+
* ``vlc.MediaPlayerRole.Communication`` < Speech, real-time communication
4228+
* ``vlc.MediaPlayerRole.Game`` < Video game
4229+
* ``vlc.MediaPlayerRole.Notification`` < User interaction feedback
4230+
* ``vlc.MediaPlayerRole.Animation`` < Embedded animation (e.g. in web page)
4231+
* ``vlc.MediaPlayerRole.Production`` < Audio editting/production
4232+
* ``vlc.MediaPlayerRole.Accessibility`` < Accessibility
4233+
* ``vlc.MediaPlayerRole.Test`` Testing
42344234
"""
42354235

42364236
_enum_names_ = {
@@ -4621,7 +4621,7 @@ class VideoLogoOption(_Enum):
46214621
46224622
Defined symbols:
46234623
* ``vlc.VideoLogoOption.logo_enable``
4624-
* ``vlc.VideoLogoOption.logo_file``
4624+
* ``vlc.VideoLogoOption.logo_file`` < string argument, "file,d,t;file,d,t;..."
46254625
* ``vlc.VideoLogoOption.logo_x`` < string argument, "file,d,t;file,d,t;..."
46264626
* ``vlc.VideoLogoOption.logo_y``
46274627
* ``vlc.VideoLogoOption.logo_delay``
@@ -4657,7 +4657,7 @@ class VideoMarqueeOption(_Enum):
46574657
46584658
Defined symbols:
46594659
* ``vlc.VideoMarqueeOption.Enable``
4660-
* ``vlc.VideoMarqueeOption.Text``
4660+
* ``vlc.VideoMarqueeOption.Text`` string argument
46614661
* ``vlc.VideoMarqueeOption.Color`` string argument
46624662
* ``vlc.VideoMarqueeOption.Opacity``
46634663
* ``vlc.VideoMarqueeOption.Position``
@@ -4698,14 +4698,14 @@ class VideoOrient(_Enum):
46984698
"""
46994699
47004700
Defined symbols:
4701-
* ``vlc.VideoOrient.top_left``
4702-
* ``vlc.VideoOrient.top_right`` < Normal. Top line represents top, left column left.
4703-
* ``vlc.VideoOrient.bottom_left`` < Flipped horizontally
4704-
* ``vlc.VideoOrient.bottom_right`` < Flipped vertically
4705-
* ``vlc.VideoOrient.left_top`` < Rotated 180 degrees
4706-
* ``vlc.VideoOrient.left_bottom`` < Transposed
4707-
* ``vlc.VideoOrient.right_top`` < Rotated 90 degrees clockwise (or 270 anti-clockwise)
4708-
* ``vlc.VideoOrient.right_bottom`` < Rotated 90 degrees anti-clockwise
4701+
* ``vlc.VideoOrient.top_left`` < Normal. Top line represents top, left column left.
4702+
* ``vlc.VideoOrient.top_right`` < Flipped horizontally
4703+
* ``vlc.VideoOrient.bottom_left`` < Flipped vertically
4704+
* ``vlc.VideoOrient.bottom_right`` < Rotated 180 degrees
4705+
* ``vlc.VideoOrient.left_top`` < Transposed
4706+
* ``vlc.VideoOrient.left_bottom`` < Rotated 90 degrees clockwise (or 270 anti-clockwise)
4707+
* ``vlc.VideoOrient.right_top`` < Rotated 90 degrees anti-clockwise
4708+
* ``vlc.VideoOrient.right_bottom`` < Anti-transposed
47094709
"""
47104710

47114711
_enum_names_ = {
@@ -4735,7 +4735,7 @@ class VideoProjection(_Enum):
47354735
47364736
Defined symbols:
47374737
* ``vlc.VideoProjection.rectangular``
4738-
* ``vlc.VideoProjection.equirectangular``
4738+
* ``vlc.VideoProjection.equirectangular`` < 360 spherical
47394739
* ``vlc.VideoProjection.cubemap_layout_standard`` < 360 spherical
47404740
"""
47414741

generator/generate.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
# Version number MUST have a major < 10 and a minor < 99 so that the
5353
# generated dist version can be correctly generated (major * 100 + minor).
54-
__version__ = "2.1"
54+
__version__ = "2.2"
5555

5656
_debug = False
5757

@@ -1388,8 +1388,22 @@ def parse_enums(self):
13881388
), "Expected `child` to have a child of name _name_. `child` is not of type _enumerator_? Parsing malformed C code?"
13891389
vname = tsnode_text(vname)
13901390

1391-
vdocs = self.parse_doxygen_comment(child)
1392-
if vdocs is None:
1391+
vdocs = None
1392+
# Find the value documentation.
1393+
if (
1394+
child.next_named_sibling is not None
1395+
and child.next_named_sibling.type == "comment"
1396+
and child.next_named_sibling.start_point[0] == child.end_point[0]
1397+
):
1398+
# There is a comment following the value on the same line
1399+
vdocs = clean_doxygen_comment(tsnode_text(child.next_named_sibling))
1400+
elif (
1401+
child.prev_sibling is not None
1402+
and child.prev_sibling.type == "comment"
1403+
):
1404+
# The comment is placed before the value
1405+
vdocs = clean_doxygen_comment(tsnode_text(child.prev_sibling))
1406+
else:
13931407
vdocs = ""
13941408

13951409
vvalue = child.child_by_field_name("value")

0 commit comments

Comments
 (0)