private int _lines; // source lines counter /// <summary> /// Initializes new instance of a scanner object with given source /// </summary> /// <param name="source">Source for scanning</param> /// <remarks> /// <paramref name="source"/> must not be null /// </remarks> protected Scanner(IScannerSource source) { Debug.Assert(source != null, "Scanner source must not be null"); _source = source; _lines = 0; }
private string[] keywords; // all keywords // construct scanner instance for given source public CSScanner(IScannerSource source) : base(source) { all = new CharSet(); all.Add('\u0001', '\uFFFF'); numeric = new CharSet(); numeric.Add('0', '9'); hexadecimal = new CharSet(); hexadecimal.Add('0', '9'); hexadecimal.Add('A', 'F'); hexadecimal.Add('a', 'f'); alpha = new CharSet(); alpha.Add('_'); alpha.Add('A', 'Z'); alpha.Add('a', 'z'); // TODO: refine alpha range alpha.Add('\u0100', '\uFFFF'); alphanum = new CharSet(alpha); alphanum.Add('0', '9'); hexprefixes = new string[] { "0x", "0X" }; escapes = new string[] { "\\'", "\\\"", "\\\\", "\\t", "\\r", "\\n", "\\b", "\\f", "\\0" }; compounds = new string[] { "<<=", ">>=", "==", "!=", "=>", "&&", "??", "++", "--", "||", ">=", "<=", "+=", "-=", "/=", "*=", "%=", "&=", "|=", "^=", "->" }; keywords = new string[] { "abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "extern", "false", "finally", "float", "for", "foreach", "get", "goto", "if", "int", "interface", "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "override", "params", "partial", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "set", "short", "sizeof", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "using", "ushort", "var", "virtual", "void", "while", "yield" }; }
internal Scanner(IScannerSource source, ScannerErrorHandler errorHandler) { this._source = source; this._errorHandler = errorHandler; }