# File lib/puppet/parser/lexer.rb, line 296 296: def find_regex_token 297: @regex += 1 298: best_token = nil 299: best_length = 0 300: 301: # I tried optimizing based on the first char, but it had 302: # a slightly negative affect and was a good bit more complicated. 303: TOKENS.regex_tokens.each do |token| 304: if length = @scanner.match?(token.regex) and token.acceptable?(lexing_context) 305: # We've found a longer match 306: if length > best_length 307: best_length = length 308: best_token = token 309: end 310: end 311: end 312: 313: return best_token, @scanner.scan(best_token.regex) if best_token 314: end