New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing StringScanner methods #11259
Comments
I particularly need |
I don't know what you are doing, but |
Also, could you describe what you are doing? |
I am porting this code to Crystal which walks a string attempt to match a series of regexes at each index, and if one of them matches wraps the matching string in ANSI styling: https://github.com/postmodern/hexdump.rb/blob/ead8dc6b45b281423ad7d4ea86d88f533ea0fbb4/lib/hexdump/theme/rule.rb#L129-L146 I even tried rewriting the code to only use Yeah mutable methods like |
Have you tried
|
@HertzDevil ah clever and now the specs pass. Thank you! I still think StringScanner should support more of Ruby's StringScanner to make porting to Crystal easier. |
I agree, though I'll probably name them read_byte, read_char, etc., to match IO |
Crystal's StringScanner does not support every method which Ruby's StringScanner does.
#beginning_of_line?
#get_byte
#getch
#match
#match?
#matched?
#matched_size
#exist?
#pos
#rest?
#rest_size
#pre_match
#post_match
#<<
#concat
#unscan
The text was updated successfully, but these errors were encountered: