Class: Rouge::Lexers::SML
Constant Summary
Constants inherited
from RegexLexer
RegexLexer::MAX_NULL_SCANS
Token::Tokens::Num, Token::Tokens::Str
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from RegexLexer
append, #delegate, get_state, #get_state, #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
aliases, all, assert_utf8!, #debug, default_options, demo, demo_file, desc, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #initialize, lex, #lex, mimetypes, #option, #options, #reset!, #stream_tokens, tag, #tag
token
Constructor Details
This class inherits a constructor from Rouge::Lexer
Class Method Details
.analyze_text(text) ⇒ Object
28
29
30
|
# File 'lib/rouge/lexers/sml.rb', line 28
def self.analyze_text(text)
return 0
end
|
.keywords ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'lib/rouge/lexers/sml.rb', line 11
def self.keywords
@keywords ||= Set.new %w(
abstype and andalso as case datatype do else end exception
fn fun handle if in infix infixr let local nonfix of op open
orelse raise rec then type val with withtype while
eqtype functor include sharing sig signature struct structure
where
)
end
|
.symbolic_reserved ⇒ Object
21
22
23
|
# File 'lib/rouge/lexers/sml.rb', line 21
def self.symbolic_reserved
@symbolic_reserved ||= Set.new %w(: | = => -> # :>)
end
|
Instance Method Details
#token_for_final_id(id) ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/rouge/lexers/sml.rb', line 61
def token_for_final_id(id)
if self.class.keywords.include? id or self.class.symbolic_reserved.include? id
Error
else
Name
end
end
|
#token_for_id(id) ⇒ Object
69
70
71
72
73
74
75
76
77
|
# File 'lib/rouge/lexers/sml.rb', line 69
def token_for_id(id)
if self.class.keywords.include? id
Keyword::Reserved
elsif self.class.symbolic_reserved.include? id
Punctuation
else
Name
end
end
|
#token_for_id_with_dot(id) ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/rouge/lexers/sml.rb', line 53
def token_for_id_with_dot(id)
if self.class.keywords.include? id
Error
else
Name::Namespace
end
end
|