Loading...
Searching...
No Matches
parser.f90 File Reference

Go to the source code of this file.

Data Types

interface  preprocess
 Generic interface to start preprocessing from various sources/sinks. More...
 

Functions/Subroutines

subroutine preprocess_file (filepath, outputfile)
 Preprocess a file and write result to an optional output file (default: stdout) Opens the input file, determines the base filename for error messages, opens the output file if requested, and delegates to the unit-to-unit routine.
 
subroutine preprocess_unit_to_file (iunit, ofile)
 Preprocess from an already-open input unit and write to a file.
 
subroutine preprocess_file_to_unit (ifile, ounit)
 Preprocess a file and write to an already-open output unit.
 
subroutine preprocess_unit_to_unit (iunit, ounit)
 Core preprocessing routine: read from iunit, write to ounit Sets up a clean macro environment for the top-level file, resets conditional compilation state, and calls the worker routine.
 
subroutine preprocess_unit (iunit, ounit, macros, from_include)
 Worker routine that reads lines, handles continuations, comments and directives This is the main loop that:
 
recursive character(:) function, allocatable process_line (current_line, ounit, filepath, linenum, macros, stch)
 Process a single (possibly continued) line – handles directives and macro expansion Responsibilities:
 

Variables

character(256) name
 Current source file name (without path)
 
logical c_continue
 Flags for C-style continuation.
 
logical f_continue
 Flags for Fortran-style continuation.
 
logical in_comment
 Internal state flags.
 
logical reprocess
 Internal state flags.
 
logical stitch
 Internal state flags.
 
character(:), allocatable res
 Accumulated result line buffers.
 
character(:), allocatable tmp
 Accumulated temporary line buffers.
 
character(max_line_lenline
 Raw input line.
 
character(max_line_lencontinued_line
 Raw and continued input line.
 
integer iline
 Current line number position.
 
integer icontinuation
 Continuation position.