fdoc

modulefdoc_parser

Turning a source text into entities: fformat finds the statements and their structure, and this module reads the declarations and doc comments.

Doc comments are attached to code statements. A statement's documentation is any predocmark block before it, then its inline comments, then the docmark lines after it.

Each file is parsed into a list of its own, in parallel with others, so nothing here calls a function returning a deferred-length string (see example/slen_race.f90).

Uses

Graphs

Uses

Used by

Variables

NameTypeAttributesDefaultDescription
ATTRIBUTE_WORDScharacter(len=*)privateparameterdimension(*)[character(len=12)::'asynchronous','allocatable','data','dimension','external','optional','parameter','pointer','private','protected','public','save','target','value','volatile']
MAX_DEPTHintegerprivateparameter256
META_KEYScharacter(len=*)privateparameter'authorcategorycopy_subdirdatedeprecateddisplaygraphgraph_maxdepthgraph_maxnodeslicensenum_lines'//'ordered_subpageproc_internalssincesourcesummarytitleversion'

Types

association_tprivate

A name given by an associate statement.

doc_lines_tprivate

Documentation lines of one item.

Functions

chain_endprivate

integer function chain_end(v, j) result(last)

The last name of the component chain starting at token j, or 0.

chain_startprivate

integer function chain_start(v, j) result(first)

The first token of the component chain ending at name j.

comma_countpureprivate

pure integer function comma_count(text)

Number of commas in text.

first_word_ofpureprivate

pure character(len=word_length(text)) function first_word_of(text) result(word)

The first blank-separated word of text, after any leading blanks.

has_markpureprivate

pure logical function has_mark(c, mark)

True if comment c starts with ! and doc marker mark.

implicit_variableprivate

integer function implicit_variable(list, parent, name, role) result(id)

Add a variable for name, implicitly typed.

inherited_permissionpureprivate

pure character(len=permission_length(list,id)) function inherited_permission(list, id) result(permission)

The permission of what is declared now in id.

is_attribute_statementprivate

logical function is_attribute_statement(low)

True if low starts with a word that gives attributes to names listed after it.

is_executableprivate

logical function is_executable(v, info, source_low)

True if statement v can have procedure references: not a declaration.

leading_textpureprivate

pure character(len=80) function leading_text(v, j) result(text)

The first code tokens of v from token j, in lowercase and joined by blanks, up to about 80 characters.

nearest_callerpureprivate

pure integer function nearest_caller(list, stack, top) result(caller)

The innermost entity on stack that can call procedures, or 0 if there is none or a declaration scope such as a type is inside it.

permission_lengthpureprivate

pure integer function permission_length(list, id)

Length of the result of inherited_permission.

replace_commaspureprivate

pure character(len=len(attr)+comma_count(attr)) function replace_commas(attr) result(out)

attr with a blank after each comma.

strip_trailingpureprivate

pure character(len=len_trim(s)) function strip_trailing(s) result(t)

s without trailing whitespace.

word_lengthpureprivate

pure integer function word_length(text)

Length of the first blank-separated word of text.

Subroutines

add_callprivate

subroutine add_call(v, j, e, associations)

Add the reference ending at name j to e%more%calls, unless it is intrinsic or already there.

apply_attributesprivate

subroutine apply_attributes(list, id)

Apply statements such as public :: x to the entities they name.

apply_oneprivate

subroutine apply_one(e, u, value)

Apply attribute value, from a statement in unit u, to entity e.

attach_argumentsprivate

subroutine attach_arguments(list, id)

Connect the dummy arguments and result of a procedure with their declarations.

close_interfaceprivate

subroutine close_interface(list, id)

Finish an interface block. All but generic interfaces dissolve, leaving their bodies in the unit around them.

close_unitprivate

subroutine close_unit(list, id, s)

Finish entity id at its closing statement.

collect_docsprivate

subroutine collect_docs(src, s, docs, file_doc)

Find the documentation of each code statement.

doxygen_metaprivate

subroutine doxygen_meta(line, moved)

If line is a doxygen command, blank it and add it to moved as a metadata line.

doxygen_paramsprivate

subroutine doxygen_params(list, id)

Move doxygen @param name text lines from procedure id to the variables they describe.

inherit_displayprivate

subroutine inherit_display(list, id, s)

Copy the display settings that apply to id from its parent, and apply its own metadata.

mark_common_membersprivate

subroutine mark_common_members(list, id)

Mark the variables of unit id named in its common blocks.

open_procedureprivate

subroutine open_procedure(list, parent, line, id)

Create the entity for a subroutine or function statement.

open_unitprivate

subroutine open_unit(list, parent, construct, line, item, src, doc, s, id)

Create the entity for the statement opening construct construct, if it has one.

parse_file

subroutine parse_file(path, text, s, list)

Parse source text of file path into list, whose first entity is the file.

parse_statementprivate

subroutine parse_statement(list, unit, line, doc, s)

Read a statement that opens nothing, if it declares anything.

read_associationsprivate

subroutine read_associations(v, associations, level)

Add the names of an associate statement to associations.

read_attribute_statementprivate

subroutine read_attribute_statement(u, line, low)

Read a statement such as public :: x, keeping what it says until the unit is finished.

read_bindingprivate

subroutine read_binding(list, unit, line, doc, s)

Read a type-bound procedure or generic statement.

read_commonprivate

subroutine read_common(list, unit, line, doc, s)

Read a common statement, adding a common block entity for each block it names.

read_declarationprivate

subroutine read_declaration(list, unit, line, doc, s)

Read a variable declaration, adding a variable for each name.

read_finalprivate

subroutine read_final(list, unit, line)

Read a final statement.

read_module_proceduresprivate

subroutine read_module_procedures(u, line)

Read a module procedure or procedure statement in an interface.

read_namelistprivate

subroutine read_namelist(list, unit, line, doc, s)

Read a namelist statement.

read_submoduleprivate

subroutine read_submodule(e, line)

Read a submodule statement.

read_type_statementprivate

subroutine read_type_statement(e, line)

Read a type statement.

read_useprivate

subroutine read_use(u, line)

Read a use statement.

remove_childpureprivate

pure subroutine remove_child(e, id)

Remove id from the children of e.

set_docprivate

subroutine set_doc(e, s, lines)

Set the documentation and metadata of e from its doc lines.

set_typeprivate

subroutine set_type(v, t)

Copy a parsed type to variable v.

statement_callsprivate

subroutine statement_calls(v, info, e, associations, level)

Add the procedures that a statement refers to to e%more%calls.

statement_textprivate

subroutine statement_text(src, item, text)

The code of statement item: its tokens as written, without comments and continuation marks. Continuation lines are joined as FORD joins them.