protected override void ResolveDqsEscape(EscapeMatch escapeMatch, StringBuilder sb) { char c = ResolveDqsEscapeChar(escapeMatch); if (IsLegalXmlChar(c)) { sb.Append(c); } }
protected char ResolveDqsEscapeCode(EscapeMatch escapeMatch) { var code = escapeMatch.Value.TrimStart('$', '(', '\t', ' ').TrimEnd(')', '\t', ' '); if (code[0] != '#') { return((char)int.Parse(code)); } return(Convert.ToChar(Convert.ToUInt32(code.Substring(1), 16))); }
protected char ResolveDqsEscapeChar(EscapeMatch escapeMatch) { var text = escapeMatch.Value; if (text[0] == '$') { return(ResolveDqsEscapeCode(escapeMatch)); } //This is EscSeq switch (text[1]) { //'$'|'b'|'f'|'n'|'r'|'t'|'v' case '"': case '\'': case '\\': case '/': case '$': return(text[1]); case 'b': return((char)8); case 'f': return((char)0xC); case 'n': return((char)0xA); case 'r': return((char)0xD); case 't': return((char)0x9); case 'v': return((char)0xB); case 'u': return(Convert.ToChar(Convert.ToUInt32(text.Substring(2), 16))); } return((char)0);//should never reach this code if lexer works correctly }
protected virtual void ResolveDqsEscape(EscapeMatch escapeMatch, StringBuilder sb) { char c = ResolveDqsEscapeChar(escapeMatch); sb.Append(c); }