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

Document epp:scan_erl_form/1 and add epp:scan_file/2 #2658

Merged
merged 1 commit into from
Feb 12, 2021

Conversation

richcarl
Copy link
Contributor

epp:scan_erl_form/1 was undocumented, but in use by edoc and there were tests for it.
epp:scan_file/2 can be used to implement e.g. a standalone token level preprocessor pass, like gcc -E.

@rickard-green rickard-green added the team:VM Assigned to OTP team VM label Jun 12, 2020
@jhogberg jhogberg added testing currently being tested, tag is used by OTP internal CI and removed testing currently being tested, tag is used by OTP internal CI labels Jun 16, 2020
@jhogberg jhogberg added testing currently being tested, tag is used by OTP internal CI and removed testing currently being tested, tag is used by OTP internal CI labels Jun 22, 2020

scan_file(Epp) ->
case scan_erl_form(Epp) of
{ok,Toks} ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dialyzer is still unhappy :(

epp.erl:265: The pattern 
          {'ok', Toks} can never match the type 
          {'eof',
           non_neg_integer() | {non_neg_integer(), pos_integer()}} |
          {'error',
           {non_neg_integer() | {non_neg_integer(), pos_integer()},
            atom(),
            _},
           non_neg_integer() | {non_neg_integer(), pos_integer()}} |
          {'ok',
           [{atom(), erl_anno:anno()} |
            {atom(), erl_anno:anno(), atom() | string() | number()}],
           non_neg_integer() | {non_neg_integer(), pos_integer()}}
epp.erl:267: The pattern 
          {'error', E} can never match the type 
          {'eof',
           non_neg_integer() | {non_neg_integer(), pos_integer()}} |
          {'error',
           {non_neg_integer() | {non_neg_integer(), pos_integer()},
            atom(),
            _},
           non_neg_integer() | {non_neg_integer(), pos_integer()}} |
          {'ok',
           [{atom(), erl_anno:anno()} |
            {atom(), erl_anno:anno(), atom() | string() | number()}],
           non_neg_integer() | {non_neg_integer(), pos_integer()}}

@jhogberg jhogberg added the waiting waiting for changes/input from author label Jul 6, 2020
@richcarl richcarl force-pushed the epp-scan-only branch 2 times, most recently from c5d914e to a6e6fd3 Compare January 29, 2021 10:58
@richcarl
Copy link
Contributor Author

Fixed type spec, rebased and squashed. But I can't see why it's failing now: Missing Anchor: "/lib/stdlib-3.14/doc/html/epp.html#type-warning_info" from /lib/stdlib-3.14/doc/html/epp.html - the warning_info() type was already used in the spec of parse_erl_form/1 which was already exported - cf. http://erlang.org/doc/man/epp.html#parse_erl_form-1

@garazdawi
Copy link
Contributor

Fixed type spec, rebased and squashed. But I can't see why it's failing now: Missing Anchor: "/lib/stdlib-3.14/doc/html/epp.html#type-warning_info" from /lib/stdlib-3.14/doc/html/epp.html - the warning_info() type was already used in the spec of parse_erl_form/1 which was already exported - cf. http://erlang.org/doc/man/epp.html#parse_erl_form-1

You need to either put the warning_info type in the <datatypes> section or explicitly inline the type into the function docs as parse_erl_form/1 has done.

@richcarl
Copy link
Contributor Author

richcarl commented Feb 1, 2021

Fixed doc and rebased.

@jhogberg jhogberg added testing currently being tested, tag is used by OTP internal CI and removed waiting waiting for changes/input from author labels Feb 5, 2021
@jhogberg jhogberg merged commit e71991c into erlang:master Feb 12, 2021
@jhogberg
Copy link
Contributor

Merged, thanks for the PR!

@richcarl richcarl deleted the epp-scan-only branch February 12, 2021 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants