Skip to content

Commit 78411dc

Browse files
committed
moon_json: formatter
1 parent 8cb2514 commit 78411dc

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/moon_json/formatter.cr

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -----------------------------------------------------------------------
2+
# This file is part of MoonScript
3+
#
4+
# MoonSript is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# MoonSript is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with MoonSript. If not, see <https://www.gnu.org/licenses/>.
16+
#
17+
# Copyright (C) 2025 Krisna Pranav, MoonScript Developers
18+
# -----------------------------------------------------------------------
19+
20+
module MoonScript
21+
class MoonJson
22+
class Parser
23+
def parse_formatter : Formatter::Config
24+
indent_size = 2
25+
26+
@parser.read_object do |key|
27+
case key
28+
when "indent-size"
29+
indent_size = parse_formatter_indent_size
30+
else
31+
error! :formatter_invalid_key do
32+
text "The"
33+
end
34+
end
35+
end
36+
end
37+
end
38+
end
39+
end

0 commit comments

Comments
 (0)