Mercurial > projects > dang
diff lexer/Token.d @ 44:495188f9078e new_gen
Big update - Moving towards a better, more seperated parser
The parser no loner creates the AST directly, but through
callbacks(actions). This means the parser can be run with a different set
of actions that do something else.
The parser is not back to full strength yet, the main thing missing is the
various statements and structs.
Also added a SmallArray that uses the stack only until a given size is
exceeded, after which the array is copied unto the heap.
author | Anders Halager <halager@gmail.com> |
---|---|
date | Wed, 23 Apr 2008 00:57:45 +0200 |
parents | 4e879f82dd64 |
children | b6c1dc30ca4b |
line wrap: on
line diff
--- a/lexer/Token.d Tue Apr 22 22:31:39 2008 +0200 +++ b/lexer/Token.d Wed Apr 23 00:57:45 2008 +0200 @@ -56,6 +56,23 @@ { return location.get(length); } + + /** + Returns true if the type of this token is a basic type (int, float, ...). + Void is included, although a void in it self is not really a type. + */ + bool isBasicType() + { + return type >= Tok.Byte && type <= Tok.Void; + } + + /** + Just a shortcut to avoid `token.type == Tok.Identifier`. + */ + bool isIdentifier() + { + return type == Tok.Identifier; + } } /**