-module(eyg@parser@token). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/eyg/parser/token.gleam"). -export([drop_whitespace/1, drop_comments/1, to_string/1]). -export_type([token/0]). -type token() :: {comment, binary()} | {whitespace, binary()} | {name, binary()} | {uppername, binary()} | {integer, binary()} | {string, binary()} | 'let' | match | perform | deep | handle | import | equal | comma | dot_dot | dot | colon | right_arrow | minus | bang | bar | hash | at | left_paren | right_paren | left_brace | right_brace | left_square | right_square | {unexpected_grapheme, binary()} | {unterminated_string, binary()} | {invalid_escape, binary()}. -file("src/eyg/parser/token.gleam", 42). -spec drop_whitespace(list({token(), FBY})) -> list({token(), FBY}). drop_whitespace(Tokens) -> gleam@list:filter(Tokens, fun(Token) -> case Token of {{whitespace, _}, _} -> false; _ -> true end end). -file("src/eyg/parser/token.gleam", 51). -spec drop_comments(list({token(), FCD})) -> list({token(), FCD}). drop_comments(Tokens) -> gleam@list:filter(Tokens, fun(Token) -> case Token of {{comment, _}, _} -> false; _ -> true end end). -file("src/eyg/parser/token.gleam", 60). -spec to_string(token()) -> binary(). to_string(Token) -> case Token of {comment, Content} -> <<"//"/utf8, Content/binary>>; {whitespace, Raw} -> Raw; {name, Raw@1} -> Raw@1; {uppername, Raw@2} -> Raw@2; {integer, Raw@3} -> Raw@3; {string, Raw@4} -> <<<<"\""/utf8, Raw@4/binary>>/binary, "\""/utf8>>; 'let' -> <<"let"/utf8>>; match -> <<"match"/utf8>>; perform -> <<"perform"/utf8>>; deep -> <<"deep"/utf8>>; handle -> <<"handle"/utf8>>; import -> <<"import"/utf8>>; equal -> <<"="/utf8>>; comma -> <<","/utf8>>; dot_dot -> <<".."/utf8>>; dot -> <<"."/utf8>>; colon -> <<":"/utf8>>; right_arrow -> <<"->"/utf8>>; minus -> <<"-"/utf8>>; bang -> <<"!"/utf8>>; bar -> <<"|"/utf8>>; hash -> <<"#"/utf8>>; at -> <<"@"/utf8>>; left_paren -> <<"("/utf8>>; right_paren -> <<")"/utf8>>; left_brace -> <<"{"/utf8>>; right_brace -> <<"}"/utf8>>; left_square -> <<"["/utf8>>; right_square -> <<"]"/utf8>>; {unexpected_grapheme, Raw@5} -> Raw@5; {unterminated_string, Raw@6} -> <<"\""/utf8, Raw@6/binary>>; {invalid_escape, Raw@7} -> <<"\""/utf8, Raw@7/binary>> end.