Class: Rouge::Lexers::C

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

Direct Known Subclasses

Cpp, ObjectiveC

Constant Summary

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

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

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, #run_callback, #run_rule, #stack, start, start_procs, #state, state, #state?, state_definitions, states, #step, #stream_tokens, #token

Methods inherited from Rouge::Lexer

aliases, all, assert_utf8!, #debug, default_options, demo, demo_file, desc, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #initialize, lex, #lex, mimetypes, #option, #options, #reset!, #stream_tokens, tag, #tag

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.analyze_textObject

high priority for filename matches



51
52
53
# File 'lib/rouge/lexers/c.rb', line 51

def self.analyze_text(*)
  0.3
end

.builtinsObject



55
56
57
# File 'lib/rouge/lexers/c.rb', line 55

def self.builtins
  @builtins ||= []
end

.keywordsObject



14
15
16
17
18
19
20
# File 'lib/rouge/lexers/c.rb', line 14

def self.keywords
  @keywords ||= Set.new %w(
    auto break case const continue default do else enum extern
    for goto if register restricted return sizeof static struct
    switch typedef union volatile virtual while
  )
end

.keywords_typeObject



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

def self.keywords_type
  @keywords_type ||= Set.new %w(
    int long float short double char unsigned signed void

    jmp_buf FILE DIR div_t ldiv_t mbstate_t sig_atomic_t fpos_t
    clock_t time_t va_list size_t ssize_t off_t wchar_t ptrdiff_t
    wctrans_t wint_t wctype_t

    _Bool _Complex int8_t int16_t int32_t int64_t
    uint8_t uint16_t uint32_t uint64_t int_least8_t
    int_least16_t int_least32_t int_least64_t
    uint_least8_t uint_least16_t uint_least32_t
    uint_least64_t int_fast8_t int_fast16_t int_fast32_t
    int_fast64_t uint_fast8_t uint_fast16_t uint_fast32_t
    uint_fast64_t intptr_t uintptr_t intmax_t
    uintmax_t
  )
end

.reservedObject



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

def self.reserved
  @reserved ||= Set.new %w(
    __asm __int8 __based __except __int16 __stdcall __cdecl
    __fastcall __int32 __declspec __finally __int61 __try __leave
    inline _inline __inline naked _naked __naked restrict _restrict
    __restrict thread _thread __thread typename _typename __typename
  )
end