Class: Rouge::Lexers::Janet

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/janet.rb

Constant Summary

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

Token::Tokens::Num, Token::Tokens::Str

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

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

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.bundledObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/rouge/lexers/janet.rb', line 23

def self.bundled
  @bundled ||= Set.new %w(
    % %= * *= + ++ += - -- -= -> ->> -?> -?>> / /= < <= = > >=
    abstract? accumulate accumulate2 all all-bindings
    all-dynamics and apply array array/concat array/ensure
    array/fill array/insert array/new array/new-filled
    array/peek array/pop array/push array/remove array/slice
    array? as-> as?-> asm assert bad-compile bad-parse band
    blshift bnot boolean? bor brshift brushift buffer buffer/bit
    buffer/bit-clear buffer/bit-set buffer/bit-toggle
    buffer/blit buffer/clear buffer/fill buffer/format
    buffer/new buffer/new-filled buffer/popn buffer/push-byte
    buffer/push-string buffer/push-word buffer/slice buffer?
    bxor bytes? case cfunction? chr cli-main comment comp
    compare compare= compare< compare<= compare> compare>=
    compile complement comptime cond coro count debug
    debug/arg-stack debug/break debug/fbreak debug/lineage
    debug/stack debug/stacktrace debug/step debug/unbreak
    debug/unfbreak debugger-env dec deep-not= deep= default
    default-peg-grammar def- defer defmacro defmacro- defn defn-
    defglobal describe dictionary? disasm distinct doc doc*
    doc-format dofile drop drop-until drop-while dyn each eachk
    eachp eachy edefer eflush empty? env-lookup eprin eprinf
    eprint eprintf error errorf eval eval-string even? every?
    extreme false? fiber/can-resume? fiber/current fiber/getenv
    fiber/maxstack fiber/new fiber/root fiber/setenv
    fiber/setmaxstack fiber/status fiber? file/close file/flush
    file/open file/popen file/read file/seek file/temp
    file/write filter find find-index first flatten flatten-into
    flush for forv freeze frequencies function? gccollect
    gcinterval gcsetinterval generate gensym get get-in getline
    hash idempotent? identity import import* if-let if-not
    if-with in inc indexed? int/s64 int/u64 int? interleave
    interpose invert janet/build janet/config-bits janet/version
    juxt juxt* keep keys keyword keyword? kvs label last length
    let load-image load-image-dict loop macex macex1 make-env
    make-image make-image-dict map mapcat marshal math/-inf
    math/abs math/acos math/acosh math/asin math/asinh math/atan
    math/atan2 math/atanh math/cbrt math/ceil math/cos math/cosh
    math/e math/erf math/erfc math/exp math/exp2 math/expm1
    math/floor math/gamma math/hypot math/inf math/log
    math/log10 math/log1p math/log2 math/next math/pi math/pow
    math/random math/rng math/rng-buffer math/rng-int
    math/rng-uniform math/round math/seedrandom math/sin
    math/sinh math/sqrt math/tan math/tanh math/trunc match max
    mean merge merge-into min mod module/add-paths module/cache
    module/expand-path module/find module/loaders module/loading
    module/paths nan? nat? native neg? net/chunk net/close
    net/connect net/read net/server net/write next nil? not not=
    number? odd? one? or os/arch os/cd os/chmod os/clock
    os/cryptorand os/cwd os/date os/dir os/environ os/execute
    os/exit os/getenv os/link os/lstat os/mkdir os/mktime
    os/perm-int os/perm-string os/readlink os/realpath os/rename
    os/rm os/rmdir os/setenv os/shell os/sleep os/stat
    os/symlink os/time os/touch os/umask os/which pairs parse
    parser/byte parser/clone parser/consume parser/eof
    parser/error parser/flush parser/has-more parser/insert
    parser/new parser/produce parser/state parser/status
    parser/where partial partition peg/compile peg/match pos?
    postwalk pp prewalk prin prinf print printf product prompt
    propagate protect put put-in quit range reduce reduce2
    repeat repl require resume return reverse reversed root-env
    run-context scan-number seq setdyn shortfn signal slice
    slurp some sort sort-by sorted sorted-by spit stderr stdin
    stdout string string/ascii-lower string/ascii-upper
    string/bytes string/check-set string/find string/find-all
    string/format string/from-bytes string/has-prefix?
    string/has-suffix? string/join string/repeat string/replace
    string/replace-all string/reverse string/slice string/split
    string/trim string/triml string/trimr string? struct struct?
    sum symbol symbol? table table/clone table/getproto
    table/new table/rawget table/setproto table/to-struct table?
    take take-until take-while tarray/buffer tarray/copy-bytes
    tarray/length tarray/new tarray/properties tarray/slice
    tarray/swap-bytes thread/close thread/current thread/new
    thread/receive thread/send trace tracev true? truthy? try
    tuple tuple/brackets tuple/setmap tuple/slice
    tuple/sourcemap tuple/type tuple? type unless unmarshal
    untrace update update-in use values var- varfn varglobal
    walk walk-ind walk-dict when when-let when-with with
    with-dyns with-syms with-vars yield zero? zipcoll
  )
end

.specialsObject



17
18
19
20
21
# File 'lib/rouge/lexers/janet.rb', line 17

def self.specials
  @specials ||= Set.new %w(
    break def do fn if quote quasiquote splice set unquote var while
  )
end

Instance Method Details

#name_token(name) ⇒ Object



107
108
109
110
111
112
113
114
115
# File 'lib/rouge/lexers/janet.rb', line 107

def name_token(name)
  if self.class.specials.include? name
    Keyword
  elsif self.class.bundled.include? name
    Keyword::Reserved
  else
    Name::Function
  end
end