• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SKSL_ASTSECTION
9 #define SKSL_ASTSECTION
10 
11 #include "SkSLASTDeclaration.h"
12 
13 namespace SkSL {
14 
15 /**
16  * A section declaration (e.g. @body { body code here })..
17  */
18 struct ASTSection : public ASTDeclaration {
ASTSectionASTSection19     ASTSection(Position position, String name, String arg, String text)
20     : INHERITED(position, kSection_Kind)
21     , fName(std::move(name))
22     , fArgument(std::move(arg))
23     , fText(std::move(text)) {}
24 
descriptionASTSection25     String description() const override {
26         String result = "@" + fName;
27         if (fArgument.size()) {
28             result += "(" + fArgument + ")";
29         }
30         result += " { " + fText + " }";
31         return result;
32     }
33 
34     const String fName;
35     const String fArgument;
36     const String fText;
37 
38     typedef ASTDeclaration INHERITED;
39 };
40 
41 } // namespace
42 
43 #endif
44