Class: Rouge::Lexers::Fortran

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/fortran.rb

Constant Summary

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

Token::Tokens::Num, Token::Tokens::Str

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

Class Method Summary collapse

Methods inherited from RegexLexer

append, #delegate, get_state, #get_state, #goto, #group, #groups, #in_state?, #pop!, prepend, #push, #recurse, replace_state, #reset!, #reset_stack, #stack, start, start_procs, state, #state, #state?, state_definitions, states, #step, #stream_tokens, #token

Methods inherited from Rouge::Lexer

aliases, all, analyze_text, #as_bool, #as_lexer, #as_list, #as_string, #as_token, assert_utf8!, #bool_option, debug_enabled?, demo, demo_file, desc, disable_debug!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, #lex, lex, #lexer_option, #list_option, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.intrinsicsObject


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/rouge/lexers/fortran.rb', line 48

def self.intrinsics
  @intrinsics ||= Set.new %w(
    abs achar acos acosh adjustl adjustr aimag aint all allocated anint
    any asin asinh associated atan atan2 atanh bessel_j0 bessel_j1
    bessel_jn bessel_y0 bessel_y1 bessel_yn bge bgt bit_size ble blt btest
    c_associated c_f_pointer c_f_procpointer c_funloc c_loc c_sizeof
    ceiling char cmplx command_argument_count compiler_options
    compiler_version conjg cos cosh count cpu_time cshift date_and_time
    dble digits dim dot_product dprod dshiftl dshiftr eoshift epsilon erf
    erfc_scaled erfc execute_command_line exp exponent extends_type_of
    findloc floor fraction gamma get_command_argument get_command
    get_environment_variable huge hypot iachar iall iand iany ibclr ibits
    ibset ichar ieee_class ieee_copy_sign ieee_get_flag
    ieee_get_halting_mode ieee_get_rounding_mode ieee_get_status
    ieee_get_underflow_mode ieee_is_finite ieee_is_nan ieee_is_normal
    ieee_logb ieee_next_after ieee_rem ieee_rint ieee_scalb
    ieee_selected_real_kind ieee_set_flag ieee_set_halting_mode
    ieee_set_rounding_mode ieee_set_status ieee_set_underflow_mode
    ieee_support_datatype ieee_support_denormal ieee_support_divide
    ieee_support_flag ieee_support_halting ieee_support_inf
    ieee_support_io ieee_support_nan ieee_support_rounding
    ieee_support_sqrt ieee_support_standard ieee_support_underflow_control
    ieee_unordered ieee_value ieor image_index index int ior iparity
    is_contiguous is_iostat_end is_iostat_eor ishft ishftc kind lbound
    lcobound leadz len_trim len lge lgt lle llt log_gamma log log10
    logical maskl maskr matmul max maxexponent maxloc maxval merge_bits
    merge min minexponent minloc minval mod modulo move_alloc mvbits
    nearest new_line nint norm2 not null num_images pack parity popcnt
    poppar present product radix random_number random_seed range real
    repeat reshape rrspacing same_type_as scale scan selected_char_kind
    selected_int_kind selected_real_kind set_exponent shape shifta shiftl
    shiftr sign sin sinh size spacing spread sqrt storage_size sum
    system_clock tan tanh this_image tiny trailz transfer transpose trim
    ubound ucobound unpack verify
  )
end

.keywordsObject


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rouge/lexers/fortran.rb', line 21

def self.keywords
  # Fortran allows to omit whitespace between certain keywords...
  @keywords ||= Set.new %w(
    abstract all allocatable allocate assign assignment asynchronous
    backspace bind block blockdata close common concurrent contiguous call
    case class codimension contains continue cycle data deallocate
    deferred dimension do elemental else elseif elsewhere end endblock
    endblockdata enddo endenum endfile endforall endfunction endif
    endinterface endmodule endprogram endselect endsubmodule endsubroutine
    endtype endwhere endwhile entry enum enumerator equivalence error exit
    external final flush forall format function generic go goto if
    implicit import in include inout inquire intent interface intrinsic is
    module namelist non_overridable none nopass nullify only open operator
    optional out parameter pass pause pointer print private procedure
    program protected public pure read recursive result return rewind save
    select selectcase sequence stop submodule subroutine target then to
    type use value volatile wait where while write
  )
end

.typesObject


41
42
43
44
45
46
# File 'lib/rouge/lexers/fortran.rb', line 41

def self.types
  # There is a separate rule for "double precision" (two words) below
  @types ||= Set.new %w(
    character complex doubleprecision integer logical real
  )
end