s/sfc/gsc/g
'
This commit is contained in:
+2
-2
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
# TODONE
|
# TODONE
|
||||||
|
|
||||||
- undo gs_ naming fuckery.. everything is `gsc_*`. it's just
|
- undo gs_ naming fuckery.. everything is `sfc_*`. it's just
|
||||||
needlessly confusing. for now let's name new things gsc_* and then
|
needlessly confusing. for now let's name new things sfc_* and then
|
||||||
go back and undo the stupidity
|
go back and undo the stupidity
|
||||||
|
|
||||||
# TODONT
|
# TODONT
|
||||||
|
|||||||
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Bash harness for GSC command line tool
|
# Bash harness for sfc command line tool
|
||||||
#
|
#
|
||||||
# based on similar harness for sfp
|
# based on similar harness for sfp
|
||||||
#
|
#
|
||||||
# gsc foo bar baz
|
# sfc foo bar baz
|
||||||
# -> zx rundir /home/pharpend/src/ioecs/gsc \
|
# -> zx rundir /home/pharpend/src/ioecs/sfc \
|
||||||
# foo bar baz
|
# foo bar baz
|
||||||
|
|
||||||
zx_exists() {
|
zx_exists() {
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{application,gsc,
|
|
||||||
[{description,"Exploratory sophia compiler rewrite"},
|
|
||||||
{registered,[]},
|
|
||||||
{included_applications,[]},
|
|
||||||
{applications,[stdlib,kernel]},
|
|
||||||
{vsn,"0.1.0"},
|
|
||||||
{modules,['ast-gulp',gsc_ast,gsc_bst,gsc_parse_type_expr,
|
|
||||||
gsc_token_chunks,ifarith,parse_type_expr,test_ntree,
|
|
||||||
unicode,gsc,gsc_cli,gsc_ntree,gsc_signal,gsc_strmatch,
|
|
||||||
gsc_tokens,gso_scan,gsc_test_file,gsc_test_ntree,
|
|
||||||
gsc_test_tokens,ts_utils]}]}.
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{application,sfc,
|
||||||
|
[{description,"Exploratory sophia compiler rewrite"},
|
||||||
|
{registered,[]},
|
||||||
|
{included_applications,[]},
|
||||||
|
{applications,[stdlib,kernel]},
|
||||||
|
{vsn,"0.1.0"},
|
||||||
|
{modules,['ast-gulp',sfc_ast,sfc_bst,sfc_parse_type_expr,
|
||||||
|
sfc_token_chunks,ifarith,parse_type_expr,test_ntree,
|
||||||
|
unicode,sfc,sfc_cli,sfc_ntree,sfc_signal,sfc_strmatch,
|
||||||
|
sfc_tokens,gso_scan,sfc_test_file,sfc_test_ntree,
|
||||||
|
sfc_test_tokens,ts_utils]}]}.
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
% This is a header file that contains gsc's record types
|
% This is a header file that contains sfc's record types
|
||||||
%
|
%
|
||||||
% This is in order to
|
% This is in order to
|
||||||
% 1. share records across modules; and,
|
% 1. share records across modules; and,
|
||||||
% 2. allow external modules to just use the gsc records
|
% 2. allow external modules to just use the sfc records
|
||||||
|
|
||||||
-type tk_shape()
|
-type tk_shape()
|
||||||
:: bcom % /* ... */
|
:: bcom % /* ... */
|
||||||
@@ -83,13 +83,13 @@
|
|||||||
% lists = (_, _, _)
|
% lists = (_, _, _)
|
||||||
% | [_, _, _]
|
% | [_, _, _]
|
||||||
% | {_, _, _}
|
% | {_, _, _}
|
||||||
%-record(gsc_ast1_block,
|
%-record(sfc_ast1_block,
|
||||||
% {indent = none :: none | pos_integer(),
|
% {indent = none :: none | pos_integer(),
|
||||||
% decls = none :: [gsc_ast1_decl()]}).
|
% decls = none :: [sfc_ast1_decl()]}).
|
||||||
%
|
%
|
||||||
%-type gsc_ast() ::
|
%-type sfc_ast() ::
|
||||||
%
|
%
|
||||||
%-type gsc_list_group() :: {'(', [tk()], ')'}
|
%-type sfc_list_group() :: {'(', [tk()], ')'}
|
||||||
% | {'[', [tk()], ']'}
|
% | {'[', [tk()], ']'}
|
||||||
% | {'{', [tk()], '}'}
|
% | {'{', [tk()], '}'}
|
||||||
% | {proof,
|
% | {proof,
|
||||||
@@ -102,47 +102,47 @@
|
|||||||
% record type: unterminated block comments at the end
|
% record type: unterminated block comments at the end
|
||||||
% of files. these are ok in legacy sophia, so we have to
|
% of files. these are ok in legacy sophia, so we have to
|
||||||
% specifically account for this error
|
% specifically account for this error
|
||||||
-record(gsc_err_bcom_unterminated,
|
-record(sfc_err_bcom_unterminated,
|
||||||
{prev_tokens :: [tk()],
|
{prev_tokens :: [tk()],
|
||||||
break_pos :: tk_pos(),
|
break_pos :: tk_pos(),
|
||||||
rest :: string()}).
|
rest :: string()}).
|
||||||
|
|
||||||
-record(gsc_err_no_tokmatch,
|
-record(sfc_err_no_tokmatch,
|
||||||
{prev_tokens :: [tk()],
|
{prev_tokens :: [tk()],
|
||||||
break_pos :: tk_pos(),
|
break_pos :: tk_pos(),
|
||||||
rest :: string()}).
|
rest :: string()}).
|
||||||
|
|
||||||
|
|
||||||
-record(gsc_err_delims,
|
-record(sfc_err_delims,
|
||||||
{past :: [tk()],
|
{past :: [tk()],
|
||||||
open_stack :: [tk()],
|
open_stack :: [tk()],
|
||||||
bad_close :: tk(),
|
bad_close :: tk(),
|
||||||
future :: [tk()]}).
|
future :: [tk()]}).
|
||||||
% FIXME
|
% FIXME
|
||||||
-record(gsc_err_nyi, {}).
|
-record(sfc_err_nyi, {}).
|
||||||
-record(gsc_err_empty_file, {}).
|
-record(sfc_err_empty_file, {}).
|
||||||
|
|
||||||
%-record(src_parse_error,
|
%-record(src_parse_error,
|
||||||
% {atom = none :: none | atom(),
|
% {atom = none :: none | atom(),
|
||||||
% string =
|
% string =
|
||||||
|
|
||||||
%j-record(gsc_err_gulp_ct,
|
%j-record(sfc_err_gulp_ct,
|
||||||
%j {gulped ::
|
%j {gulped ::
|
||||||
|
|
||||||
% @doc
|
% @doc
|
||||||
% generic placeholder error for now
|
% generic placeholder error for now
|
||||||
-record(gsc_err,
|
-record(sfc_err,
|
||||||
{atom :: atom(),
|
{atom :: atom(),
|
||||||
str = none :: none | iolist(),
|
str = none :: none | iolist(),
|
||||||
extra = none :: none | any()}).
|
extra = none :: none | any()}).
|
||||||
|
|
||||||
% @doc all errors GSC can return conveniently listed in
|
% @doc all errors SFC can return conveniently listed in
|
||||||
% one place
|
% one place
|
||||||
-type gsc_err() :: #gsc_err_bcom_unterminated{}
|
-type sfc_err() :: #sfc_err_bcom_unterminated{}
|
||||||
| #gsc_err_no_tokmatch{}
|
| #sfc_err_no_tokmatch{}
|
||||||
| #gsc_err_nyi{}
|
| #sfc_err_nyi{}
|
||||||
| #gsc_err_empty_file{}
|
| #sfc_err_empty_file{}
|
||||||
| #gsc_err{}.
|
| #sfc_err{}.
|
||||||
|
|
||||||
|
|
||||||
%----------------------------
|
%----------------------------
|
||||||
+31
-31
@@ -31,9 +31,9 @@
|
|||||||
% gulp means it must consume all input
|
% gulp means it must consume all input
|
||||||
-spec gulp(AstTarget, SigTokens) -> Perhaps
|
-spec gulp(AstTarget, SigTokens) -> Perhaps
|
||||||
when AstTarget :: gulp_target(),
|
when AstTarget :: gulp_target(),
|
||||||
SigTokens :: [gsc_token()],
|
SigTokens :: [sfc_token()],
|
||||||
Perhaps :: {gulp, ast()}
|
Perhaps :: {gulp, ast()}
|
||||||
| {error, gsc_err()}.
|
| {error, sfc_err()}.
|
||||||
|
|
||||||
gulp(ast_file, Tokens) ->
|
gulp(ast_file, Tokens) ->
|
||||||
gulp_file(Tokens);
|
gulp_file(Tokens);
|
||||||
@@ -46,11 +46,11 @@ gulp(ast_ct, Tokens) ->
|
|||||||
gulp(ast_nyi, Tokens) ->
|
gulp(ast_nyi, Tokens) ->
|
||||||
{gulp, #ast_nyi{tokens = Tokens}};
|
{gulp, #ast_nyi{tokens = Tokens}};
|
||||||
gulp({block_of, X}, Tokens) ->
|
gulp({block_of, X}, Tokens) ->
|
||||||
{barf, ItemChunks, []} = gsc_token_chunks:barf(block_as_items, Tokens),
|
{barf, ItemChunks, []} = sfc_token_chunks:barf(block_as_items, Tokens),
|
||||||
gulp_block_of(X, ItemChunks);
|
gulp_block_of(X, ItemChunks);
|
||||||
gulp(Nyi, Tokens) ->
|
gulp(Nyi, Tokens) ->
|
||||||
Msg = io_lib:format("gsc_ast:gulp/2: unknown target: ~p", [Nyi]),
|
Msg = io_lib:format("sfc_ast:gulp/2: unknown target: ~p", [Nyi]),
|
||||||
Err = #gsc_err{atom = gulp_nyi,
|
Err = #sfc_err{atom = gulp_nyi,
|
||||||
string = Msg,
|
string = Msg,
|
||||||
extra = [{target, Nyi}, {tokens, Tokens}]},
|
extra = [{target, Nyi}, {tokens, Tokens}]},
|
||||||
{error, Err}.
|
{error, Err}.
|
||||||
@@ -60,35 +60,35 @@ gulp(Nyi, Tokens) ->
|
|||||||
% FIXME: payable and main need to be in that order i think
|
% FIXME: payable and main need to be in that order i think
|
||||||
gulp_ct(Ast = #ast_ct{payable = none}, Tokens) ->
|
gulp_ct(Ast = #ast_ct{payable = none}, Tokens) ->
|
||||||
case Tokens of
|
case Tokens of
|
||||||
[#gsc_token{string = "payable", type = kwd} | NewTokens] ->
|
[#sfc_token{string = "payable", type = kwd} | NewTokens] ->
|
||||||
gulp_ct(Ast#ast_ct{payable = payable}, NewTokens);
|
gulp_ct(Ast#ast_ct{payable = payable}, NewTokens);
|
||||||
_ ->
|
_ ->
|
||||||
gulp_ct(Ast#ast_ct{payable = false}, Tokens)
|
gulp_ct(Ast#ast_ct{payable = false}, Tokens)
|
||||||
end;
|
end;
|
||||||
gulp_ct(Ast = #ast_ct{main = none}, Tokens) ->
|
gulp_ct(Ast = #ast_ct{main = none}, Tokens) ->
|
||||||
case Tokens of
|
case Tokens of
|
||||||
[#gsc_token{string = "main", type = kwd} | NewTokens] ->
|
[#sfc_token{string = "main", type = kwd} | NewTokens] ->
|
||||||
gulp_ct(Ast#ast_ct{main = main}, NewTokens);
|
gulp_ct(Ast#ast_ct{main = main}, NewTokens);
|
||||||
_ ->
|
_ ->
|
||||||
gulp_ct(Ast#ast_ct{main = false}, Tokens)
|
gulp_ct(Ast#ast_ct{main = false}, Tokens)
|
||||||
end;
|
end;
|
||||||
gulp_ct(Ast = #ast_ct{contract = none}, Tokens) ->
|
gulp_ct(Ast = #ast_ct{contract = none}, Tokens) ->
|
||||||
case Tokens of
|
case Tokens of
|
||||||
[#gsc_token{string = "contract", type = kwd} | NewTokens] ->
|
[#sfc_token{string = "contract", type = kwd} | NewTokens] ->
|
||||||
gulp_ct(Ast#ast_ct{contract = contract}, NewTokens);
|
gulp_ct(Ast#ast_ct{contract = contract}, NewTokens);
|
||||||
% FIXME: reject logic applies to choice of branch, therefore
|
% FIXME: reject logic applies to choice of branch, therefore
|
||||||
% should be contained in branchpoint code
|
% should be contained in branchpoint code
|
||||||
_ ->
|
_ ->
|
||||||
reject
|
reject
|
||||||
%[#gsc_token{pos = P, string = S} | _] ->
|
%[#sfc_token{pos = P, string = S} | _] ->
|
||||||
% {error, #gsc_err{atom = no_kwd_contract,
|
% {error, #sfc_err{atom = no_kwd_contract,
|
||||||
% extra = [{pos, P},
|
% extra = [{pos, P},
|
||||||
% {expecting, "contract"},
|
% {expecting, "contract"},
|
||||||
% {got, S},
|
% {got, S},
|
||||||
% {ast, Ast},
|
% {ast, Ast},
|
||||||
% {tokens, Tokens}]}};
|
% {tokens, Tokens}]}};
|
||||||
%[] ->
|
%[] ->
|
||||||
% {error, #gsc_err{atom = no_kwd_contract,
|
% {error, #sfc_err{atom = no_kwd_contract,
|
||||||
% extra = [{pos, none},
|
% extra = [{pos, none},
|
||||||
% {expecting, "contract"},
|
% {expecting, "contract"},
|
||||||
% {got, eof},
|
% {got, eof},
|
||||||
@@ -97,7 +97,7 @@ gulp_ct(Ast = #ast_ct{contract = none}, Tokens) ->
|
|||||||
end;
|
end;
|
||||||
gulp_ct(Ast = #ast_ct{name = none}, Tokens) ->
|
gulp_ct(Ast = #ast_ct{name = none}, Tokens) ->
|
||||||
case Tokens of
|
case Tokens of
|
||||||
[#gsc_token{string = Name, type = con} | NewTokens] ->
|
[#sfc_token{string = Name, type = con} | NewTokens] ->
|
||||||
gulp_ct(Ast#ast_ct{name = Name}, NewTokens);
|
gulp_ct(Ast#ast_ct{name = Name}, NewTokens);
|
||||||
_ ->
|
_ ->
|
||||||
reject
|
reject
|
||||||
@@ -112,27 +112,27 @@ gulp_ct(Ast = #ast_ct{implements = none}, Tokens) ->
|
|||||||
end;
|
end;
|
||||||
gulp_ct(Ast = #ast_ct{eq = none}, Tokens) ->
|
gulp_ct(Ast = #ast_ct{eq = none}, Tokens) ->
|
||||||
case Tokens of
|
case Tokens of
|
||||||
[#gsc_token{string = "=", type = op} | NewTokens] ->
|
[#sfc_token{string = "=", type = op} | NewTokens] ->
|
||||||
gulp_ct(Ast#ast_ct{eq = '='}, NewTokens);
|
gulp_ct(Ast#ast_ct{eq = '='}, NewTokens);
|
||||||
_ ->
|
_ ->
|
||||||
{error, #gsc_err{atom = no_eq}}
|
{error, #sfc_err{atom = no_eq}}
|
||||||
end;
|
end;
|
||||||
gulp_ct(Ast = #ast_ct{decls = none}, Tokens) ->
|
gulp_ct(Ast = #ast_ct{decls = none}, Tokens) ->
|
||||||
Decls = [gulp(decl, Item) || Item <- gsc_token_chunks:unsafe_block_to_items(Tokens)],
|
Decls = [gulp(decl, Item) || Item <- sfc_token_chunks:unsafe_block_to_items(Tokens)],
|
||||||
{gulp, Ast#ast_ct{decls = Decls}};
|
{gulp, Ast#ast_ct{decls = Decls}};
|
||||||
gulp_ct(_, _) ->
|
gulp_ct(_, _) ->
|
||||||
reject.
|
reject.
|
||||||
|
|
||||||
|
|
||||||
slurp_ct_impls([#gsc_token{string = ":", type = op},
|
slurp_ct_impls([#sfc_token{string = ":", type = op},
|
||||||
#gsc_token{string = Con1, type = con}
|
#sfc_token{string = Con1, type = con}
|
||||||
| Rest]) ->
|
| Rest]) ->
|
||||||
slurp_ct_impls2(Rest, [Con1]);
|
slurp_ct_impls2(Rest, [Con1]);
|
||||||
slurp_ct_impls(_) ->
|
slurp_ct_impls(_) ->
|
||||||
reject.
|
reject.
|
||||||
|
|
||||||
slurp_ct_impls2([#gsc_token{string = ",", type = sep},
|
slurp_ct_impls2([#sfc_token{string = ",", type = sep},
|
||||||
#gsc_token{string = Con1, type = con}
|
#sfc_token{string = Con1, type = con}
|
||||||
| Rest],
|
| Rest],
|
||||||
Acc) ->
|
Acc) ->
|
||||||
slurp_ct_impls2(Rest, [Con1 | Acc]);
|
slurp_ct_impls2(Rest, [Con1 | Acc]);
|
||||||
@@ -144,28 +144,28 @@ slurp_ct_impls2(Rest, Names) ->
|
|||||||
|
|
||||||
|
|
||||||
-spec gulp_file(SigTokens) -> Perhaps
|
-spec gulp_file(SigTokens) -> Perhaps
|
||||||
when SigTokens :: [gsc_token()],
|
when SigTokens :: [sfc_token()],
|
||||||
Perhaps :: {gulp, #ast_file{}}
|
Perhaps :: {gulp, #ast_file{}}
|
||||||
| {error, gsc_err()}.
|
| {error, sfc_err()}.
|
||||||
% @private
|
% @private
|
||||||
% `file` enforces that the entire SigTokens is one
|
% `file` enforces that the entire SigTokens is one
|
||||||
% block, chokes otherwise
|
% block, chokes otherwise
|
||||||
|
|
||||||
gulp_file([]) ->
|
gulp_file([]) ->
|
||||||
{error, #gsc_err{atom = empty_file}};
|
{error, #sfc_err{atom = empty_file}};
|
||||||
gulp_file(FileTokens = [#gsc_token{pos = FilePos} | _]) ->
|
gulp_file(FileTokens = [#sfc_token{pos = FilePos} | _]) ->
|
||||||
case gsc_token_chunks:barf(block, FileTokens) of
|
case sfc_token_chunks:barf(block, FileTokens) of
|
||||||
% happy path: got the whole file back
|
% happy path: got the whole file back
|
||||||
{barf, FileTokens, []} ->
|
{barf, FileTokens, []} ->
|
||||||
gulp_full_file(FileTokens);
|
gulp_full_file(FileTokens);
|
||||||
% sad path: block terminated
|
% sad path: block terminated
|
||||||
{barf, _, [#gsc_token{pos = EndPos}]} ->
|
{barf, _, [#sfc_token{pos = EndPos}]} ->
|
||||||
Msg = io_lib:format("block starting at ~p ends at ~p instead of EOF",
|
Msg = io_lib:format("block starting at ~p ends at ~p instead of EOF",
|
||||||
[FilePos, EndPos]),
|
[FilePos, EndPos]),
|
||||||
{error, #gsc_err{atom = bad_file,
|
{error, #sfc_err{atom = bad_file,
|
||||||
string = Msg}};
|
string = Msg}};
|
||||||
Nyi ->
|
Nyi ->
|
||||||
{error, #gsc_err{atom = bad_file_nyi, extra = Nyi}}
|
{error, #sfc_err{atom = bad_file_nyi, extra = Nyi}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ gulp_file(FileTokens = [#gsc_token{pos = FilePos} | _]) ->
|
|||||||
|
|
||||||
% file = block(top_decl)
|
% file = block(top_decl)
|
||||||
gulp_full_file(BlockTokens) ->
|
gulp_full_file(BlockTokens) ->
|
||||||
ItemChunks = gsc_token_chunks:unsafe_block_to_items(BlockTokens),
|
ItemChunks = sfc_token_chunks:unsafe_block_to_items(BlockTokens),
|
||||||
gulp_file_decls([], [], ItemChunks).
|
gulp_file_decls([], [], ItemChunks).
|
||||||
|
|
||||||
|
|
||||||
@@ -183,8 +183,8 @@ gulp_file_decls(Decls, Errs, [DeclTokens | Rest]) ->
|
|||||||
{gulp, NewDecl} ->
|
{gulp, NewDecl} ->
|
||||||
gulp_file_decls([NewDecl | Decls], Errs, Rest);
|
gulp_file_decls([NewDecl | Decls], Errs, Rest);
|
||||||
reject ->
|
reject ->
|
||||||
ErrPos = gsc_token_chunks:start_pos(DeclTokens),
|
ErrPos = sfc_token_chunks:start_pos(DeclTokens),
|
||||||
NewErr = #gsc_err{atom = bad_top_decl,
|
NewErr = #sfc_err{atom = bad_top_decl,
|
||||||
extra = [{tokens, DeclTokens},
|
extra = [{tokens, DeclTokens},
|
||||||
{pos, ErrPos}]},
|
{pos, ErrPos}]},
|
||||||
gulp_file_decls(Decls, [NewErr | Errs], Rest);
|
gulp_file_decls(Decls, [NewErr | Errs], Rest);
|
||||||
@@ -195,5 +195,5 @@ gulp_file_decls(Decls, Errs, [DeclTokens | Rest]) ->
|
|||||||
gulp_file_decls(Decls, _Errs = [], _Input = []) ->
|
gulp_file_decls(Decls, _Errs = [], _Input = []) ->
|
||||||
{gulp, #ast_file{top_decls = lists:reverse(Decls)}};
|
{gulp, #ast_file{top_decls = lists:reverse(Decls)}};
|
||||||
gulp_file_decls(_Decls, Errs, _Input = []) ->
|
gulp_file_decls(_Decls, Errs, _Input = []) ->
|
||||||
{error, #gsc_err{atom = many,
|
{error, #sfc_err{atom = many,
|
||||||
extra = Errs}}.
|
extra = Errs}}.
|
||||||
|
|||||||
+13
-13
@@ -1,5 +1,5 @@
|
|||||||
% @doc
|
% @doc
|
||||||
% type for a GSC AST
|
% type for a SFC AST
|
||||||
%
|
%
|
||||||
% based on so_syntax.erl
|
% based on so_syntax.erl
|
||||||
%
|
%
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
% Domain ::= Type // Single argument
|
% Domain ::= Type // Single argument
|
||||||
% | '(' Sep(Type, ',') ')' // Multiple arguments
|
% | '(' Sep(Type, ',') ')' // Multiple arguments
|
||||||
% ```
|
% ```
|
||||||
-module(gsc_ast).
|
-module(sfc_ast).
|
||||||
|
|
||||||
%-compile([export_all,nowarn_export_all]).
|
%-compile([export_all,nowarn_export_all]).
|
||||||
%
|
%
|
||||||
@@ -71,10 +71,10 @@
|
|||||||
% gulp_file/1
|
% gulp_file/1
|
||||||
%]).
|
%]).
|
||||||
%
|
%
|
||||||
%-include("$gsc_include/gsc.hrl").
|
%-include("$sfc_include/sfc.hrl").
|
||||||
%
|
%
|
||||||
%%%-----------------------------
|
%%%-----------------------------
|
||||||
%%% TYPES: gsc_ast
|
%%% TYPES: sfc_ast
|
||||||
%%%-----------------------------
|
%%%-----------------------------
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
@@ -196,13 +196,13 @@
|
|||||||
%gulp_file([]) ->
|
%gulp_file([]) ->
|
||||||
% {error, empty_file};
|
% {error, empty_file};
|
||||||
%gulp_file(Tokens) ->
|
%gulp_file(Tokens) ->
|
||||||
% case gsc_tokens:take_block(Tokens) of
|
% case sfc_tokens:take_block(Tokens) of
|
||||||
% {Tokens, []} ->
|
% {Tokens, []} ->
|
||||||
% gulp_block(fun gulp_top_decl/1, Tokens);
|
% gulp_block(fun gulp_top_decl/1, Tokens);
|
||||||
% %gulp_file2([], [], Tokens);
|
% %gulp_file2([], [], Tokens);
|
||||||
% {A, B} ->
|
% {A, B} ->
|
||||||
% StartPos = gsc_tokens:start_pos(A),
|
% StartPos = sfc_tokens:start_pos(A),
|
||||||
% ErrPos = gsc_tokens:start_pos(B),
|
% ErrPos = sfc_tokens:start_pos(B),
|
||||||
% Msg = efmt("gulp_file: block starting at ~p ends at ~p instead of EOF",
|
% Msg = efmt("gulp_file: block starting at ~p ends at ~p instead of EOF",
|
||||||
% [StartPos, ErrPos]),
|
% [StartPos, ErrPos]),
|
||||||
% {error, #parse_error{pos = ErrPos, msg = Msg}}
|
% {error, #parse_error{pos = ErrPos, msg = Msg}}
|
||||||
@@ -212,7 +212,7 @@
|
|||||||
%
|
%
|
||||||
%%gulp_file2(AccOks, AccErrs, Tokens = [_ | _]) ->
|
%%gulp_file2(AccOks, AccErrs, Tokens = [_ | _]) ->
|
||||||
%% % ItemTokens will be nonempty
|
%% % ItemTokens will be nonempty
|
||||||
%% {ItemTokens, NewTokens} = gsc_tokens:take_block_item(Tokens),
|
%% {ItemTokens, NewTokens} = sfc_tokens:take_block_item(Tokens),
|
||||||
%% case gulp_top_decl(ItemTokens) of
|
%% case gulp_top_decl(ItemTokens) of
|
||||||
%% {gulp, Ok} -> gulp_file2([Ok | AccOks], AccErrs, NewTokens);
|
%% {gulp, Ok} -> gulp_file2([Ok | AccOks], AccErrs, NewTokens);
|
||||||
%% Err -> gulp_file2(AccOks, [Err | AccErrs], NewTokens)
|
%% Err -> gulp_file2(AccOks, [Err | AccErrs], NewTokens)
|
||||||
@@ -258,7 +258,7 @@
|
|||||||
%
|
%
|
||||||
%gulp_block(GulpItem, AccOks, AccErrs, Tokens = [_ | _]) ->
|
%gulp_block(GulpItem, AccOks, AccErrs, Tokens = [_ | _]) ->
|
||||||
% % ItemTokens will be nonempty
|
% % ItemTokens will be nonempty
|
||||||
% {ItemTokens, NewTokens} = gsc_tokens:take_block_item(Tokens),
|
% {ItemTokens, NewTokens} = sfc_tokens:take_block_item(Tokens),
|
||||||
% case GulpItem(ItemTokens) of
|
% case GulpItem(ItemTokens) of
|
||||||
% {gulp, Ok} -> gulp_block(GulpItem, [Ok | AccOks], AccErrs, NewTokens);
|
% {gulp, Ok} -> gulp_block(GulpItem, [Ok | AccOks], AccErrs, NewTokens);
|
||||||
% Err -> gulp_block(GulpItem, AccOks, [Err | AccErrs], NewTokens)
|
% Err -> gulp_block(GulpItem, AccOks, [Err | AccErrs], NewTokens)
|
||||||
@@ -284,7 +284,7 @@
|
|||||||
%% | Using
|
%% | Using
|
||||||
%% @end
|
%% @end
|
||||||
%gulp_top_decl(DeclTokens) ->
|
%gulp_top_decl(DeclTokens) ->
|
||||||
% case gsc_tokens:strings(3, DeclTokens) of
|
% case sfc_tokens:strings(3, DeclTokens) of
|
||||||
% ["payable", "contract", "interface"] ->
|
% ["payable", "contract", "interface"] ->
|
||||||
% gulp_nyi(DeclTokens);
|
% gulp_nyi(DeclTokens);
|
||||||
% ["contract", "interface" | _] ->
|
% ["contract", "interface" | _] ->
|
||||||
@@ -410,7 +410,7 @@
|
|||||||
%% | (EModifier* 'entrypoint' | FModifier* 'function') Block(FunDecl)
|
%% | (EModifier* 'entrypoint' | FModifier* 'function') Block(FunDecl)
|
||||||
%% | Using
|
%% | Using
|
||||||
%gulp_decl(Tokens) ->
|
%gulp_decl(Tokens) ->
|
||||||
% case gsc_tokens:strings(1, Tokens) of
|
% case sfc_tokens:strings(1, Tokens) of
|
||||||
% ["type"] -> gulp_type_alias(Tokens);
|
% ["type"] -> gulp_type_alias(Tokens);
|
||||||
% _ -> gulp_nyi(Tokens)
|
% _ -> gulp_nyi(Tokens)
|
||||||
% end.
|
% end.
|
||||||
@@ -611,7 +611,7 @@
|
|||||||
%% Type1 = {plist, Types} () (foo) (foo, bar)
|
%% Type1 = {plist, Types} () (foo) (foo, bar)
|
||||||
%% | {token, #tk{}} foo Bar.baz 'quux
|
%% | {token, #tk{}} foo Bar.baz 'quux
|
||||||
%slurp_type1(Tks) ->
|
%slurp_type1(Tks) ->
|
||||||
% case gsc_tokens:slurp_plist(Tks) of
|
% case sfc_tokens:slurp_plist(Tks) of
|
||||||
% % head token is NOT open paren -> must be id/qid/tvar
|
% % head token is NOT open paren -> must be id/qid/tvar
|
||||||
% {slurp, [], [Tk | NewTks]} ->
|
% {slurp, [], [Tk | NewTks]} ->
|
||||||
% TkType = Tk#tk.type,
|
% TkType = Tk#tk.type,
|
||||||
@@ -633,7 +633,7 @@
|
|||||||
%
|
%
|
||||||
%
|
%
|
||||||
%%slurp_type_expr_plist(Tks) ->
|
%%slurp_type_expr_plist(Tks) ->
|
||||||
%% case gsc_tokens:slurp_plist(Tks) of
|
%% case sfc_tokens:slurp_plist(Tks) of
|
||||||
%% % head token is NOT open paren -> must be id/qid/tvar
|
%% % head token is NOT open paren -> must be id/qid/tvar
|
||||||
%% {slurp, [], [Tk | NewTks]} ->
|
%% {slurp, [], [Tk | NewTks]} ->
|
||||||
%% TkType = Tk#tk.type,
|
%% TkType = Tk#tk.type,
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
% @doc
|
% @doc
|
||||||
% gsc_bst = ast second attempt but prefix so tab complete
|
% sfc_bst = ast second attempt but prefix so tab complete
|
||||||
%
|
%
|
||||||
% from docs/sophia/so_syntax.md:
|
% from docs/sophia/so_syntax.md:
|
||||||
%
|
%
|
||||||
@@ -38,10 +38,10 @@
|
|||||||
% FModifier ::= 'stateful' | 'private'
|
% FModifier ::= 'stateful' | 'private'
|
||||||
%
|
%
|
||||||
% Args ::= '(' Sep(Pattern, ',') ')'
|
% Args ::= '(' Sep(Pattern, ',') ')'
|
||||||
-module(gsc_bst).
|
-module(sfc_bst).
|
||||||
|
|
||||||
-compile([export_all, nowarn_export_all]).
|
-compile([export_all, nowarn_export_all]).
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
|
|
||||||
%-record(bst_nyi, {tokens :: [tk()]).
|
%-record(bst_nyi, {tokens :: [tk()]).
|
||||||
%
|
%
|
||||||
|
|||||||
+2
-2
@@ -17,7 +17,7 @@ do_tests(List) ->
|
|||||||
run_test(TestName) ->
|
run_test(TestName) ->
|
||||||
% we have two candidate atoms
|
% we have two candidate atoms
|
||||||
C1 = list_to_atom(TestName),
|
C1 = list_to_atom(TestName),
|
||||||
C2 = list_to_atom("gsc_test_" ++ TestName),
|
C2 = list_to_atom("sfc_test_" ++ TestName),
|
||||||
KnownMods = test_mods(),
|
KnownMods = test_mods(),
|
||||||
IsC1 = lists:member(C1, KnownMods),
|
IsC1 = lists:member(C1, KnownMods),
|
||||||
IsC2 = lists:member(C2, KnownMods),
|
IsC2 = lists:member(C2, KnownMods),
|
||||||
@@ -44,7 +44,7 @@ rmm(X) -> run_mod_main(X).
|
|||||||
|
|
||||||
|
|
||||||
test_mods() ->
|
test_mods() ->
|
||||||
known_modules_with_prefix("gsc_test").
|
known_modules_with_prefix("sfc_test").
|
||||||
|
|
||||||
known_modules_with_prefix(Pfx) ->
|
known_modules_with_prefix(Pfx) ->
|
||||||
ModsZipBeamsZipLoaded = code:all_available(),
|
ModsZipBeamsZipLoaded = code:all_available(),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-module(gsc_parse_type_expr).
|
-module(sfc_parse_type_expr).
|
||||||
%
|
%
|
||||||
%-export_type([
|
%-export_type([
|
||||||
%]).
|
%]).
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
% take_until_ifx_op/1
|
% take_until_ifx_op/1
|
||||||
%]).
|
%]).
|
||||||
%
|
%
|
||||||
%-include("$gsc_include/gsc.hrl").
|
%-include("$sfc_include/sfc.hrl").
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
%%------------------------------------------------------
|
%%------------------------------------------------------
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
%
|
%
|
||||||
%% @doc for testing
|
%% @doc for testing
|
||||||
%unsafe_vtks_from_string(S) ->
|
%unsafe_vtks_from_string(S) ->
|
||||||
% {ok, SigTks} = gsc_tokens:significant_tokens(S),
|
% {ok, SigTks} = sfc_tokens:significant_tokens(S),
|
||||||
% {gulp, Vtks} = gulp_vtks(SigTks),
|
% {gulp, Vtks} = gulp_vtks(SigTks),
|
||||||
% Vtks.
|
% Vtks.
|
||||||
%
|
%
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
% end.
|
% end.
|
||||||
%
|
%
|
||||||
%slurp_plist_rec(Tokens = [#tk{string = "(" | _]) ->
|
%slurp_plist_rec(Tokens = [#tk{string = "(" | _]) ->
|
||||||
% case gsc_tokens:slurp_plist(Tokens) of
|
% case sfc_tokens:slurp_plist(Tokens) of
|
||||||
% {slurp, [], _} ->
|
% {slurp, [], _} ->
|
||||||
% barf;
|
% barf;
|
||||||
% {slurp, PTokens, NewTokens} ->
|
% {slurp, PTokens, NewTokens} ->
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
% {_Pfx = Tks1_BeforeOpen,
|
% {_Pfx = Tks1_BeforeOpen,
|
||||||
% _Sfx = Tks2_OpenNAfter
|
% _Sfx = Tks2_OpenNAfter
|
||||||
% = [#tk{string = "("} | _]} ->
|
% = [#tk{string = "("} | _]} ->
|
||||||
% case gsc_tokens:slurp_plist(Tks2_OpenNAfter) of
|
% case sfc_tokens:slurp_plist(Tks2_OpenNAfter) of
|
||||||
% {slurp, Tks2A_OpenToClose, Tks2B_AfterClose} ->
|
% {slurp, Tks2A_OpenToClose, Tks2B_AfterClose} ->
|
||||||
% NewAcc = [Acc,
|
% NewAcc = [Acc,
|
||||||
% Tks1_BeforeOpen,
|
% Tks1_BeforeOpen,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
%
|
%
|
||||||
% generally assume no whitespace/comment tokens in
|
% generally assume no whitespace/comment tokens in
|
||||||
% input stream
|
% input stream
|
||||||
-module(gsc_token_chunks).
|
-module(sfc_token_chunks).
|
||||||
|
|
||||||
%-export_type([
|
%-export_type([
|
||||||
% chunk_shape/0,
|
% chunk_shape/0,
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
% end_pos/1
|
% end_pos/1
|
||||||
%]).
|
%]).
|
||||||
%
|
%
|
||||||
%% $gsc_include is so c() works from sfp eshell
|
%% $sfc_include is so c() works from sfp eshell
|
||||||
%-include("$gsc_include/gsc.hrl").
|
%-include("$sfc_include/sfc.hrl").
|
||||||
%
|
%
|
||||||
%%------------------------------------------
|
%%------------------------------------------
|
||||||
%% Types
|
%% Types
|
||||||
@@ -45,25 +45,25 @@
|
|||||||
%
|
%
|
||||||
%take(block, []) ->
|
%take(block, []) ->
|
||||||
% {[], []};
|
% {[], []};
|
||||||
%take(block, [Hd = #gsc_token{pos = {_, BCol}} | Tl]) ->
|
%take(block, [Hd = #sfc_token{pos = {_, BCol}} | Tl]) ->
|
||||||
% tw(fun(#gsc_token{pos = {_, TkCol}}) -> BCol =< TkCol end, [Hd], Tl);
|
% tw(fun(#sfc_token{pos = {_, TkCol}}) -> BCol =< TkCol end, [Hd], Tl);
|
||||||
%take(block_item, []) ->
|
%take(block_item, []) ->
|
||||||
% {[], []};
|
% {[], []};
|
||||||
%take(block_item, [Hd = #gsc_token{pos = {_, ICol}} | Tl]) ->
|
%take(block_item, [Hd = #sfc_token{pos = {_, ICol}} | Tl]) ->
|
||||||
% tw(fun(#gsc_token{pos = {_, TkCol}}) -> ICol < TkCol end, Tl).
|
% tw(fun(#sfc_token{pos = {_, TkCol}}) -> ICol < TkCol end, Tl).
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
%-spec start_pos([gsc_token()]) -> {value, tk_pos()} | none.
|
%-spec start_pos([sfc_token()]) -> {value, tk_pos()} | none.
|
||||||
%
|
%
|
||||||
%start_pos([#gsc_token{pos = P}]) -> {value, P};
|
%start_pos([#sfc_token{pos = P}]) -> {value, P};
|
||||||
%start_pos([]) -> none.
|
%start_pos([]) -> none.
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
%-spec end_pos([gsc_token()]) -> {value, tk_pos()} | none.
|
%-spec end_pos([sfc_token()]) -> {value, tk_pos()} | none.
|
||||||
%
|
%
|
||||||
%end_pos([#gsc_token{pos = Pos, string = Str}]) ->
|
%end_pos([#sfc_token{pos = Pos, string = Str}]) ->
|
||||||
% {value, gsc_tokens:new_pos(Pos, Str)};
|
% {value, sfc_tokens:new_pos(Pos, Str)};
|
||||||
%end_pos([_ | T]) ->
|
%end_pos([_ | T]) ->
|
||||||
% end_pos(T);
|
% end_pos(T);
|
||||||
%end_pos([]) ->
|
%end_pos([]) ->
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
% | [[Token]], % block_as_items
|
% | [[Token]], % block_as_items
|
||||||
% Rest :: [Token],
|
% Rest :: [Token],
|
||||||
% Reason :: choke_reason(),
|
% Reason :: choke_reason(),
|
||||||
% Token :: gsc_token().
|
% Token :: sfc_token().
|
||||||
%
|
%
|
||||||
%% @doc
|
%% @doc
|
||||||
%% slurp/barf terminology comes from paredit mode in
|
%% slurp/barf terminology comes from paredit mode in
|
||||||
@@ -93,23 +93,23 @@
|
|||||||
%
|
%
|
||||||
%barf(_, []) ->
|
%barf(_, []) ->
|
||||||
% {barf, [], []};
|
% {barf, [], []};
|
||||||
%barf(block, [H = #gsc_token{pos = {_, BlkCol}} | T]) ->
|
%barf(block, [H = #sfc_token{pos = {_, BlkCol}} | T]) ->
|
||||||
% Take =
|
% Take =
|
||||||
% fun(#gsc_token{pos = {_, TkCol}}) ->
|
% fun(#sfc_token{pos = {_, TkCol}}) ->
|
||||||
% BlkCol =< TkCol
|
% BlkCol =< TkCol
|
||||||
% end,
|
% end,
|
||||||
% {A, B} = tw(Take, T),
|
% {A, B} = tw(Take, T),
|
||||||
% {barf, [H | A], B};
|
% {barf, [H | A], B};
|
||||||
%barf(block_item, [H = #gsc_token{pos = {_, BlkCol}} | T]) ->
|
%barf(block_item, [H = #sfc_token{pos = {_, BlkCol}} | T]) ->
|
||||||
% Take =
|
% Take =
|
||||||
% fun(#gsc_token{pos = {_, TkCol}}) ->
|
% fun(#sfc_token{pos = {_, TkCol}}) ->
|
||||||
% BlkCol < TkCol
|
% BlkCol < TkCol
|
||||||
% end,
|
% end,
|
||||||
% {A, B} = tw(Take, T),
|
% {A, B} = tw(Take, T),
|
||||||
% {barf, [H | A], B};
|
% {barf, [H | A], B};
|
||||||
%% not needed for our case, future-proofing. see unsafe_block_to_items
|
%% not needed for our case, future-proofing. see unsafe_block_to_items
|
||||||
%% for details
|
%% for details
|
||||||
%barf({block_item, Level}, Tokens = [#gsc_token{pos = {_, StartLevel}} | _]) ->
|
%barf({block_item, Level}, Tokens = [#sfc_token{pos = {_, StartLevel}} | _]) ->
|
||||||
% case Level =:= StartLevel of
|
% case Level =:= StartLevel of
|
||||||
% false -> {barf, [], Tokens};
|
% false -> {barf, [], Tokens};
|
||||||
% true -> barf(block_item, Tokens)
|
% true -> barf(block_item, Tokens)
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
% {barf, BlockTokens, Rest} = barf(block, Tokens),
|
% {barf, BlockTokens, Rest} = barf(block, Tokens),
|
||||||
% {barf, unsafe_block_to_items(BlockTokens), Rest};
|
% {barf, unsafe_block_to_items(BlockTokens), Rest};
|
||||||
%barf(_, _) ->
|
%barf(_, _) ->
|
||||||
% {choke, #gsc_err_nyi{}}.
|
% {choke, #sfc_err_nyi{}}.
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
@@ -132,7 +132,7 @@
|
|||||||
%
|
%
|
||||||
%
|
%
|
||||||
%-spec unsafe_block_to_items([Token]) -> [[Token]]
|
%-spec unsafe_block_to_items([Token]) -> [[Token]]
|
||||||
% when Token :: gsc_token().
|
% when Token :: sfc_token().
|
||||||
%
|
%
|
||||||
%% @doc
|
%% @doc
|
||||||
%% PITFALL: this ASSUMES that the given list of tokens has the
|
%% PITFALL: this ASSUMES that the given list of tokens has the
|
||||||
|
|||||||
@@ -42,13 +42,13 @@
|
|||||||
% qid : Foo.Bar.baz
|
% qid : Foo.Bar.baz
|
||||||
% tvar : 'a
|
% tvar : 'a
|
||||||
-record(ast_te_name,
|
-record(ast_te_name,
|
||||||
{name = none :: none | gsc_token()}).
|
{name = none :: none | sfc_token()}).
|
||||||
|
|
||||||
|
|
||||||
% @doc
|
% @doc
|
||||||
% placeholder
|
% placeholder
|
||||||
-record(ast_te_nyi,
|
-record(ast_te_nyi,
|
||||||
{tokens = none :: none | [gsc_token()]}).
|
{tokens = none :: none | [sfc_token()]}).
|
||||||
-type ast_te_nyi() :: #ast_nyi{}.
|
-type ast_te_nyi() :: #ast_nyi{}.
|
||||||
|
|
||||||
|
|
||||||
@@ -64,14 +64,14 @@
|
|||||||
-record(ifx_stem_op,
|
-record(ifx_stem_op,
|
||||||
{left = none :: none | [ifx_tree_()],
|
{left = none :: none | [ifx_tree_()],
|
||||||
op = none :: none | infix_op(),
|
op = none :: none | infix_op(),
|
||||||
op_token = none :: none | {value, gsc_token()},
|
op_token = none :: none | {value, sfc_token()},
|
||||||
right = none :: none | [ifx_tree_()]}).
|
right = none :: none | [ifx_tree_()]}).
|
||||||
|
|
||||||
-record(ifx_stem_plist,
|
-record(ifx_stem_plist,
|
||||||
{items :: [any()]}).
|
{items :: [any()]}).
|
||||||
|
|
||||||
-record(ifx_leaf_idtk,
|
-record(ifx_leaf_idtk,
|
||||||
{token :: gsc_token()}).
|
{token :: sfc_token()}).
|
||||||
|
|
||||||
-type ifx_tree()
|
-type ifx_tree()
|
||||||
:: #ifx_stem_op{}
|
:: #ifx_stem_op{}
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
|
|
||||||
-spec slurp_ifx_tree(Tokens) -> SlurpedIfxTree when
|
-spec slurp_ifx_tree(Tokens) -> SlurpedIfxTree when
|
||||||
Tokens :: [gsc_token()],
|
Tokens :: [sfc_token()],
|
||||||
SlurpedIfxNode :: slurped(ifx_tree()).
|
SlurpedIfxNode :: slurped(ifx_tree()).
|
||||||
|
|
||||||
slurp_ifx_tree(Tokens) ->
|
slurp_ifx_tree(Tokens) ->
|
||||||
|
|||||||
+11
-11
@@ -1,17 +1,17 @@
|
|||||||
-spec mktree(Signal) -> Tree when
|
-spec mktree(Signal) -> Tree when
|
||||||
Signal :: gsc:signal(),
|
Signal :: sfc:signal(),
|
||||||
Tree :: gsc_ntree:ntree().
|
Tree :: sfc_ntree:ntree().
|
||||||
|
|
||||||
% @doc make into a tree
|
% @doc make into a tree
|
||||||
mktree(Sig) ->
|
mktree(Sig) ->
|
||||||
Tree0 = gsc_ntree:nstem(vtokens, Sig),
|
Tree0 = sfc_ntree:nstem(vtokens, Sig),
|
||||||
Tree1 = rerootl_tkstr("=>", Tree0),
|
Tree1 = rerootl_tkstr("=>", Tree0),
|
||||||
Tree2 = rerootl_tkstr("*", Tree1),
|
Tree2 = rerootl_tkstr("*", Tree1),
|
||||||
Tree2.
|
Tree2.
|
||||||
|
|
||||||
|
|
||||||
rerootl_tkstr(S, Tree0 = #ns{val = Root0}) ->
|
rerootl_tkstr(S, Tree0 = #ns{val = Root0}) ->
|
||||||
Kids0 = gsc_ntree:deleaf0(Tree0),
|
Kids0 = sfc_ntree:deleaf0(Tree0),
|
||||||
IsntS = fun(Tk) -> isnt_str(S, Tk) end,
|
IsntS = fun(Tk) -> isnt_str(S, Tk) end,
|
||||||
case lists:splitwith(IsntS, Kids0) of
|
case lists:splitwith(IsntS, Kids0) of
|
||||||
% found
|
% found
|
||||||
@@ -28,11 +28,11 @@ rerootl_tkstr(S, Tree0 = #ns{val = Root0}) ->
|
|||||||
% +-- *s Root0 -- .l Bar
|
% +-- *s Root0 -- .l Bar
|
||||||
{LHS1, [Tk0 | RHS1]} ->
|
{LHS1, [Tk0 | RHS1]} ->
|
||||||
Root1 = Root0,
|
Root1 = Root0,
|
||||||
LTree1 = gsc_ntree:releaf0(Root1, LHS1),
|
LTree1 = sfc_ntree:releaf0(Root1, LHS1),
|
||||||
RTree1 = rerootl_tkstr(S, gsc_ntree:releaf0(Root1, RHS1)),
|
RTree1 = rerootl_tkstr(S, sfc_ntree:releaf0(Root1, RHS1)),
|
||||||
NewRoot0 = {op, Tk0},
|
NewRoot0 = {op, Tk0},
|
||||||
NewKids0 = [LTree1, RTree1],
|
NewKids0 = [LTree1, RTree1],
|
||||||
NewTree = gsc_ntree:releaf0(NewRoot0, NewKids0),
|
NewTree = sfc_ntree:releaf0(NewRoot0, NewKids0),
|
||||||
NewTree;
|
NewTree;
|
||||||
% not found, nothing to do
|
% not found, nothing to do
|
||||||
{Kids0, []} ->
|
{Kids0, []} ->
|
||||||
@@ -41,17 +41,17 @@ rerootl_tkstr(S, Tree0 = #ns{val = Root0}) ->
|
|||||||
|
|
||||||
|
|
||||||
%reroot_mapsto(Tree0 = #ns{val = Root0}) ->
|
%reroot_mapsto(Tree0 = #ns{val = Root0}) ->
|
||||||
% Kids0 = gsc_ntree:deleaf0(Tree0),
|
% Kids0 = sfc_ntree:deleaf0(Tree0),
|
||||||
% IsntMapsto = fun(DL) -> isnt_str("=>", Tk) end,
|
% IsntMapsto = fun(DL) -> isnt_str("=>", Tk) end,
|
||||||
% case lists:splitwith(IsntMapsto, Kids0) of
|
% case lists:splitwith(IsntMapsto, Kids0) of
|
||||||
% % found
|
% % found
|
||||||
% {LHS1, [Tk0 | RHS1]} ->
|
% {LHS1, [Tk0 | RHS1]} ->
|
||||||
% Root1 = Root0,
|
% Root1 = Root0,
|
||||||
% LTree1 = gsc_ntree:releaf0(Root1, LHS1),
|
% LTree1 = sfc_ntree:releaf0(Root1, LHS1),
|
||||||
% RTree1 = reroot_mapsto(gsc_ntree:releaf0(Root1, RHS1)),
|
% RTree1 = reroot_mapsto(sfc_ntree:releaf0(Root1, RHS1)),
|
||||||
% NewRoot0 = {op, Tk0},
|
% NewRoot0 = {op, Tk0},
|
||||||
% NewKids0 = [LTree1, RTree1],
|
% NewKids0 = [LTree1, RTree1],
|
||||||
% NewTree = gsc_ntree:releaf0(NewRoot0, NewKids0),
|
% NewTree = sfc_ntree:releaf0(NewRoot0, NewKids0),
|
||||||
% NewTree;
|
% NewTree;
|
||||||
% % nothing to do
|
% % nothing to do
|
||||||
% {Kids0, []} ->
|
% {Kids0, []} ->
|
||||||
|
|||||||
+13
-13
@@ -7,7 +7,7 @@
|
|||||||
% 0.1 is to match behavior exactly
|
% 0.1 is to match behavior exactly
|
||||||
% @end
|
% @end
|
||||||
|
|
||||||
-module(gsc).
|
-module(sfc).
|
||||||
|
|
||||||
% token and tokens
|
% token and tokens
|
||||||
-export_type([
|
-export_type([
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
very_stable_file/1
|
very_stable_file/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
|
|
||||||
%-----------------------------------------
|
%-----------------------------------------
|
||||||
% types
|
% types
|
||||||
@@ -85,20 +85,20 @@ unsafe_signal_from_string(S) ->
|
|||||||
|
|
||||||
|
|
||||||
%
|
%
|
||||||
filter_signal(X) -> gsc_tokens:filter_significant(X).
|
filter_signal(X) -> sfc_tokens:filter_significant(X).
|
||||||
signal_from_file(X) -> sigtokens_from_file(X).
|
signal_from_file(X) -> sigtokens_from_file(X).
|
||||||
signal_from_string(X) -> sigtokens_from_string(X).
|
signal_from_string(X) -> sigtokens_from_string(X).
|
||||||
|
|
||||||
% @doc legacy name for signal
|
% @doc legacy name for signal
|
||||||
sigtokens_from_file(X) ->
|
sigtokens_from_file(X) ->
|
||||||
case tokens_from_file(X) of
|
case tokens_from_file(X) of
|
||||||
{ok, Y} -> {ok, gsc_tokens:filter_significant(Y)};
|
{ok, Y} -> {ok, sfc_tokens:filter_significant(Y)};
|
||||||
Err -> Err
|
Err -> Err
|
||||||
end.
|
end.
|
||||||
|
|
||||||
sigtokens_from_string(X) ->
|
sigtokens_from_string(X) ->
|
||||||
case tokens_from_string(X) of
|
case tokens_from_string(X) of
|
||||||
{ok, Y} -> {ok, gsc_tokens:filter_significant(Y)};
|
{ok, Y} -> {ok, sfc_tokens:filter_significant(Y)};
|
||||||
Err -> Err
|
Err -> Err
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ sigtokens_from_string(X) ->
|
|||||||
-spec tokens_from_file(FilePath) -> Perhaps
|
-spec tokens_from_file(FilePath) -> Perhaps
|
||||||
when FilePath :: string(),
|
when FilePath :: string(),
|
||||||
Perhaps :: {ok, Tokens}
|
Perhaps :: {ok, Tokens}
|
||||||
| {error, gsc_err() | any()},
|
| {error, sfc_err() | any()},
|
||||||
Tokens :: [tk()].
|
Tokens :: [tk()].
|
||||||
|
|
||||||
tokens_from_file(FilePath) ->
|
tokens_from_file(FilePath) ->
|
||||||
@@ -120,11 +120,11 @@ tokens_from_file(FilePath) ->
|
|||||||
-spec tokens_from_string(SrcStr) -> Result
|
-spec tokens_from_string(SrcStr) -> Result
|
||||||
when SrcStr :: string(),
|
when SrcStr :: string(),
|
||||||
Result :: {ok, Tokens}
|
Result :: {ok, Tokens}
|
||||||
| {error, gsc_err()},
|
| {error, sfc_err()},
|
||||||
Tokens :: [tk()].
|
Tokens :: [tk()].
|
||||||
|
|
||||||
tokens_from_string(SrcStr) ->
|
tokens_from_string(SrcStr) ->
|
||||||
gsc_tokens:tokens(SrcStr).
|
sfc_tokens:tokens(SrcStr).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ tokens_from_string(SrcStr) ->
|
|||||||
FilePath :: string(),
|
FilePath :: string(),
|
||||||
Result :: {ok, GsoTks} | {error, Reason},
|
Result :: {ok, GsoTks} | {error, Reason},
|
||||||
GsoTks :: [gso_scan:so_token()],
|
GsoTks :: [gso_scan:so_token()],
|
||||||
Reason :: gsc_err() | any().
|
Reason :: sfc_err() | any().
|
||||||
|
|
||||||
gso_tokens_from_file(FilePath) ->
|
gso_tokens_from_file(FilePath) ->
|
||||||
case file:read_file(FilePath) of
|
case file:read_file(FilePath) of
|
||||||
@@ -146,10 +146,10 @@ gso_tokens_from_file(FilePath) ->
|
|||||||
Str :: iolist(),
|
Str :: iolist(),
|
||||||
Result :: {ok, GsoTks} | {error, Reason},
|
Result :: {ok, GsoTks} | {error, Reason},
|
||||||
GsoTks :: [gso_scan:so_token()],
|
GsoTks :: [gso_scan:so_token()],
|
||||||
Reason :: gsc_err() | any().
|
Reason :: sfc_err() | any().
|
||||||
|
|
||||||
gso_tokens_from_string(Evil) ->
|
gso_tokens_from_string(Evil) ->
|
||||||
Str = gsc_tokens:very_stable_codepoints(Evil),
|
Str = sfc_tokens:very_stable_codepoints(Evil),
|
||||||
gso_scan:scan(Str).
|
gso_scan:scan(Str).
|
||||||
|
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ gso_tokens_from_string(Evil) ->
|
|||||||
|
|
||||||
%% @doc normalize string to utf8 NFC list form
|
%% @doc normalize string to utf8 NFC list form
|
||||||
very_stable_codepoints(X) ->
|
very_stable_codepoints(X) ->
|
||||||
gsc_tokens:very_stable_codepoints(X).
|
sfc_tokens:very_stable_codepoints(X).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ very_stable_codepoints(X) ->
|
|||||||
|
|
||||||
%% @doc alias for `very_stable_codepoints/1'
|
%% @doc alias for `very_stable_codepoints/1'
|
||||||
very_stable_string(X) ->
|
very_stable_string(X) ->
|
||||||
gsc_tokens:very_stable_codepoints(X).
|
sfc_tokens:very_stable_codepoints(X).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
%%% @doc
|
%%% @doc
|
||||||
%%% GSC CLI: explorer/harness for gsc iteration
|
%%% SFC CLI: explorer/harness for sfc iteration
|
||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gsc_cli).
|
-module(sfc_cli).
|
||||||
-vsn("0.1.0").
|
-vsn("0.1.0").
|
||||||
-author("Peter Harpending <peterharpending@qpq.swiss>").
|
-author("Peter Harpending <peterharpending@qpq.swiss>").
|
||||||
-copyright("Peter Harpending <peterharpending@qpq.swiss>").
|
-copyright("Peter Harpending <peterharpending@qpq.swiss>").
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
-export([start/1]).
|
-export([start/1]).
|
||||||
-export([do_help/0]).
|
-export([do_help/0]).
|
||||||
|
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
-include("ansi.hrl").
|
-include("ansi.hrl").
|
||||||
|
|
||||||
do_help() ->
|
do_help() ->
|
||||||
@@ -23,14 +23,14 @@ do_help() ->
|
|||||||
|
|
||||||
help_screen() ->
|
help_screen() ->
|
||||||
"""
|
"""
|
||||||
Usage: gsc <command> [args]
|
Usage: sfc <command> [args]
|
||||||
COMMANDS
|
COMMANDS
|
||||||
(no args)
|
(no args)
|
||||||
shell
|
shell
|
||||||
eshell
|
eshell
|
||||||
Start an Erlang shell with GSC loaded.
|
Start an Erlang shell with SFC loaded.
|
||||||
tokens <file>
|
tokens <file>
|
||||||
Print GSC tokens from <file>, one per line.
|
Print SFC tokens from <file>, one per line.
|
||||||
tokens -c <file>
|
tokens -c <file>
|
||||||
tokens --color <file>
|
tokens --color <file>
|
||||||
tcat <file>
|
tcat <file>
|
||||||
@@ -43,30 +43,30 @@ help_screen() ->
|
|||||||
Print sophia-compatible (so_scan) tokens from <file>,
|
Print sophia-compatible (so_scan) tokens from <file>,
|
||||||
one per line.
|
one per line.
|
||||||
rmm <file>
|
rmm <file>
|
||||||
Compile <file> and call its main/0 with GSC context loaded.
|
Compile <file> and call its main/0 with SFC context loaded.
|
||||||
Useful for running scratch scripts.
|
Useful for running scratch scripts.
|
||||||
|
|
||||||
TEST HARNESS (gsc test ...)
|
TEST HARNESS (sfc test ...)
|
||||||
gsc test -l
|
sfc test -l
|
||||||
gsc test --list
|
sfc test --list
|
||||||
List available named tests.
|
List available named tests.
|
||||||
gsc test -a
|
sfc test -a
|
||||||
gsc test --all
|
sfc test --all
|
||||||
Run all named tests.
|
Run all named tests.
|
||||||
gsc test so tokens <file>
|
sfc test so tokens <file>
|
||||||
gsc test so_tokens <file>
|
sfc test so_tokens <file>
|
||||||
Print sophia-original (so_scan) tokens from <file>,
|
Print sophia-original (so_scan) tokens from <file>,
|
||||||
one per line.
|
one per line.
|
||||||
gsc test tokenizers_agree <file>
|
sfc test tokenizers_agree <file>
|
||||||
Check whether gsc and so_scan produce identical tokens
|
Check whether sfc and so_scan produce identical tokens
|
||||||
for <file>. Prints 'true' or 'false'.
|
for <file>. Prints 'true' or 'false'.
|
||||||
<file> is resolved relative to cwd.
|
<file> is resolved relative to cwd.
|
||||||
Example:
|
Example:
|
||||||
gsc test tokenizers_agree foo.aes
|
sfc test tokenizers_agree foo.aes
|
||||||
gsc test <name>
|
sfc test <name>
|
||||||
Run a named test module. 'gsc test foo' and
|
Run a named test module. 'sfc test foo' and
|
||||||
'gsc test gsc_test_foo' are equivalent.
|
'sfc test sfc_test_foo' are equivalent.
|
||||||
Use 'gsc test --list' to see available names.
|
Use 'sfc test --list' to see available names.
|
||||||
""".
|
""".
|
||||||
|
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ start(ArgV) ->
|
|||||||
do(["test" | Tests]) ->
|
do(["test" | Tests]) ->
|
||||||
do_test(Tests);
|
do_test(Tests);
|
||||||
% slowly phasing out shitty names like lctokens
|
% slowly phasing out shitty names like lctokens
|
||||||
% tokens = native gsc token representation
|
% tokens = native sfc token representation
|
||||||
do(["tokens", Foo]) -> do_tokens(Foo);
|
do(["tokens", Foo]) -> do_tokens(Foo);
|
||||||
% print source file to screen with token boundaries
|
% print source file to screen with token boundaries
|
||||||
% highlighted
|
% highlighted
|
||||||
@@ -119,12 +119,12 @@ do_doi() ->
|
|||||||
|
|
||||||
|
|
||||||
do_test(Args) ->
|
do_test(Args) ->
|
||||||
GscTestsMod = gsc_tests_mod(),
|
SfcTestsMod = sfc_tests_mod(),
|
||||||
GscTestsMod:cli_args(Args).
|
SfcTestsMod:cli_args(Args).
|
||||||
|
|
||||||
|
|
||||||
gsc_tests_mod() ->
|
sfc_tests_mod() ->
|
||||||
FilePath = zx:get_home() ++ "/test/gsc_tests.erl",
|
FilePath = zx:get_home() ++ "/test/sfc_tests.erl",
|
||||||
case compile:file(FilePath) of
|
case compile:file(FilePath) of
|
||||||
{ok, Mod} -> Mod;
|
{ok, Mod} -> Mod;
|
||||||
Error -> error(Error)
|
Error -> error(Error)
|
||||||
@@ -164,7 +164,7 @@ less_file(Less, FilePath) ->
|
|||||||
% @doc start an erlang shell
|
% @doc start an erlang shell
|
||||||
|
|
||||||
do_eshell() ->
|
do_eshell() ->
|
||||||
io:format("Welcome to the GSC shell!~n", []),
|
io:format("Welcome to the SFC shell!~n", []),
|
||||||
case shell:start_interactive() of
|
case shell:start_interactive() of
|
||||||
ok -> ok;
|
ok -> ok;
|
||||||
{error, already_started} -> ok;
|
{error, already_started} -> ok;
|
||||||
@@ -197,12 +197,12 @@ gso_tokens(FilePath) ->
|
|||||||
|
|
||||||
|
|
||||||
tokens(FilePath) ->
|
tokens(FilePath) ->
|
||||||
{ok, Tokens} = gsc:tokens_from_file(FilePath),
|
{ok, Tokens} = sfc:tokens_from_file(FilePath),
|
||||||
Tokens.
|
Tokens.
|
||||||
|
|
||||||
|
|
||||||
do_color_tokens(File) ->
|
do_color_tokens(File) ->
|
||||||
case gsc:tokens_from_file(File) of
|
case sfc:tokens_from_file(File) of
|
||||||
{ok, Tokens} ->
|
{ok, Tokens} ->
|
||||||
ColorizedSrcStr = colorize_tokens(chunk_color_wheel(), Tokens, ""),
|
ColorizedSrcStr = colorize_tokens(chunk_color_wheel(), Tokens, ""),
|
||||||
Full = [?ANSI_INVERT, ColorizedSrcStr, ?ANSI_UNINVERT],
|
Full = [?ANSI_INVERT, ColorizedSrcStr, ?ANSI_UNINVERT],
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
-module(gsc_ntree).
|
-module(sfc_ntree).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
nstem/2, meta/1, kids/1,
|
nstem/2, meta/1, kids/1,
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
]).
|
]).
|
||||||
|
|
||||||
|
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
|
|
||||||
|
|
||||||
%%=====================================================
|
%%=====================================================
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
% signal = non-noisy tokens
|
% signal = non-noisy tokens
|
||||||
-module(gsc_signal).
|
-module(sfc_signal).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
from_tokens/1,
|
from_tokens/1,
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
take_block_item/1
|
take_block_item/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
|
|
||||||
|
|
||||||
-spec from_tokens(Tokens) -> Signal when
|
-spec from_tokens(Tokens) -> Signal when
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
% @doc filter out comments/whitespace
|
% @doc filter out comments/whitespace
|
||||||
|
|
||||||
from_tokens(Tokens) ->
|
from_tokens(Tokens) ->
|
||||||
gsc_tokens:filter_significant(Tokens).
|
sfc_tokens:filter_significant(Tokens).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -65,12 +65,12 @@
|
|||||||
% KW = string:join(Keywords, "|"),
|
% KW = string:join(Keywords, "|"),
|
||||||
%
|
%
|
||||||
% There is a lot going on in that code. This is purely the part that matches
|
% There is a lot going on in that code. This is purely the part that matches
|
||||||
% strings specifically, . The *tokenizer* (gsc_tokenizer) knows the hierarchy
|
% strings specifically, . The *tokenizer* (sfc_tokenizer) knows the hierarchy
|
||||||
% of sophia tokens (e.g. it knows to match keywords before identifiers, so that
|
% of sophia tokens (e.g. it knows to match keywords before identifiers, so that
|
||||||
% `contract` gets tokenized as a keyword and not a variable name), and then
|
% `contract` gets tokenized as a keyword and not a variable name), and then
|
||||||
% calls into this module in order to match the string shape it's looking for.
|
% calls into this module in order to match the string shape it's looking for.
|
||||||
% @end
|
% @end
|
||||||
-module(gsc_strmatch).
|
-module(sfc_strmatch).
|
||||||
|
|
||||||
%-compile([export_all, nowarn_export_all]).
|
%-compile([export_all, nowarn_export_all]).
|
||||||
|
|
||||||
@@ -7,16 +7,16 @@
|
|||||||
% For MVP it mimics the behavior of so_scan exactly, in terms of like what its
|
% For MVP it mimics the behavior of so_scan exactly, in terms of like what its
|
||||||
% definition of a token is and so on.
|
% definition of a token is and so on.
|
||||||
%
|
%
|
||||||
% gsc_so_scan.erl contains a compatibility layer that should agree with so_scan
|
% sfc_so_scan.erl contains a compatibility layer that should agree with so_scan
|
||||||
% exactly. It converts the data types here to the shapes that so_scan outputs.
|
% exactly. It converts the data types here to the shapes that so_scan outputs.
|
||||||
%
|
%
|
||||||
% This is for two reasons:
|
% This is for two reasons:
|
||||||
%
|
%
|
||||||
% 1. in order to enable testing the two modules against each other, and
|
% 1. in order to enable testing the two modules against each other, and
|
||||||
% 2. to future-proof in case we decide to incrementally incorporate the gsc
|
% 2. to future-proof in case we decide to incrementally incorporate the sfc
|
||||||
% code into the legacy sophia compiler
|
% code into the legacy sophia compiler
|
||||||
% @end
|
% @end
|
||||||
-module(gsc_tokens).
|
-module(sfc_tokens).
|
||||||
|
|
||||||
% meta
|
% meta
|
||||||
-export([
|
-export([
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
new_pos/2
|
new_pos/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
|
|
||||||
|
|
||||||
%=======================================================
|
%=======================================================
|
||||||
@@ -316,7 +316,7 @@ indent_level(#tk{pos = {_, IndentLevel}}) ->
|
|||||||
-spec significant_tokens(SrcStr) -> Result
|
-spec significant_tokens(SrcStr) -> Result
|
||||||
when SrcStr :: iolist(),
|
when SrcStr :: iolist(),
|
||||||
Result :: {ok, Tokens}
|
Result :: {ok, Tokens}
|
||||||
| {error, gsc_err()},
|
| {error, sfc_err()},
|
||||||
Tokens :: [tk()].
|
Tokens :: [tk()].
|
||||||
|
|
||||||
significant_tokens(SrcStr) ->
|
significant_tokens(SrcStr) ->
|
||||||
@@ -373,7 +373,7 @@ very_stable_codepoints(S) ->
|
|||||||
-spec tokens_from_iolist(SrcStr) -> Result when
|
-spec tokens_from_iolist(SrcStr) -> Result when
|
||||||
SrcStr :: iolist(),
|
SrcStr :: iolist(),
|
||||||
Result :: {ok, Tokens}
|
Result :: {ok, Tokens}
|
||||||
| {error, gsc_err()},
|
| {error, sfc_err()},
|
||||||
Tokens :: [tk()].
|
Tokens :: [tk()].
|
||||||
|
|
||||||
%% @equiv `tokens/1'
|
%% @equiv `tokens/1'
|
||||||
@@ -383,7 +383,7 @@ tokens_from_iolist(S) -> tokens(S).
|
|||||||
-spec tokens_from_string(SrcStr) -> Result when
|
-spec tokens_from_string(SrcStr) -> Result when
|
||||||
SrcStr :: iolist(),
|
SrcStr :: iolist(),
|
||||||
Result :: {ok, Tokens}
|
Result :: {ok, Tokens}
|
||||||
| {error, gsc_err()},
|
| {error, sfc_err()},
|
||||||
Tokens :: [tk()].
|
Tokens :: [tk()].
|
||||||
|
|
||||||
%% @equiv `tokens/1'
|
%% @equiv `tokens/1'
|
||||||
@@ -395,7 +395,7 @@ tokens_from_string(S) -> tokens(S).
|
|||||||
-spec tokens(SrcStr) -> Result
|
-spec tokens(SrcStr) -> Result
|
||||||
when SrcStr :: iolist(),
|
when SrcStr :: iolist(),
|
||||||
Result :: {ok, Tokens}
|
Result :: {ok, Tokens}
|
||||||
| {error, gsc_err()},
|
| {error, sfc_err()},
|
||||||
Tokens :: [tk()].
|
Tokens :: [tk()].
|
||||||
% @doc
|
% @doc
|
||||||
% Recursively parse all tokens off the front end of the
|
% Recursively parse all tokens off the front end of the
|
||||||
@@ -416,7 +416,7 @@ tokens(Stack, Pos, SrcStr) ->
|
|||||||
tokens([NewToken | Stack], NewPos, NewSrcStr);
|
tokens([NewToken | Stack], NewPos, NewSrcStr);
|
||||||
no_tokmatch ->
|
no_tokmatch ->
|
||||||
PrevTokens = lists:reverse(Stack),
|
PrevTokens = lists:reverse(Stack),
|
||||||
Err = #gsc_err_no_tokmatch{prev_tokens = PrevTokens,
|
Err = #sfc_err_no_tokmatch{prev_tokens = PrevTokens,
|
||||||
break_pos = Pos,
|
break_pos = Pos,
|
||||||
rest = SrcStr},
|
rest = SrcStr},
|
||||||
{error, Err};
|
{error, Err};
|
||||||
@@ -428,7 +428,7 @@ tokens(Stack, Pos, SrcStr) ->
|
|||||||
% for now we're just going to agree with so_scan
|
% for now we're just going to agree with so_scan
|
||||||
{ierr, unterminated_block_comment} ->
|
{ierr, unterminated_block_comment} ->
|
||||||
PrevTokens = lists:reverse(Stack),
|
PrevTokens = lists:reverse(Stack),
|
||||||
Err = #gsc_err_bcom_unterminated{prev_tokens = PrevTokens,
|
Err = #sfc_err_bcom_unterminated{prev_tokens = PrevTokens,
|
||||||
break_pos = Pos,
|
break_pos = Pos,
|
||||||
rest = SrcStr},
|
rest = SrcStr},
|
||||||
{error, Err};
|
{error, Err};
|
||||||
@@ -520,7 +520,7 @@ next_tabstop8(Col0) when Col0 >= 0 ->
|
|||||||
SrcStr :: string(),
|
SrcStr :: string(),
|
||||||
Result :: {tokmatch, Token, Rest}
|
Result :: {tokmatch, Token, Rest}
|
||||||
| no_tokmatch
|
| no_tokmatch
|
||||||
| {error, gsc_err()}
|
| {error, sfc_err()}
|
||||||
| {ierr, unterminated_block_comment},
|
| {ierr, unterminated_block_comment},
|
||||||
Token :: tk(),
|
Token :: tk(),
|
||||||
Rest :: string().
|
Rest :: string().
|
||||||
@@ -540,7 +540,7 @@ slurp_token(Pos, SrcStr) ->
|
|||||||
SrcStr :: string(),
|
SrcStr :: string(),
|
||||||
Result :: {tokmatch, Token, Rest}
|
Result :: {tokmatch, Token, Rest}
|
||||||
| no_tokmatch
|
| no_tokmatch
|
||||||
| {error, gsc_err()}
|
| {error, sfc_err()}
|
||||||
| {ierr, unterminated_block_comment},
|
| {ierr, unterminated_block_comment},
|
||||||
Token :: tk(),
|
Token :: tk(),
|
||||||
Rest :: string().
|
Rest :: string().
|
||||||
@@ -565,7 +565,7 @@ slurp_token_shapes([], _Pos, _SrcStr) ->
|
|||||||
SrcStr :: string(),
|
SrcStr :: string(),
|
||||||
MaybeToken :: {tokmatch, Token, Rest}
|
MaybeToken :: {tokmatch, Token, Rest}
|
||||||
| no_tokmatch
|
| no_tokmatch
|
||||||
| {error, gsc_err()}
|
| {error, sfc_err()}
|
||||||
| {ierr, unterminated_block_comment},
|
| {ierr, unterminated_block_comment},
|
||||||
Token :: tk(),
|
Token :: tk(),
|
||||||
Rest :: string().
|
Rest :: string().
|
||||||
@@ -608,8 +608,8 @@ slurp_token_of_shape(bcom, Pos, SrcStr0) ->
|
|||||||
no_tokmatch
|
no_tokmatch
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(ws, Pos, SrcStr) ->
|
slurp_token_of_shape(ws, Pos, SrcStr) ->
|
||||||
WhitespaceMatcher = gsc_strmatch:smr_sf_ws(),
|
WhitespaceMatcher = sfc_strmatch:smr_sf_ws(),
|
||||||
case gsc_strmatch:match(WhitespaceMatcher, SrcStr) of
|
case sfc_strmatch:match(WhitespaceMatcher, SrcStr) of
|
||||||
no_strmatch ->
|
no_strmatch ->
|
||||||
no_tokmatch;
|
no_tokmatch;
|
||||||
{strmatch, WS, Rest} ->
|
{strmatch, WS, Rest} ->
|
||||||
@@ -643,7 +643,7 @@ slurp_token_of_shape(kwd, Pos, SrcStr) ->
|
|||||||
no_tokmatch
|
no_tokmatch
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(op, Pos, SrcStr) ->
|
slurp_token_of_shape(op, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_op(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_op(), SrcStr) of
|
||||||
{strmatch, Str, Rest} ->
|
{strmatch, Str, Rest} ->
|
||||||
Token = #tk{shape = op, pos = Pos, str = Str},
|
Token = #tk{shape = op, pos = Pos, str = Str},
|
||||||
{tokmatch, Token, Rest};
|
{tokmatch, Token, Rest};
|
||||||
@@ -651,7 +651,7 @@ slurp_token_of_shape(op, Pos, SrcStr) ->
|
|||||||
no_tokmatch
|
no_tokmatch
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(sep, Pos, SrcStr) ->
|
slurp_token_of_shape(sep, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_sep(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_sep(), SrcStr) of
|
||||||
{strmatch, Str, Rest} ->
|
{strmatch, Str, Rest} ->
|
||||||
Token = #tk{shape = sep, pos = Pos, str = Str},
|
Token = #tk{shape = sep, pos = Pos, str = Str},
|
||||||
{tokmatch, Token, Rest};
|
{tokmatch, Token, Rest};
|
||||||
@@ -660,7 +660,7 @@ slurp_token_of_shape(sep, Pos, SrcStr) ->
|
|||||||
end;
|
end;
|
||||||
% SOPHIA VARIABLE NAMES: id, con, qid, qcon, tvar
|
% SOPHIA VARIABLE NAMES: id, con, qid, qcon, tvar
|
||||||
slurp_token_of_shape(id, Pos, SrcStr) ->
|
slurp_token_of_shape(id, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_id(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_id(), SrcStr) of
|
||||||
{strmatch, IdStr, Rest} ->
|
{strmatch, IdStr, Rest} ->
|
||||||
Token = #tk{shape = id, pos = Pos, str = IdStr},
|
Token = #tk{shape = id, pos = Pos, str = IdStr},
|
||||||
{tokmatch, Token, Rest};
|
{tokmatch, Token, Rest};
|
||||||
@@ -668,7 +668,7 @@ slurp_token_of_shape(id, Pos, SrcStr) ->
|
|||||||
no_tokmatch
|
no_tokmatch
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(con, Pos, SrcStr) ->
|
slurp_token_of_shape(con, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_con(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_con(), SrcStr) of
|
||||||
{strmatch, Str, Rest} ->
|
{strmatch, Str, Rest} ->
|
||||||
Token = #tk{shape = con, pos = Pos, str = Str},
|
Token = #tk{shape = con, pos = Pos, str = Str},
|
||||||
{tokmatch, Token, Rest};
|
{tokmatch, Token, Rest};
|
||||||
@@ -676,7 +676,7 @@ slurp_token_of_shape(con, Pos, SrcStr) ->
|
|||||||
no_tokmatch
|
no_tokmatch
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(qid, Pos, SrcStr) ->
|
slurp_token_of_shape(qid, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_qid(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_qid(), SrcStr) of
|
||||||
{strmatch, Str, Rest} ->
|
{strmatch, Str, Rest} ->
|
||||||
Token = #tk{shape = qid, pos = Pos, str = Str},
|
Token = #tk{shape = qid, pos = Pos, str = Str},
|
||||||
{tokmatch, Token, Rest};
|
{tokmatch, Token, Rest};
|
||||||
@@ -684,7 +684,7 @@ slurp_token_of_shape(qid, Pos, SrcStr) ->
|
|||||||
no_tokmatch
|
no_tokmatch
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(qcon, Pos, SrcStr) ->
|
slurp_token_of_shape(qcon, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_qcon(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_qcon(), SrcStr) of
|
||||||
{strmatch, Str, Rest} ->
|
{strmatch, Str, Rest} ->
|
||||||
Token = #tk{shape = qcon, pos = Pos, str = Str},
|
Token = #tk{shape = qcon, pos = Pos, str = Str},
|
||||||
{tokmatch, Token, Rest};
|
{tokmatch, Token, Rest};
|
||||||
@@ -692,7 +692,7 @@ slurp_token_of_shape(qcon, Pos, SrcStr) ->
|
|||||||
no_tokmatch
|
no_tokmatch
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(tvar, Pos, SrcStr) ->
|
slurp_token_of_shape(tvar, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_tvar(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_tvar(), SrcStr) of
|
||||||
{strmatch, Str, Rest} ->
|
{strmatch, Str, Rest} ->
|
||||||
Token = #tk{shape = tvar, pos = Pos, str = Str},
|
Token = #tk{shape = tvar, pos = Pos, str = Str},
|
||||||
{tokmatch, Token, Rest};
|
{tokmatch, Token, Rest};
|
||||||
@@ -700,7 +700,7 @@ slurp_token_of_shape(tvar, Pos, SrcStr) ->
|
|||||||
no_tokmatch
|
no_tokmatch
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(int16, Pos, SrcStr) ->
|
slurp_token_of_shape(int16, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_int16(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_int16(), SrcStr) of
|
||||||
{strmatch, Str, Rest} ->
|
{strmatch, Str, Rest} ->
|
||||||
Token = #tk{shape = int16, pos = Pos, str = Str},
|
Token = #tk{shape = int16, pos = Pos, str = Str},
|
||||||
{tokmatch, Token, Rest};
|
{tokmatch, Token, Rest};
|
||||||
@@ -708,7 +708,7 @@ slurp_token_of_shape(int16, Pos, SrcStr) ->
|
|||||||
no_tokmatch
|
no_tokmatch
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(int10, Pos, SrcStr) ->
|
slurp_token_of_shape(int10, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_int10(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_int10(), SrcStr) of
|
||||||
{strmatch, Str, Rest} ->
|
{strmatch, Str, Rest} ->
|
||||||
Token = #tk{shape = int10, pos = Pos, str = Str},
|
Token = #tk{shape = int10, pos = Pos, str = Str},
|
||||||
{tokmatch, Token, Rest};
|
{tokmatch, Token, Rest};
|
||||||
@@ -720,8 +720,8 @@ slurp_token_of_shape(int10, Pos, SrcStr) ->
|
|||||||
%
|
%
|
||||||
% char: sophia char literal
|
% char: sophia char literal
|
||||||
slurp_token_of_shape(ak, Pos, SrcStr) ->
|
slurp_token_of_shape(ak, Pos, SrcStr) ->
|
||||||
StringMatcher = gsc_strmatch:smr_sf_ak(),
|
StringMatcher = sfc_strmatch:smr_sf_ak(),
|
||||||
case gsc_strmatch:match(StringMatcher, SrcStr) of
|
case sfc_strmatch:match(StringMatcher, SrcStr) of
|
||||||
no_strmatch ->
|
no_strmatch ->
|
||||||
no_tokmatch;
|
no_tokmatch;
|
||||||
{strmatch, TokenStr, Rest} ->
|
{strmatch, TokenStr, Rest} ->
|
||||||
@@ -729,8 +729,8 @@ slurp_token_of_shape(ak, Pos, SrcStr) ->
|
|||||||
{tokmatch, Token, Rest}
|
{tokmatch, Token, Rest}
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(ct, Pos, SrcStr) ->
|
slurp_token_of_shape(ct, Pos, SrcStr) ->
|
||||||
StringMatcher = gsc_strmatch:smr_sf_ct(),
|
StringMatcher = sfc_strmatch:smr_sf_ct(),
|
||||||
case gsc_strmatch:match(StringMatcher, SrcStr) of
|
case sfc_strmatch:match(StringMatcher, SrcStr) of
|
||||||
no_strmatch ->
|
no_strmatch ->
|
||||||
no_tokmatch;
|
no_tokmatch;
|
||||||
{strmatch, TokenStr, Rest} ->
|
{strmatch, TokenStr, Rest} ->
|
||||||
@@ -738,8 +738,8 @@ slurp_token_of_shape(ct, Pos, SrcStr) ->
|
|||||||
{tokmatch, Token, Rest}
|
{tokmatch, Token, Rest}
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(sg, Pos, SrcStr) ->
|
slurp_token_of_shape(sg, Pos, SrcStr) ->
|
||||||
StringMatcher = gsc_strmatch:smr_sf_sg(),
|
StringMatcher = sfc_strmatch:smr_sf_sg(),
|
||||||
case gsc_strmatch:match(StringMatcher, SrcStr) of
|
case sfc_strmatch:match(StringMatcher, SrcStr) of
|
||||||
no_strmatch ->
|
no_strmatch ->
|
||||||
no_tokmatch;
|
no_tokmatch;
|
||||||
{strmatch, TokenStr, Rest} ->
|
{strmatch, TokenStr, Rest} ->
|
||||||
@@ -747,8 +747,8 @@ slurp_token_of_shape(sg, Pos, SrcStr) ->
|
|||||||
{tokmatch, Token, Rest}
|
{tokmatch, Token, Rest}
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(char, Pos, SrcStr) ->
|
slurp_token_of_shape(char, Pos, SrcStr) ->
|
||||||
StringMatcher = gsc_strmatch:smr_sf_char(),
|
StringMatcher = sfc_strmatch:smr_sf_char(),
|
||||||
case gsc_strmatch:match(StringMatcher, SrcStr) of
|
case sfc_strmatch:match(StringMatcher, SrcStr) of
|
||||||
no_strmatch ->
|
no_strmatch ->
|
||||||
no_tokmatch;
|
no_tokmatch;
|
||||||
{strmatch, TokenStr, Rest} ->
|
{strmatch, TokenStr, Rest} ->
|
||||||
@@ -756,7 +756,7 @@ slurp_token_of_shape(char, Pos, SrcStr) ->
|
|||||||
{tokmatch, Token, Rest}
|
{tokmatch, Token, Rest}
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(string, Pos, SrcStr) ->
|
slurp_token_of_shape(string, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_str(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_str(), SrcStr) of
|
||||||
no_strmatch ->
|
no_strmatch ->
|
||||||
no_tokmatch;
|
no_tokmatch;
|
||||||
{strmatch, TokenStr, Rest} ->
|
{strmatch, TokenStr, Rest} ->
|
||||||
@@ -764,7 +764,7 @@ slurp_token_of_shape(string, Pos, SrcStr) ->
|
|||||||
{tokmatch, Token, Rest}
|
{tokmatch, Token, Rest}
|
||||||
end;
|
end;
|
||||||
slurp_token_of_shape(bytes, Pos, SrcStr) ->
|
slurp_token_of_shape(bytes, Pos, SrcStr) ->
|
||||||
case gsc_strmatch:match(gsc_strmatch:smr_sf_bytes(), SrcStr) of
|
case sfc_strmatch:match(sfc_strmatch:smr_sf_bytes(), SrcStr) of
|
||||||
no_strmatch ->
|
no_strmatch ->
|
||||||
no_tokmatch;
|
no_tokmatch;
|
||||||
{strmatch, TokenStr, Rest} ->
|
{strmatch, TokenStr, Rest} ->
|
||||||
@@ -773,7 +773,7 @@ slurp_token_of_shape(bytes, Pos, SrcStr) ->
|
|||||||
end;
|
end;
|
||||||
slurp_token_of_shape(NyiType, Pos, SrcStr) ->
|
slurp_token_of_shape(NyiType, Pos, SrcStr) ->
|
||||||
Message = io_lib:format("cannot slurp token of shape: ~p", [NyiType]),
|
Message = io_lib:format("cannot slurp token of shape: ~p", [NyiType]),
|
||||||
error(#gsc_err{atom = nyi,
|
error(#sfc_err{atom = nyi,
|
||||||
str = Message,
|
str = Message,
|
||||||
extra = [{token_shape, NyiType},
|
extra = [{token_shape, NyiType},
|
||||||
{pos, Pos},
|
{pos, Pos},
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
% @doc compatibility layer to test against so_scan
|
% @doc compatibility layer to test against so_scan
|
||||||
%
|
%
|
||||||
% converts gsc_tokens data to so_scan tokens
|
% converts sfc_tokens data to so_scan tokens
|
||||||
%
|
%
|
||||||
% Ref: so_scan.erl
|
% Ref: so_scan.erl
|
||||||
-module(gso_scan).
|
-module(gso_scan).
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
ken_barson_rises/2
|
ken_barson_rises/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
|
|
||||||
%================================
|
%================================
|
||||||
% API: types
|
% API: types
|
||||||
@@ -93,36 +93,36 @@
|
|||||||
% API: functions
|
% API: functions
|
||||||
%================================
|
%================================
|
||||||
|
|
||||||
-spec scan(SrcStr) -> {ok, SoTokens} | {error, gsc_err()}
|
-spec scan(SrcStr) -> {ok, SoTokens} | {error, sfc_err()}
|
||||||
when SrcStr :: iolist(),
|
when SrcStr :: iolist(),
|
||||||
SoTokens :: [so_token()].
|
SoTokens :: [so_token()].
|
||||||
% @doc
|
% @doc
|
||||||
% this is meant to agree with so_scan:scan/1 in all cases
|
% this is meant to agree with so_scan:scan/1 in all cases
|
||||||
%
|
%
|
||||||
% this converts gsc's internal representation of tokens into the format that
|
% this converts sfc's internal representation of tokens into the format that
|
||||||
% so_scan outputs
|
% so_scan outputs
|
||||||
% @end
|
% @end
|
||||||
|
|
||||||
scan(SrcStr) ->
|
scan(SrcStr) ->
|
||||||
case gsc_tokens:tokens(SrcStr) of
|
case sfc_tokens:tokens(SrcStr) of
|
||||||
{ok, SfLTokens} ->
|
{ok, SfLTokens} ->
|
||||||
SoTokens = to_so_tokens(SfLTokens),
|
SoTokens = to_so_tokens(SfLTokens),
|
||||||
{ok, SoTokens};
|
{ok, SoTokens};
|
||||||
% fucking stupid
|
% fucking stupid
|
||||||
{error, #gsc_err_bcom_unterminated{prev_tokens = GscTokens}} ->
|
{error, #sfc_err_bcom_unterminated{prev_tokens = SfcTokens}} ->
|
||||||
{ok, to_so_tokens(GscTokens)};
|
{ok, to_so_tokens(SfcTokens)};
|
||||||
Error ->
|
Error ->
|
||||||
Error
|
Error
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-spec to_so_tokens(GscTokens) -> SoTokens
|
-spec to_so_tokens(SfcTokens) -> SoTokens
|
||||||
when GscTokens :: [tk()],
|
when SfcTokens :: [tk()],
|
||||||
SoTokens :: [so_token()].
|
SoTokens :: [so_token()].
|
||||||
|
|
||||||
% @doc
|
% @doc
|
||||||
% most gsc tokens map 1-to-1 with so_tokens. the
|
% most sfc tokens map 1-to-1 with so_tokens. the
|
||||||
% exception is ak/ct/sg literals. this is a
|
% exception is ak/ct/sg literals. this is a
|
||||||
% many-to-one-mapping, and therefore ak, sg, ct need to
|
% many-to-one-mapping, and therefore ak, sg, ct need to
|
||||||
% be handled at the list level.
|
% be handled at the list level.
|
||||||
@@ -133,7 +133,7 @@ scan(SrcStr) ->
|
|||||||
% stage computes the pubkey that corresponds to.
|
% stage computes the pubkey that corresponds to.
|
||||||
%
|
%
|
||||||
% as a result, if we have ak_GHI, I is not a valid
|
% as a result, if we have ak_GHI, I is not a valid
|
||||||
% base58 char, so WE (gsc) end up lexing that as
|
% base58 char, so WE (sfc) end up lexing that as
|
||||||
%
|
%
|
||||||
% [{ak, "ak_GH"}, {con, "I"}]
|
% [{ak, "ak_GH"}, {con, "I"}]
|
||||||
%
|
%
|
||||||
@@ -252,8 +252,8 @@ to_so_tokens([]) ->
|
|||||||
%
|
%
|
||||||
% When any of these appear AFTER at least one valid
|
% When any of these appear AFTER at least one valid
|
||||||
% base58 char in a `ak_`/`ct_`/`sg_` prefixed
|
% base58 char in a `ak_`/`ct_`/`sg_` prefixed
|
||||||
% identifier, `gsc` splits what `so_scan` sees as one
|
% identifier, `sfc` splits what `so_scan` sees as one
|
||||||
% `id` token into 2+ gsc tokens.
|
% `id` token into 2+ sfc tokens.
|
||||||
%
|
%
|
||||||
% **No split if non-base58 char is immediately after
|
% **No split if non-base58 char is immediately after
|
||||||
% `_`**: `smr_plus` requires >=1 base58 char to
|
% `_`**: `smr_plus` requires >=1 base58 char to
|
||||||
@@ -309,8 +309,8 @@ pass_types() ->
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-spec to_so_token(GscToken) -> MaybeSoToken
|
-spec to_so_token(SfcToken) -> MaybeSoToken
|
||||||
when GscToken :: tk(),
|
when SfcToken :: tk(),
|
||||||
MaybeSoToken :: {true, SoToken}
|
MaybeSoToken :: {true, SoToken}
|
||||||
| false,
|
| false,
|
||||||
SoToken :: so_token().
|
SoToken :: so_token().
|
||||||
@@ -369,8 +369,8 @@ to_so_token(#tk{shape = SfTokenType,
|
|||||||
int10 -> {true, {int, Pos, so_parse_int(SfTokenStr)}};
|
int10 -> {true, {int, Pos, so_parse_int(SfTokenStr)}};
|
||||||
bytes -> {true, {bytes, Pos, so_parse_bytes(SfTokenStr)}};
|
bytes -> {true, {bytes, Pos, so_parse_bytes(SfTokenStr)}};
|
||||||
NYI ->
|
NYI ->
|
||||||
Msg = io_lib:format("gsc_so_scan:to_so_token/1: unhandled token shape: ~p", [NYI]),
|
Msg = io_lib:format("sfc_so_scan:to_so_token/1: unhandled token shape: ~p", [NYI]),
|
||||||
error(#gsc_err{atom = nyi,
|
error(#sfc_err{atom = nyi,
|
||||||
str = Msg})
|
str = Msg})
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ so_parse_char([$' | Chars]) ->
|
|||||||
case unicode:characters_to_nfc_list(unescape($', Chars, [])) of
|
case unicode:characters_to_nfc_list(unescape($', Chars, [])) of
|
||||||
[Char] -> Char;
|
[Char] -> Char;
|
||||||
_Bad ->
|
_Bad ->
|
||||||
error(#gsc_err{atom = bad_token,
|
error(#sfc_err{atom = bad_token,
|
||||||
str = "Bad character literal: '" ++ Chars})
|
str = "Bad character literal: '" ++ Chars})
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ unescape(Delim, [$\\, Code | Chars], Acc) ->
|
|||||||
$r -> Ok($\r);
|
$r -> Ok($\r);
|
||||||
$t -> Ok($\t);
|
$t -> Ok($\t);
|
||||||
$v -> Ok($\v);
|
$v -> Ok($\v);
|
||||||
_ -> error(#gsc_err{atom = bad_escape_char,
|
_ -> error(#sfc_err{atom = bad_escape_char,
|
||||||
str = "Bad control sequence: \\" ++ [Code]}) %% TODO
|
str = "Bad control sequence: \\" ++ [Code]}) %% TODO
|
||||||
end;
|
end;
|
||||||
unescape(Delim, [C | Chars], Acc) ->
|
unescape(Delim, [C | Chars], Acc) ->
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
% @doc experiment centering around the file syntax node using ntree approach
|
% @doc experiment centering around the file syntax node using ntree approach
|
||||||
-module(gsc_test_file).
|
-module(sfc_test_file).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
main/0
|
main/0
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
|
|
||||||
|
|
||||||
-record(ct,
|
-record(ct,
|
||||||
@@ -64,7 +64,7 @@ main() ->
|
|||||||
HelloN = "hello.aes",
|
HelloN = "hello.aes",
|
||||||
HelloP = ts_utils:ct_file_abspath(HelloN),
|
HelloP = ts_utils:ct_file_abspath(HelloN),
|
||||||
{ok, HelloS} = file:read_file(HelloP),
|
{ok, HelloS} = file:read_file(HelloP),
|
||||||
S0 = gsc:unsafe_signal_from_file(HelloP),
|
S0 = sfc:unsafe_signal_from_file(HelloP),
|
||||||
T1 = s2t(file, S0),
|
T1 = s2t(file, S0),
|
||||||
io:format("hello.aes:~n", []),
|
io:format("hello.aes:~n", []),
|
||||||
io:format("```~n", []),
|
io:format("```~n", []),
|
||||||
@@ -103,7 +103,7 @@ s2t(file, Signal) ->
|
|||||||
% | Using
|
% | Using
|
||||||
s2t(top_decl, Signal) ->
|
s2t(top_decl, Signal) ->
|
||||||
NewTarget =
|
NewTarget =
|
||||||
case gsc_tokens:strings(3, Signal) of
|
case sfc_tokens:strings(3, Signal) of
|
||||||
["payable", "contract", "interface"] -> iface;
|
["payable", "contract", "interface"] -> iface;
|
||||||
["contract", "interface" | _] -> iface;
|
["contract", "interface" | _] -> iface;
|
||||||
["payable", "main", "contract"] -> ct;
|
["payable", "main", "contract"] -> ct;
|
||||||
@@ -127,7 +127,7 @@ s2t(ct, S0) ->
|
|||||||
% | Using
|
% | Using
|
||||||
s2t(decl, S0) ->
|
s2t(decl, S0) ->
|
||||||
NewTarget =
|
NewTarget =
|
||||||
case gsc_tokens:strings(3, S0) of
|
case sfc_tokens:strings(3, S0) of
|
||||||
["type" | _] -> decl_type;
|
["type" | _] -> decl_type;
|
||||||
["record" | _] -> decl_record;
|
["record" | _] -> decl_record;
|
||||||
["datatype" | _] -> decl_datatype;
|
["datatype" | _] -> decl_datatype;
|
||||||
@@ -161,7 +161,7 @@ s2t(NYI, Signal) ->
|
|||||||
Forest :: asf().
|
Forest :: asf().
|
||||||
|
|
||||||
s2f({block_of, TreeTarget}, S0) ->
|
s2f({block_of, TreeTarget}, S0) ->
|
||||||
{gulp, Items} = gsc_signal:gulp_block_items(S0),
|
{gulp, Items} = sfc_signal:gulp_block_items(S0),
|
||||||
[s2t(TreeTarget, I) || I <- Items].
|
[s2t(TreeTarget, I) || I <- Items].
|
||||||
|
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ s2s_sm_ct(Ct = #ct{con = none}, S0) ->
|
|||||||
error({no_contract_name, Ct, S0})
|
error({no_contract_name, Ct, S0})
|
||||||
end;
|
end;
|
||||||
s2s_sm_ct(Ct = #ct{impls = none}, S0) ->
|
s2s_sm_ct(Ct = #ct{impls = none}, S0) ->
|
||||||
case gsc_tokens:strings(1, S0) of
|
case sfc_tokens:strings(1, S0) of
|
||||||
[":"] ->
|
[":"] ->
|
||||||
{slurp, Impls, S1} = s2f_slurp_impls(S0),
|
{slurp, Impls, S1} = s2f_slurp_impls(S0),
|
||||||
s2s_sm_ct(Ct#ct{impls = Impls}, S1);
|
s2s_sm_ct(Ct#ct{impls = Impls}, S1);
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
-module(gsc_test_ntree).
|
-module(sfc_test_ntree).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
main/0
|
main/0
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
|
|
||||||
% just parsing type expressions right now, so only need
|
% just parsing type expressions right now, so only need
|
||||||
% to worry about round parens
|
% to worry about round parens
|
||||||
@@ -37,8 +37,8 @@ x00() ->
|
|||||||
|
|
||||||
% sample type expr, tokens, signal
|
% sample type expr, tokens, signal
|
||||||
x00_src() -> "(foo => (bar) * baz)".
|
x00_src() -> "(foo => (bar) * baz)".
|
||||||
x00_tks() -> gsc:unsafe_tokens_from_string(x00_src()).
|
x00_tks() -> sfc:unsafe_tokens_from_string(x00_src()).
|
||||||
x00_sgl() -> gsc:filter_signal(x00_tks()).
|
x00_sgl() -> sfc:filter_signal(x00_tks()).
|
||||||
x00_fst() -> parse(x00_sgl()).
|
x00_fst() -> parse(x00_sgl()).
|
||||||
|
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
% gsc tokenizer tests
|
% sfc tokenizer tests
|
||||||
-module(gsc_test_tokens).
|
-module(sfc_test_tokens).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
main/0, ct_dir/0
|
main/0, ct_dir/0
|
||||||
%tokens_match/1
|
%tokens_match/1
|
||||||
]).
|
]).
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
main() ->
|
main() ->
|
||||||
@@ -24,13 +24,13 @@ agreement_tests_dir() ->
|
|||||||
ct_dir() ++ "/tokenizers_agree".
|
ct_dir() ++ "/tokenizers_agree".
|
||||||
|
|
||||||
|
|
||||||
% the divergences claude found between gsc tokenizer and so tokenizer
|
% the divergences claude found between sfc tokenizer and so tokenizer
|
||||||
%
|
%
|
||||||
% mostly stupid corner cases like a string crossing a line boundary
|
% mostly stupid corner cases like a string crossing a line boundary
|
||||||
% or unterminated block comment
|
% or unterminated block comment
|
||||||
%
|
%
|
||||||
% divergence files: "divergence" means so_scan disagrees with
|
% divergence files: "divergence" means so_scan disagrees with
|
||||||
% gsc_so_scan in one of the following ways:
|
% sfc_so_scan in one of the following ways:
|
||||||
%
|
%
|
||||||
% - one succeeds when the other errors
|
% - one succeeds when the other errors
|
||||||
% - disagree on success case
|
% - disagree on success case
|
||||||
@@ -117,12 +117,12 @@ tokstr_concat_test_() ->
|
|||||||
|
|
||||||
concat_property(FileName, FilePath) ->
|
concat_property(FileName, FilePath) ->
|
||||||
%?debugFmt("concat_property(~p, _)", [FileName]),
|
%?debugFmt("concat_property(~p, _)", [FileName]),
|
||||||
FileChars = gsc:very_stable_file(FilePath),
|
FileChars = sfc:very_stable_file(FilePath),
|
||||||
{FileName ++ ": file = sum(tokens)",
|
{FileName ++ ": file = sum(tokens)",
|
||||||
fun() ->
|
fun() ->
|
||||||
case gsc:tokens_from_file(FileChars) of
|
case sfc:tokens_from_file(FileChars) of
|
||||||
{ok, GscTokens} ->
|
{ok, SfcTokens} ->
|
||||||
ConcatStr = concat_token_strs(GscTokens, []),
|
ConcatStr = concat_token_strs(SfcTokens, []),
|
||||||
?assertEqual(FileChars, ConcatStr);
|
?assertEqual(FileChars, ConcatStr);
|
||||||
_Error ->
|
_Error ->
|
||||||
ok
|
ok
|
||||||
@@ -147,7 +147,7 @@ tokens_match(FileName, FilePath) ->
|
|||||||
% extracting data to be tested
|
% extracting data to be tested
|
||||||
% i hate this so much but lazy and this is test code so who really cares.
|
% i hate this so much but lazy and this is test code so who really cares.
|
||||||
SoTokens = so_tokens_from_file(FilePath),
|
SoTokens = so_tokens_from_file(FilePath),
|
||||||
SfTokens = gsc:gso_tokens_from_file(FilePath),
|
SfTokens = sfc:gso_tokens_from_file(FilePath),
|
||||||
{FileName ++ ": tokenizers_agree",
|
{FileName ++ ": tokenizers_agree",
|
||||||
fun() ->
|
fun() ->
|
||||||
case {SoTokens, SfTokens} of
|
case {SoTokens, SfTokens} of
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
-module(gsc_test_ytree).
|
-module(sfc_test_ytree).
|
||||||
|
|
||||||
-export([main/0]).
|
-export([main/0]).
|
||||||
-include("$gsc_include/gsc.hrl").
|
-include("$sfc_include/sfc.hrl").
|
||||||
|
|
||||||
main() ->
|
main() ->
|
||||||
Src =
|
Src =
|
||||||
@@ -51,7 +51,7 @@ main() ->
|
|||||||
|
|
||||||
|
|
||||||
handle_src_str(SrcStr) ->
|
handle_src_str(SrcStr) ->
|
||||||
Sig = gsc:unsafe_signal_from_string(SrcStr),
|
Sig = sfc:unsafe_signal_from_string(SrcStr),
|
||||||
Result = gulp(file, Sig),
|
Result = gulp(file, Sig),
|
||||||
io:format("~tp~n", [Result]).
|
io:format("~tp~n", [Result]).
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ handle_src_str(SrcStr) ->
|
|||||||
gulp(file, Sig) ->
|
gulp(file, Sig) ->
|
||||||
gulp({block_of, top_decl}, Sig);
|
gulp({block_of, top_decl}, Sig);
|
||||||
gulp({block_of, X}, Sig) ->
|
gulp({block_of, X}, Sig) ->
|
||||||
{gulp, BlockItems} = gsc_signal:gulp_block_items(Sig),
|
{gulp, BlockItems} = sfc_signal:gulp_block_items(Sig),
|
||||||
#ys{target = {block_of, X},
|
#ys{target = {block_of, X},
|
||||||
signal = Sig,
|
signal = Sig,
|
||||||
stem_meta = none,
|
stem_meta = none,
|
||||||
@@ -77,7 +77,7 @@ gulp(top_decl, Sig) ->
|
|||||||
% | 'include' String
|
% | 'include' String
|
||||||
% | Using
|
% | Using
|
||||||
NewTarget =
|
NewTarget =
|
||||||
case gsc_tokens:strings(3, Sig) of
|
case sfc_tokens:strings(3, Sig) of
|
||||||
["namespace", _, _] -> namespace;
|
["namespace", _, _] -> namespace;
|
||||||
["@compiler", _, _] -> '@compiler';
|
["@compiler", _, _] -> '@compiler';
|
||||||
["include", _, _] -> include;
|
["include", _, _] -> include;
|
||||||
@@ -93,7 +93,7 @@ gulp(top_decl, Sig) ->
|
|||||||
gulp(NewTarget, Sig);
|
gulp(NewTarget, Sig);
|
||||||
gulp(contract, Sig) ->
|
gulp(contract, Sig) ->
|
||||||
{slurp, CtMeta, BlockSignal} = slurp(#ct{}, Sig),
|
{slurp, CtMeta, BlockSignal} = slurp(#ct{}, Sig),
|
||||||
{gulp, BlockItems} = gsc_signal:gulp_block_items(BlockSignal),
|
{gulp, BlockItems} = sfc_signal:gulp_block_items(BlockSignal),
|
||||||
Forest = [gulp(decl, Item) || Item <- BlockItems],
|
Forest = [gulp(decl, Item) || Item <- BlockItems],
|
||||||
#ys{target = contract,
|
#ys{target = contract,
|
||||||
signal = Sig,
|
signal = Sig,
|
||||||
@@ -124,7 +124,7 @@ gulp(NyiTarget, Sig) ->
|
|||||||
slurp(Meta = #ct{payable = none, main = none}, Sig) ->
|
slurp(Meta = #ct{payable = none, main = none}, Sig) ->
|
||||||
%% nato phonetic alphabet
|
%% nato phonetic alphabet
|
||||||
{Pa, Mi, No} =
|
{Pa, Mi, No} =
|
||||||
case gsc_tokens:strings(2, Sig) of
|
case sfc_tokens:strings(2, Sig) of
|
||||||
["payable", "main"] -> {true, true, 2};
|
["payable", "main"] -> {true, true, 2};
|
||||||
["main", "payable"] -> {true, true, 2};
|
["main", "payable"] -> {true, true, 2};
|
||||||
["payable", _] -> {true, false, 1};
|
["payable", _] -> {true, false, 1};
|
||||||
@@ -186,7 +186,7 @@ slurp_sep1_ii(Stk, TkShape, SepByStr, Sig) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
strings(N, Tks) ->
|
strings(N, Tks) ->
|
||||||
gsc_tokens:strings(N, Tks).
|
sfc_tokens:strings(N, Tks).
|
||||||
|
|
||||||
|
|
||||||
take(N, [_ | Rest]) when N >= 1 -> take(N-1, Rest);
|
take(N, [_ | Rest]) when N >= 1 -> take(N-1, Rest);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
% dynamic hacky module that loads all the tests
|
% dynamic hacky module that loads all the tests
|
||||||
-module(gsc_tests).
|
-module(sfc_tests).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
main/0,
|
main/0,
|
||||||
@@ -21,26 +21,26 @@ cli_args(TestNames) ->
|
|||||||
end,
|
end,
|
||||||
% this loads the test deps and then cleans up any
|
% this loads the test deps and then cleans up any
|
||||||
% beam files afterwards
|
% beam files afterwards
|
||||||
ts_utils:tidily(fun() -> do_gsc_test(TestNames) end).
|
ts_utils:tidily(fun() -> do_sfc_test(TestNames) end).
|
||||||
|
|
||||||
|
|
||||||
%do_gsc_test(["-h" | _]) -> do_help();
|
%do_sfc_test(["-h" | _]) -> do_help();
|
||||||
%do_gsc_test(["--help" | _]) -> do_help();
|
%do_sfc_test(["--help" | _]) -> do_help();
|
||||||
do_gsc_test(["-l" | _]) -> do_list();
|
do_sfc_test(["-l" | _]) -> do_list();
|
||||||
do_gsc_test(["--list" | _]) -> do_list();
|
do_sfc_test(["--list" | _]) -> do_list();
|
||||||
do_gsc_test(["-a" | _]) -> do_all();
|
do_sfc_test(["-a" | _]) -> do_all();
|
||||||
do_gsc_test(["--all" | _]) -> do_all();
|
do_sfc_test(["--all" | _]) -> do_all();
|
||||||
do_gsc_test(["so_tokens", X]) -> do_so_tokens(X);
|
do_sfc_test(["so_tokens", X]) -> do_so_tokens(X);
|
||||||
do_gsc_test(["so", "tokens", X]) -> do_so_tokens(X);
|
do_sfc_test(["so", "tokens", X]) -> do_so_tokens(X);
|
||||||
do_gsc_test(["tokenizers_agree", X]) ->
|
do_sfc_test(["tokenizers_agree", X]) ->
|
||||||
do_tokenizers_agree(X);
|
do_tokenizers_agree(X);
|
||||||
do_gsc_test([TestName]) ->
|
do_sfc_test([TestName]) ->
|
||||||
case ts_utils:test_exists_by_name(TestName) of
|
case ts_utils:test_exists_by_name(TestName) of
|
||||||
true -> ts_utils:run_test_by_name(TestName);
|
true -> ts_utils:run_test_by_name(TestName);
|
||||||
false -> gsc_cli:do_help()
|
false -> sfc_cli:do_help()
|
||||||
end;
|
end;
|
||||||
do_gsc_test(_) ->
|
do_sfc_test(_) ->
|
||||||
gsc_cli:do_help().
|
sfc_cli:do_help().
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+13
-13
@@ -32,7 +32,7 @@ tokenizers_agree(Relpath) ->
|
|||||||
% extracting data to be tested
|
% extracting data to be tested
|
||||||
% i hate this so much but lazy and this is test code so who really cares.
|
% i hate this so much but lazy and this is test code so who really cares.
|
||||||
SoTokens = so_tokens(FilePath),
|
SoTokens = so_tokens(FilePath),
|
||||||
SfTokens = gsc:gso_tokens_from_file(FilePath),
|
SfTokens = sfc:gso_tokens_from_file(FilePath),
|
||||||
case {SoTokens, SfTokens} of
|
case {SoTokens, SfTokens} of
|
||||||
{{ok, So}, {ok, Sf}} -> So =:= Sf;
|
{{ok, So}, {ok, Sf}} -> So =:= Sf;
|
||||||
{{error, _}, {error, _}} -> true;
|
{{error, _}, {error, _}} -> true;
|
||||||
@@ -82,7 +82,7 @@ load_dep(D) ->
|
|||||||
Result :: any().
|
Result :: any().
|
||||||
|
|
||||||
% @doc
|
% @doc
|
||||||
% run Fun(), delete gsc/test/*.beam afterward even if
|
% run Fun(), delete sfc/test/*.beam afterward even if
|
||||||
% Fun() errors
|
% Fun() errors
|
||||||
% @end
|
% @end
|
||||||
clean_after(Fun) ->
|
clean_after(Fun) ->
|
||||||
@@ -156,7 +156,7 @@ rmm(Mod) ->
|
|||||||
|
|
||||||
find_test_by_name(Name) ->
|
find_test_by_name(Name) ->
|
||||||
C1 = list_to_atom(Name),
|
C1 = list_to_atom(Name),
|
||||||
C2 = list_to_atom("gsc_test_" ++ Name),
|
C2 = list_to_atom("sfc_test_" ++ Name),
|
||||||
{Gd, Bd} = runnable_test_mods(),
|
{Gd, Bd} = runnable_test_mods(),
|
||||||
C1Gd = lists:member(C1, Gd),
|
C1Gd = lists:member(C1, Gd),
|
||||||
C2Gd = lists:member(C2, Gd),
|
C2Gd = lists:member(C2, Gd),
|
||||||
@@ -185,7 +185,7 @@ rtns(Acc, [TestMod | Rest]) ->
|
|||||||
rtns([{TestName, TestMod} | Acc], Rest).
|
rtns([{TestName, TestMod} | Acc], Rest).
|
||||||
|
|
||||||
test_mod_name(TestModAtom) ->
|
test_mod_name(TestModAtom) ->
|
||||||
"gsc_test_" ++ Name = atom_to_list(TestModAtom),
|
"sfc_test_" ++ Name = atom_to_list(TestModAtom),
|
||||||
Name.
|
Name.
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ runnable_test_mods() ->
|
|||||||
|
|
||||||
is_runnable(ModAtom) ->
|
is_runnable(ModAtom) ->
|
||||||
case atom_to_list(ModAtom) of
|
case atom_to_list(ModAtom) of
|
||||||
"gsc_test_" ++ _ -> true;
|
"sfc_test_" ++ _ -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@@ -253,9 +253,9 @@ abspath_to_name(FP) ->
|
|||||||
|
|
||||||
-spec ls_test_erls() -> AbsPaths when
|
-spec ls_test_erls() -> AbsPaths when
|
||||||
AbsPaths :: [string()].
|
AbsPaths :: [string()].
|
||||||
% @doc ["/path/to/gsc/test/foo.erl",
|
% @doc ["/path/to/sfc/test/foo.erl",
|
||||||
% "/path/to/gsc/test/bar.erl",
|
% "/path/to/sfc/test/bar.erl",
|
||||||
% "/path/to/gsc/test/baz.erl"]
|
% "/path/to/sfc/test/baz.erl"]
|
||||||
|
|
||||||
ls_test_erls() ->
|
ls_test_erls() ->
|
||||||
lists:filter(fun is_erl/1, ls_test()).
|
lists:filter(fun is_erl/1, ls_test()).
|
||||||
@@ -306,9 +306,9 @@ is_erl(Filename) ->
|
|||||||
% @doc
|
% @doc
|
||||||
% Includes junk/irrelevant files:
|
% Includes junk/irrelevant files:
|
||||||
%
|
%
|
||||||
% ["/path/to/gsc/test/foo.erl",
|
% ["/path/to/sfc/test/foo.erl",
|
||||||
% "/path/to/gsc/test/.foo.erl.swp",
|
% "/path/to/sfc/test/.foo.erl.swp",
|
||||||
% "/path/to/gsc/test/bar.erl"]
|
% "/path/to/sfc/test/bar.erl"]
|
||||||
|
|
||||||
ls_test() ->
|
ls_test() ->
|
||||||
TD = test_dir(),
|
TD = test_dir(),
|
||||||
@@ -324,7 +324,7 @@ ls_pwd() ->
|
|||||||
|
|
||||||
-spec test_dir() -> AbsPath when
|
-spec test_dir() -> AbsPath when
|
||||||
AbsPath :: string().
|
AbsPath :: string().
|
||||||
% @doc "/path/to/gsc/test"
|
% @doc "/path/to/sfc/test"
|
||||||
|
|
||||||
test_dir() ->
|
test_dir() ->
|
||||||
zx_daemon:get_home() ++ "/test".
|
zx_daemon:get_home() ++ "/test".
|
||||||
@@ -334,7 +334,7 @@ test_dir() ->
|
|||||||
-spec ct_dir() -> AbsPath when
|
-spec ct_dir() -> AbsPath when
|
||||||
AbsPath :: string().
|
AbsPath :: string().
|
||||||
|
|
||||||
% @doc "/path/to/gsc/test/ct"
|
% @doc "/path/to/sfc/test/ct"
|
||||||
%
|
%
|
||||||
% directory containing the tests for the tokenizer
|
% directory containing the tests for the tokenizer
|
||||||
ct_dir() ->
|
ct_dir() ->
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
{name,"Gajumaru Sophia Compiler"}.
|
{name,"Gajumaru Sophia Compiler"}.
|
||||||
{type,cli}.
|
{type,cli}.
|
||||||
{modules,[]}.
|
{modules,[]}.
|
||||||
{mod, "gsc_cli"}.
|
{mod, "sfc_cli"}.
|
||||||
{author,"Peter Harpending"}.
|
{author,"Peter Harpending"}.
|
||||||
{prefix,"gsc"}.
|
{prefix,"sfc"}.
|
||||||
{desc,"Exploratory sophia compiler rewrite"}.
|
{desc,"Exploratory sophia compiler rewrite"}.
|
||||||
{package_id,{"otpr","gsc",{0,1,0}}}.
|
{package_id,{"otpr","sfc",{0,1,0}}}.
|
||||||
{deps,[]}.
|
{deps,[]}.
|
||||||
{key_name,none}.
|
{key_name,none}.
|
||||||
{a_email,"peterharpending@qpq.swiss"}.
|
{a_email,"peterharpending@qpq.swiss"}.
|
||||||
{c_email,"peterharpending@qpq.swiss"}.
|
{c_email,"peterharpending@qpq.swiss"}.
|
||||||
{copyright,"2026 QPQ AG"}.
|
{copyright,"2026 QPQ IaaS AG"}.
|
||||||
{file_exts,[]}.
|
{file_exts,[]}.
|
||||||
{license,"GPL-3.0-only"}.
|
{license,"GPL-3.0-only"}.
|
||||||
{repo_url,"https://git.qpq.swiss/QPQ-AG/gsc"}.
|
{repo_url,"https://git.harpending.org/pharpend/sfc"}.
|
||||||
{tags,[]}.
|
{tags,[]}.
|
||||||
{ws_url,"https://git.qpq.swiss/QPQ-AG/gsc"}.
|
{ws_url,"https://git.harpending.org/pharpend/sfc"}.
|
||||||
|
|||||||
Reference in New Issue
Block a user