# File lib/puppet/parser/lexer.rb, line 334 334: def find_regex_token 335: @regex += 1 336: best_token = nil 337: best_length = 0 338: 339: # I tried optimizing based on the first char, but it had 340: # a slightly negative affect and was a good bit more complicated. 341: TOKENS.regex_tokens.each do |token| 342: if length = @scanner.match?(token.regex) and token.acceptable?(lexing_context) 343: # We've found a longer match 344: if length > best_length 345: best_length = length 346: best_token = token 347: end 348: end 349: end 350: 351: return best_token, @scanner.scan(best_token.regex) if best_token 352: end