|
|
|||
File indexing completed on 2026-05-10 08:36:50
0001 //===--- OperatorPrecedence.h - Operator precedence levels ------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 /// 0009 /// \file 0010 /// Defines and computes precedence levels for binary/ternary operators. 0011 /// 0012 //===----------------------------------------------------------------------===// 0013 0014 #ifndef LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H 0015 #define LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H 0016 0017 #include "clang/Basic/TokenKinds.h" 0018 0019 namespace clang { 0020 0021 /// PrecedenceLevels - These are precedences for the binary/ternary 0022 /// operators in the C99 grammar. These have been named to relate 0023 /// with the C99 grammar productions. Low precedences numbers bind 0024 /// more weakly than high numbers. 0025 namespace prec { 0026 enum Level { 0027 Unknown = 0, // Not binary operator. 0028 Comma = 1, // , 0029 Assignment = 2, // =, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |= 0030 Conditional = 3, // ? 0031 LogicalOr = 4, // || 0032 LogicalAnd = 5, // && 0033 InclusiveOr = 6, // | 0034 ExclusiveOr = 7, // ^ 0035 And = 8, // & 0036 Equality = 9, // ==, != 0037 Relational = 10, // >=, <=, >, < 0038 Spaceship = 11, // <=> 0039 Shift = 12, // <<, >> 0040 Additive = 13, // -, + 0041 Multiplicative = 14, // *, /, % 0042 PointerToMember = 15 // .*, ->* 0043 }; 0044 } 0045 0046 /// Return the precedence of the specified binary operator token. 0047 prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator, 0048 bool CPlusPlus11); 0049 0050 } // end namespace clang 0051 0052 #endif // LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|