Compiler/lexical analyzer: Difference between revisions
→{{header|Fortran}}
Line 4,042:
end subroutine lexer_input_t_use_file
!!!
!!! If you tell gfortran you want -std=f2008 or -std=f2018, you likely
!!! will need to add also -fall-intrinsics or -U__GFORTRAN__
!!!
!!! The first way, you get the FGETC intrinsic. The latter way, you
!!! get the C interface code that uses getchar(3).
!!!
#ifdef __GFORTRAN__
Line 4,194 ⟶ 4,201:
select case (token%token_no)
case (tk_Integer, tk_Ident, tk_String)
write (outputter%unit_no, '(1X, I20, 1X, I20, 1X,
& token%line_no, token%column_no,
& token_names(token%token_no), token%val
case default
write (outputter%unit_no, '(1X, I20, 1X, I20, 1X,
& token%line_no, token%column_no, &
& trim (token_names(token%token_no))
end select
end subroutine lexer_output_t_output_token
Line 4,722 ⟶ 4,729:
program lex
use, intrinsic :: iso_fortran_env, only: output_unit
use, non_intrinsic :: lexical_analysis
Line 4,764 ⟶ 4,769:
{{out}}
Test case 3.
<pre> 5 16
5 40
6 16
6 40
7 16
7 40
8 16
8 40
9 16
9 40
10 16
10 40
11 16
11 40
12 16
12 40
13 16
13 40
14 16
14 40
15 16
15 40
16 16
16 40
17 16
17 40
18 16
18 40
19 16
19 40
20 26
21 26
22 26
23 1
=={{header|FreeBASIC}}==
|