1 #include "grammar/Joos1WGrammar.h"
2 #include "parsetree/ParseTree.h"
4 using Node = parsetree::
Node;
6 using Literal = parsetree::
Literal;
11 Node* Joos1WLexer::make_poison(YYLTYPE& loc) {
12 void* bytes = alloc.allocate_bytes(
sizeof(Node));
13 return new(bytes) Node
(make_range(loc)
, Node::Type::Poison
);
16 Node* Joos1WLexer::make_operator(YYLTYPE& loc, Operator::Type type) {
17 void* bytes = alloc.allocate_bytes(
sizeof(Operator));
18 return new(bytes) Operator(make_range(loc), type);
21 Node* Joos1WLexer::make_literal(YYLTYPE& loc, Literal::Type type,
23 void* bytes = alloc.allocate_bytes(
sizeof(Literal));
24 return new(bytes) Literal(make_range(loc), alloc, type, value);
27 Node* Joos1WLexer::make_identifier(YYLTYPE& loc,
char const* name) {
28 void* bytes = alloc.allocate_bytes(
sizeof(Identifier));
29 return new(bytes) Identifier(make_range(loc), alloc, name);
32 Node* Joos1WLexer::make_modifier(YYLTYPE& loc, Modifier::Type type) {
33 void* bytes = alloc.allocate_bytes(
sizeof(Modifier));
34 return new(bytes) Modifier(make_range(loc), type);
37 Node* Joos1WLexer::make_basic_type(YYLTYPE& loc, BasicType::Type type) {
38 void* bytes = alloc.allocate_bytes(
sizeof(BasicType));
39 return new(bytes) BasicType(make_range(loc), type);