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

Error in parsing *.xrl #289

Closed
vkatsuba opened this issue Nov 21, 2021 · 2 comments
Closed

Error in parsing *.xrl #289

vkatsuba opened this issue Nov 21, 2021 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@vkatsuba
Copy link
Contributor

Describe the bug
Currently formatter works not good with *.xrl files and provide crash.

To Reproduce

  • Create *.xrl:
%%====================================================================
%% Definitions
%%====================================================================
Definitions.

String = '([^']*?)'

%%====================================================================
%% Rules
%%====================================================================
Rules.

%% =============================================================================
%% Erlang Code
%% =============================================================================
Erlang code.

strip_value(Value) ->
    io:format("~p", [Value]).
  • Run rebar3_format:
$ rebar3 format
===> Error parsing files: {modified_ast,"src/some.xrl",
                                     "src/some.xrl"}
Stack: [{rebar3_ast_formatter,format,3,
                              [{file,"/some/_build/default/plugins/rebar3_format/src/rebar3_ast_formatter.erl"},
                               {line,40}]},
        {rebar3_format_prv,'-format_files/2-fun-0-',2,
                           [{file,"/some/_build/default/plugins/rebar3_format/src/rebar3_format_prv.erl"},
                            {line,125}]},
        {lists,'-filter/2-lc$^0/1-0-',2,[{file,"lists.erl"},{line,1290}]},
        {rebar3_format_prv,format_files,2,
                           [{file,"/some/_build/default/plugins/rebar3_format/src/rebar3_format_prv.erl"},
                            {line,123}]},
        {rebar3_format_prv,do,1,
                           [{file,"/some/_build/default/plugins/rebar3_format/src/rebar3_format_prv.erl"},
                            {line,43}]},
        {rebar_core,do,2,
                    [{file,"/home/runner/work/rebar3/rebar3/src/rebar_core.erl"},
                     {line,155}]},
        {rebar3,run_aux,2,
                [{file,"/home/runner/work/rebar3/rebar3/src/rebar3.erl"},
                 {line,182}]},
        {rebar3,main,1,
                [{file,"/home/runner/work/rebar3/rebar3/src/rebar3.erl"},
                 {line,66}]}]
=ERROR REPORT==== 21-Nov-2021::13:08:17.860648 ===
    modified_ast: src/mql_scanner.xrl
    removed: [{error,no}]
    added: [{tree,no,
                  {attr,no,[],none},
                  "* * 6 : unterminated atom starting with '\\n\\n%%============' * *"}]
===> Unknown Formatting Error: {modified_ast,"src/some.xrl",
                              "src/some.xrl"}
  • Output of file:
%%====================================================================
%% Definitions
%%====================================================================
Definitions.

** 6: unterminated atom starting with '\n\n%%============' **

Expected behavior
The rebar3_format do parse *.xrl files as well.

@vkatsuba vkatsuba added the bug Something isn't working label Nov 21, 2021
@vkatsuba
Copy link
Contributor Author

vkatsuba commented Nov 21, 2021

Hm.. looks like this is not implemented. See: #246.

@elbrujohalcon
Copy link
Collaborator

Exactly. I'll close this as a duplicate of #246.

@elbrujohalcon elbrujohalcon added the duplicate This issue or pull request already exists label Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants