Skip to content

Semicolon rule - #28

Merged
adityatrivedi merged 17 commits into
masterfrom
at-semicolon-rule
Jun 10, 2015
Merged

adityatrivedi merged 17 commits into
masterfrom
at-semicolon-rule

Conversation

@adityatrivedi

Copy link
Copy Markdown
Member

Resolves #10. Flag semicolon terminated statements.

* Add protocol test cases to SemiColonTerminatedStatementTests.swift
* Add tests for structs
* Add tests for variable declarations
* Amend grammar for "declarations"
* structs
* for loops
* do while loop
* extension
* while loop

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.

Currently error messages display the ctx.start.line and ctx.start.column, but for this type of rule (that checks for statement-terminating punctuation), the messages should use the ctx.stop.line and ctx.stop.column. A parameter (that potentially defaults to ctx.start) could be used to modify error() for this use case.

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.

Done.

@alykhank

Copy link
Copy Markdown
Member

Increased column value for semicolon rule by 1 to ensure that Xcode points to the semicolon:
semicolon-column

@alykhank

Copy link
Copy Markdown
Member

👍

Comment thread tailor/listeners/mainlistener.py 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.

You could actually get an actual context object for the ';'. You need to iterate through the children of the current context to find the node.

for child in ctx.children:
    if child.getText() == ';':
        // this is it!

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.

This won't work because child is of type TerminalNodeImpl which in turn has no attribute start.

@adityatrivedi adityatrivedi assigned a4sriniv and unassigned alykhank Jun 10, 2015
@a4sriniv

Copy link
Copy Markdown
Member

👍

@alykhank

Copy link
Copy Markdown
Member

👍

adityatrivedi added a commit that referenced this pull request Jun 10, 2015
@adityatrivedi
adityatrivedi merged commit f0a3ae1 into master Jun 10, 2015
@adityatrivedi
adityatrivedi deleted the at-semicolon-rule branch June 10, 2015 23:21
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