Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

erl_lint(3erl) [linux man page]

erl_lint(3erl)						     Erlang Module Definition						    erl_lint(3erl)

NAME
erl_lint - The Erlang Code Linter DESCRIPTION
This module is used to check Erlang code for illegal syntax and other bugs. It also warns against coding practices which are not recom- mended. The errors detected include: * redefined and undefined functions * unbound and unsafe variables * illegal record usage. Warnings include: * unused functions and imports * unused variables * variables imported into matches * variables exported from if / case / receive * variables shadowed in lambdas and list comprehensions. Some of the warnings are optional, and can be turned on by giving the appropriate option, described below. The functions in this module are invoked automatically by the Erlang compiler and there is no reason to invoke these functions separately unless you have written your own Erlang compiler. EXPORTS
module(AbsForms) -> {ok,Warnings} | {error,Errors,Warnings} module(AbsForms, FileName) -> {ok,Warnings} | {error,Errors,Warnings} module(AbsForms, FileName, CompileOptions) -> {ok,Warnings} | {error,Errors,Warnings} Types AbsForms = [term()] FileName = FileName2 = atom() | string() Warnings = Errors = [{Filename2,[ErrorInfo]}] ErrorInfo = see separate description below. CompileOptions = [term()] This function checks all the forms in a module for errors. It returns: {ok,Warnings} : There were no errors in the module. {error,Errors,Warnings} : There were errors in the module. Since this module is of interest only to the maintainers of the compiler, and to avoid having the same description in two places to avoid the usual maintenance nightmare, the elements of Options that control the warnings are only described in compile(3erl) . The AbsForms of a module which comes from a file that is read through epp , the Erlang pre-processor, can come from many files. This means that any references to errors must include the file name (see epp(3erl) , or parser erl_parse(3erl) ). The warnings and errors returned have the following format: [{FileName2,[ErrorInfo]}] The errors and warnings are listed in the order in which they are encountered in the forms. This means that the errors from one file may be split into different entries in the list of errors. is_guard_test(Expr) -> bool() Types Expr = term() This function tests if Expr is a legal guard test. Expr is an Erlang term representing the abstract form for the expression. erl_parse:parse_exprs(Tokens) can be used to generate a list of Expr . format_error(ErrorDescriptor) -> Chars Types ErrorDescriptor = errordesc() Chars = [char() | Chars] Takes an ErrorDescriptor and returns a string which describes the error or warning. This function is usually called implicitly when processing an ErrorInfo structure (see below). ERROR INFORMATION
The ErrorInfo mentioned above is the standard ErrorInfo structure which is returned from all IO modules. It has the following format: {ErrorLine, Module, ErrorDescriptor} A string which describes the error is obtained with the following call: Module:format_error(ErrorDescriptor) SEE ALSO
erl_parse(3erl) , epp(3erl) Ericsson AB stdlib 1.17.3 erl_lint(3erl)

Check Out this Related Man Page

epp_dodger(3erl)					     Erlang Module Definition						  epp_dodger(3erl)

NAME
epp_dodger - epp_dodger - bypasses the Erlang preprocessor. DESCRIPTION
epp_dodger - bypasses the Erlang preprocessor. This module tokenises and parses most Erlang source code without expanding preprocessor directives and macro applications, as long as these are syntactically "well-behaved". Because the normal parse trees of the erl_parse module cannot represent these things (normally, they are expanded by the Erlang preprocessor epp(3erl) before the parser sees them), an extended syntax tree is created, using the erl_syntax mod- ule. DATA TYPES
errorinfo() = {ErrorLine::integer(), Module::atom(), Descriptor::term()} : This is a so-called Erlang I/O ErrorInfo structure; see the io(3erl) module for details. EXPORTS
parse(Dev::IODevice) -> {ok, Forms} | {error, errorinfo()} Equivalent to parse(IODevice, 1) . parse(Dev::IODevice, L::StartLine) -> {ok, Forms} | {error, errorinfo()} Types IODevice = pid() StartLine = integer() Forms = [syntaxTree() (see module erl_syntax)] Equivalent to parse(IODevice, StartLine, []) . See also: parse/1 . parse(Dev::IODevice, L0::StartLine, Options) -> {ok, Forms} | {error, errorinfo()} Types IODevice = pid() StartLine = integer() Options = [term()] Forms = [syntaxTree() (see module erl_syntax)] Reads and parses program text from an I/O stream. Characters are read from IODevice until end-of-file; apart from this, the behav- iour is the same as for parse_file/2 . StartLine is the initial line number, which should be a positive integer. See also: parse/2 , parse_file/2 , parse_form/2 , quick_parse/3 . parse_file(File) -> {ok, Forms} | {error, errorinfo()} Types File = filename() (see module file) Forms = [syntaxTree() (see module erl_syntax)] Equivalent to parse_file(File, []) . parse_file(File, Options) -> {ok, Forms} | {error, errorinfo()} Types File = filename() (see module file) Options = [term()] Forms = [syntaxTree() (see module erl_syntax)] Reads and parses a file. If successful, {ok, Forms} is returned, where Forms is a list of abstract syntax trees representing the "program forms" of the file (cf. erl_syntax:is_form/1 ). Otherwise, {error, errorinfo()} is returned, typically if the file could not be opened. Note that parse errors show up as error markers in the returned list of forms; they do not cause this function to fail or return {error, errorinfo()} . Options: {no_fail, boolean()} : If true , this makes epp_dodger replace any program forms that could not be parsed with nodes of type text (see erl_syn- tax:text/1 ), representing the raw token sequence of the form, instead of reporting a parse error. The default value is false . {clever, boolean()} : If set to true , this makes epp_dodger try to repair the source code as it seems fit, in certain cases where parsing would oth- erwise fail. Currently, it inserts ++ -operators between string literals and macros where it looks like concatenation was intended. The default value is false . See also: parse/2 , quick_parse_file/1 , erl_syntax:is_form/1 . parse_form(Dev::IODevice, L0::StartLine) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo} Types IODevice = pid() StartLine = integer() Form = syntaxTree() (see module erl_syntax) LineNo = integer() Equivalent to parse_form(IODevice, StartLine, []) . See also: quick_parse_form/2 . parse_form(Dev::IODevice, L0::StartLine, Options) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo} Types IODevice = pid() StartLine = integer() Options = [term()] Form = syntaxTree() (see module erl_syntax) LineNo = integer() Reads and parses a single program form from an I/O stream. Characters are read from IODevice until an end-of-form marker is found (a period character followed by whitespace), or until end-of-file; apart from this, the behaviour is similar to that of parse/3 , except that the return values also contain the final line number given that StartLine is the initial line number, and that {eof, LineNo} may be returned. See also: parse/3 , parse_form/2 , quick_parse_form/3 . quick_parse(Dev::IODevice) -> {ok, Forms} | {error, errorinfo()} Equivalent to quick_parse(IODevice, 1) . quick_parse(Dev::IODevice, L::StartLine) -> {ok, Forms} | {error, errorinfo()} Types IODevice = pid() StartLine = integer() Forms = [syntaxTree() (see module erl_syntax)] Equivalent to quick_parse(IODevice, StartLine, []) . See also: quick_parse/1 . quick_parse(Dev::IODevice, L0::StartLine, Options) -> {ok, Forms} | {error, errorinfo()} Types IODevice = pid() StartLine = integer() Options = [term()] Forms = [syntaxTree() (see module erl_syntax)] Similar to parse/3 , but does a more quick-and-dirty processing of the code. See quick_parse_file/2 for details. See also: parse/3 , quick_parse/2 , quick_parse_file/2 , quick_parse_form/2 . quick_parse_file(File) -> {ok, Forms} | {error, errorinfo()} Types File = filename() (see module file) Forms = [syntaxTree() (see module erl_syntax)] Equivalent to quick_parse_file(File, []) . quick_parse_file(File, Options) -> {ok, Forms} | {error, errorinfo()} Types File = filename() (see module file) Options = [term()] Forms = [syntaxTree() (see module erl_syntax)] Similar to parse_file/2 , but does a more quick-and-dirty processing of the code. Macro definitions and other preprocessor direc- tives are discarded, and all macro calls are replaced with atoms. This is useful when only the main structure of the code is of interest, and not the details. Furthermore, the quick-parse method can usually handle more strange cases than the normal, more exact parsing. Options: see parse_file/2 . Note however that for quick_parse_file/2 , the option no_fail is true by default. See also: parse_file/2 , quick_parse/2 . quick_parse_form(Dev::IODevice, L0::StartLine) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo} Types IODevice = pid() StartLine = integer() Form = syntaxTree() (see module erl_syntax) | none LineNo = integer() Equivalent to quick_parse_form(IODevice, StartLine, []) . See also: parse_form/2 . quick_parse_form(Dev::IODevice, L0::StartLine, Options) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo} Types IODevice = pid() StartLine = integer() Options = [term()] Form = syntaxTree() (see module erl_syntax) LineNo = integer() Similar to parse_form/3 , but does a more quick-and-dirty processing of the code. See quick_parse_file/2 for details. See also: parse/3 , parse_form/3 , quick_parse_form/2 . tokens_to_string(Tokens::[term()]) -> string() Generates a string corresponding to the given token sequence. The string can be re-tokenized to yield the same token list again. AUTHORS
Richard Carlsson <richardc@it.uu.se > syntax_tools 1.6.7 epp_dodger(3erl)
Man Page