# File lib/puppet/parser/lexer.rb, line 277 277: def find_string_token 278: matched_token = value = nil 279: 280: # We know our longest string token is three chars, so try each size in turn 281: # until we either match or run out of chars. This way our worst-case is three 282: # tries, where it is otherwise the number of string chars we have. Also, 283: # the lookups are optimized hash lookups, instead of regex scans. 284: [3, 2, 1].each do |i| 285: str = @scanner.peek(i) 286: if matched_token = TOKENS.lookup(str) 287: value = @scanner.scan(matched_token.regex) 288: break 289: end 290: end 291: 292: return matched_token, value 293: end