lizard 1.18.0__py2.py3-none-any.whl → 1.20.0__py2.py3-none-any.whl

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.
Files changed (40) hide show
  1. {lizard-1.18.0.dist-info → lizard-1.20.0.dist-info}/METADATA +30 -20
  2. lizard-1.20.0.dist-info/RECORD +70 -0
  3. lizard_ext/__init__.py +0 -1
  4. lizard_ext/htmloutput.py +86 -17
  5. lizard_ext/lizardcomplextags.py +6 -0
  6. lizard_ext/lizardmccabe.py +6 -1
  7. lizard_ext/lizardmodified.py +7 -2
  8. lizard_ext/lizardnd.py +64 -1
  9. lizard_ext/lizardnonstrict.py +2 -1
  10. lizard_ext/lizardns.py +31 -8
  11. lizard_ext/version.py +1 -1
  12. lizard_languages/__init__.py +2 -0
  13. lizard_languages/clike.py +6 -3
  14. lizard_languages/code_reader.py +27 -3
  15. lizard_languages/csharp.py +21 -2
  16. lizard_languages/erlang.py +9 -1
  17. lizard_languages/fortran.py +5 -6
  18. lizard_languages/gdscript.py +6 -2
  19. lizard_languages/kotlin.py +6 -3
  20. lizard_languages/perl.py +8 -4
  21. lizard_languages/php.py +6 -2
  22. lizard_languages/plsql.py +422 -0
  23. lizard_languages/python.py +6 -4
  24. lizard_languages/r.py +9 -6
  25. lizard_languages/rubylike.py +6 -3
  26. lizard_languages/rust.py +7 -2
  27. lizard_languages/scala.py +6 -2
  28. lizard_languages/solidity.py +6 -1
  29. lizard_languages/st.py +9 -5
  30. lizard_languages/swift.py +6 -2
  31. lizard_languages/tnsdl.py +6 -1
  32. lizard_languages/tsx.py +2 -2
  33. lizard_languages/ttcn.py +5 -3
  34. lizard_languages/typescript.py +58 -4
  35. lizard_languages/zig.py +7 -1
  36. lizard-1.18.0.dist-info/RECORD +0 -69
  37. {lizard-1.18.0.dist-info → lizard-1.20.0.dist-info}/LICENSE.txt +0 -0
  38. {lizard-1.18.0.dist-info → lizard-1.20.0.dist-info}/WHEEL +0 -0
  39. {lizard-1.18.0.dist-info → lizard-1.20.0.dist-info}/entry_points.txt +0 -0
  40. {lizard-1.18.0.dist-info → lizard-1.20.0.dist-info}/top_level.txt +0 -0
@@ -11,7 +11,12 @@ class SolidityReader(CodeReader, CCppCommentsMixin):
11
11
 
12
12
  ext = ['sol']
13
13
  language_names = ['solidity']
14
- _conditions = set(['if', 'for', 'while', '&&', '||', '?'])
14
+
15
+ # Separated condition categories
16
+ _control_flow_keywords = {'if', 'for', 'while'}
17
+ _logical_operators = {'&&', '||'}
18
+ _case_keywords = set()
19
+ _ternary_operators = {'?'}
15
20
 
16
21
  def __init__(self, context):
17
22
  super(SolidityReader, self).__init__(context)
lizard_languages/st.py CHANGED
@@ -22,11 +22,15 @@ class StReader(CodeReader, StCommentsMixin):
22
22
  language_names = ['st']
23
23
  macro_pattern = re.compile(r"#\s*(\w+)\s*(.*)", re.M | re.S)
24
24
 
25
- # track block starters
26
- _conditions = set([
27
- 'if', 'elsif', 'case', 'for', 'while', 'repeat',
28
- 'IF', 'ELSIF', 'CASE', 'FOR', 'WHILE', 'REPEAT'
29
- ])
25
+ # Separated condition categories (case-insensitive language)
26
+ _control_flow_keywords = {
27
+ 'if', 'elsif', 'for', 'while', 'repeat',
28
+ 'IF', 'ELSIF', 'FOR', 'WHILE', 'REPEAT'
29
+ }
30
+ # ST is case-insensitive, so include both lowercase and uppercase forms
31
+ _logical_operators = {'and', 'or', 'AND', 'OR'}
32
+ _case_keywords = {'case', 'CASE'}
33
+ _ternary_operators = set()
30
34
 
31
35
  _functions = set([
32
36
  'FUNCTION_BLOCK', 'FUNCTION', 'ACTION'
lizard_languages/swift.py CHANGED
@@ -30,8 +30,12 @@ class SwiftReader(CodeReader, CCppCommentsMixin, SwiftReplaceLabel):
30
30
  FUNC_KEYWORD = 'def'
31
31
  ext = ['swift']
32
32
  language_names = ['swift']
33
- _conditions = set(['if', 'for', 'while', '&&', '||', '?', 'catch',
34
- 'case', 'guard'])
33
+
34
+ # Separated condition categories
35
+ _control_flow_keywords = {'if', 'for', 'while', 'catch', 'guard'}
36
+ _logical_operators = {'&&', '||'}
37
+ _case_keywords = {'case'} # Pattern matching
38
+ _ternary_operators = {'?'}
35
39
 
36
40
  def __init__(self, context):
37
41
  super(SwiftReader, self).__init__(context)
lizard_languages/tnsdl.py CHANGED
@@ -84,7 +84,12 @@ class SDLReader(CodeReader, CCppCommentsMixin):
84
84
  if condition:
85
85
  return self.context.CONDITION()
86
86
 
87
- _conditions = set(['WHILE', 'AND', 'OR', '#if'])
87
+ # Separated condition categories
88
+ _control_flow_keywords = {'WHILE', '#if'}
89
+ _logical_operators = {'AND', 'OR'}
90
+ _case_keywords = set()
91
+ _ternary_operators = set()
92
+ # Note: No need to define _conditions - base class builds it automatically
88
93
 
89
94
  def _is_condition(self, token, last_token):
90
95
  if token == ':' and last_token == ')':
lizard_languages/tsx.py CHANGED
@@ -48,8 +48,8 @@ class JSXTypeScriptStates(CodeStateMachine):
48
48
  self.started_function = None
49
49
  self.pending_function_name = ''
50
50
  self._ts_declare = False
51
- self._conditions = set(['if', 'elseif', 'for', 'while', '&&', '||', '?',
52
- 'catch', 'case'])
51
+ # Note: Condition categories come from TypeScriptReader class level,
52
+ # no need to define instance-level duplicates
53
53
  self.inside_function = inside_function # Track if we're already inside a function
54
54
 
55
55
  def statemachine_before_return(self):
lizard_languages/ttcn.py CHANGED
@@ -10,9 +10,11 @@ class TTCNReader(CLikeReader): # pylint: disable=R0903
10
10
  ext = ['ttcn', 'ttcnpp']
11
11
  language_names = ['ttcn', 'ttcn3']
12
12
 
13
- _conditions = set(['if', 'else', 'for', 'while',
14
- 'altstep', 'case', 'goto', 'alt',
15
- 'interleave', 'and', 'or', 'xor'])
13
+ # Separated condition categories
14
+ _control_flow_keywords = {'if', 'for', 'while', 'altstep', 'alt', 'interleave', 'goto'}
15
+ _logical_operators = {'and', 'or', 'xor'}
16
+ _case_keywords = {'case'}
17
+ _ternary_operators = set()
16
18
 
17
19
  def __init__(self, context):
18
20
  super(TTCNReader, self).__init__(context)
@@ -51,8 +51,12 @@ class TypeScriptReader(CodeReader, CCppCommentsMixin):
51
51
 
52
52
  ext = ['ts']
53
53
  language_names = ['typescript', 'ts']
54
- _conditions = set(['if', 'elseif', 'for', 'while', '&&', '||', '?',
55
- 'catch', 'case'])
54
+
55
+ # Separated condition categories
56
+ _control_flow_keywords = {'if', 'elseif', 'for', 'while', 'catch'}
57
+ _logical_operators = {'&&', '||'}
58
+ _case_keywords = {'case'}
59
+ _ternary_operators = {'?'}
56
60
 
57
61
  def __init__(self, context):
58
62
  super().__init__(context)
@@ -128,6 +132,9 @@ class TypeScriptStates(CodeStateMachine):
128
132
  self._getter_setter_prefix = None
129
133
  self.arrow_function_pending = False
130
134
  self._ts_declare = False # Track if 'declare' was seen
135
+ self._static_seen = False # Track if 'static' was seen
136
+ self._async_seen = False # Track if 'async' was seen
137
+ self._prev_token = '' # Track previous token to detect method calls
131
138
 
132
139
  def statemachine_before_return(self):
133
140
  # Ensure the main function is closed at the end
@@ -152,6 +159,20 @@ class TypeScriptStates(CodeStateMachine):
152
159
  return
153
160
  self._ts_declare = False
154
161
 
162
+ # Track static and async modifiers
163
+ if token == 'static':
164
+ self._static_seen = True
165
+ self._prev_token = token
166
+ return
167
+ if token == 'async':
168
+ self._async_seen = True
169
+ self._prev_token = token
170
+ return
171
+ if token == 'new':
172
+ # Track 'new' keyword to avoid treating constructors as functions
173
+ self._prev_token = token
174
+ return
175
+
155
176
  if self.as_object:
156
177
  # Support for getter/setter: look for 'get' or 'set' before method name
157
178
  if token in ('get', 'set'):
@@ -169,15 +190,26 @@ class TypeScriptStates(CodeStateMachine):
169
190
  self.function_name = self.last_tokens
170
191
  return
171
192
  elif token == '(':
193
+ # Check if this is a method call (previous token was . or this/identifier)
194
+ if self._prev_token == '.' or self._prev_token == 'new':
195
+ # This is a method call, not a function definition
196
+ self._prev_token = token
197
+ return
172
198
  if not self.started_function:
173
199
  self.arrow_function_pending = True
174
200
  self._function(self.last_tokens)
175
201
  self.next(self._function, token)
176
202
  return
203
+ # If we've seen async/static and this is an identifier, it's likely a method name
204
+ elif (self._async_seen or self._static_seen) and token not in ('*', 'function'):
205
+ # This is a method name after async/static
206
+ self.last_tokens = token
207
+ return
177
208
 
178
209
  if token in '.':
179
210
  self._state = self._field
180
211
  self.last_tokens += token
212
+ self._prev_token = token
181
213
  return
182
214
  if token == 'function':
183
215
  self._state = self._function
@@ -191,8 +223,14 @@ class TypeScriptStates(CodeStateMachine):
191
223
  elif token == '=':
192
224
  self.function_name = self.last_tokens
193
225
  elif token == "(":
194
- self.sub_state(
195
- self.__class__(self.context))
226
+ # Check if this is a method call or constructor
227
+ if self._prev_token == '.' or self._prev_token == 'new':
228
+ # This is a method call or constructor, not a function definition
229
+ self.sub_state(
230
+ self.__class__(self.context))
231
+ else:
232
+ self.sub_state(
233
+ self.__class__(self.context))
196
234
  elif token in '{':
197
235
  if self.started_function:
198
236
  self.sub_state(
@@ -205,14 +243,21 @@ class TypeScriptStates(CodeStateMachine):
205
243
  elif self.context.newline or token == ';':
206
244
  self.function_name = ''
207
245
  self._pop_function_from_stack()
246
+ # Reset modifiers on newline/semicolon
247
+ self._static_seen = False
248
+ self._async_seen = False
208
249
 
209
250
  if token == '`':
210
251
  self.next(self._state_template_literal)
211
252
  if not self.as_object:
212
253
  if token == ':':
213
254
  self._consume_type_annotation()
255
+ self._prev_token = token
214
256
  return
215
257
  self.last_tokens = token
258
+ # Don't overwrite _prev_token if it's 'new' or '.' (preserve for next token)
259
+ if self._prev_token not in ('new', '.'):
260
+ self._prev_token = token
216
261
 
217
262
  def read_object(self):
218
263
  def callback():
@@ -220,7 +265,13 @@ class TypeScriptStates(CodeStateMachine):
220
265
 
221
266
  object_reader = self.__class__(self.context)
222
267
  object_reader.as_object = True
268
+ # Pass along the modifier flags
269
+ object_reader._static_seen = self._static_seen
270
+ object_reader._async_seen = self._async_seen
223
271
  self.sub_state(object_reader, callback)
272
+ # Reset modifiers after entering object
273
+ self._static_seen = False
274
+ self._async_seen = False
224
275
 
225
276
  def _expecting_condition_and_statement_block(self, token):
226
277
  def callback():
@@ -269,6 +320,9 @@ class TypeScriptStates(CodeStateMachine):
269
320
  return
270
321
  if token != '(':
271
322
  self.function_name = token
323
+ # Reset modifiers after setting function name
324
+ self._static_seen = False
325
+ self._async_seen = False
272
326
  else:
273
327
  if not self.started_function:
274
328
  self._push_function_to_stack()
lizard_languages/zig.py CHANGED
@@ -12,7 +12,13 @@ from .golike import GoLikeStates
12
12
  class ZigReader(CodeReader, CCppCommentsMixin):
13
13
  ext = ["zig"]
14
14
  language_names = ["zig"]
15
- _conditions = {"if", "for", "while", "and", "or", "orelse", "try", "catch", "=>"}
15
+
16
+ # Separated condition categories
17
+ _control_flow_keywords = {"if", "for", "while", "try", "catch"}
18
+ _logical_operators = {"and", "or", "orelse"} # orelse is Zig's null coalescing
19
+ _case_keywords = set()
20
+ # Note: '=>' is for error union and switch cases in Zig
21
+ _ternary_operators = {"=>"}
16
22
 
17
23
  def __init__(self, context):
18
24
  super().__init__(context)
@@ -1,69 +0,0 @@
1
- lizard.py,sha256=B0g5lEp5me31bQpjfMKVayF0iUfH0PalVecOKeUX3-A,41365
2
- lizard_ext/__init__.py,sha256=AkZYVqCgd7XX1hMwLMyh_ABm9geIHmobEch-thYXZz8,932
3
- lizard_ext/auto_open.py,sha256=byD_RbeVhvSUhR2bJMRitvA3zcKEapFwv0-XaDJ6GFo,1096
4
- lizard_ext/checkstyleoutput.py,sha256=UzDHg837ErEZepXkR8I8YCoz2r1lkmzGctMA7dpyB-M,1245
5
- lizard_ext/csvoutput.py,sha256=43fhmo8kB85qcdujCwySGNuTC4FkKUPLqIApPeljPnA,2663
6
- lizard_ext/default_ordered_dict.py,sha256=YbVz6nPlQ6DjWc_EOFBz6AJN2XLo9dpnUdeyejQvUDE,831
7
- lizard_ext/extension_base.py,sha256=rnjUL2mqSGToUVYydju7fa8ZwynLPY8S1F17gIJP55I,346
8
- lizard_ext/htmloutput.py,sha256=oavhEzCIJtoJrFveiWIp0pMAOwg4pukJ6l07IpmPiag,4426
9
- lizard_ext/keywords.py,sha256=VxsxoATtKV-8egMKd7I8sd2qbZMtEFEpsszk__6rmjQ,893
10
- lizard_ext/lizardboolcount.py,sha256=abmMA9X3VFRO5mziicUxWKmHldHNC0jBEe7NKAKA5fs,1062
11
- lizard_ext/lizardcomplextags.py,sha256=flrwYg24P5DoDsBO3gdcK9SxkugX_brhfjuu8zgPnOc,681
12
- lizard_ext/lizardcpre.py,sha256=bVrMXffGUZlydv_zwIVtp-Ij9XyXMFEcap2R4DmLXPU,1277
13
- lizard_ext/lizarddependencycount.py,sha256=6Nt2z69cyG8P3pceTUCTU6yh4h73lezL2awRFh7K77Y,2423
14
- lizard_ext/lizarddumpcomments.py,sha256=-c46U3CP_beDfBuB9QhObpiB6wK7xq1u9jeRjgAyU90,683
15
- lizard_ext/lizardduplicate.py,sha256=tlU-UTB_d_qjekiO4MSaXPBT1FSX8uTaOcfeXnjBzU8,9762
16
- lizard_ext/lizardduplicated_param_list.py,sha256=_ApeSbjA-NU_rmICsivyfGEEg0-O94wWgWpeeE8F3Zc,1811
17
- lizard_ext/lizardexitcount.py,sha256=ziAVFi5RgjxJOwAQy6LzdZZflkvvxTiXOIp0FAL0wKQ,692
18
- lizard_ext/lizardgotocount.py,sha256=w2GWWwqVh4j7Fum41Wvg172b70JvtCm5BCzZUmmTlcM,514
19
- lizard_ext/lizardignoreassert.py,sha256=sqLwcnJQ06SYqIk901ib4NQ8ECwjIe_qL4T6z1wLXAk,644
20
- lizard_ext/lizardio.py,sha256=xQN-AgLGLKJarJkgfaqX_TKyupbb7GTcwPxrL2B1J1w,3357
21
- lizard_ext/lizardmccabe.py,sha256=RiO8ASmQUah4udOH8SbE2OOMxwShIPByW93TlFxXlQU,1274
22
- lizard_ext/lizardmodified.py,sha256=4Ld7yy1D2m2biMtx-g0DtjXwLa-9mG2togS2IRDAF3k,705
23
- lizard_ext/lizardnd.py,sha256=2_uZkRlaM1mDLLW8yXtO7MtjMGklU8_Cy-6ocaILEuo,4391
24
- lizard_ext/lizardnonstrict.py,sha256=pPG22up2uh9rEkdRFtTWdiuOaiBNe0ZUjaZQpSTX5LE,394
25
- lizard_ext/lizardns.py,sha256=8pztUoRS_UWN24MawwxeHEJgYh49id5PWODUBb6O72U,4184
26
- lizard_ext/lizardoutside.py,sha256=FGm2tbBZ17-2OCgmQlD-vobUCfQKb0FAygf86eM3xuM,336
27
- lizard_ext/lizardstatementcount.py,sha256=xYk6ixSIItSE1BWQXzrWmduFgGhA3VR817SNKLffyVQ,1182
28
- lizard_ext/lizardwordcount.py,sha256=2QYXD7-AtkkgAbi9VSidunMbSsGQ7MKYb6IT-bS-cok,7575
29
- lizard_ext/version.py,sha256=WiI5ub_2twuTf6tscOzwP6MNdZV6kq-ElL2-2HqdUXc,181
30
- lizard_ext/xmloutput.py,sha256=-cbh0he4O_X-wX56gkv9AnSPNN0qvR7FACqlBeezUS4,5609
31
- lizard_languages/__init__.py,sha256=NsYspQ6h--XHMJrIcmOxlZRF4f_l5M7JprenLBz2oIE,1559
32
- lizard_languages/clike.py,sha256=RICnhzBzLbMwpceo3X-z7_-hcTZmGAZKGqpKgJf0G0o,13598
33
- lizard_languages/code_reader.py,sha256=IfEHg9lzKnyCipX9xscgyGEOovll5qr9dCe5cSX2sJM,6852
34
- lizard_languages/csharp.py,sha256=EfFAIOIcJXUUhXTlZApXGSlzG34NZvHM9OSe6m7hpv0,2141
35
- lizard_languages/erlang.py,sha256=7YJS2cMyXDKEV_kpH8DzBARxFCFcjKuTOPSQ3K52auU,3860
36
- lizard_languages/fortran.py,sha256=KATDsnfjob5W3579A_VxbwrbTkK7Rx3p0eXdBgjx25I,8973
37
- lizard_languages/gdscript.py,sha256=KwlGoODilQnFgXvODpq_XlA6fV3hGbN9fd7bsiEUn78,637
38
- lizard_languages/go.py,sha256=sntz0jOEuj4klPipoTFd16UDK1fAUQfwK7YX_cLMZAc,1346
39
- lizard_languages/golike.py,sha256=vRIfjTVvc0VmJf27lTOLht55ZF1AQ9wn0Fvu-9WabWk,2858
40
- lizard_languages/java.py,sha256=HQBTZjUKbUJwgmtLYIzJrWtPpFP3ZdBP_NJK7YOXZC0,6424
41
- lizard_languages/javascript.py,sha256=vniCNMW-ea9Jpv6c8qCcjLVDYjT8VztjXigp5XRWt0E,317
42
- lizard_languages/js_style_regex_expression.py,sha256=Xgyogch4xElYtCG4EnBKvalHTl3tjRPcIIcIQRRd61I,1970
43
- lizard_languages/kotlin.py,sha256=v_o2orEzA5gB9vM_0h-E4QXjrc5Yum-0K6W6_laOThc,2844
44
- lizard_languages/lua.py,sha256=3nqBcunBzJrhv4Iqaf8xvbyqxZy3aSxJ-IiHimHFlac,1573
45
- lizard_languages/objc.py,sha256=2a1teLdaXZBtCeFiIZer1j_sVx9LZ1CbF2XfnqlvLmk,2319
46
- lizard_languages/perl.py,sha256=136w620eECe_t-kmlRUGrsZSxQNo2JQ_PZTSQfCSmHY,11987
47
- lizard_languages/php.py,sha256=UV40p8WzNC64NQ5qElPKzcFTjVt5kenLMz-eKYlcnMY,9940
48
- lizard_languages/python.py,sha256=AsL0SmQ73zhNS1iGi4Z8VtuUE0VjqBzo9W8W0mjqL0E,5790
49
- lizard_languages/r.py,sha256=IoyMhmFtUmTji6rm6-fqss_j_kvIHu3JjABRh6RNys0,12583
50
- lizard_languages/ruby.py,sha256=HL1ZckeuUUJU3QSVAOPsG_Zsl0C6X2PX5_VaWqclzkM,2277
51
- lizard_languages/rubylike.py,sha256=dAGZ2wqW8nqaESMU8HkeR9gwQ-q9fmZqE6AANvVZD1Q,3426
52
- lizard_languages/rust.py,sha256=WarDHnFZv99Yu3_C5DpZfLS8dVWz6AcOzo2dzLW94rA,817
53
- lizard_languages/scala.py,sha256=6Jr_TG945VYqB3o5weD7jN7S4beHt4aVj3r-fmKeMAM,1316
54
- lizard_languages/script_language.py,sha256=SKe45AbO6Z-axbN8KW_g7jf9g7YTXZ6dWzJj4ubDsM8,1172
55
- lizard_languages/solidity.py,sha256=Z0GD7U5bI5eUikdy7m_iKWeFD5yXRYq4r3zycscOhJQ,553
56
- lizard_languages/st.py,sha256=7fpOfNAoUjNY8RCHSYLufnOzZTUkKwjVvcyRyM1xP2Y,4160
57
- lizard_languages/swift.py,sha256=p8S2OAkQOx9YQ02yhoVXFkr7pMqUH1Nb3RVXPHRU_9M,2450
58
- lizard_languages/tnsdl.py,sha256=pGcalA_lHY362v2wwPS86seYBOOBBjvmU6vd4Yy3A9g,2803
59
- lizard_languages/tsx.py,sha256=1oOVCcz5yHkmYLYGhSarCMSXfGVasweklAqqapkuNR4,17160
60
- lizard_languages/ttcn.py,sha256=ygjw_raBmPF-4mgoM8m6CAdyEMpTI-n1kZJK1RL4Vxo,2131
61
- lizard_languages/typescript.py,sha256=C8VWmHLGGYwCrP6hJ9HmJ-PETrKux4npjOzDN6AkTGU,12347
62
- lizard_languages/vue.py,sha256=KXUBUo2R1zNF8Pffrz_KsQEN44m5XFRMoGXylxKUeT0,1038
63
- lizard_languages/zig.py,sha256=NX1iyBstBuJFeAGBOAIaRfrmeBREne2HX6Pt4fXZZTQ,586
64
- lizard-1.18.0.dist-info/LICENSE.txt,sha256=05ZjgQ8Cl1dD9p0BhW-Txzkc5rhCogGJVEuf1GT2Y_M,1303
65
- lizard-1.18.0.dist-info/METADATA,sha256=BX2GeLwA0iQpWmDi0wYg4xXCTISh6Un8alaLcJhuRxc,16260
66
- lizard-1.18.0.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
67
- lizard-1.18.0.dist-info/entry_points.txt,sha256=pPMMwoHAltzGHqR2WeJQItLeeyR7pbX5R2S_POC-xoo,40
68
- lizard-1.18.0.dist-info/top_level.txt,sha256=5NTrTaOLhHuTzXaGcZPKfuaOgUv7WafNGe0Zl5aycpg,35
69
- lizard-1.18.0.dist-info/RECORD,,