Skip to content

Class definition attributes not parsed correctly #67

Description

@joeced

I started working with textmate-grammar-python for the https://github.com/sphinx-contrib/matlabdomain package. Thanks for starting this work - it's much more structured than the pygments tokens.

Given this MATLAB class definition

classdef (AllowedSubclasses = {?SubClass1,?SubClass2}) SuperClass
end

is parsed to these tokens with textmate-grammar-python==0.6.0:

{'token': 'source.matlab',
 'children': [{'token': 'meta.class.matlab',
               'begin': [{'token': 'storage.type.class.matlab', 'content': 'classdef'}],
               'end': [{'token': 'storage.type.class.end.matlab', 'content': 'end'}],
               'children': [{'token': 'meta.class.declaration.matlab',
                             'children': [{'token': 'punctuation.section.parens.begin.matlab', 'content': '('},
                                          {'token': 'storage.modifier.class.matlab', 'content': 'AllowedSubclasses'},    
                                          {'token': 'keyword.operator.assignment.matlab', 'content': '='},
                                          {'token': 'punctuation.separator.modifier.comma.matlab', 'content': ','},      
                                          {'token': 'storage.modifier.class.matlab', 'content': 'SubClass2'},
                                          {'token': 'punctuation.section.parens.end.matlab', 'content': ')'},
                                          {'token': 'entity.name.type.class.matlab', 'content': 'SuperClass'}]}]}]}      

As one can see, we are missing:

  • Begin and end curly braces { / }.
  • SubClass1
  • The ? in front of SubClass1 and SubClass2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions