401 """ |
401 """ |
402 name = 'Ruby irb session' |
402 name = 'Ruby irb session' |
403 aliases = ['rbcon', 'irb'] |
403 aliases = ['rbcon', 'irb'] |
404 mimetypes = ['text/x-ruby-shellsession'] |
404 mimetypes = ['text/x-ruby-shellsession'] |
405 |
405 |
406 _prompt_re = re.compile('irb\([a-zA-Z_]\w*\):\d{3}:\d+[>*"\'] ' |
406 _prompt_re = re.compile(r'irb\([a-zA-Z_]\w*\):\d{3}:\d+[>*"\'] ' |
407 '|>> |\?> ') |
407 r'|>> |\?> ') |
408 |
408 |
409 def get_tokens_unprocessed(self, text): |
409 def get_tokens_unprocessed(self, text): |
410 rblexer = RubyLexer(**self.options) |
410 rblexer = RubyLexer(**self.options) |
411 |
411 |
412 curcode = '' |
412 curcode = '' |
496 Name.Builtin), |
496 Name.Builtin), |
497 # functions |
497 # functions |
498 (r'[a-zA-Z](\w|[-+?!=*/^><%])*:', Name.Function), |
498 (r'[a-zA-Z](\w|[-+?!=*/^><%])*:', Name.Function), |
499 # operators, must be below functions |
499 # operators, must be below functions |
500 (r'[-+*/~,<>=&!?%^\[\].$]+', Operator), |
500 (r'[-+*/~,<>=&!?%^\[\].$]+', Operator), |
501 ('[A-Z]\w*', Name.Constant), |
501 (r'[A-Z]\w*', Name.Constant), |
502 ('@[a-zA-Z_]\w*', Name.Variable.Instance), |
502 (r'@[a-zA-Z_]\w*', Name.Variable.Instance), |
503 ('@@[a-zA-Z_]\w*', Name.Variable.Class), |
503 (r'@@[a-zA-Z_]\w*', Name.Variable.Class), |
504 ('@@?', Operator), |
504 ('@@?', Operator), |
505 ('[a-zA-Z_]\w*', Name), |
505 (r'[a-zA-Z_]\w*', Name), |
506 # numbers - / checks are necessary to avoid mismarking regexes, |
506 # numbers - / checks are necessary to avoid mismarking regexes, |
507 # see comment in RubyLexer |
507 # see comment in RubyLexer |
508 (r'(0[oO]?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?', |
508 (r'(0[oO]?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?', |
509 bygroups(Number.Oct, Text, Operator)), |
509 bygroups(Number.Oct, Text, Operator)), |
510 (r'(0[xX][0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?', |
510 (r'(0[xX][0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?', |