Module: ABNF::Parser::Controls::Compiler::Tokens

Extended by:
Tokens
Included in:
Tokens
Defined in:
lib/abnf/parser/controls/compiler/tokens.rb

Instance Method Summary collapse

Instance Method Details

#alternation_slashObject



8
9
10
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 8

def alternation_slash
  Parser::Compiler::Token.new 'alternation-SLASH', ' / '
end

#bin_val_rangeObject



12
13
14
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 12

def bin_val_range
  Parser::Compiler::Token.new 'bin-val-RANGE', '%b100000-100001'
end

#bin_val_sequenceObject



16
17
18
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 16

def bin_val_sequence
  Parser::Compiler::Token.new 'bin-val-SEQUENCE', '%b1100110.1101111.1101111'
end

#c_nl(comment = nil) ⇒ Object



20
21
22
23
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 20

def c_nl comment=nil
  abnf = "#{comment}\r\n"
  Parser::Compiler::Token.new 'c-nl', abnf
end

#c_wsp(abnf = nil) ⇒ Object



25
26
27
28
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 25

def c_wsp abnf=nil
  abnf ||= ' '
  Parser::Compiler::Token.new 'c-wsp', abnf
end

#char_val(string = nil) ⇒ Object



30
31
32
33
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 30

def char_val string=nil
  string ||= 'foo'
  Parser::Compiler::Token.new 'char-val', string.inspect
end

#dec_val_rangeObject



35
36
37
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 35

def dec_val_range
  Parser::Compiler::Token.new 'dec-val-RANGE', '%d32-33'
end

#dec_val_sequenceObject



39
40
41
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 39

def dec_val_sequence
  Parser::Compiler::Token.new 'dec-val-SEQUENCE', '%d102.111.111'
end

#defined_as(operator = nil) ⇒ Object



43
44
45
46
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 43

def defined_as operator=nil
  operator ||= '='
  Parser::Compiler::Token.new 'defined-as', operator
end

#group_startObject



48
49
50
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 48

def group_start
  Parser::Compiler::Token.new 'group-START', '( '
end

#group_stopObject



52
53
54
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 52

def group_stop
  Parser::Compiler::Token.new 'group-STOP', ' )'
end

#hex_val_rangeObject



56
57
58
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 56

def hex_val_range
  Parser::Compiler::Token.new 'hex-val-RANGE', '%x20-21'
end

#hex_val_sequence(sequence = nil) ⇒ Object Also known as: example, foo, num_val, terminal



60
61
62
63
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 60

def hex_val_sequence sequence=nil
  sequence ||= ABNF.foo
  Parser::Compiler::Token.new 'hex-val-SEQUENCE', sequence
end

#option_startObject



69
70
71
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 69

def option_start
  Parser::Compiler::Token.new 'option-START', '[ '
end

#option_stopObject



73
74
75
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 73

def option_stop
  Parser::Compiler::Token.new 'option-STOP', ' ]'
end

#prose_valObject



77
78
79
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 77

def prose_val
  Parser::Compiler::Token.new 'prose-val', '<Some Prose>'
end

#repeat_exactObject



81
82
83
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 81

def repeat_exact
  Parser::Compiler::Token.new 'repeat-EXACT', '1'
end

#repeat_range(abnf = nil) ⇒ Object



85
86
87
88
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 85

def repeat_range abnf=nil
  abnf ||= '*'
  Parser::Compiler::Token.new 'repeat-RANGE', abnf
end

#rulenameObject



90
91
92
# File 'lib/abnf/parser/controls/compiler/tokens.rb', line 90

def rulename
  Parser::Compiler::Token.new 'rulename', 'some-rule'
end