Class: SrcLexer::CSharpLexer

Inherits:
Lexer
  • Object
show all
Defined in:
lib/src_lexer.rb

Constant Summary

Constants inherited from Lexer

Lexer::END_TOKEN, Lexer::NUMBER_REGEX, Lexer::STRING_REGEX

Instance Attribute Summary

Attributes inherited from Lexer

#comment_markers, #keywords, #line_comment_marker, #str, #string_literal_marker, #symbols, #tokens

Instance Method Summary collapse

Methods inherited from Lexer

#analyze, #pop_token

Constructor Details

#initializeCSharpLexer

Returns a new instance of CSharpLexer.



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/src_lexer.rb', line 185

def initialize
  super(
    [ # C# keywords
      'abstract',   'as',       'base',       'bool',      'break',
      'byte',       'case',     'catch',      'char',      'checked',
      'class',      'const',    'continue',   'decimal',   'default',
      'delegate',   'do',       'double',     'else',      'enum',
      'event',      'explicit', 'extern',     'false',     'finally',
      'fixed',      'float',    'for',        'foreach',   'goto',
      'if',         'implicit', 'in',         'int',       'interface',
      'internal',   'is',       'lock',       'long',      'namespace',
      'new',        'null',     'object',     'operator',  'out',
      'override',   'params',   'private',    'protected', 'public',
      'readonly',   'ref',      'return',     'sbyte',     'sealed',
      'short',      'sizeof',   'stackalloc', 'static',    'string',
      'struct',     'switch',   'this',       'throw',     'true',
      'try',        'typeof',   'uint',       'ulong',     'unchecked',
      'unsafe',     'ushort',   'using',      'virtual',   'void',
      'volatile',   'while',
      # C# context keywords
      'add',        'alias',    'ascending',  'async',     'await',
      'descending', 'dynamic',  'from',       'get',       'global',
      'group',      'into',     'join',       'let',       'orderby',
      'partial',    'remove',   'select',     'set',       'value',
      'var',        'where',    'yield'
    ],
    [
      '<<=', '>>=', '<<',  '>>',  '<=',
      '>=',  '==',  '!=',  '&&',  '||',
      '??',  '+=',  '-=',  '*=',  '/=',
      '%=',  '&=',  '|=',  '^=',  '=>',
      '*',   '/',   '%',   '+',   '-',
      '<',   '>',   '&',   '^',   '|',
      '?',   ':',   '=',   '{',   '}',
      '(',   ')',   '[',   ']',   ';',
      ','
    ],
    ['"', '"'], # comment markers
    '//', # line comment marker
    ['/*', '*/']) # multi line comment markers
end