diff --git a/include/gsc.hrl b/include/gsc.hrl index 65b27df..d644a70 100644 --- a/include/gsc.hrl +++ b/include/gsc.hrl @@ -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. % diff --git a/scratch/ast-gulp.erl b/scratch/ast-gulp.erl index 6f66530..b05b583 100644 --- a/scratch/ast-gulp.erl +++ b/scratch/ast-gulp.erl @@ -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) -> diff --git a/src/gsc_strmatch.erl b/src/gsc_strmatch.erl index 02992a8..bfaee40 100644 --- a/src/gsc_strmatch.erl +++ b/src/gsc_strmatch.erl @@ -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]). diff --git a/src/gsc_tokens.erl b/src/gsc_tokens.erl index 2c6ec56..d20a819 100644 --- a/src/gsc_tokens.erl +++ b/src/gsc_tokens.erl @@ -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 diff --git a/src/gso_scan.erl b/src/gso_scan.erl index 374c191..d414e78 100644 --- a/src/gso_scan.erl +++ b/src/gso_scan.erl @@ -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}}; %------------------------------------