/// <summary>Creates a new variable fragment by reading it from the given lexer.</summary> /// <param name="sr">The lexer to read the variable from.</param> public VariableFragment(CodeLexer sr) { Value += char.ToLower(sr.Read()); // Read until some other block can take over: while (true) { char peek = sr.Peek(); if (peek == ';' || peek == ',' || peek == StringReader.NULL || BracketFragment.AnyBracket(peek)) { // Pass control back to the operation: break; } if (sr.PeekJunk()) { // Is Value anything special? if (Value == "var") { break; } else if (Value == "private") { break; } else if (Value == "function") { break; } else if (Value == "class") { break; } else if (Value == "new") { GivenType = new TypeFragment(sr, false); break; } else if (IsKeyword()) { break; } } Handler handle = Handlers.Find(peek); if (handle != Handler.Stop && handle != Handler.Variable && handle != Handler.Number) { break; } Value += char.ToLower(sr.Read()); } }
/// <summary>Creates a new variable fragment by reading it from the given lexer.</summary> /// <param name="sr">The lexer to read the variable from.</param> public VariableFragment(CodeLexer sr){ Value+=char.ToLower(sr.Read()); // Read until some other block can take over: while(true){ char peek=sr.Peek(); if(peek==';'||peek==','||peek==StringReader.NULL||BracketFragment.AnyBracket(peek)){ // Pass control back to the operation: break; } if(sr.PeekJunk()){ // Is Value anything special? if(Value=="var"){ break; }else if(Value=="private"){ break; }else if(Value=="function"){ break; }else if(Value=="class"){ break; }else if(Value=="new"){ GivenType=new TypeFragment(sr,false); break; }else if(IsKeyword()){ break; } } Handler handle=Handlers.Find(peek); if(handle!=Handler.Stop&&handle!=Handler.Variable&&handle!=Handler.Number){ break; } Value+=char.ToLower(sr.Read()); } }