protected override void Visit(ISyntaxContext context, BinaryWriter writer) { foreach (Char ch in _data) { writer.Write(StringCodes.GetInstance().Encode(ch)); } }
public PScriptString(string source) : base(source) { String pattern = "\"([^\\\"\\\\]|\\\")*\""; var match = Regex.Match(_source, pattern); if (match.Value.Length != _source.Length) { throw new FormatException(String.Format(SyntaxErrorMessages.InvalidStringValue, _source)); } _data = _source.Substring(1, _source.Length - 2); foreach (Char ch in _data) { if (StringCodes.GetInstance().Encode(ch) == null) { throw new FormatException(String.Format(SyntaxErrorMessages.InvalidCharacterValue, ch)); } } _tokenType = PScriptTokenType.Data; }