Class: Rouge::Lexers::HyLang
- Inherits:
-
RegexLexer
- Object
- Rouge::Lexer
- RegexLexer
- Rouge::Lexers::HyLang
- Defined in:
- lib/rouge/lexers/hylang.rb
Constant Summary
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, #goto, #group, #groups, #in_state?, #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, #bool_option, continue_lex, #continue_lex, debug_enabled?, demo, demo_file, desc, detect?, detectable?, disable_debug!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, lex, #lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, #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
.builtins ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rouge/lexers/hylang.rb', line 25 def self.builtins @builtins ||= Set.new %w( != % %= & &= * ** **= *= *map + += , - -= -> ->> . / // //= /= < << <<= <= = > >= >> >>= @ @= ^ ^= accumulate apply as-> assoc butlast calling-module-name car cdr chain coll? combinations comp complement compress cond cons cons? constantly count cut cycle dec defclass defmacro defmacro! defmacro/g! defmain defn defreader dict-comp disassemble dispatch-reader-macro distinct do doto drop drop-last drop-while empty? eval eval-and-compile eval-when-compile even? every? filter first flatten float? fn for* fraction genexpr gensym get group-by identity if* if-not if-python2 inc input instance? integer integer-char? integer? interleave interpose islice iterable? iterate iterator? juxt keyword keyword? last let lif lif-not list* list-comp macro-error macroexpand macroexpand-1 map merge-with multicombinations name neg? none? not-in not? nth numeric? odd? partition permutations pos? product quasiquote quote range read read-str reduce remove repeat repeatedly require rest second set-comp setv some string string? symbol? take take-nth take-while tee unless unquote unquote-splicing when with* with-decorator with-gensyms xor yield-from zero? zip zip-longest | |= ~ ) end |
.keywords ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/rouge/lexers/hylang.rb', line 17 def self.keywords @keywords ||= Set.new %w( False None True and as assert break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try ) end |
Instance Method Details
#name_token(name) ⇒ Object
50 51 52 53 54 |
# File 'lib/rouge/lexers/hylang.rb', line 50 def name_token(name) return Keyword if self.class.keywords.include?(name) return Name::Builtin if self.class.builtins.include?(name) nil end |