Repository navigation
Semicolon rule - #28
Merged
Merged
Conversation
The following statement categories are inspected: * Declarations * Loop statements * Branch statements * Labeled statements * Control transfer 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
Member
There was a problem hiding this comment.
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.
* Ensure that Xcode points to semicolon
Member
Member
|
👍 |
Member
There was a problem hiding this comment.
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!
Member
Author
There was a problem hiding this comment.
This won't work because child is of type TerminalNodeImpl which in turn has no attribute start.
Member
|
👍 |
Signed-off-by: Aditya Trivedi <adityatriv@gmail.com>
Member
|
👍 |
adityatrivedi
added a commit
that referenced
this pull request
Jun 10, 2015
Resolve #28: Semicolon rule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Resolves #10. Flag semicolon terminated statements.