Module: RubyLexer::SSWrapper

Included in:
RubyLexer
Defined in:
lib/ruby_lexer.rb

Instance Method Summary collapse

Instance Method Details

#beginning_of_line?Boolean Also known as: bol?

Returns:

  • (Boolean)


1010
1011
1012
# File 'lib/ruby_lexer.rb', line 1010

def beginning_of_line?
  ss.bol?
end

#check(re) ⇒ Object



1016
1017
1018
1019
1020
# File 'lib/ruby_lexer.rb', line 1016

def check re
  maybe_pop_stack

  ss.check re
end

#end_of_stream?Boolean Also known as: eos?

Returns:

  • (Boolean)


1022
1023
1024
# File 'lib/ruby_lexer.rb', line 1022

def end_of_stream?
  ss.eos?
end

#getchObject



1028
1029
1030
1031
1032
# File 'lib/ruby_lexer.rb', line 1028

def getch
  c = ss.getch
  c = ss.getch if c == "\r" && ss.peek(1) == "\n"
  c
end

#in_heredoc?Boolean

Returns:

  • (Boolean)


1042
1043
1044
# File 'lib/ruby_lexer.rb', line 1042

def in_heredoc?
  !!self.old_ss
end

#matchObject



1034
1035
1036
# File 'lib/ruby_lexer.rb', line 1034

def match
  ss
end

#matchedObject



1038
1039
1040
# File 'lib/ruby_lexer.rb', line 1038

def matched
  ss.matched
end

#maybe_pop_stackObject



1046
1047
1048
1049
1050
1051
# File 'lib/ruby_lexer.rb', line 1046

def maybe_pop_stack
  if ss.eos? && in_heredoc? then
    self.ss_pop
    self.lineno_pop
  end
end

#posObject



1053
1054
1055
# File 'lib/ruby_lexer.rb', line 1053

def pos
  ss.pos
end

#pos=(n) ⇒ Object



1057
1058
1059
# File 'lib/ruby_lexer.rb', line 1057

def pos= n
  ss.pos = n
end

#restObject



1061
1062
1063
# File 'lib/ruby_lexer.rb', line 1061

def rest
  ss.rest
end

#scan(re) ⇒ Object



1065
1066
1067
1068
1069
# File 'lib/ruby_lexer.rb', line 1065

def scan re
  maybe_pop_stack

  ss.scan re
end

#scanner_classObject

TODO: design this out of oedipus_lex. or something.



1071
1072
1073
# File 'lib/ruby_lexer.rb', line 1071

def scanner_class # TODO: design this out of oedipus_lex. or something.
  RPStringScanner
end

#ss_stringObject



1075
1076
1077
# File 'lib/ruby_lexer.rb', line 1075

def ss_string
  ss.string
end

#ss_string=(s) ⇒ Object



1079
1080
1081
1082
# File 'lib/ruby_lexer.rb', line 1079

def ss_string= s
  raise "Probably not"
  ss.string = s
end

#string=(s) ⇒ Object



1006
1007
1008
# File 'lib/ruby_lexer.rb', line 1006

def string= s
  ss.string= s
end

#unscanObject



1084
1085
1086
# File 'lib/ruby_lexer.rb', line 1084

def unscan
  ss.unscan
end