[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for Dlang support] d: change the return value of yylex() from

From: Akim Demaille
Subject: Re: [PATCH for Dlang support] d: change the return value of yylex() from int to TokenKind
Date: Sat, 12 Sep 2020 17:18:25 +0200

Hi Adela,

> Le 11 sept. 2020 à 15:09, Adela Vais <> a écrit :
> * data/skeletons/lalr1.d: Change return value.
> * examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust.

This commit fails the test suite too, since the test suite is
still using int for yylex's return value.

As a matter of fact, the TODO had a question:

  ** Change the return value of yylex
  Historically people were allowed to return any int from the scanner (which
  is convenient and allows `return '+'` from the scanner).  Akim tends to see
  this as an error, we should restrict the return values to TokenKind (not to
  be confused with SymbolKind).

  In the case of D, without the history, we have the choice to support or not
  `int`.  If we want to _keep_ `int`, is there a way, say via introspection,
  to support both signatures of yylex?  If we don't keep `int`, just move to

I was really curious to know if D's introspection made it possible to
support both signatures.  If it can't, or if we consider returning an
int is not right, then, sure, your commit (once the test suite issue
addressed) is the right path.

In case you're wondering where the test suite's yoles is coming from,


in tests/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]