using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; namespace Rokojori { public class CSharpLexer:Lexer { public static List Lex( string source ) { var lexer = new CSharpLexer(); var events = lexer.LexToList( source ); if ( lexer.hasError ) { return null; } events.ForEach( ev => { ev.GrabMatch( source ); } ); return events; } public CSharpLexer() { AddAllMatchers( LexerMatcherLibrary.SINGLE_LINE_COMMENT_MATCHER, LexerMatcherLibrary.MULTI_LINE_COMMENT_MATCHER, LexerMatcherLibrary.DOUBLE_QUOTED_STRING_MATCHER, LexerMatcherLibrary.SINGLE_QUOTED_STRING_MATCHER, LexerMatcherLibrary.C_INSTRUCTION_MATCHER, LexerMatcherLibrary.NUMBER_MATCHER, LexerMatcherLibrary.NULL_MATCHER, LexerMatcherLibrary.BOOL_MATCHER, LexerMatcherLibrary.BREAK_MATCHER, LexerMatcherLibrary.WHITESPACE_MATCHER, LexerMatcherLibrary.LOGIC_MATCHER, LexerMatcherLibrary.BRACKET_MATCHER, LexerMatcherLibrary.ACCESS_MODIFIER_MATCHER, LexerMatcherLibrary.CLASS_MATCHER, LexerMatcherLibrary.OPERATOR_MATCHER, LexerMatcherLibrary.CFUNCTION_MATCHER, LexerMatcherLibrary.CWORD_MATCHER, LexerMatcherLibrary.ANY_SYMBOL_MATCHER ); } } }