You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
allows a typedefed named to immediately follow its typedef
In the following example
```
typedef int T; T foo(void);
```
i.e., when the next token after a typedef is the typedefed name, the T
token is already looked ahead, so it is recognized as IDENT not as
NAMED_TYPE, e.g., here is the trace,
```
Lookahead token is now IDENT (15-16) <-- 'T'
Reducing production typedef -> TYPEDEF typedef_type typedef_defs SEMICOLON
adding T <-- debug output from the lexer, indicating that T was added
```
The solution is to factor out the typedef non-terminal and move the
semicolon to globals so that we have it reduced earlier, when the next
token is SEMICOLON:
```
Reducing production typedef -> TYPEDEF typedef_type typedef_defs
adding T <-- typedef reduces before semicolon
State 542:
Shifting (SEMICOLON) to state 543
State 543:
Lookahead token is now NAMED_TYPE (15-16) <-- it is now recognized as type name
```
Fixes#23
0 commit comments