Class: Rubber::TokenStringScanner

Inherits:
StringScanner
  • Object
show all
Defined in:
lib/rubber/scanner.rb

Instance Method Summary collapse

Instance Method Details

#scan(*args) ⇒ Object



26
27
28
29
30
# File 'lib/rubber/scanner.rb', line 26

def scan(*args)
  x = super
  #p [x, *args] if x
  x
end

#scan_constantObject



43
44
45
# File 'lib/rubber/scanner.rb', line 43

def scan_constant
  scan(/([A-Z][a-z_0-9A-Z]*)/)
end

#scan_floatObject



37
38
39
# File 'lib/rubber/scanner.rb', line 37

def scan_float
  scan(/(\d[.]\d+)/)
end

#scan_lit_boolObject



58
59
60
# File 'lib/rubber/scanner.rb', line 58

def scan_lit_bool
  scan(/TRUE|FALSE/i)
end

#scan_lit_integerObject



40
41
42
# File 'lib/rubber/scanner.rb', line 40

def scan_lit_integer
  scan(/([0-9]+)/)
end

#scan_lit_stringObject



34
35
36
# File 'lib/rubber/scanner.rb', line 34

def scan_lit_string
  scan(/(".*?[^\\]")/)
end

#scan_literalObject



49
50
51
# File 'lib/rubber/scanner.rb', line 49

def scan_literal
  scan(/([A-Za-z0-9_]+)/)
end

#scan_nilObject



55
56
57
# File 'lib/rubber/scanner.rb', line 55

def scan_nil
  scan(/NULL|nil/i)
end

#scan_numberObject



31
32
33
# File 'lib/rubber/scanner.rb', line 31

def scan_number
  scan(/(0x[0-9A-Fa-f]+|[0-9]+[.][0-9]+(e[0-9]+)?|[0-9]+)/)
end

#scan_pc_blockObject



61
62
63
64
65
# File 'lib/rubber/scanner.rb', line 61

def scan_pc_block
  raw = scan_until(/%\}/)
  raw[-2..-1] = ""
  raw
end

#scan_upcase_constantObject



46
47
48
# File 'lib/rubber/scanner.rb', line 46

def scan_upcase_constant
  scan(/([A-Z][0-9A-Z_]*)/)
end

#skip(*args) ⇒ Object



21
22
23
24
25
# File 'lib/rubber/scanner.rb', line 21

def skip(*args)
  x = super
  #p [x, *args] if x
  x
end

#skip_wsObject



52
53
54
# File 'lib/rubber/scanner.rb', line 52

def skip_ws
  skip(/\s+/)
end