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

Fix untyped methods in Objective-C lexer #1118

Merged
merged 1 commit into from
May 27, 2019

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented May 19, 2019

The Objective-C lexer prepends a rule to the :root state that is intended to match a method definition. Although the regular expression indicates that the return type of the method may not match anything, it was nevertheless passing the result to RegexLexer#recurse regardless of whether it was nil or not.

If this occurred with an untyped instance method, the output would insert an additional - in the output. Checking whether to call RegexLexer#recurse on the basis of whether the value was non-nil fixed the problem. This fixes #1076.

The Objective-C lexer prepends a rule to the `:root` state that is
intended to match a method definition. Although the regular expression
indicates that the return type of the method may not match anything, it
was nevertheless passing the result to `RegexLexer#recurse` regardless
of whether it was nil or not.

If this occurred with an untyped instance method, the output would
insert an additional `-` in the output. Checking whether to call
`RegexLexer#recurse` on the basis of whether the value was non-nil fixed
the problem. This fixes rouge-ruby#1076.
@pyrmont pyrmont merged commit 71fbeec into rouge-ruby:master May 27, 2019
@pyrmont pyrmont deleted the bugfix.objc-untyped-methods branch January 8, 2020 20:05
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.

Objective-C highlighter fails on untyped methods
1 participant