Class: Rouge::Lexers::SML
Constant Summary
Constants inherited
from RegexLexer
RegexLexer::MAX_NULL_SCANS
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, 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, #as_bool, #as_lexer, #as_list, #as_string, #as_token, assert_utf8!, #bool_option, debug_enabled?, demo, demo_file, desc, 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, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option
token
Constructor Details
This class inherits a constructor from Rouge::Lexer
Class Method Details
.analyze_text(text) ⇒ Object
31
32
33
|
# File 'lib/rouge/lexers/sml.rb', line 31
def self.analyze_text(text)
return 0
end
|
.keywords ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/rouge/lexers/sml.rb', line 14
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
24
25
26
|
# File 'lib/rouge/lexers/sml.rb', line 24
def self.symbolic_reserved
@symbolic_reserved ||= Set.new %w(: | = => -> # :>)
end
|
Instance Method Details
#token_for_final_id(id) ⇒ Object
65
66
67
68
69
70
71
|
# File 'lib/rouge/lexers/sml.rb', line 65
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
73
74
75
76
77
78
79
80
81
|
# File 'lib/rouge/lexers/sml.rb', line 73
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
57
58
59
60
61
62
63
|
# File 'lib/rouge/lexers/sml.rb', line 57
def token_for_id_with_dot(id)
if self.class.keywords.include? id
Error
else
Name::Namespace
end
end
|