wip name cleanups

This commit is contained in:
Peter Harpending
2026-06-01 18:00:37 -07:00
parent f548c7d88d
commit 9da6dbf18d
12 changed files with 804 additions and 281 deletions
+35 -51
View File
@@ -1,20 +1,10 @@
% This is a header file that contains sfc's record types
% This is a header file that contains gsc's record types
%
% This is in order to
% 1. share records across modules; and,
% 2. allow external modules to just use the sfc records
% 2. allow external modules to just use the gsc records
%-------------------------------------------------------
% API Types: sfc internal token representation
%
% -export_type([
% sf_token_type/0
% sf_token/0
% ]).
%-------------------------------------------------------
%
-type sfc_token_type()
-type tk_shape()
:: bcom % /* ... */
| lcom % //
| ws % whitespace
@@ -50,14 +40,14 @@
.
-type sfc_pos() :: {Line :: pos_integer(), Col :: pos_integer()}.
-type tk_pos() :: {Line :: pos_integer(), Col :: pos_integer()}.
-record(sfc_token,
{type :: sfc_token_type(),
pos :: sfc_pos(),
string :: string()}).
-record(tk,
{shape :: tk_shape(),
pos :: tk_pos(),
str :: string()}).
-type sfc_token() :: #sfc_token{}.
-type tk() :: #tk{}.
% tokens are in essence the "chunk boundaries" of
@@ -93,15 +83,15 @@
% lists = (_, _, _)
% | [_, _, _]
% | {_, _, _}
%-record(sfc_ast1_block,
%-record(gsc_ast1_block,
% {indent = none :: none | pos_integer(),
% decls = none :: [sfc_ast1_decl()]}).
% decls = none :: [gsc_ast1_decl()]}).
%
%-type sfc_ast() ::
%-type gsc_ast() ::
%
%-type sfc_list_group() :: {'(', [sfc_token()], ')'}
% | {'[', [sfc_token()], ']'}
% | {'{', [sfc_token()], '}'}
%-type gsc_list_group() :: {'(', [tk()], ')'}
% | {'[', [tk()], ']'}
% | {'{', [tk()], '}'}
% | {proof,
% .
@@ -112,50 +102,44 @@
% record type: unterminated block comments at the end
% of files. these are ok in legacy sophia, so we have to
% specifically account for this error
-record(sfc_err_bcom_unterminated,
{prev_tokens :: [sfc_token()],
break_pos :: sfc_pos(),
-record(gsc_err_bcom_unterminated,
{prev_tokens :: [tk()],
break_pos :: gsc_pos(),
rest :: string()}).
-record(sfc_err_no_tokmatch,
{prev_tokens :: [sfc_token()],
break_pos :: sfc_pos(),
-record(gsc_err_no_tokmatch,
{prev_tokens :: [tk()],
break_pos :: gsc_pos(),
rest :: string()}).
-record(sfc_err_delims,
{past :: [sfc_token()],
open_stack :: [sfc_token()],
bad_close :: sfc_token(),
future :: [sfc_token()]}).
-record(gsc_err_delims,
{past :: [tk()],
open_stack :: [tk()],
bad_close :: tk(),
future :: [tk()]}).
% FIXME
-record(sfc_err_nyi, {}).
-record(sfc_err_empty_file, {}).
-record(gsc_err_nyi, {}).
-record(gsc_err_empty_file, {}).
%-record(src_parse_error,
% {atom = none :: none | atom(),
% string =
%j-record(sfc_err_gulp_ct,
%j-record(gsc_err_gulp_ct,
%j {gulped ::
% @doc
% generic placeholder error for now
-record(sfc_err,
-record(gsc_err,
{atom :: atom(),
string = none :: none | iolist(),
extra = none :: none | any()}).
% @doc all errors SFC can return conveniently listed in
% one place
-type sfc_err() :: #sfc_err_bcom_unterminated{}
| #sfc_err_no_tokmatch{}
| #sfc_err_nyi{}
| #sfc_err_empty_file{}
| #sfc_err{}.
%% FIXME
-type sfc_ast() :: any().
-type gsc_err() :: #gsc_err_bcom_unterminated{}
| #gsc_err_no_tokmatch{}
| #gsc_err_nyi{}
| #gsc_err_empty_file{}
| #gsc_err{}.