1 using System;
2 using System.Collections;
3
4
5
6
7
8 namespace System.XPath
9 {
10 public ustring ParseDQString(const string& fileName, const System.Lex.Token& token)
11 {
12 ustring s;
13 const uchar* p = token.match.begin;
14 const uchar* e = token.match.end;
15 if (p != e && *p == '\"')
16 {
17 ++p;
18 }
19 while (p != e && *p != '\"')
20 {
21 s.Append(*p, 1);
22 ++p;
23 }
24 if (p != e && *p == '\"')
25 {
26 ++p;
27 }
28 if (p != e)
29 {
30 throw Exception("invalid string literal at " + fileName + ":" + ToString(token.line) + ": " + ToUtf8(token.match.ToString()));
31 }
32 return s;
33 }
34 public ustring ParseSQString(const string& fileName, const System.Lex.Token& token)
35 {
36 ustring s;
37 const uchar* p = token.match.begin;
38 const uchar* e = token.match.end;
39 if (p != e && *p == '\'')
40 {
41 ++p;
42 }
43 while (p != e && *p != '\'')
44 {
45 s.Append(*p, 1);
46 ++p;
47 }
48 if (p != e && *p == '\'')
49 {
50 ++p;
51 }
52 if (p != e)
53 {
54 throw Exception("invalid string literal at " + fileName + ":" + ToString(token.line) + ": " + ToUtf8(token.match.ToString()));
55 }
56 return s;
57 }
58 }