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_SECTION
9#define SKSL_SECTION
10
11#include "SkSLProgramElement.h"
12
13namespace SkSL {
14
15/**
16 * A section declaration (e.g. @body { body code here })..
17 */
18struct Section : public ProgramElement {
19    Section(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
25    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 ProgramElement INHERITED;
39};
40
41} // namespace
42
43#endif
44