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

server/utils: fix Bison directives #72

Closed
wants to merge 1 commit into from
Closed

server/utils: fix Bison directives #72

wants to merge 1 commit into from

Conversation

akimd
Copy link

@akimd akimd commented Nov 11, 2019

Non terminal cannot have string aliases (only tokens appear in error
messages). %token is used to define tokens, and %nterm non terminals.
The hidden %type (which was only recently documented) is meant for
both tokens and non terminals. Yet

%type <foo> expr "expression"

is actually more or less equivalent to

%nterm <foo> expr
%token <foo> "expression"

which is clearly not the intention of the author here.

  • server/util_expr_parse.y: Remove useless string-literal only tokens.
    Prefer %nterm to %type to avoid this error.

@notroj
Copy link
Collaborator

notroj commented Nov 12, 2019

This didn't get tested properly in Travis because buildconf suppresses regeneration of the parser sources by default. I fixed this in 2dd0046 so if you rebase to current trunk you'll get one CI job testing it properly.

Non terminal cannot have string aliases (only tokens appear in error
messages).  %token is used to define tokens, and %nterm non terminals.
The hidden %type (which was only recently documented) is meant for
both tokens and non terminals.  Yet

    %type <foo> expr "expression"

is actually more or less equivalent to

    %nterm <foo> expr
    %token <foo> "expression"

which is clearly not the intention of the author here.

* server/util_expr_parse.y: Remove useless string-literal only tokens.
Prefer %nterm to %type to avoid this error.
@akimd
Copy link
Author

akimd commented Nov 13, 2019

Hi @notroj
Thanks for the help! I updated the patch, and it seems to pass.
Cheers!

asfgit pushed a commit that referenced this pull request Nov 13, 2019
messages).  %token is used to define tokens, and %nterm non terminals.
The hidden %type (which was only recently documented) is meant for
both tokens and non terminals.  Yet

    %type <foo> expr "expression"

is actually more or less equivalent to

    %nterm <foo> expr
    %token <foo> "expression"

which is clearly not the intention of the author here.

* server/util_expr_parse.y: Remove useless string-literal only tokens.
Prefer %nterm to %type to avoid this error.

PR: #72
Submitted by: Akim Demaille <akim.demaille gmail.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1869724 13f79535-47bb-0310-9956-ffa450edef68
@notroj
Copy link
Collaborator

notroj commented Nov 13, 2019

Thanks for the contribution @akimd! I've merged this to trunk, but I'll have to ask you to close the PR since I can't do it myself.

@akimd
Copy link
Author

akimd commented Nov 13, 2019

Thanks!

@akimd akimd closed this Nov 13, 2019
@akimd akimd deleted the fix-utils-parser branch November 13, 2019 08:07
akimd added a commit to akimd/bison that referenced this pull request Nov 16, 2019
As an extension to POSIX Yacc, Bison's %type accepts tokens.
Unfortunately with string literals as implicit tokens, this is
misleading, and led some users to write

    %type <exVal> cond "condition"

believing that "condition" would be associated to the 'cond'
nonterminal (see apache/httpd#72).

* doc/bison.texi: Promote %nterm rather than %type to declare the type
of nonterminals.
akimd added a commit to akimd/bison that referenced this pull request Nov 16, 2019
As an extension to POSIX Yacc, Bison's %type accepts tokens.
Unfortunately with string literals as implicit tokens, this is
misleading, and led some users to write

    %type <exVal> cond "condition"

believing that "condition" would be associated to the 'cond'
nonterminal (see apache/httpd#72).

* doc/bison.texi: Promote %nterm rather than %type to declare the type
of nonterminals.
akimd added a commit to akimd/bison that referenced this pull request Nov 16, 2019
As an extension to POSIX Yacc, Bison's %type accepts tokens.
Unfortunately with string literals as implicit tokens, this is
misleading, and led some users to write

    %type <exVal> cond "condition"

believing that "condition" would be associated to the 'cond'
nonterminal (see apache/httpd#72).

* doc/bison.texi: Promote %nterm rather than %type to declare the type
of nonterminals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants