Age | Commit message (Collapse) | Author |
|
This is needed for code like this:
#define __WASI_ERRNO_INVAL (UINT16_C(28))
#define EINVAL __WASI_ERRNO_INVAL
|
|
|
|
|
|
|
|
This implements expressions such as "-5" and "-5 - 2", in other words,
negative numbers.
|
|
This follows the Pratt parser design.
|
|
This converts the existing const parser to the basics of a Pratt parser,
following the book "Writing An Interpreter In Go" by Thorsten Ball. It
doesn't really do anything interesting yet, it simply converts the
existing code (with existing tests) to the new structure.
|
|
|
|
|
|
Previously it was just a combination of heuristics to try to fit a
constant in an *ast.BasicLit. For more complex expressions, this is not
enough.
This change also introduces proper syntax error with locations, if
parsing a constant failed. For example, this will print a real error
message with source location:
#define FOO 5)
|
|
Put them in a separate file for separation of concerns (making them
testable) and add some tests.
|