Diff of /SQLite.Designer/Design/SimpleTokenizer.cs [d935ac] .. [a235fd]  Maximize  Restore

  Switch to unified view

a/SQLite.Designer/Design/SimpleTokenizer.cs b/SQLite.Designer/Design/SimpleTokenizer.cs
...
...
8
namespace SQLite.Designer.Design
8
namespace SQLite.Designer.Design
9
{
9
{
10
  using System;
10
  using System;
11
  using System.Collections.Generic;
11
  using System.Collections.Generic;
12
  using System.Text;
12
  using System.Text;
13
  using System.Globalization;
13
14
14
  internal static class SimpleTokenizer
15
  internal static class SimpleTokenizer
15
  {
16
  {
16
    public struct StringParts
17
    public struct StringParts
17
    {
18
    {
...
...
23
      internal string keyword;
24
      internal string keyword;
24
      internal char sepchar;
25
      internal char sepchar;
25
26
26
      public override string ToString()
27
      public override string ToString()
27
      {
28
      {
28
        return String.Format("{0} {1} at {2} {3} depth {4}", value, quote, position, sep == true ? "(sep)" : "", depth);
29
        return String.Format(CultureInfo.InvariantCulture, "{0} {1} at {2} {3} depth {4}", value, quote, position, sep == true ? "(sep)" : "", depth);
29
      }
30
      }
30
    }
31
    }
31
32
32
    public static StringParts[] BreakString(string source)
33
    public static StringParts[] BreakString(string source)
33
    {
34
    {
...
...
62
        }
63
        }
63
        else if (source.Length > 1 && source[0] == '/' && source[1] == '*')
64
        else if (source.Length > 1 && source[0] == '/' && source[1] == '*')
64
        {
65
        {
65
          StringParts tok = new StringParts();
66
          StringParts tok = new StringParts();
66
          tok.position = startat;
67
          tok.position = startat;
67
          x = source.IndexOf("*/");
68
          x = source.IndexOf("*/", StringComparison.Ordinal);
68
          if (x == -1) tok.value = source;
69
          if (x == -1) tok.value = source;
69
          else tok.value = source.Substring(0, x + 2);
70
          else tok.value = source.Substring(0, x + 2);
70
71
71
          //ls.Add(tok);
72
          //ls.Add(tok);
72
          source = source.Substring(tok.value.Length);
73
          source = source.Substring(tok.value.Length);
73
          startat += tok.value.Length;
74
          startat += tok.value.Length;
74
          continue;
75
          continue;
75
        }
76
        }
76
        int comment = source.IndexOf("--", n);
77
        int comment = source.IndexOf("--", n, StringComparison.Ordinal);
77
        if (comment == -1) comment = source.IndexOf("/*", n);
78
        if (comment == -1) comment = source.IndexOf("/*", n, StringComparison.Ordinal);
78
79
79
        if (n > 0)
80
        if (n > 0)
80
          n = source.IndexOfAny(opens2, n);
81
          n = source.IndexOfAny(opens2, n);
81
        else
82
        else
82
          n = source.IndexOfAny(opens, n);
83
          n = source.IndexOfAny(opens, n);
...
...
127
          if (tok.value.Length > 1)
128
          if (tok.value.Length > 1)
128
          {
129
          {
129
            x = opensstr.IndexOf(tok.value[0]);
130
            x = opensstr.IndexOf(tok.value[0]);
130
            if (x != -1 && tok.value[tok.value.Length - 1] == closes[x])
131
            if (x != -1 && tok.value[tok.value.Length - 1] == closes[x])
131
            {
132
            {
132
              tok.quote = String.Format("{0}{1}", tok.value[0], tok.value[tok.value.Length - 1]);
133
              tok.quote = String.Format(CultureInfo.InvariantCulture, "{0}{1}", tok.value[0], tok.value[tok.value.Length - 1]);
133
              tok.value = tok.value.Substring(1, tok.value.Length - 2);
134
              tok.value = tok.value.Substring(1, tok.value.Length - 2);
134
            }
135
            }
135
            else
136
            else
136
              tok.keyword = tok.value.ToUpperInvariant();
137
              tok.keyword = tok.value.ToUpperInvariant();
137
          }
138
          }
...
...
170
        if (tok.value.Length > 1)
171
        if (tok.value.Length > 1)
171
        {
172
        {
172
          x = opensstr.IndexOf(tok.value[0]);
173
          x = opensstr.IndexOf(tok.value[0]);
173
          if (x != -1 && tok.value[tok.value.Length - 1] == closes[x])
174
          if (x != -1 && tok.value[tok.value.Length - 1] == closes[x])
174
          {
175
          {
175
            tok.quote = String.Format("{0}{1}", tok.value[0], tok.value[tok.value.Length - 1]);
176
            tok.quote = String.Format(CultureInfo.InvariantCulture, "{0}{1}", tok.value[0], tok.value[tok.value.Length - 1]);
176
            tok.value = tok.value.Substring(1, tok.value.Length - 2);
177
            tok.value = tok.value.Substring(1, tok.value.Length - 2);
177
          }
178
          }
178
          else
179
          else
179
            tok.keyword = tok.value.ToUpperInvariant();
180
            tok.keyword = tok.value.ToUpperInvariant();
180
        }
181
        }

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks