parse_source Subroutine

public subroutine parse_source(text, s)

Read text into s: tokenize it, group the tokens into items and find the protected ones.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: text

the source text

type(source_t), intent(out) :: s

the result


Calls

proc~~parse_source~~CallsGraph proc~parse_source parse_source proc~protected_items protected_items proc~parse_source->proc~protected_items proc~split_statements split_statements proc~parse_source->proc~split_statements proc~tokenize tokenize proc~parse_source->proc~tokenize proc~directive directive proc~protected_items->proc~directive proc~ends_with_continuation ends_with_continuation proc~split_statements->proc~ends_with_continuation proc~find_semicolon find_semicolon proc~split_statements->proc~find_semicolon proc~line_end_token line_end_token proc~split_statements->proc~line_end_token proc~line_kind line_kind proc~split_statements->proc~line_kind proc~push statement_list_t%push proc~split_statements->proc~push proc~add add proc~tokenize->proc~add proc~comment_kind comment_kind proc~tokenize->proc~comment_kind proc~dotop_at dotop_at proc~tokenize->proc~dotop_at proc~dotop_end dotop_end proc~tokenize->proc~dotop_end proc~fypp_inline_end fypp_inline_end proc~tokenize->proc~fypp_inline_end proc~is_blank is_blank proc~tokenize->proc~is_blank proc~is_digit is_digit proc~tokenize->proc~is_digit proc~is_preproc_start is_preproc_start proc~tokenize->proc~is_preproc_start proc~is_quote is_quote proc~tokenize->proc~is_quote proc~lex_number lex_number proc~tokenize->proc~lex_number proc~line_end line_end proc~tokenize->proc~line_end proc~name_end name_end proc~tokenize->proc~name_end proc~operator_end operator_end proc~tokenize->proc~operator_end proc~peek peek proc~tokenize->proc~peek proc~preproc_end preproc_end proc~tokenize->proc~preproc_end proc~string_end string_end proc~tokenize->proc~string_end proc~add->proc~is_blank proc~add->proc~peek proc~is_code_char is_code_char proc~add->proc~is_code_char proc~push~2 token_list_t%push proc~add->proc~push~2 proc~comment_kind->proc~peek proc~is_letter is_letter proc~comment_kind->proc~is_letter proc~lowercase lowercase proc~comment_kind->proc~lowercase proc~token_text token_text proc~directive->proc~token_text proc~dotop_at->proc~peek proc~dotop_at->proc~is_letter proc~dotop_end->proc~name_end proc~dotop_end->proc~peek proc~is_name_char is_name_char proc~dotop_end->proc~is_name_char proc~dotop_end->proc~lowercase proc~fypp_inline_end->proc~peek proc~is_preproc_start->proc~peek proc~lex_number->proc~dotop_at proc~lex_number->proc~is_digit proc~lex_number->proc~name_end proc~lex_number->proc~peek proc~digits_end digits_end proc~lex_number->proc~digits_end proc~lex_number->proc~is_name_char proc~lower_char lower_char proc~lex_number->proc~lower_char proc~name_end->proc~peek proc~name_end->proc~is_name_char proc~preproc_end->proc~line_end proc~preproc_end->proc~peek proc~last_nonblank last_nonblank proc~preproc_end->proc~last_nonblank proc~string_end->proc~is_blank proc~string_end->proc~line_end proc~string_end->proc~peek proc~only_blanks_to_eol only_blanks_to_eol proc~string_end->proc~only_blanks_to_eol proc~digits_end->proc~is_digit proc~digits_end->proc~peek proc~is_code_char->proc~is_blank proc~is_name_char->proc~is_digit proc~is_name_char->proc~is_letter proc~last_nonblank->proc~is_blank proc~lowercase->proc~lower_char proc~only_blanks_to_eol->proc~line_end proc~only_blanks_to_eol->proc~last_nonblank

Called by

proc~~parse_source~~CalledByGraph proc~parse_source parse_source proc~code_signature code_signature proc~code_signature->proc~parse_source proc~convert_relational convert_relational proc~convert_relational->proc~parse_source proc~format_pass format_pass proc~format_pass->proc~parse_source proc~limit_diagnostics limit_diagnostics proc~limit_diagnostics->proc~parse_source proc~long_code_lines long_code_lines proc~long_code_lines->proc~parse_source proc~sort_use sort_use proc~sort_use->proc~parse_source proc~split_long_lines split_long_lines proc~split_long_lines->proc~parse_source proc~format_text format_text proc~format_text->proc~convert_relational proc~format_text->proc~format_pass proc~format_text->proc~limit_diagnostics proc~format_text->proc~long_code_lines proc~format_text->proc~sort_use proc~format_text->proc~split_long_lines proc~relayout relayout proc~format_text->proc~relayout proc~relayout->proc~format_pass proc~same_code same_code proc~same_code->proc~code_signature proc~process_text process_text proc~process_text->proc~format_text proc~process_file process_file proc~process_file->proc~process_text proc~process_stdin process_stdin proc~process_stdin->proc~process_text proc~run run proc~run->proc~process_file proc~run->proc~process_stdin

Source Code

subroutine parse_source(text, s)
    !! Read `text` into `s`: tokenize it, group the tokens into items and find the protected ones.
    character(len=*), intent(in) :: text   !! the source text
    type(source_t), intent(out) :: s       !! the result
    s%text = text
    call tokenize(s%text, s%tokens)
    call split_statements(s%text, s%tokens, s%stmts)
    s%keep = protected_items(s%text, s%tokens, s%stmts)
end subroutine parse_source