tsql_parser 0.0.8 → 0.1.0

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: 75691620d6ff57a073073f7438189fb9858a74f06737872ac0d38994fd9293ba
4
- data.tar.gz: a5f2bdf884135c00ca792a0f6e8b321d5959295836072c5a9a182f641eced85e
3
+ metadata.gz: a0a85b6dba179ecd613d8c18923b25c14ea4ae1b7a06f0ddba09eb212c21502b
4
+ data.tar.gz: dbc151c034be90b2837d133b3c87e4fe476585b0108f9afd382f01a0471d4259
5
5
  SHA512:
6
- metadata.gz: '058f424ea22ebcf1e84ce1dcd0dacec6360210ab145ef71946a30bd989b71463b373526aebe01ba1a0d0e42c3701c2ad42f1e14f8a993fe93ff68cecf4708745'
7
- data.tar.gz: 1a405f6ae5c149dd653179979fa17f9db0fd64804e5ef60f6bfbc4d1e4521f526796aee807714619e1547019bc8aeebd3b248d05aaf7469d2f2d0e659f770610
6
+ metadata.gz: f77f801453284b9a941b2d1f8ca22718e6783a3b733181c697f0f6ff09bfc0373afdc50b39ea7915006c16c81b0b60b2641dd0926ecd13df5800c6a65a6a9a4f
7
+ data.tar.gz: eaf630332538b7cf7fa6d677d400882a1f7f194c95882f1f630fbbb59e3d3b902f3bc8708eecd792e1d8f51489c79831298d4673589a2d6583ceea975bf3b038
@@ -78,13 +78,21 @@ module TSqlParser::Parsing
78
78
  next_line = work_lines[index + 1] unless index + 1 > work_lines.size
79
79
  next_line_first = next_line.strip.split(" ").first unless next_line.nil?
80
80
 
81
+ if first.nil?
82
+ #tab_count -= 1 if tab_count > 0
83
+ next
84
+ end
85
+
81
86
  if Parser.is_label? first
82
87
  indented_lines << "#{tab * tab_count}#{line}"
83
- tab_count += 1
88
+ #tab_count += 1
84
89
  elsif %w[CASE BEGIN SELECT].include? first or line.strip.start_with? "CREATE PROCEDURE"
85
90
  indented_lines << "#{tab * tab_count}#{line}"
86
91
  tab_count += 1
87
- elsif %w[FROM END GO].include? first and not %w[DELETE UPDATE INSERT SET].include? last
92
+ elsif %w[FROM GO].include? first and not %w[DELETE UPDATE INSERT FROM FETCH].include? last
93
+ tab_count -= 1 if tab_count > 0
94
+ indented_lines << "#{tab * tab_count}#{line}"
95
+ elsif %w[END END;].include? first
88
96
  tab_count -= 1 if tab_count > 0
89
97
  indented_lines << "#{tab * tab_count}#{line}"
90
98
  else
@@ -106,7 +106,6 @@ module TSqlParser::Parsing
106
106
  builder << c
107
107
  next
108
108
  elsif comment and c == "\n"
109
- puts "comment builder: #{builder}"
110
109
  specific_tokens << builder unless builder.empty?
111
110
  builder = ""
112
111
  comment = false
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.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Stauffer