Skip to content

Enforce naming conventions for constants - #34

Merged
a4sriniv merged 3 commits into
masterfrom
as-12-constant-naming
Jun 13, 2015
Merged

a4sriniv merged 3 commits into
masterfrom
as-12-constant-naming

Conversation

@a4sriniv

Copy link
Copy Markdown
Member

Fixes #12.

@alykhank alykhank added this to the Sprint 1 milestone Jun 11, 2015
Comment thread grammar/Swift.g4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What made you refactor the comparator and assignment operators? To improve readability?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it was to fix a bug in the grammar. I can discuss this in person if you want, too long of an explanation.

@adityatrivedi

Copy link
Copy Markdown
Member

👍

@a4sriniv a4sriniv assigned alykhank and unassigned adityatrivedi Jun 12, 2015
Comment thread grammar/Swift.g4 Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a typo in the original ANTLR version of the Swift grammar compared to the Apple-provided grammar which indicates that external params are optional while local params are required:

parameter → inout­? ­let?­ ­#?­ ­external-parameter-name­? ­local-parameter-name ­type-annotation ­default-argument-clause­?­
parameter → inout­? ­var ­#?­ ­external-parameter-name? ­local-parameter-name ­type-annotation­ default-argument-clause­?

Shouldn't parameterName be made optional to match the Apple grammar and localParameterName be made required?

Also, it seems to make sense that typeAnnotation should be made optional. For closures, is this a bug in Apple's provided grammar?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah true, this wouldn't really cause a bug though (in terms of parsing). But I guess in order to keep things consistent and if we eventually need to implement a check for external parameters in particular, I'll change this.

And yes, it was a bug in Apple's grammar.

@alykhank

Copy link
Copy Markdown
Member

👍

a4sriniv added a commit that referenced this pull request Jun 13, 2015
Enforce naming conventions for constants
@a4sriniv
a4sriniv merged commit cecb6f2 into master Jun 13, 2015
@a4sriniv
a4sriniv deleted the as-12-constant-naming branch June 13, 2015 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants