| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* Copyright 2025 Jonathan S. Arney | ||
| 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 | * https://github.com/jarney/gyoji/blob/master/LICENSE | ||
| 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 | #include <gyoji-frontend.hpp> | ||
| 16 | |||
| 17 | using namespace Gyoji::context; | ||
| 18 | using namespace Gyoji::frontend; | ||
| 19 | using namespace Gyoji::frontend::ast; | ||
| 20 | |||
| 21 | /////////////////////////////////////////////////// | ||
| 22 | 80698 | SyntaxNode::SyntaxNode( | |
| 23 | TokenID _type, | ||
| 24 | SyntaxNode::specific_type_t _data, | ||
| 25 | const SourceReference & _source_ref | ||
| 26 | 80698 | ) | |
| 27 | 80698 | : source_ref(_source_ref) | |
| 28 | 80698 | , type(_type) | |
| 29 | 80698 | , data(_data) | |
| 30 | 80698 | {} | |
| 31 | 76082 | SyntaxNode::~SyntaxNode() | |
| 32 | 76082 | {} | |
| 33 | void | ||
| 34 | 75528 | SyntaxNode::add_child(const SyntaxNode & node) | |
| 35 | { | ||
| 36 | 75528 | children.push_back(node); | |
| 37 | 75528 | } | |
| 38 | void | ||
| 39 | ✗ | SyntaxNode::prepend_child(const SyntaxNode & node) | |
| 40 | { | ||
| 41 | ✗ | children.insert(children.begin(), node); | |
| 42 | ✗ | } | |
| 43 | const std::vector<std::reference_wrapper<const SyntaxNode>> & | ||
| 44 | 34272 | SyntaxNode::get_children() const | |
| 45 | { | ||
| 46 | 34272 | return children; | |
| 47 | } | ||
| 48 | 12474 | const TokenID & SyntaxNode::get_type() const | |
| 49 | { | ||
| 50 | 12474 | return type; | |
| 51 | } | ||
| 52 | const SyntaxNode & | ||
| 53 | 96 | SyntaxNode::get_syntax_node() const | |
| 54 | 96 | { return *this; } | |
| 55 | |||
| 56 | const SourceReference & | ||
| 57 | 77070 | SyntaxNode::get_source_ref() const | |
| 58 | 77070 | { return source_ref; } | |
| 59 |