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

Allow function parameter types in QualifiedName #1626

Closed
wants to merge 1 commit into from

Conversation

rainers
Copy link
Member

@rainers rainers commented Apr 8, 2017

Nested symbols encode the function arguments of the outer function, similar to template arguments.

Nested symbols encode the function arguments of the outer function, similar to template arguments.
@ibuclaw
Copy link
Member

ibuclaw commented Apr 9, 2017

When testing this against your bison files, it adds 6 shift/reduce conflicts for dwebsite3.bison, and 5 shift/reduce conflicts for d_noconflicts.bison. ;-)

@rainers
Copy link
Member Author

rainers commented Apr 9, 2017

When testing this against your bison files, it adds 6 shift/reduce conflicts for dwebsite3.bison, and 5 shift/reduce conflicts for d_noconflicts.bison. ;-)

Yes, I had to add a token that tells the parser that there is no function return type after TypeFunctionNoReturn (see token QFT in https://gist.githubusercontent.com/rainers/6cdf73b48837defb9f88/raw/d6dc446362f4e41dedfa8e24f11b5a43f85285b4/dwebsite4.bison). That's a deficiency of the LALR parser, but not an ambiguity in the grammar. I think an adhoc parser will be able to handle this without too much trouble.

I also wondered why bison doesn't detect https://issues.dlang.org/show_bug.cgi?id=14591, maybe it's a similar case?

@ibuclaw
Copy link
Member

ibuclaw commented Apr 10, 2017

I also wondered why bison doesn't detect https://issues.dlang.org/show_bug.cgi?id=14591, maybe it's a similar case?

I could be swayed into believing that the problem is with my hand rolled parser. I'll have another look at debugging it. Perhaps the problem would go away if I refactor the symbol name handling into two functions - I think it's currently the case that QualifiedName and SymbolName are handled by the same function. (see dland_parse_symbol for comments about possible ambiguity between pascal and template value parameter https://github.com/ibuclaw/gdb/blob/dlang/libiberty/d-demangle.c).

@ibuclaw
Copy link
Member

ibuclaw commented Apr 10, 2017

I may have to check the change history of the mangle abi too, as I based that program on the current documentation of the time. I can already see some new parts that need adding. ☺️

@ibuclaw
Copy link
Member

ibuclaw commented Apr 10, 2017

By the way, I noticed this in your comments:

FuncAttrScope:
    'M'                // 'M' indistinguishable from first parameter having scope modifier, use Nm instead?
  ;

Looks like no one updated the documentation after this change: dlang/dmd@7b1b10f

@rainers
Copy link
Member Author

rainers commented Apr 11, 2017

Yeah, my plea wasn't heard (dlang/dmd#6496 (comment)). Here's a PR to change that: #1630

@rainers
Copy link
Member Author

rainers commented Apr 13, 2017

Oops, just noticed that "Improve this page" created this PR as a banch of the dlang.org repository (I didn't even know I could merge PRs in this repo). I'll close and delete this one and reopen another from my fork.

@rainers rainers closed this Apr 13, 2017
@rainers rainers deleted the rainers-patch-3 branch April 13, 2017 18:57
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

Successfully merging this pull request may close these issues.

2 participants