-module(guddle). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/guddle.gleam"). -export([parse/1]). -file("src/guddle.gleam", 16). -spec handle_comments(list(binary()), list(binary()), boolean()) -> list(binary()). handle_comments(Input, Accumulator, In_comment) -> case Input of [<<"/"/utf8>>, <<"/"/utf8>> | Input@1] -> _pipe = Input@1, _pipe@1 = gleam@list:drop_while( _pipe, fun(G) -> G /= <<"\n"/utf8>> end ), handle_comments(_pipe@1, Accumulator, In_comment); [<<"/"/utf8>>, <<"*"/utf8>> | Input@2] -> _pipe@2 = Input@2, handle_comments(_pipe@2, Accumulator, true); [<<"*"/utf8>>, <<"/"/utf8>> | Input@3] when In_comment -> _pipe@3 = Input@3, handle_comments(_pipe@3, Accumulator, false); [_ | Input@4] when In_comment -> _pipe@4 = Input@4, handle_comments(_pipe@4, Accumulator, In_comment); [G@1 | Input@5] -> _pipe@5 = Input@5, handle_comments(_pipe@5, [G@1 | Accumulator], In_comment); [] -> Accumulator end. -file("src/guddle.gleam", 38). -spec handle_whitespace(list(binary())) -> list(binary()). handle_whitespace(Input) -> case Input of [<<" "/utf8>> | Input@1] -> handle_whitespace(Input@1); [<<"\t"/utf8>> | Input@2] -> handle_whitespace(Input@2); [<<"\n"/utf8>> | Input@3] -> handle_whitespace(Input@3); [<<"\r\n"/utf8>> | Input@4] -> handle_whitespace(Input@4); _ -> Input end. -file("src/guddle.gleam", 5). -spec parse(binary()) -> nil. parse(Input) -> Input@1 = begin _pipe = Input, _pipe@1 = gleam@string:to_graphemes(_pipe), _pipe@2 = handle_comments(_pipe@1, [], false), handle_whitespace(_pipe@2) end, _pipe@3 = Input@1, gleam@list:each(_pipe@3, fun gleam_stdlib:print/1).