restructure done

This commit is contained in:
2026-06-05 18:35:34 -07:00
parent ff066072e2
commit b88e51bb81
5 changed files with 17 additions and 17 deletions
+3 -3
View File
@@ -23,14 +23,14 @@
| qid % Foo.Bar.baz
| qcon % Foo.Bar.Baz
| tvar % 'foo, 'foo_bar, '_'foo'_'bar'''
% kwds ops and punct are all collapsed by
% kwds ops and sep are all collapsed by
% so_scan:scan down to eg {'contract', {420, 69}}
% where {420, 69} is the source location
% these are three different parsers
| kwd % contract, interface, payable, etc
| op % "=!<>+-*/:&|?~@^"
| punct % ".." | oneof(",.;()[]{}")
% kwds and punct are kind of the same thing
| sep % ".." | oneof(",.;()[]{}")
% kwds and sep are kind of the same thing
% but i'll keep them separate now for my own sanity. ok
% i guess op or symbol or whatever is fine.
%
+1 -1
View File
@@ -131,7 +131,7 @@ slurp_ct_impls([#gsc_token{string = ":", type = op},
slurp_ct_impls(_) ->
reject.
slurp_ct_impls2([#gsc_token{string = ",", type = punct},
slurp_ct_impls2([#gsc_token{string = ",", type = sep},
#gsc_token{string = Con1, type = con}
| Rest],
Acc) ->
+4 -4
View File
@@ -88,7 +88,7 @@
-export([
smr_sf_ws/0,
smr_sf_op/0,
smr_sf_punct/0,
smr_sf_sep/0,
smr_sf_id/0,
smr_sf_con/0,
smr_sf_qid/0,
@@ -175,7 +175,7 @@ match(Matcher, Source) ->
% -export([
% smr_sf_ws/0,
% smr_sf_op/0,
% smr_sf_punct/0,
% smr_sf_sep/0,
% smr_sf_id/0,
% smr_sf_con/0,
% smr_sf_qid/0,
@@ -224,7 +224,7 @@ smr_sf_op() ->
-spec smr_sf_punct() -> string_matcher().
-spec smr_sf_sep() -> string_matcher().
% @doc
% String matcher for parens/braces
%
@@ -233,7 +233,7 @@ smr_sf_op() ->
% , {"\\.\\.|[,.;()\\[\\]{}]", symbol()}
% @end
smr_sf_punct() ->
smr_sf_sep() ->
M_DotDotOp = smr_string(".."),
M_PunctChars = smr_oneofchars(",.;()[]{}"),
smr_union([M_DotDotOp, M_PunctChars]).
+6 -6
View File
@@ -254,7 +254,7 @@ token_shapes_parse_order() ->
lists:flatten([
% comments and whitespace
lcom, bcom, ws,
punct,
sep,
% literals
char, string, int16, int10, bytes,
ak, ct, sg,
@@ -264,7 +264,7 @@ token_shapes_parse_order() ->
% keywords need to be parsed ahead of ids
kwd, id,
con,
% ops [=, =>, >>], punctuation (parens/braces)
% ops [=, =>, >>], sepuation (parens/braces)
op
]).
@@ -597,7 +597,7 @@ slurp_token_of_shape(ws, Pos, SrcStr) ->
str = WS},
{tokmatch, Token, Rest}
end;
% KEYWORDS, OPERATORS, PUNCTUATION: kwd, op, punct
% KEYWORDS, OPERATORS, PUNCTUATION: kwd, op, sep
%
% all the kwds are valid ids, so we match as an id and then check if it's a
% kwd
@@ -629,10 +629,10 @@ slurp_token_of_shape(op, Pos, SrcStr) ->
no_strmatch ->
no_tokmatch
end;
slurp_token_of_shape(punct, Pos, SrcStr) ->
case gsc_strmatch:match(gsc_strmatch:smr_sf_punct(), SrcStr) of
slurp_token_of_shape(sep, Pos, SrcStr) ->
case gsc_strmatch:match(gsc_strmatch:smr_sf_sep(), SrcStr) of
{strmatch, Str, Rest} ->
Token = #tk{shape = punct, pos = Pos, str = Str},
Token = #tk{shape = sep, pos = Pos, str = Str},
{tokmatch, Token, Rest};
no_strmatch ->
no_tokmatch
+3 -3
View File
@@ -299,7 +299,7 @@ pass_types() ->
[lcom, % ak_AB// breaks out of id
bcom, % ak_AB/* breaks out of id
ws, % ak_AB\t breaks out of id
punct, % ak_AB{ breaks out of id
sep, % ak_AB{ breaks out of id
string, % ak_AB" breaks out of id
bytes, % ak_AB# breaks out of id
ak,ct,sg, % ak_ABak [akctsg] all in base58 alphabet
@@ -335,13 +335,13 @@ to_so_token(#tk{shape = SfTokenType,
%
% {contract, {420, 69}}
%-----------------------
% kwds ops and punct are all collapsed by
% kwds ops and sep are all collapsed by
% so_scan:scan down to eg {'contract', {420, 69}}
% where {420, 69} is the source location
% these are three different parsers
Sym when Sym =:= kwd;
Sym =:= op;
Sym =:= punct ->
Sym =:= sep ->
Symbol = list_to_atom(SfTokenStr),
{true, {Symbol, Pos}};
%------------------------------------