aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/core_scan.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-12-15 09:17:09 +0100
committerBjörn Gustavsson <[email protected]>2017-01-12 12:10:11 +0100
commitcef1a51a881f9b36d2096efec29df262e5f17a3c (patch)
treefe06152c9ee900dd23cc5a10e8e02a502bf8afbb /lib/compiler/src/core_scan.erl
parentf5c890993a5ee52338d9edd669e380d751c5f8aa (diff)
downloadotp-cef1a51a881f9b36d2096efec29df262e5f17a3c.tar.gz
otp-cef1a51a881f9b36d2096efec29df262e5f17a3c.tar.bz2
otp-cef1a51a881f9b36d2096efec29df262e5f17a3c.zip
core_scan: Add missing types and specs
Diffstat (limited to 'lib/compiler/src/core_scan.erl')
-rw-r--r--lib/compiler/src/core_scan.erl24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/compiler/src/core_scan.erl b/lib/compiler/src/core_scan.erl
index 11b52f6c5f..15bfc78c8b 100644
--- a/lib/compiler/src/core_scan.erl
+++ b/lib/compiler/src/core_scan.erl
@@ -49,13 +49,37 @@
-import(lists, [reverse/1]).
+-type location() :: integer().
+-type category() :: atom().
+-type symbol() :: atom() | float() | integer() | string().
+-type token() :: {category(), Anno :: location(), symbol()}
+ | {category(), Anno :: location()}.
+-type tokens() :: [token()].
+-type error_description() :: term().
+-type error_info() :: {erl_anno:location(), module(), error_description()}.
+
%% string([Char]) ->
%% string([Char], StartPos) ->
%% {ok, [Tok], EndPos} |
%% {error, {Pos,core_scan,What}, EndPos}
+-spec string(String) -> Return when
+ String :: string(),
+ Return :: {'ok', Tokens :: tokens(), EndLocation}
+ | {'error', ErrorInfo :: error_info(), ErrorLocation},
+ EndLocation :: location(),
+ ErrorLocation :: location().
+
string(Cs) -> string(Cs, 1).
+-spec string(String, StartLocation) -> Return when
+ String :: string(),
+ Return :: {'ok', Tokens :: tokens(), EndLocation}
+ | {'error', ErrorInfo :: error_info(), ErrorLocation},
+ StartLocation :: location(),
+ EndLocation :: location(),
+ ErrorLocation :: location().
+
string(Cs, Sp) ->
%% Add an 'eof' to always get correct handling.
case string_pre_scan(Cs, [], Sp) of