Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing Issues #23

Open
anosidium opened this issue Apr 29, 2021 · 1 comment
Open

Parsing Issues #23

anosidium opened this issue Apr 29, 2021 · 1 comment

Comments

@anosidium
Copy link

My app is a Cocoa app and the constraints are based on AppKit.

Input No. 1:

(
    "<NSLayoutConstraint:0x6000025f4c30 'GridView.bottom_containment' (NSGridView:0x7fbc23ce8660.row-boundary+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.row-boundary)) >= NSTextField:0x7fbc23cf1680.bottom   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200 )>",
    "<NSLayoutConstraint:0x6000025f5180 'GridView_Y_centering' (NSGridView:0x7fbc23ce8660.row-boundary+0.5*(NSGridView:0x7fbc23ce8660.bottom - NSGridView:0x7fbc23ce8660.row-boundary)) == HacKit.BadgeView:0x7fbc23ce83e0.centerY   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200, NSGridView:0x7fbc23ce8660.bottom:0x600001d44200 )>",
    "<NSLayoutConstraint:0x6000025f4730 'GridView_bottom_placement' (NSGridView:0x7fbc23ce8660.top+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.top)) == NSImageView:0x7fbc23cf0ea0.bottom   (active, names: NSGridView:0x7fbc23ce8660.top:0x600001d44ec0, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240 )>",
    "<NSLayoutConstraint:0x6000025f51d0 'GridView.top_containment' NSGridView:0x7fbc23ce8660.row-boundary <= HacKit.BadgeView:0x7fbc23ce83e0.top   (active)>",
    "<NSLayoutConstraint:0x6000025f4f00 NSTextField:0x7fbc23cf1680.firstBaseline == NSSlider:0x7fbc23cf1b10.firstBaseline   (active)>",
    "<NSLayoutConstraint:0x6000025f4780 'GridView.top_containment' NSGridView:0x7fbc23ce8660.top <= NSImageView:0x7fbc23cf0ea0.top   (active)>",
    "<NSLayoutConstraint:0x60000258fca0 V:|-(NSSpace(20))-[NSGridView:0x7fbc23ce8660]   (active, names: '|':NSView:0x7fbc23ce88f0 )>",
    "<NSLayoutConstraint:0x60000258fcf0 V:[NSGridView:0x7fbc23ce8660]-(NSSpace(20))-|   (active, names: '|':NSView:0x7fbc23ce88f0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025f57c0 h=-&- v=-&- NSView:0x7fbc23ce88f0.minY == - 1   (active, names: '|':NSBox:0x7fbc23ce8b30'Story' )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025f5810 h=-&- v=-&- V:|-(15)-[NSView:0x7fbc23ce88f0]   (active, names: '|':NSBox:0x7fbc23ce8b30'Story' )>",
    "<NSLayoutConstraint:0x60000258fa20 V:[NSBox:0x7fbc23ce8b30'Story']-(NSSpace(20))-|   (active, names: '|':NSView:0x7fbc23ce8de0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025a2a30 h=--& v=--& NSView:0x7fbc23ce8de0.height == 167   (active)>",
    "<NSLayoutConstraint:0x60000258f9d0 V:[NSBox:0x7fbc23ce9020'Stories List']-(NSSpace(8))-[NSBox:0x7fbc23ce8b30'Story']   (active)>",
    "<NSLayoutConstraint:0x60000258f980 V:|-(NSSpace(20))-[NSBox:0x7fbc23ce9020'Stories List']   (active, names: '|':NSView:0x7fbc23ce8de0 )>",
    "<NSLayoutConstraint:0x60000258f840 NSBox:0x7fbc23ce9020'Stories List'.height == 89   (active)>",
    "<NSLayoutConstraint:0x6000025f4f50 'GridView.top_containment' NSGridView:0x7fbc23ce8660.row-boundary <= NSSlider:0x7fbc23cf1b10.top   (active)>"
)

Output:

Line 2, Column 71
    "<NSLayoutConstraint:0x6000025f4c30 'GridView.bottom_containment' (NSGridView:0x7fbc23ce8660.row-boundary+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.row-boundary)) >= NSTextField:0x7fbc23cf1680.bottom   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200 )>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: whitespace in constraint instance
Expected: whitespace
Expected: ':' in instance
Expected: valid class name character in instance
Expected: '.' in dot attribute
Expected: valid partial identifier character
Expected: 'H'
Expected: 'V'

Input No. 2:

(
    "<NSLayoutConstraint:0x6000025f4c30 'GridView.bottom_containment' (NSGridView:0x7fbc23ce8660.row-boundary+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.row-boundary)) >= NSTextField:0x7fbc23cf1680.bottom   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200 )>",
    "<NSLayoutConstraint:0x6000025f5180 'GridView_Y_centering' (NSGridView:0x7fbc23ce8660.row-boundary+0.5*(NSGridView:0x7fbc23ce8660.bottom - NSGridView:0x7fbc23ce8660.row-boundary)) == HacKit.BadgeView:0x7fbc23ce83e0.centerY   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200, NSGridView:0x7fbc23ce8660.bottom:0x600001d44200 )>",
    "<NSLayoutConstraint:0x6000025f51d0 'GridView.top_containment' NSGridView:0x7fbc23ce8660.row-boundary <= HacKit.BadgeView:0x7fbc23ce83e0.top   (active)>",
    "<NSLayoutConstraint:0x6000025f4f00 NSTextField:0x7fbc23cf1680.firstBaseline == NSSlider:0x7fbc23cf1b10.firstBaseline   (active)>",
    "<NSLayoutConstraint:0x60000258fca0 V:|-(NSSpace(20))-[NSGridView:0x7fbc23ce8660]   (active, names: '|':NSView:0x7fbc23ce88f0 )>",
    "<NSLayoutConstraint:0x60000258fcf0 V:[NSGridView:0x7fbc23ce8660]-(NSSpace(20))-|   (active, names: '|':NSView:0x7fbc23ce88f0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025f57c0 h=-&- v=-&- NSView:0x7fbc23ce88f0.minY == - 1   (active, names: '|':NSBox:0x7fbc23ce8b30'Story' )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025f5810 h=-&- v=-&- V:|-(15)-[NSView:0x7fbc23ce88f0]   (active, names: '|':NSBox:0x7fbc23ce8b30'Story' )>",
    "<NSLayoutConstraint:0x60000258fa20 V:[NSBox:0x7fbc23ce8b30'Story']-(NSSpace(20))-|   (active, names: '|':NSView:0x7fbc23ce8de0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000025a2a30 h=--& v=--& NSView:0x7fbc23ce8de0.height == 167   (active)>",
    "<NSLayoutConstraint:0x60000258f9d0 V:[NSBox:0x7fbc23ce9020'Stories List']-(NSSpace(8))-[NSBox:0x7fbc23ce8b30'Story']   (active)>",
    "<NSLayoutConstraint:0x60000258f980 V:|-(NSSpace(20))-[NSBox:0x7fbc23ce9020'Stories List']   (active, names: '|':NSView:0x7fbc23ce8de0 )>",
    "<NSLayoutConstraint:0x60000258f840 NSBox:0x7fbc23ce9020'Stories List'.height == 89   (active)>",
    "<NSLayoutConstraint:0x6000025f4f50 'GridView.top_containment' NSGridView:0x7fbc23ce8660.row-boundary <= NSSlider:0x7fbc23cf1b10.top   (active)>",
    "<NSLayoutConstraint:0x6000025f4a00 'GridView.top_containment' NSGridView:0x7fbc23ce8660.top <= NSImageView:0x7fbc23cf1290.top   (active)>",
    "<NSLayoutConstraint:0x6000025f4960 'GridView_bottom_placement' (NSGridView:0x7fbc23ce8660.top+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.top)) == NSImageView:0x7fbc23cf1290.bottom   (active, names: NSGridView:0x7fbc23ce8660.top:0x600001d44ec0, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240 )>"
)

Output:

Line 2, Column 71
    "<NSLayoutConstraint:0x6000025f4c30 'GridView.bottom_containment' (NSGridView:0x7fbc23ce8660.row-boundary+((NSGridView:0x7fbc23ce8660.row-boundary-6) - NSGridView:0x7fbc23ce8660.row-boundary)) >= NSTextField:0x7fbc23cf1680.bottom   (active, names: NSGridView:0x7fbc23ce8660.row-boundary:0x600001d5a240, NSGridView:0x7fbc23ce8660.row-boundary:0x600001d40200 )>",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: whitespace in constraint instance
Expected: whitespace
Expected: ':' in instance
Expected: valid class name character in instance
Expected: '.' in dot attribute
Expected: valid partial identifier character
Expected: 'H'
Expected: 'V'

Input No. 3:

(
    "<NSLayoutConstraint:0x60000258f840 NSBox:0x7fbc23ce9020'Stories List'.height == 89   (active)> (Actual Distance - pixels):178"
)

Output:

Line 2, Column 100
    "<NSLayoutConstraint:0x60000258f840 NSBox:0x7fbc23ce9020'Stories List'.height == 89   (active)> (Actual Distance - pixels):178"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Expected: '"' in >"

The last input is based on me clicking on the orange vertical line.

Screenshot 2021-04-29 at 5 55 32 PM

@johnpatrickmorgan
Copy link
Owner

Thank you very much for documenting these errors. I believe the first two are due to the lack of support for constraints using NSLayoutDimensions based on multiple anchors (similar to #21). I think supporting those will be a bit tricky, but it's useful to have some examples of how they print, so thanks!

As for the third one, I've not worked on macOS so the debugging feature is new to me, it looks useful! It looks like these have a suffix after the closing > which should be easy enough to parse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants