jserv / MazuCC

A minimalist C compiler with x86_64 code generation
BSD 2-Clause "Simplified" License
516 stars 65 forks source link

Add private data into Token struct #2

Closed lecopzer closed 5 years ago

lecopzer commented 5 years ago

The definition of make_ functions are similar, so consolidate these functions to a single make_token() and use define to keep origin make_ function exist for readability.

To achieve this goal, we have to merge the union inside struct Token. Each of the elements in the union is relative to one or more Token enum types, but actully they can be merged to a single private data.

After that, add helper function to avoid exposing private data.