Class: Rouge::Lexers::Perl
- Inherits:
-
RegexLexer
- Object
- Rouge::Lexer
- RegexLexer
- Rouge::Lexers::Perl
- Defined in:
- lib/rouge/lexers/perl.rb
Constant Summary collapse
- KEYWORDS =
Set.new %w( case continue do else elsif for foreach if last my next our redo reset then unless until while use print new BEGIN CHECK INIT END return )
- BUILTINS =
Set.new %w( abs accept alarm atan2 bind binmode bless caller chdir chmod chomp chop chown chr chroot close closedir connect continue cos crypt dbmclose dbmopen defined delete die dump each endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl fileno flock fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt glob gmtime goto grep hex import index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat map mkdir msgctl msgget msgrcv msgsnd my next no oct open opendir ord our pack package pipe pop pos printf prototype push quotemeta rand read readdir readline readlink readpipe recv redo ref rename require reverse rewinddir rindex rmdir scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat study substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unlink unpack unshift untie utime values vec wait waitpid wantarray warn write )
- OPERATOR_WORDS =
Set.new %w(eq lt gt le ge ne not and or cmp)
- BALANCED_DELIMITERS =
{ '{' => '}', '(' => ')', '[' => ']', '<' => '>', }
Constants inherited from RegexLexer
Constants included from Token::Tokens
Token::Tokens::Num, Token::Tokens::Str
Instance Attribute Summary
Attributes inherited from Rouge::Lexer
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from RegexLexer
append, #delegate, #fallthrough!, get_state, #get_state, #goto, #group, #groups, #in_state?, #inspect_details, #pop!, prepend, #push, #recurse, replace_state, #reset!, #reset_stack, #stack, start, start_procs, state, #state, #state?, state_definitions, states, #step, #stream_tokens, #token
Methods inherited from Rouge::Lexer
aliases, all, #as_bool, #as_lexer, #as_list, #as_string, #as_token, assert_utf8!, #bool_option, continue_lex, #continue_lex, debug_enabled?, demo, demo_file, desc, detectable?, disable_debug!, eager_load!, #eager_load!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, #inspect, #inspect_details, #inspect_parts, lazy, lex, #lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, skip_auto_load?, #stream_tokens, #string_option, tag, #tag, title, #token_option, #with
Methods included from Token::Tokens
Constructor Details
This class inherits a constructor from Rouge::Lexer
Class Method Details
.detect?(text) ⇒ Boolean
16 17 18 |
# File 'lib/rouge/lexers/perl.rb', line 16 def self.detect?(text) return true if text.shebang? 'perl' end |
Instance Method Details
#open_regex!(delimiter) ⇒ Object
121 122 123 124 |
# File 'lib/rouge/lexers/perl.rb', line 121 def open_regex!(delimiter) @regex_end = BALANCED_DELIMITERS.fetch(delimiter, delimiter) push :regex end |
#open_regex_operator!(delimiter) ⇒ Object
126 127 128 129 130 131 132 133 134 |
# File 'lib/rouge/lexers/perl.rb', line 126 def open_regex_operator!(delimiter) if BALANCED_DELIMITERS.key?(delimiter) push :balanced_regex else push :continued_regex end open_regex!(delimiter) end |