more mass renaming

This commit is contained in:
2026-06-02 01:48:05 -07:00
parent eff77fff6b
commit 270f192f0c
53 changed files with 1264 additions and 431 deletions
+16 -16
View File
@@ -1,6 +1,6 @@
% @doc compatibility layer to test against so_scan
%
% converts gsc_tokens data to so_scan tokens
% converts gs_tokens data to so_scan tokens
%
% Ref: so_scan.erl
-module(gso_scan).
@@ -76,14 +76,14 @@
-type so_symbol() :: so_kwd() | so_special_char() | atom().
-type so_token2() :: {Symbol :: so_symbol(),
Location :: gsc_pos()}.
Location :: tk_pos()}.
% FIXME
% this is 'id', 'con', qid
-type so_tk3type() :: char | string | hex | int | bytes | qid | qcon | tvar | id | con.
-type so_token3() :: {TokenType :: so_tk3type(),
Location :: gsc_pos(),
Location :: tk_pos(),
TokenValue :: term()}.
-type so_token() :: so_token2() | so_token3().
@@ -104,7 +104,7 @@
% @end
scan(SrcStr) ->
case gsc_tokens:tokens(SrcStr) of
case gs_tokens:tokens(SrcStr) of
{ok, SfLTokens} ->
SoTokens = to_so_tokens(SfLTokens),
{ok, SoTokens};
@@ -151,12 +151,12 @@ scan(SrcStr) ->
%
% so if we see an ak/ct/sg token, we summon evil ben
% carson to reconjoin the unconjoined twins
to_so_tokens([ AkTok = #tk{type = AkCtSg, pos = Pos}
to_so_tokens([ AkTok = #tk{shape = AkCtSg, pos = Pos}
| Sheeit])
when ak =:= AkCtSg;
ct =:= AkCtSg;
sg =:= AkCtSg ->
{#tk{string = FinalAkStr}, NewSheeit}
{#tk{str = FinalAkStr}, NewSheeit}
= ken_barson_rises(AkTok, Sheeit),
[{id, Pos, FinalAkStr}| to_so_tokens(NewSheeit)];
% this part is just lists:filtermap
@@ -259,9 +259,9 @@ to_so_tokens([]) ->
% `_`**: `smr_plus` requires >=1 base58 char to
% match; `ak_I`, `ak_0`, `ak__bar` all fall
% through to `id` and both tokenizers agree.
ken_barson_rises(AkTokAcc = #tk{string = AkStr},
SrcTokens = [#tk{type = CandidateType,
string = CandidateString}
ken_barson_rises(AkTokAcc = #tk{str = AkStr},
SrcTokens = [#tk{shape = CandidateType,
str = CandidateString}
| Rest]) ->
% candidate:
% dig out the token type and the string
@@ -273,7 +273,7 @@ ken_barson_rises(AkTokAcc = #tk{string = AkStr},
Smash ->
% dig out the token from LcTokApi
NewAkStr = AkStr ++ CandidateString,
NewAkTokAcc = AkTokAcc#tk{string = NewAkStr},
NewAkTokAcc = AkTokAcc#tk{str = NewAkStr},
ken_barson_rises(NewAkTokAcc, Rest);
Pass ->
{AkTokAcc, SrcTokens}
@@ -320,9 +320,9 @@ pass_types() ->
% follow-on tokens
% @end
to_so_token(#tk{type = SfTokenType,
pos = Pos,
string = SfTokenStr}) ->
to_so_token(#tk{shape = SfTokenType,
pos = Pos,
str = SfTokenStr}) ->
case SfTokenType of
%-----------------
% Ignored
@@ -371,7 +371,7 @@ to_so_token(#tk{type = SfTokenType,
NYI ->
Msg = io_lib:format("gsc_so_scan:to_so_token/1: unhandled token shape: ~p", [NYI]),
error(#gsc_err{atom = nyi,
string = Msg})
str = Msg})
end.
%% ak/ct/sg all tokenize to id
@@ -393,7 +393,7 @@ so_parse_char([$' | Chars]) ->
[Char] -> Char;
_Bad ->
error(#gsc_err{atom = bad_token,
string = "Bad character literal: '" ++ Chars})
str = "Bad character literal: '" ++ Chars})
end.
so_parse_string([$" | Chars]) ->
@@ -435,7 +435,7 @@ unescape(Delim, [$\\, Code | Chars], Acc) ->
$t -> Ok($\t);
$v -> Ok($\v);
_ -> error(#gsc_err{atom = bad_escape_char,
string = "Bad control sequence: \\" ++ [Code]}) %% TODO
str = "Bad control sequence: \\" ++ [Code]}) %% TODO
end;
unescape(Delim, [C | Chars], Acc) ->
unescape(Delim, Chars, [C | Acc]).