Octopus
parser_oct_m Module Reference

Data Types

type  block_t
 
interface  oct_parse_block
 
interface  oct_parse_complex
 
interface  oct_parse_double
 
interface  oct_parse_expression
 The public subroutine parse_expression accepts two possible interfaces, one which assumes that the variables in the expression are "x(:)", "r" and "t", and another one which permits to set one variable to whichever string. Examples of usage: More...
 
interface  oct_parse_int
 
interface  oct_parse_string
 
interface  parse_block_cmplx
 
interface  parse_block_cols
 
interface  parse_block_end
 
interface  parse_block_float
 
interface  parse_block_integer
 
interface  parse_block_n
 
interface  parse_block_string
 
interface  parse_end
 
interface  parse_environment
 
interface  parse_expression
 
interface  parse_init
 
interface  parse_input_file
 
interface  parse_input_string
 
interface  parse_isdef
 
interface  parse_putsym
 
interface  parse_variable
 
interface  sym_output_table
 

Functions/Subroutines

subroutine, public parser_initialize_symbol_table (log_file)
 Initialise the Octopus parser symbol table from file of keys. More...
 
subroutine, public parser_init ()
 Initialise the Octopus parser. More...
 
subroutine, public parser_end ()
 End the Octopus parser. More...
 
logical function, public parse_is_defined (namespace, name)
 
subroutine parse_integer (namespace, name, def, res)
 
subroutine parse_integer8 (namespace, name, def, res)
 
subroutine parse_integer48 (namespace, name, def, res)
 
subroutine parse_integer84 (namespace, name, def, res)
 
subroutine parse_string (namespace, name, def, res)
 
subroutine parse_logical (namespace, name, def, res)
 
subroutine parse_cmplx (namespace, name, def, res)
 
integer function, public parse_block (namespace, name, blk, check_varinfo_)
 
subroutine, public parse_block_logical (blk, l, c, res)
 
subroutine oct_parse_double_unit (namespace, name, def, res, unit)
 
subroutine oct_parse_block_double_unit (blk, l, c, res, unit)
 
subroutine oct_parse_expression_vec (re, im, ndim, x, r, t, pot)
 
subroutine, public parse_array (inp_string, x, arraychar)
 A very primitive way to "preprocess" a string that contains reference to the elements of a two-dimensional array, substituting them with the values of the array x. This way the string can be processed by the parser later. More...
 
subroutine parse_check_varinfo (varname)
 
character(len=:) function, allocatable parse_get_full_name (namespace, varname)
 Given a namespace and a variable name, this function will iterate over all namespace ancestors contained in the namespace, until it finds one for which the variable is defined. If it finds such namespace it returns the variable name prefixed with the namespace. If it does not find any suitable namespace it returns the variable name without any prefix. More...
 
subroutine parse_fatal ()
 

Variables

character(len=27), parameter, public parser_varname_excluded_characters = '|!''"#$%&/\‍()=?{}+-*^.,;:<> '
 The following characters should not be allowed in variable names. More...
 

Function/Subroutine Documentation

◆ parser_initialize_symbol_table()

subroutine, public parser_oct_m::parser_initialize_symbol_table ( character(len=*), intent(in), optional  log_file)

Initialise the Octopus parser symbol table from file of keys.

Several steps are performed:

  • The variables file must exist because this will be used to initialise the symbol table with key entries.
  • The parser is initialised. This initialises the symbol table instance, and opens a log file for the parser. If '-' is passed instead of a file name, the parser log is written to stdout.
  • The symbol table is initialised with keys defined in the variables file. Attempting to parse any key prior to this call will result in an error.
    Parameters
    [in]log_fileParser log file

Definition at line 400 of file parser.F90.

◆ parser_init()

subroutine, public parser_oct_m::parser_init

Initialise the Octopus parser.

Definition at line 449 of file parser.F90.

◆ parser_end()

subroutine, public parser_oct_m::parser_end

End the Octopus parser.

Definition at line 480 of file parser.F90.

◆ parse_is_defined()

logical function, public parser_oct_m::parse_is_defined ( type(namespace_t), intent(in)  namespace,
character(len=*), intent(in)  name 
)

Definition at line 501 of file parser.F90.

◆ parse_integer()

subroutine parser_oct_m::parse_integer ( type(namespace_t), intent(in)  namespace,
character(len=*), intent(in)  name,
integer, intent(in)  def,
integer, intent(out)  res 
)
private

Definition at line 511 of file parser.F90.

◆ parse_integer8()

subroutine parser_oct_m::parse_integer8 ( type(namespace_t), intent(in)  namespace,
character(len=*), intent(in)  name,
integer(int64), intent(in)  def,
integer(int64), intent(out)  res 
)
private

Definition at line 528 of file parser.F90.

◆ parse_integer48()

subroutine parser_oct_m::parse_integer48 ( type(namespace_t), intent(in)  namespace,
character(len=*), intent(in)  name,
integer, intent(in)  def,
integer(int64), intent(out)  res 
)
private

Definition at line 541 of file parser.F90.

◆ parse_integer84()

subroutine parser_oct_m::parse_integer84 ( type(namespace_t), intent(in)  namespace,
character(len=*), intent(in)  name,
integer(int64), intent(in)  def,
integer, intent(out)  res 
)
private

Definition at line 554 of file parser.F90.

◆ parse_string()

subroutine parser_oct_m::parse_string ( type(namespace_t), intent(in)  namespace,
character(len=*), intent(in)  name,
character(len=*), intent(in)  def,
character(len=*), intent(out)  res 
)
private

Definition at line 571 of file parser.F90.

◆ parse_logical()

subroutine parser_oct_m::parse_logical ( type(namespace_t), intent(in)  namespace,
character(len=*), intent(in)  name,
logical, intent(in)  def,
logical, intent(out)  res 
)
private

Definition at line 583 of file parser.F90.

◆ parse_cmplx()

subroutine parser_oct_m::parse_cmplx ( type(namespace_t), intent(in)  namespace,
character(len=*), intent(in)  name,
complex(real64), intent(in)  def,
complex(real64), intent(out)  res 
)
private

Definition at line 604 of file parser.F90.

◆ parse_block()

integer function, public parser_oct_m::parse_block ( type(namespace_t), intent(in)  namespace,
character(len=*), intent(in)  name,
type(block_t), intent(out)  blk,
logical, intent(in), optional  check_varinfo_ 
)

Definition at line 617 of file parser.F90.

◆ parse_block_logical()

subroutine, public parser_oct_m::parse_block_logical ( type(block_t), intent(in)  blk,
integer, intent(in)  l,
integer, intent(in)  c,
logical, intent(out)  res 
)

Definition at line 637 of file parser.F90.

◆ oct_parse_double_unit()

subroutine parser_oct_m::oct_parse_double_unit ( type(namespace_t), intent(in)  namespace,
character(len=*), intent(in)  name,
real(real64), intent(in)  def,
real(real64), intent(out)  res,
type(unit_t), intent(in), optional  unit 
)
private

Definition at line 651 of file parser.F90.

◆ oct_parse_block_double_unit()

subroutine parser_oct_m::oct_parse_block_double_unit ( type(block_t), intent(in)  blk,
integer, intent(in)  l,
integer, intent(in)  c,
real(real64), intent(out)  res,
type(unit_t), intent(in)  unit 
)
private

Definition at line 671 of file parser.F90.

◆ oct_parse_expression_vec()

subroutine parser_oct_m::oct_parse_expression_vec ( real(real64), intent(out)  re,
real(real64), intent(out)  im,
integer, intent(in)  ndim,
real(real64), dimension(:), intent(in)  x,
real(real64), intent(in)  r,
real(real64), intent(in)  t,
character(len=*), intent(in)  pot 
)
private

Definition at line 683 of file parser.F90.

◆ parse_array()

subroutine, public parser_oct_m::parse_array ( character(len=*), intent(inout)  inp_string,
real(real64), dimension(:, :), intent(in)  x,
character(len=1), intent(in)  arraychar 
)

A very primitive way to "preprocess" a string that contains reference to the elements of a two-dimensional array, substituting them with the values of the array x. This way the string can be processed by the parser later.

Definition at line 699 of file parser.F90.

◆ parse_check_varinfo()

subroutine parser_oct_m::parse_check_varinfo ( character(len=*), intent(in)  varname)
private

Definition at line 729 of file parser.F90.

◆ parse_get_full_name()

character(len=:) function, allocatable parser_oct_m::parse_get_full_name ( type(namespace_t), intent(in), target  namespace,
character(len=*), intent(in)  varname 
)
private

Given a namespace and a variable name, this function will iterate over all namespace ancestors contained in the namespace, until it finds one for which the variable is defined. If it finds such namespace it returns the variable name prefixed with the namespace. If it does not find any suitable namespace it returns the variable name without any prefix.

To make it clear what we mean by all namespace ancestors contained in a given namesspace, lets suppose that we have the following namespace:

"A.B.C"

Clearly "A" and "B" are ancestors of "C", but also the full path to "B", that is "A.B", is an ancestor. For practical purposes we will also consider that "C" is an ancestor of itself. So "C", "B.C" and "A.B.C" are also ancestors.

The order in which the function iterates over the possible namespace ancestors is crucial, as it effectively determines namespace precedence in the input file. The order is such that it goes from the rigth-most ancestor to the left-most, and form the more complete path to the least complete. So for the above example, the order will be the following:

"A.B.C", "B.C", "C", "A.B", "B", "A"

as "C" is the right-most ancestor while "A" is the left-most and "A.B.C" is the most complete path while "C" is the least complete.

Definition at line 767 of file parser.F90.

◆ parse_fatal()

subroutine parser_oct_m::parse_fatal
private

Definition at line 805 of file parser.F90.

Variable Documentation

◆ parser_varname_excluded_characters

character(len=27), parameter, public parser_oct_m::parser_varname_excluded_characters = '|!''"#$%&/\‍()=?{}+-*^.,;:<> '

The following characters should not be allowed in variable names.

Definition at line 154 of file parser.F90.