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

C++ grammar refactoring #593

Closed
guwirth opened this issue Jul 25, 2015 · 6 comments · Fixed by #743
Closed

C++ grammar refactoring #593

guwirth opened this issue Jul 25, 2015 · 6 comments · Fixed by #743
Assignees
Labels
Milestone

Comments

@guwirth
Copy link
Collaborator

guwirth commented Jul 25, 2015

Align grammar with latest C++ standard.

e.g. @Bertk By the way, the sequence of the statements within postfixExpression is not correct and the definition for postfix-expression [ braced-init-list ]is missing. New parser errors occurred after moving primary-expression to the binginning of the rule and I stopped this activity.
Excerpt from N4527 Annex A Grammar summary:

postfix-expression:
primary-expression
postfix-expression [ expression ]
postfix-expression [ braced-init-list ]
postfix-expression ( expression-listopt)
simple-type-specifier ( expression-listopt)
typename-specifier ( expression-listopt)
simple-type-specifier braced-init-list
typename-specifier braced-init-list
postfix-expression . templateopt id-expression
postfix-expression -> templateopt id-expression
postfix-expression . pseudo-destructor-name
postfix-expression -> pseudo-destructor-name
postfix-expression ++
postfix-expression --
dynamic_cast < type-id > ( expression )
static_cast < type-id > ( expression )
reinterpret_cast < type-id > ( expression )
const_cast < type-id > ( expression )
typeid ( expression )
typeid ( type-id )
@guwirth
Copy link
Collaborator Author

guwirth commented Dec 30, 2015

From @Bertk: By the way, the C++ standard (n4527) defines

class-name:
      identifier
      simple-template-id

but we use :

  b.firstOf(
    simpleTemplateId,
    b.sequence(b.optional("::"), IDENTIFIER)
    )
  );

@guwirth
Copy link
Collaborator Author

guwirth commented Jan 3, 2016

There are some lines which shall be checked as well - I feel the b.optional("::") should be removed:

Line 960:     b.rule(usingDirective).is(b.optional(attributeSpecifier), CxxKeyword.USING, CxxKeyword.NAMESPACE, b.optional("::"), b.optional(nestedNameSpecifier), namespaceName, ";");
Line 1461:             b.sequence(b.optional("::"), b.optional(nestedNameSpecifier), typeName, b.optional("^")),
Line 1462:             b.sequence(b.optional("::"), b.optional(nestedNameSpecifier), CxxKeyword.TEMPLATE, templateId, "^")
Line 1519:         b.sequence(b.optional("::"), b.optional(nestedNameSpecifier), innerSimpleTemplateId),
Line 1520:         b.sequence(b.optional("::"), b.optional(nestedNameSpecifier), CxxKeyword.TEMPLATE, innerSimpleTemplateId),

@guwirth guwirth added this to the M 0.9.5 milestone Jan 5, 2016
@guwirth guwirth self-assigned this Jan 5, 2016
@guwirth
Copy link
Collaborator Author

guwirth commented Feb 21, 2016

Some of the issues are fixed/improved with #743. Bigger refactoring is difficult without having better parser error information #476.

@guwirth
Copy link
Collaborator Author

guwirth commented Feb 27, 2016

@Bertk there are also some issues from you solved. Maybe you can also test it?

@Bertk
Copy link
Contributor

Bertk commented Feb 28, 2016

I did a small test and it is OK. Did anybody check the performance impact? I got the impression the analysis takes some minutes more but this might also related to other modifications.
I will do some more tests in the evening.

@jmecosta
Copy link
Member

for me now its also ok, did not see any impact in this small project i run

image

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

Successfully merging a pull request may close this issue.

3 participants