tsql_parser 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18f0af056c66e37a5b5f541779ee7387fc5756884f5e2d302329f7c8b35b9bfe
4
- data.tar.gz: e914e56c485ec9fc0e282f27734d36e17b8a16bb220a4288744f7e45ac263614
3
+ metadata.gz: 75691620d6ff57a073073f7438189fb9858a74f06737872ac0d38994fd9293ba
4
+ data.tar.gz: a5f2bdf884135c00ca792a0f6e8b321d5959295836072c5a9a182f641eced85e
5
5
  SHA512:
6
- metadata.gz: 565804ec4625e5bde30d5ef68d52a44d98317a803f1e4e90dedbb13f0805906ed165f9b4ac972bad845d13a41d72926344c02c8cf30a17c6b2b537a8a85eab42
7
- data.tar.gz: c52b196c627315e281b33f4b7cb20ed0ac11d7b0290a1ead14cb45feb71b4c165e7bdf87098f9ea1c36aaa2814be38adc35251313a90bc9731e5a1df2e827690
6
+ metadata.gz: '058f424ea22ebcf1e84ce1dcd0dacec6360210ab145ef71946a30bd989b71463b373526aebe01ba1a0d0e42c3701c2ad42f1e14f8a993fe93ff68cecf4708745'
7
+ data.tar.gz: 1a405f6ae5c149dd653179979fa17f9db0fd64804e5ef60f6bfbc4d1e4521f526796aee807714619e1547019bc8aeebd3b248d05aaf7469d2f2d0e659f770610
@@ -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,17 @@ 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
+ puts "comment builder: #{builder}"
110
+ specific_tokens << builder unless builder.empty?
111
+ builder = ""
112
+ comment = false
113
+ next
114
+ end
115
+
105
116
  if c == "'" and not multiline_comment and not comment
106
117
  if not string
107
118
  string = true
@@ -125,17 +136,7 @@ module TSqlParser::Parsing
125
136
  next
126
137
  end
127
138
 
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
139
+ if delimiters.include? c and !multiline_comment and !string and !comment
139
140
  specific_tokens << builder unless builder.empty?
140
141
  specific_tokens << c unless skip_delimiters.include? c
141
142
  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.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Stauffer