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, #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, #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
token
Constructor Details
This class inherits a constructor from Rouge::Lexer
Class Method Details
.keywords ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/rouge/lexers/sml.rb', line 15
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
25
26
27
|
# File 'lib/rouge/lexers/sml.rb', line 25
def self.symbolic_reserved
@symbolic_reserved ||= Set.new %w(: | = => -> # :>)
end
|
Instance Method Details
#token_for_final_id(id) ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/rouge/lexers/sml.rb', line 62
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
70
71
72
73
74
75
76
77
78
|
# File 'lib/rouge/lexers/sml.rb', line 70
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
54
55
56
57
58
59
60
|
# File 'lib/rouge/lexers/sml.rb', line 54
def token_for_id_with_dot(id)
if self.class.keywords.include? id
Error
else
Name::Namespace
end
end
|