# encoding: utf-8 # frozen_string_literal: true require "carbon/compiler/parser/expressions/precedence" require "carbon/compiler/parser/expressions/primary" module Carbon module Compiler class Parser # Parses expressions. module Expressions include Precedence include Primary protected PRECEDENCE = { "=": 1, "||": 2, "&&": 3, "|": 4, "^": 5, "&": 6, "===": 7, "==": 7, "!=": 7, "<": 8, ">": 8, "<=": 8, ">=": 8, "<<": 9, ">>": 9, "+": 10, "-": 10, "*": 11, "/": 11, "%": 11, ".": 12, "[": 12 }.freeze RIGHT = [:"=", :"."].freeze def parse_expression parse_precedence(parse_expression_primary, 0) end end end end end