1 // Copyright 2021 The Tint Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef SRC_SEM_BEHAVIOR_H_ 16 #define SRC_SEM_BEHAVIOR_H_ 17 18 #include "src/utils/enum_set.h" 19 20 namespace tint { 21 namespace sem { 22 23 /// Behavior enumerates the possible behaviors of an expression or statement. 24 /// @see https://www.w3.org/TR/WGSL/#behaviors 25 enum class Behavior { 26 kReturn, 27 kDiscard, 28 kBreak, 29 kContinue, 30 kFallthrough, 31 kNext, 32 }; 33 34 /// Behaviors is a set of Behavior 35 using Behaviors = utils::EnumSet<Behavior>; 36 37 /// Writes the Behavior to the std::ostream. 38 /// @param out the std::ostream to write to 39 /// @param behavior the Behavior to write 40 /// @returns out so calls can be chained 41 std::ostream& operator<<(std::ostream& out, Behavior behavior); 42 43 } // namespace sem 44 } // namespace tint 45 46 #endif // SRC_SEM_BEHAVIOR_H_ 47