Class: Rouge::Lexers::YANG

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/yang.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, #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, lookup_fancy, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option, #with

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.body_stmts_keywordsObject



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

def self.body_stmts_keywords
  @body_stms_keywords ||= Set.new %w(
    action argument augment deviation extension feature grouping identity
    if-feature input notification output rpc typedef
  )
end

.constants_keywordsObject

RFC7950 other keywords



69
70
71
72
73
74
# File 'lib/rouge/lexers/yang.rb', line 69

def self.constants_keywords
  @constants_keywords ||= Set.new %w(
    add current delete deprecated false invert-match max min
    not-supported obsolete replace true unbounded user
  )
end

.data_def_stmts_keywordsObject



47
48
49
50
51
52
# File 'lib/rouge/lexers/yang.rb', line 47

def self.data_def_stmts_keywords
  @data_def_stms_keywords ||= Set.new %w(
    anydata anyxml case choice config container deviate leaf leaf-list
    list must presence refine uses when
  )
end

.linkage_stmts_keywordsObject



34
35
36
37
38
# File 'lib/rouge/lexers/yang.rb', line 34

def self.linkage_stmts_keywords
  @linkage_stmts_keywords ||= Set.new %w(
    import include revision-date
  )
end

.list_stmts_keywordsObject



62
63
64
65
66
# File 'lib/rouge/lexers/yang.rb', line 62

def self.list_stmts_keywords
  @list_stmts_keywords ||= Set.new %w(
    key mandatory unique
  )
end

.meta_stmts_keywordsObject



28
29
30
31
32
# File 'lib/rouge/lexers/yang.rb', line 28

def self.meta_stmts_keywords
  @meta_stmts_keywords ||= Set.new %w(
    contact description organization reference revision
  )
end

.module_header_stmts_keywordsObject



22
23
24
25
26
# File 'lib/rouge/lexers/yang.rb', line 22

def self.module_header_stmts_keywords
  @module_header_stmts_keywords ||= Set.new %w(
    belongs-to namespace prefix yang-version
  )
end

.top_stmts_keywordsObject

Keywords from RFC7950 ; oriented at BNF style



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

def self.top_stmts_keywords
  @top_stms_keywords ||= Set.new %w(
    module submodule
  )
end

.type_stmts_keywordsObject



54
55
56
57
58
59
60
# File 'lib/rouge/lexers/yang.rb', line 54

def self.type_stmts_keywords
  @type_stmts_keywords ||= Set.new %w(
    base bit default enum error-app-tag error-message fraction-digits
    length max-elements min-elements modifier ordered-by path pattern
    position range require-instance status type units value yin-element
  )
end

.typesObject

RFC7950 Built-In Types



77
78
79
80
81
82
83
# File 'lib/rouge/lexers/yang.rb', line 77

def self.types
  @types ||= Set.new %w(
    binary bits boolean decimal64 empty enumeration identityref
    instance-identifier int16 int32 int64 int8 leafref string uint16
    uint32 uint64 uint8 union
  )
end