tsql_parser 0.0.7 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18f0af056c66e37a5b5f541779ee7387fc5756884f5e2d302329f7c8b35b9bfe
4
- data.tar.gz: e914e56c485ec9fc0e282f27734d36e17b8a16bb220a4288744f7e45ac263614
3
+ metadata.gz: 3e2633fba3d6e5113119872e1fad4618da4a7f404436e2e5d86137ae82516db3
4
+ data.tar.gz: a27d777e1a54c8eba9803158b121d7c74b39ca004d4d0e49b242194f9095e125
5
5
  SHA512:
6
- metadata.gz: 565804ec4625e5bde30d5ef68d52a44d98317a803f1e4e90dedbb13f0805906ed165f9b4ac972bad845d13a41d72926344c02c8cf30a17c6b2b537a8a85eab42
7
- data.tar.gz: c52b196c627315e281b33f4b7cb20ed0ac11d7b0290a1ead14cb45feb71b4c165e7bdf87098f9ea1c36aaa2814be38adc35251313a90bc9731e5a1df2e827690
6
+ metadata.gz: 71667cfc1e258bcf400ce64af5a5f49747eec77e4fa4399444bc7f2b41e1757a2dc920b7273564fbf7b430928299bbf5f2a06074c6ed5e786baae44774051e2b
7
+ data.tar.gz: 7dc006e6d915670337661dd6829e95942984d48d6ddc28ebfc3ae6332a348337fbd629fa50da81882ac2a717e9a9bf9c17507b93b8db69bb4a26ed7e2ba9094c
@@ -18,12 +18,16 @@ module TSqlParser::Parsing
18
18
  class FlatSqlContainer
19
19
  def initialize(token = nil)
20
20
  @token = token
21
- @children = []
22
21
  @siblings = []
23
22
 
24
23
  unless token.nil?
25
24
  if token.has_nodes?
26
25
  token.get_nodes.each do |n|
26
+ if n.get_token[:comment]
27
+ comment_token = n.get_token
28
+ comment_token[:value] = "#{comment_token[:value]}\n"
29
+ n.set_token comment_token
30
+ end
27
31
  @siblings << n
28
32
  end
29
33
  end
@@ -46,26 +50,14 @@ module TSqlParser::Parsing
46
50
  @siblings << token
47
51
  end
48
52
 
49
- def add_child(token)
50
- @children << SqlContainer.new(token)
51
- end
52
-
53
53
  def has_siblings?
54
54
  @siblings.size > 0
55
55
  end
56
56
 
57
- def has_children?
58
- @children.size > 0
59
- end
60
-
61
57
  def get_siblings
62
58
  @siblings
63
59
  end
64
60
 
65
- def get_children
66
- @children
67
- end
68
-
69
61
  def get_token
70
62
  @token.get_token
71
63
  end
@@ -102,6 +102,16 @@ module TSqlParser::Parsing
102
102
  next
103
103
  end
104
104
 
105
+ if comment and c != "\n"
106
+ builder << c
107
+ next
108
+ elsif comment and c == "\n"
109
+ specific_tokens << builder unless builder.empty?
110
+ builder = ""
111
+ comment = false
112
+ next
113
+ end
114
+
105
115
  if c == "'" and not multiline_comment and not comment
106
116
  if not string
107
117
  string = true
@@ -125,17 +135,7 @@ module TSqlParser::Parsing
125
135
  next
126
136
  end
127
137
 
128
- if comment and c != "\n"
129
- builder << c
130
- next
131
- elsif comment and c == "\n"
132
- specific_tokens << builder unless builder.empty?
133
- builder = ""
134
- comment = false
135
- next
136
- end
137
-
138
- if delimiters.include? c and !multiline_comment and !string
138
+ if delimiters.include? c and !multiline_comment and !string and !comment
139
139
  specific_tokens << builder unless builder.empty?
140
140
  specific_tokens << c unless skip_delimiters.include? c
141
141
  builder = ""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tsql_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Stauffer