Parse new binops
This commit is contained in:
parent
422f95e553
commit
7d4190d9a1
@ -51,14 +51,26 @@ namespace parsing {
|
|||||||
if (token.type != token::Type::Symbol) {
|
if (token.type != token::Type::Symbol) {
|
||||||
throw std::runtime_error("Expected binop");
|
throw std::runtime_error("Expected binop");
|
||||||
}
|
}
|
||||||
if (token.content == "=") {
|
else if (token.content == "=") {
|
||||||
stream.m_position = inner.m_position;
|
stream.m_position = inner.m_position;
|
||||||
return new types::BinOp{ types::BinOp::Assignment };
|
return new types::BinOp{ types::BinOp::Assignment };
|
||||||
}
|
}
|
||||||
if (token.content == "+") {
|
else if (token.content == "+") {
|
||||||
stream.m_position = inner.m_position;
|
stream.m_position = inner.m_position;
|
||||||
return new types::BinOp{ types::BinOp::Add };
|
return new types::BinOp{ types::BinOp::Add };
|
||||||
}
|
}
|
||||||
|
else if (token.content == "-") {
|
||||||
|
stream.m_position = inner.m_position;
|
||||||
|
return new types::BinOp{ types::BinOp::Sub };
|
||||||
|
}
|
||||||
|
else if (token.content == "<") {
|
||||||
|
stream.m_position = inner.m_position;
|
||||||
|
return new types::BinOp{ types::BinOp::LessThan };
|
||||||
|
}
|
||||||
|
else if (token.content == ">") {
|
||||||
|
stream.m_position = inner.m_position;
|
||||||
|
return new types::BinOp{ types::BinOp::GreaterThan };
|
||||||
|
}
|
||||||
|
|
||||||
throw std::runtime_error("Expected binop");
|
throw std::runtime_error("Expected binop");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user