Gyoji Compiler
Loading...
Searching...
No Matches
src
cmdline
jformat-tree.hpp
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
#pragma once
16
17
#include <gyoji-frontend.hpp>
18
19
namespace
Gyoji::cmdline {
20
using namespace
Gyoji::context
;
21
using namespace
Gyoji::frontend::ast
;
22
using namespace
Gyoji::frontend::tree
;
28
class
JFormatTree
{
29
public
:
30
JFormatTree
();
31
~JFormatTree
();
32
int
process(
const
SyntaxNode
& file);
33
private
:
34
int
indent;
35
std::map<TokenID, std::string>
token_map;
36
37
std::string
get_token_name(TokenID token)
const
;
38
39
void
print_non_syntax(
const
TerminalNonSyntax
& non_syntax);
40
void
print_indent(
void
);
41
void
print_comment_multi_line(
const
TerminalNonSyntax
& node);
42
void
print_comment_single_line(
const
TerminalNonSyntax
& node);
43
void
print_whitespace(
const
TerminalNonSyntax
& node);
44
void
print_file_metadata(
const
TerminalNonSyntax
& node);
45
46
47
};
48
49
};
std::basic_string
std::map
Gyoji::cmdline::JFormatTree
Definition
jformat-tree.hpp:28
Gyoji::frontend::ast::SyntaxNode
Weakly-typed syntax node.
Definition
syntax-node.hpp:69
Gyoji::frontend::tree::TerminalNonSyntax
Represents whitespace, comments, and metadata for the source file.
Definition
tree.hpp:44
Gyoji::context
The context namespace deals with objects that should last the entire scope of compilation.
Definition
gyoji-context.hpp:30
Gyoji::frontend::ast
Abstract syntax tree.
Definition
syntax-node.hpp:36
Gyoji::frontend::tree
Strongly-typed syntax tree.
Definition
forward.hpp:44
Generated by
1.9.8