Initial Parser Implementation and Feature Completion #1

Merged
me merged 16 commits from parser-dev into main 2025-12-28 11:54:12 -06:00
2 changed files with 6 additions and 2 deletions
Showing only changes of commit f024334da5 - Show all commits

View File

@ -40,7 +40,7 @@ namespace arti::lang::pratt {
BindingPower infixBindingPower(ast::InfixOperator op) {
switch (op) {
// Member Access (Highest)
case ast::InfixOperator::ModuleAccess:
case ast::InfixOperator::ModuleAccess: return { 23, 24 };
case ast::InfixOperator::MemberAccess:
case ast::InfixOperator::PointerMemberAccess: return { 21, 22 };

View File

@ -21,6 +21,7 @@
//============================================================================//
#include <artichoke/Parser/Parser.hpp>
#include <artichoke/Parser/Pratt.hpp>
#include <artichoke/Util/OverloadSet.hpp>
@ -884,6 +885,9 @@ namespace arti::lang {
return Unexpected<>{ std::move(lSquirly).error() };
}
uint16_t limit =
pratt::infixBindingPower(ast::InfixOperator::PointerMemberAccess).right;
bool keepParsing = true;
while (keepParsing) {
@ -912,7 +916,7 @@ namespace arti::lang {
else {
auto curCase = ast::MakeNode<ast::SwitchCaseNode>();
if (auto expr = parseExpression(); ! expr) {
if (auto expr = parseExpression(limit); ! expr) {
return Unexpected<>{ std::move(expr).error() };
}
else {