Class: Rouge::Lexers::C

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

Direct Known Subclasses

Cpp, Glsl, ObjectiveC

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, #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, #as_bool, #as_lexer, #as_list, #as_string, #as_token, #bool_option, #continue_lex, continue_lex, debug_enabled?, demo, demo_file, desc, detect?, detectable?, 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

.builtinsObject


59
60
61
# File 'lib/rouge/lexers/c.rb', line 59

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

.keywordsObject


18
19
20
21
22
23
24
25
26
27
# File 'lib/rouge/lexers/c.rb', line 18

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

    _Alignas _Alignof _Atomic _Generic _Imaginary
    _Noreturn _Static_assert _Thread_local
  )
end

.keywords_typeObject


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rouge/lexers/c.rb', line 29

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

    char16_t char32_t
  )
end

.reservedObject


50
51
52
53
54
55
56
57
# File 'lib/rouge/lexers/c.rb', line 50

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