Hello and welcome to Part five of implementing data types.
In this part we are going to ignore integers and I'll show you what I mean in a moment.
In the last lecture, we implement the symbol resolver.
So pretty pretty soon we'll be able to go ahead and implement things like variables.
So just go to parse the dot C and just by here we're going to say void parser ignore in it and we're
just going to accept the data type.
So all this function will do is essentially if someone provides long in it A, B, C, it will essentially
ignore the init provided by here.
And the reason for this is because if we do size of long in it, we can see the size is eight and if
we do size of long, we can see the size is also eight.
Therefore the init is mostly an abbreviation which we can ignore so we can safely ignore the init in
cases like this.
So what we're going to do, we're going to say if token is keyword token peak next in it.
And we have the explanation, Mark, because we are checking that it's not an integer.
So token is keyword in it and then we negate it by here.
So if it's not an integer, then we're just going to return because there's no integer to ignore.
Now things like init in it are not allowed.
Look at that invalid combination.
So we need to be able to check for that.
So what we're going to do is we can create another function.
I'm going to say ball parser is init valid after data type.
And we're going to pass in the data type, we're just going to return D type type is equal data type
long or D type type is equal data type float or D type type is equal data type double.
So if it's none of those, then it's not valid for an integer to go after it.
So now we're going to check for that.
We're going to say if it's not a valid integer,
if any, it is not valid after this data type, then compiler error.
Com process you provide it and a secondary and it type.
However, it's not supported with this current
abbreviation and you guys could probably maybe you could think of a better error message that makes
a bit more sense to you.
However, I think that'll be okay.
So we've been clear to the user that a secondary date type of in it is not allowed in this case.
And of course, that will give them the correct line number and stuff.
So it's all good.
And then we're just going to ignore the token, ignore the init token.
So if it is valid, then we just ignore it like the function says that we should do.
Okay.
So just scroll down and we're going to go back to function or struct union and we're just going to say
pause, ignore in it and we're just going to do data type, ignore integer abbreviations if necessary,
i.e. long in it becomes just long call nice because some some programmers they like to be very specific
when they use their types right belong in it.
It's the same as long so there's nothing to worry about.
Okay, now one little thing we need to do.
Pause ignore in it is actually below this function is using it so we're just going to copy and paste
these to just above it essentially so that it can be seen.
Okay, nice.
Let's just do a make clean and a make and see if that works.
And see that works absolutely fine.
Okay, great.
So now we ignore those in it abbreviations.
They just become long.
All right, nice.