[D] Move classification of symbols from the grammar to the lexer.
authorIain Buclaw <ibuclaw@gdcproject.org>
Thu, 13 Aug 2015 19:35:09 +0000 (21:35 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Thu, 13 Aug 2015 19:48:06 +0000 (21:48 +0200)
commit444c1ed8915961384af694249701fa7896e11da8
tree58bbf12b485f053d76655ef0f0af309c95b93e6c
parentbc7c9fab612d4d33f7fe5d17eef4f5bd5cdc4144
[D] Move classification of symbols from the grammar to the lexer.

This makes it so that alternating '.' and identifier tokens are resolved to
symbols as early as possible, which should all the addition of D properties -
such as EXP.sizeof and EXP.typeof - without the shift/reduce conflicts that
would occur in the current parsing strategy.

gdb/ChangeLog

* d-exp.y (%union): Add voidval.
(%token): Add UNKNOWN_NAME as a token to represent an unclassified
name in the lexing stage.
(PostfixExpression): Move symbol completion handling in grammar here
from PrimaryExpression.
(PrimaryExpression): Move routines to handle resolving identifier
tokens in the grammar here from push_expression_name.
(IdentifierExp): Remove the handling of alternating '.' and identifier
tokens.
(TypeExp): Allow TypeExp to be wrapped in parenthesis in the grammar.
(BasicType): Remove C-style typename rules.
(d_type_from_name, d_module_from_name, push_variable)
(push_fieldnames, push_type_name, push_module_name)
(push_expression_name): Remove.
(lex_one_token): Rename from yylex.  Replace pstate with par_state.
(token_and_value): New type.
(token_fifo, popping, name_obstack): New globals.
(classify_name): New function.
(classify_inner_name): Likewise.
(yylex): Likewise.
(d_parse): Initialize token_fifo, popping and name_obstack.
gdb/ChangeLog
gdb/d-exp.y