Current section
Files
Jump to
Current section
Files
src/cog@glexer_printer.erl
-module(cog@glexer_printer).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([print/1]).
-file("/Users/danielle/Repositories/Projects/cog/src/cog/glexer_printer.gleam", 14).
-spec print_token(glexer@token:token()) -> binary().
print_token(Token) ->
case Token of
amper_amper ->
<<"&&"/utf8>>;
as ->
<<"as"/utf8>>;
assert ->
<<"assert"/utf8>>;
at ->
<<"@"/utf8>>;
auto ->
<<"auto"/utf8>>;
bang ->
<<"!"/utf8>>;
'case' ->
<<"case"/utf8>>;
colon ->
<<":"/utf8>>;
comma ->
<<","/utf8>>;
{comment_doc, Comment} ->
<<"///"/utf8, Comment/binary>>;
{comment_module, Comment@1} ->
<<"////"/utf8, Comment@1/binary>>;
{comment_normal, Comment@2} ->
<<"//"/utf8, Comment@2/binary>>;
const ->
<<"const"/utf8>>;
delegate ->
<<"delegate"/utf8>>;
derive ->
<<"derive"/utf8>>;
{discard_name, Name} ->
<<"_"/utf8, Name/binary>>;
dot ->
<<"."/utf8>>;
dot_dot ->
<<".."/utf8>>;
echo ->
<<"echo"/utf8>>;
'else' ->
<<"else"/utf8>>;
end_of_file ->
<<""/utf8>>;
equal ->
<<"="/utf8>>;
equal_equal ->
<<"=="/utf8>>;
{float, Value} ->
Value;
fn ->
<<"fn"/utf8>>;
greater ->
<<">"/utf8>>;
greater_dot ->
<<">."/utf8>>;
greater_equal ->
<<">="/utf8>>;
greater_equal_dot ->
<<">=."/utf8>>;
greater_greater ->
<<">>"/utf8>>;
hash ->
<<"#"/utf8>>;
'if' ->
<<"if"/utf8>>;
implement ->
<<"implement"/utf8>>;
import ->
<<"import"/utf8>>;
{int, Value@1} ->
Value@1;
left_arrow ->
<<"<-"/utf8>>;
left_brace ->
<<"{"/utf8>>;
left_paren ->
<<"("/utf8>>;
left_square ->
<<"["/utf8>>;
less ->
<<"<"/utf8>>;
less_dot ->
<<"<."/utf8>>;
less_equal ->
<<"<="/utf8>>;
less_equal_dot ->
<<"<=."/utf8>>;
less_greater ->
<<"<>"/utf8>>;
less_less ->
<<"<<"/utf8>>;
'let' ->
<<"let"/utf8>>;
macro ->
<<"macro"/utf8>>;
minus ->
<<"-"/utf8>>;
minus_dot ->
<<"-."/utf8>>;
{name, Name@1} ->
Name@1;
not_equal ->
<<"!="/utf8>>;
opaque ->
<<"opaque"/utf8>>;
panic ->
<<"panic"/utf8>>;
percent ->
<<"%"/utf8>>;
pipe ->
<<"|>"/utf8>>;
plus ->
<<"+"/utf8>>;
plus_dot ->
<<"+."/utf8>>;
pub ->
<<"pub"/utf8>>;
right_arrow ->
<<"->"/utf8>>;
right_brace ->
<<"}"/utf8>>;
right_paren ->
<<")"/utf8>>;
right_square ->
<<"]"/utf8>>;
slash ->
<<"/"/utf8>>;
slash_dot ->
<<"/."/utf8>>;
{space, Space} ->
Space;
star ->
<<"*"/utf8>>;
star_dot ->
<<"*."/utf8>>;
{string, Value@2} ->
<<<<"\""/utf8, Value@2/binary>>/binary, "\""/utf8>>;
test ->
<<"test"/utf8>>;
todo ->
<<"todo"/utf8>>;
type ->
<<"type"/utf8>>;
{unexpected_grapheme, Value@3} ->
Value@3;
{unterminated_string, Value@4} ->
<<"\""/utf8, Value@4/binary>>;
{upper_name, Name@2} ->
Name@2;
use ->
<<"use"/utf8>>;
v_bar ->
<<"|"/utf8>>;
v_bar_v_bar ->
<<"||"/utf8>>
end.
-file("/Users/danielle/Repositories/Projects/cog/src/cog/glexer_printer.gleam", 7).
-spec do_print(list(glexer@token:token()), binary()) -> binary().
do_print(Tokens, Source) ->
case Tokens of
[] ->
Source;
[Token | Tokens@1] ->
do_print(Tokens@1, <<Source/binary, (print_token(Token))/binary>>)
end.
-file("/Users/danielle/Repositories/Projects/cog/src/cog/glexer_printer.gleam", 3).
-spec print(list(glexer@token:token())) -> binary().
print(Tokens) ->
do_print(Tokens, <<""/utf8>>).