Current section
Files
Jump to
Current section
Files
src/glsql@token.erl
-module(glsql@token).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/glsql/token.gleam").
-export([to_string/1]).
-export_type([token/0, positioned/0]).
-type token() :: {word, binary()} |
{quoted_ident, binary()} |
{number, binary()} |
{string_lit, binary()} |
l_paren |
r_paren |
comma |
semicolon |
dot |
l_bracket |
r_bracket |
{symbol, binary()}.
-type positioned() :: {positioned, token(), integer(), integer()}.
-file("src/glsql/token.gleam", 20).
-spec to_string(token()) -> binary().
to_string(Token) ->
case Token of
{word, W} ->
W;
{quoted_ident, W@1} ->
<<<<"\""/utf8, W@1/binary>>/binary, "\""/utf8>>;
{number, N} ->
N;
{string_lit, S} ->
<<<<"'"/utf8, S/binary>>/binary, "'"/utf8>>;
l_paren ->
<<"("/utf8>>;
r_paren ->
<<")"/utf8>>;
comma ->
<<","/utf8>>;
semicolon ->
<<";"/utf8>>;
dot ->
<<"."/utf8>>;
l_bracket ->
<<"["/utf8>>;
r_bracket ->
<<"]"/utf8>>;
{symbol, S@1} ->
S@1
end.