Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Modify parser to use first match even if in higher positions. #75

Closed
wants to merge 1 commit into from

Conversation

sillypog
Copy link

When using Elixir with single quote heredoc syntax, eg
@apidoc '''
@api {get} /index
'''
The docBlocksRegExp match is in the element 4 of the matches array.
An error was being thrown because only elements 1 & 2 were being
checked for a match.

Since a match is guaranteed, otherwise the regular expression would
have returned null and the loop would exit, it seems appropriate to
use the first non-null element of the matches array as a block. The
first element is excluded though, as this always contains the full
string being checked rather than a substring match.

When using Elixir with single quote heredoc syntax, eg
    @apidoc '''
    @api {get} /index
    '''
The docBlocksRegExp match is in the element 4 of the matches array.
An error was being thrown because only elements 1 & 2 were being
checked for a match.

Since a match is guaranteed, otherwise the regular expression would
have returned null and the loop would exit, it seems appropriate to
use the first non-null element of the matches array as a block. The
first element is excluded though, as this always contains the full
string being checked rather than a substring match.
@sillypog
Copy link
Author

sillypog commented May 24, 2018

This change allows apidocs to be specified for Elixir by wrapping the apidocs in a doc attribute, e.g.

@doc """
Text description of the route

@apidoc '''
@apiParams ...
'''
"""

This elimates the unused attribute warnings.

@sillypog sillypog mentioned this pull request May 24, 2018
@NicolasCARPi
Copy link
Collaborator

Fixed by #65, right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants