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, #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



53
54
55
# File 'lib/rouge/lexers/c.rb', line 53

def self.analyze_text(*)
  0.3
end

.builtinsObject



57
58
59
# File 'lib/rouge/lexers/c.rb', line 57

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

.keywordsObject



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

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



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

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



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

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