import { LexerTypes } from "./LexerType"; import { LexerMatcher } from "./LexerMatcher"; export class LexerMatcherLibraryTest { static readonly CWORD_MATCHER = new LexerMatcher( LexerTypes.CWORD, /[a-zA-Z_]\w*/ ); static readonly CFUNCTION_MATCHER = new LexerMatcher( LexerTypes.CFUNCTION, /[a-zA-Z_]\w*(?=\s*\()/ ); // static readonly CLASSNAME_MATCHER = // new LexerMatcher( LexerTypes.CLASSNAME, /(?<=(?:(?:class|interface|struct)\s+))[a-zA-Z_]\w*/ ); static readonly JSWORD_MATCHER = new LexerMatcher( LexerTypes.JSWORD, /[a-zA-Z_\$]\w*/ ); static readonly PHPWORD_MATCHER = new LexerMatcher( LexerTypes.PHPWORD, /\$?[a-zA-Z_]\w*/ ); static readonly CSS_CLASS_SELECTOR_MATCHER = new LexerMatcher( LexerTypes.CSS_CLASS_SELECTOR, /\.[a-zA-Z_](\w|\-)*/ ); static readonly CSS_ID_SELECTOR_MATCHER = new LexerMatcher( LexerTypes.CSS_ID_SELECTOR, /\#[a-zA-Z_](\w|\-)*/ ); static readonly CSS_WORD_MATCHER = new LexerMatcher( LexerTypes.CSS_WORD, /[a-zA-Z_](\w|\-)*/ ); static readonly HTML_CUSTOM_ELEMENT_MATCHER = new LexerMatcher( LexerTypes.HTML_CUSTOM_ELEMENT, /[a-zA-Z]\w*\-(\w|\-)+/ ); static readonly DOUBLE_QUOTED_STRING_MATCHER = new LexerMatcher( LexerTypes.DOUBLE_QUOTED_STRING, /"(?:[^"\\]|\\.)*"/ ); static readonly SINGLE_QUOTED_STRING_MATCHER = new LexerMatcher( LexerTypes.SINGLE_QUOTED_STRING, /'(?:[^'\\]|\\.)*'/ ); static readonly NUMBER_MATCHER = new LexerMatcher( LexerTypes.NUMBER, /(?=\.\d|\d)(?:\d+)?(?:\.?\d*)(?:[eE][+-]?\d+)?/ ); static readonly WHITESPACE_MATCHER = new LexerMatcher( LexerTypes.WHITESPACE, /\s+/ ); static readonly BREAK_MATCHER = new LexerMatcher( LexerTypes.BREAK, /\n/ ); static readonly NULL_MATCHER = new LexerMatcher( LexerTypes.NULL, /null/ ); static readonly BOOL_MATCHER = new LexerMatcher( LexerTypes.BOOL, /true|false/ ); static readonly LOGIC_MATCHER = new LexerMatcher( LexerTypes.LOGIC, /if|else|switch|do|while|for|break|continue|return/ ); static readonly OPERATOR_MATCHER = new LexerMatcher( LexerTypes.OPERATOR, /\+|\-|\*|\/|\^|\||\~|\&|\%|\<|\>|\=|\!|\.|\:|\,|\;/ ); static readonly BRACKET_MATCHER = new LexerMatcher( LexerTypes.BRACKET, /\(|\)|\[|\]|\{|\}/ ); static readonly BLOCKSTART_MATCHER = new LexerMatcher( LexerTypes.BLOCKSTART, /\{/ ); static readonly BLOCKEND_MATCHER = new LexerMatcher( LexerTypes.BLOCKEND, /\}/ ); static readonly CLASS_MATCHER = new LexerMatcher( LexerTypes.CLASS, /class/ ); static readonly ACCESS_MODIFIER_MATCHER = new LexerMatcher( LexerTypes.ACCESS_MODIFIER, /public|protected|private/ ); static readonly SINGLE_LINE_COMMENT_MATCHER = new LexerMatcher( LexerTypes.SINGLE_LINE_COMMENT, /\/\/.*/ ); static readonly C_INSTRUCTION_MATCHER = new LexerMatcher( LexerTypes.C_INSTRUCTION, /\#.*/ ); static readonly MULTI_LINE_COMMENT_MATCHER = new LexerMatcher( LexerTypes.MULTI_LINE_COMMENT, /\/\*(.|(\r\n|\r|\n))*?\*\// ); static readonly ANY_SYMBOL_MATCHER = new LexerMatcher( LexerTypes.ANY_SYMBOL, /./ ); }