bare-script 3.7.2__tar.gz → 3.7.3__tar.gz
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.
- {bare_script-3.7.2/src/bare_script.egg-info → bare_script-3.7.3}/PKG-INFO +1 -1
- {bare_script-3.7.2 → bare_script-3.7.3}/setup.cfg +1 -1
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/bare.py +4 -4
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/model.py +35 -22
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/parser.py +60 -28
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/runtime.py +1 -1
- {bare_script-3.7.2 → bare_script-3.7.3/src/bare_script.egg-info}/PKG-INFO +1 -1
- {bare_script-3.7.2 → bare_script-3.7.3}/LICENSE +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/README.md +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/pyproject.toml +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/__init__.py +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/__main__.py +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/baredoc.py +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/data.py +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/include/__init__.py +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/include/args.bare +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/include/dataTable.bare +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/include/diff.bare +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/include/forms.bare +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/include/markdownUp.bare +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/include/pager.bare +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/include/unittest.bare +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/include/unittestMock.bare +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/library.py +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/options.py +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script/value.py +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script.egg-info/SOURCES.txt +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script.egg-info/dependency_links.txt +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script.egg-info/entry_points.txt +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script.egg-info/requires.txt +0 -0
- {bare_script-3.7.2 → bare_script-3.7.3}/src/bare_script.egg-info/top_level.txt +0 -0
|
@@ -75,11 +75,11 @@ def main(argv=None):
|
|
|
75
75
|
if args.static or args.debug:
|
|
76
76
|
warnings = lint_script(script)
|
|
77
77
|
if not warnings:
|
|
78
|
-
print(f'BareScript
|
|
78
|
+
print(f'BareScript static analysis "{script_name}" ... OK')
|
|
79
79
|
else:
|
|
80
|
-
print(f'BareScript
|
|
80
|
+
print(f'BareScript static analysis "{script_name}" ... {len(warnings)} warning{"s" if len(warnings) > 1 else ""}:')
|
|
81
81
|
for warning in warnings:
|
|
82
|
-
print(
|
|
82
|
+
print(warning)
|
|
83
83
|
if args.static:
|
|
84
84
|
status_code = 1
|
|
85
85
|
break
|
|
@@ -104,7 +104,7 @@ def main(argv=None):
|
|
|
104
104
|
# Log script execution end with timing
|
|
105
105
|
if args.debug:
|
|
106
106
|
time_end = time.time()
|
|
107
|
-
print(f'BareScript
|
|
107
|
+
print(f'BareScript executed in {1000 * (time_end - time_begin):.1f} milliseconds')
|
|
108
108
|
|
|
109
109
|
# Stop on error status code
|
|
110
110
|
if status_code != 0:
|
|
@@ -330,10 +330,11 @@ def lint_script(script):
|
|
|
330
330
|
"""
|
|
331
331
|
|
|
332
332
|
warnings = []
|
|
333
|
+
statements = script['statements']
|
|
333
334
|
|
|
334
335
|
# Empty script?
|
|
335
336
|
if len(script['statements']) == 0:
|
|
336
|
-
warnings
|
|
337
|
+
_lint_script_warning(warnings, script, None, 'Empty script')
|
|
337
338
|
|
|
338
339
|
# Variable used before assignment?
|
|
339
340
|
var_assigns = {}
|
|
@@ -341,15 +342,13 @@ def lint_script(script):
|
|
|
341
342
|
_get_variable_assignments_and_uses(script['statements'], var_assigns, var_uses)
|
|
342
343
|
for var_name in sorted(var_assigns.keys()):
|
|
343
344
|
if var_name in var_uses and var_uses[var_name] <= var_assigns[var_name]:
|
|
344
|
-
warnings
|
|
345
|
-
f'Global variable "{var_name}" used (index {var_uses[var_name]}) before assignment (index {var_assigns[var_name]})'
|
|
346
|
-
)
|
|
345
|
+
_lint_script_warning(warnings, script, statements[var_uses[var_name]], f'Global variable "{var_name}" used before assignment')
|
|
347
346
|
|
|
348
347
|
# Iterate global statements
|
|
349
348
|
functions_defined = {}
|
|
350
349
|
labels_defined = {}
|
|
351
350
|
labels_used = {}
|
|
352
|
-
for ix_statement, statement in enumerate(
|
|
351
|
+
for ix_statement, statement in enumerate(statements):
|
|
353
352
|
statement_key = next(iter(statement.keys()))
|
|
354
353
|
|
|
355
354
|
# Function definition checks
|
|
@@ -358,7 +357,7 @@ def lint_script(script):
|
|
|
358
357
|
|
|
359
358
|
# Function redefinition?
|
|
360
359
|
if function_name in functions_defined:
|
|
361
|
-
warnings
|
|
360
|
+
_lint_script_warning(warnings, script, statement, f'Redefinition of function "{function_name}"')
|
|
362
361
|
else:
|
|
363
362
|
functions_defined[function_name] = ix_statement
|
|
364
363
|
|
|
@@ -372,16 +371,17 @@ def lint_script(script):
|
|
|
372
371
|
if args is not None and var_name in args:
|
|
373
372
|
continue
|
|
374
373
|
if var_name in fn_var_uses and fn_var_uses[var_name] <= fn_var_assigns[var_name]:
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
374
|
+
_lint_script_warning(
|
|
375
|
+
warnings, script, statement,
|
|
376
|
+
f'Variable "{var_name}" of function "{function_name}" used before assignment'
|
|
378
377
|
)
|
|
379
378
|
|
|
380
379
|
# Unused variables?
|
|
381
380
|
for var_name in sorted(fn_var_assigns.keys()):
|
|
382
381
|
if var_name not in fn_var_uses:
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
_lint_script_warning(
|
|
383
|
+
warnings, script, statement,
|
|
384
|
+
f'Unused variable "{var_name}" defined in function "{function_name}"'
|
|
385
385
|
)
|
|
386
386
|
|
|
387
387
|
# Function argument checks
|
|
@@ -390,13 +390,13 @@ def lint_script(script):
|
|
|
390
390
|
for arg in args:
|
|
391
391
|
# Duplicate argument?
|
|
392
392
|
if arg in args_defined:
|
|
393
|
-
warnings
|
|
393
|
+
_lint_script_warning(warnings, script, statement, f'Duplicate argument "{arg}" of function "{function_name}"')
|
|
394
394
|
else:
|
|
395
395
|
args_defined.add(arg)
|
|
396
396
|
|
|
397
397
|
# Unused argument?
|
|
398
398
|
if arg not in fn_var_uses:
|
|
399
|
-
warnings
|
|
399
|
+
_lint_script_warning(warnings, script, statement, f'Unused argument "{arg}" of function "{function_name}"')
|
|
400
400
|
|
|
401
401
|
# Iterate function statements
|
|
402
402
|
fn_labels_defined = {}
|
|
@@ -408,15 +408,16 @@ def lint_script(script):
|
|
|
408
408
|
if fn_statement_key == 'expr':
|
|
409
409
|
# Pointless function expression statement?
|
|
410
410
|
if 'name' not in fn_statement['expr'] and _is_pointless_expression(fn_statement['expr']['expr']):
|
|
411
|
-
warnings
|
|
411
|
+
_lint_script_warning(warnings, script, statement, f'Pointless statement in function "{function_name}"')
|
|
412
412
|
|
|
413
413
|
# Function label statement checks
|
|
414
414
|
elif fn_statement_key == 'label':
|
|
415
415
|
# Label redefinition?
|
|
416
416
|
fn_statement_label = fn_statement['label']['name']
|
|
417
417
|
if fn_statement_label in fn_labels_defined:
|
|
418
|
-
|
|
419
|
-
|
|
418
|
+
_lint_script_warning(
|
|
419
|
+
warnings, script, statement,
|
|
420
|
+
f'Redefinition of label "{fn_statement_label}" in function "{function_name}"'
|
|
420
421
|
)
|
|
421
422
|
else:
|
|
422
423
|
fn_labels_defined[fn_statement_label] = ix_fn_statement
|
|
@@ -428,25 +429,25 @@ def lint_script(script):
|
|
|
428
429
|
# Unused function labels?
|
|
429
430
|
for label in sorted(fn_labels_defined.keys()):
|
|
430
431
|
if label not in fn_labels_used:
|
|
431
|
-
warnings
|
|
432
|
+
_lint_script_warning(warnings, script, statement, f'Unused label "{label}" in function "{function_name}"')
|
|
432
433
|
|
|
433
434
|
# Unknown function labels?
|
|
434
435
|
for label in sorted(fn_labels_used.keys()):
|
|
435
436
|
if label not in fn_labels_defined:
|
|
436
|
-
warnings
|
|
437
|
+
_lint_script_warning(warnings, script, statement, f'Unknown label "{label}" in function "{function_name}"')
|
|
437
438
|
|
|
438
439
|
# Global expression statement checks
|
|
439
440
|
elif statement_key == 'expr':
|
|
440
441
|
# Pointless global expression statement?
|
|
441
442
|
if 'name' not in statement['expr'] and _is_pointless_expression(statement['expr']['expr']):
|
|
442
|
-
warnings
|
|
443
|
+
_lint_script_warning(warnings, script, statement, 'Pointless global statement')
|
|
443
444
|
|
|
444
445
|
# Global label statement checks
|
|
445
446
|
elif statement_key == 'label':
|
|
446
447
|
# Label redefinition?
|
|
447
448
|
statement_label = statement['label']['name']
|
|
448
449
|
if statement_label in labels_defined:
|
|
449
|
-
warnings
|
|
450
|
+
_lint_script_warning(warnings, script, statement, f'Redefinition of global label "{statement_label}"')
|
|
450
451
|
else:
|
|
451
452
|
labels_defined[statement_label] = ix_statement
|
|
452
453
|
|
|
@@ -457,16 +458,28 @@ def lint_script(script):
|
|
|
457
458
|
# Unused global labels?
|
|
458
459
|
for label in sorted(labels_defined.keys()):
|
|
459
460
|
if label not in labels_used:
|
|
460
|
-
warnings
|
|
461
|
+
_lint_script_warning(warnings, script, statements[labels_defined[label]], f'Unused global label "{label}"')
|
|
461
462
|
|
|
462
463
|
# Unknown global labels?
|
|
463
464
|
for label in sorted(labels_used.keys()):
|
|
464
465
|
if label not in labels_defined:
|
|
465
|
-
warnings
|
|
466
|
+
_lint_script_warning(warnings, script, statements[labels_used[label]], f'Unknown global label "{label}"')
|
|
466
467
|
|
|
467
468
|
return warnings
|
|
468
469
|
|
|
469
470
|
|
|
471
|
+
# Helper to format static analysis warnings
|
|
472
|
+
def _lint_script_warning(warnings, script, statement, message):
|
|
473
|
+
if script and statement:
|
|
474
|
+
statement_key = next(iter(statement.keys()))
|
|
475
|
+
script_name = script.get('scriptName', '')
|
|
476
|
+
lineno = statement[statement_key].get('lineNumber', '')
|
|
477
|
+
warning = f'{script_name}:{lineno}: {message}' if script_name or lineno else message
|
|
478
|
+
else:
|
|
479
|
+
warning = message
|
|
480
|
+
warnings.append(warning)
|
|
481
|
+
|
|
482
|
+
|
|
470
483
|
# Helper function to determine if an expression statement's expression is pointless
|
|
471
484
|
def _is_pointless_expression(expr):
|
|
472
485
|
expr_key = next(iter(expr.keys()))
|
|
@@ -77,20 +77,24 @@ def parse_script(script_text, start_line_number=1, script_name=None):
|
|
|
77
77
|
# Assignment?
|
|
78
78
|
match_assignment = _R_SCRIPT_ASSIGNMENT.match(line)
|
|
79
79
|
if match_assignment:
|
|
80
|
+
# Parse the expression
|
|
80
81
|
try:
|
|
81
|
-
|
|
82
|
-
'expr': {
|
|
83
|
-
'name': match_assignment.group('name'),
|
|
84
|
-
'expr': parse_expression(match_assignment.group('expr'), line_number, script_name, True),
|
|
85
|
-
**statement_base
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
statements.append(expr_statement)
|
|
89
|
-
continue
|
|
82
|
+
assignment_expr = parse_expression(match_assignment.group('expr'), line_number, script_name, True)
|
|
90
83
|
except BareScriptParserError as error:
|
|
91
84
|
column_number = len(line) - len(match_assignment.group('expr')) + error.column_number
|
|
92
85
|
raise BareScriptParserError(error.error, line, column_number, start_line_number + ix_line, script_name)
|
|
93
86
|
|
|
87
|
+
# Add the expression statement
|
|
88
|
+
expr_statement = {
|
|
89
|
+
'expr': {
|
|
90
|
+
'name': match_assignment.group('name'),
|
|
91
|
+
'expr': assignment_expr,
|
|
92
|
+
**statement_base
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
statements.append(expr_statement)
|
|
96
|
+
continue
|
|
97
|
+
|
|
94
98
|
# Function definition begin?
|
|
95
99
|
match_function_begin = _R_SCRIPT_FUNCTION_BEGIN.match(line)
|
|
96
100
|
if match_function_begin:
|
|
@@ -136,11 +140,18 @@ def parse_script(script_text, start_line_number=1, script_name=None):
|
|
|
136
140
|
# If-then begin?
|
|
137
141
|
match_if_begin = _R_SCRIPT_IF_BEGIN.match(line)
|
|
138
142
|
if match_if_begin:
|
|
143
|
+
# Parse the if-then expression
|
|
144
|
+
try:
|
|
145
|
+
ifthen_expr = parse_expression(match_if_begin.group('expr'), line_number, script_name, True)
|
|
146
|
+
except BareScriptParserError as error:
|
|
147
|
+
column_number = len(match_if_begin.group('if')) + error.column_number
|
|
148
|
+
raise BareScriptParserError(error.error, line, column_number, start_line_number + ix_line, script_name)
|
|
149
|
+
|
|
139
150
|
# Add the if-then label definition
|
|
140
151
|
ifthen = {
|
|
141
152
|
'jump': {
|
|
142
153
|
'label': f"__bareScriptIf{label_index}",
|
|
143
|
-
'expr': {'unary': {'op': '!', 'expr':
|
|
154
|
+
'expr': {'unary': {'op': '!', 'expr': ifthen_expr}},
|
|
144
155
|
**statement_base
|
|
145
156
|
},
|
|
146
157
|
'done': f"__bareScriptDone{label_index}",
|
|
@@ -158,7 +169,7 @@ def parse_script(script_text, start_line_number=1, script_name=None):
|
|
|
158
169
|
# Else-if-then?
|
|
159
170
|
match_if_else_if = _R_SCRIPT_IF_ELSE_IF.match(line)
|
|
160
171
|
if match_if_else_if:
|
|
161
|
-
# Get the if-then definition
|
|
172
|
+
# Get the else-if-then definition
|
|
162
173
|
label_def_depth = function_label_def_depth if function_def is not None else 0
|
|
163
174
|
ifthen = label_defs[len(label_defs) - 1].get('if') if len(label_defs) > label_def_depth else None
|
|
164
175
|
if ifthen is None:
|
|
@@ -168,11 +179,18 @@ def parse_script(script_text, start_line_number=1, script_name=None):
|
|
|
168
179
|
if ifthen['hasElse']:
|
|
169
180
|
raise BareScriptParserError('Elif statement following else statement', line, 1, start_line_number + ix_line, script_name)
|
|
170
181
|
|
|
182
|
+
# Parse teh else-if-then expression
|
|
183
|
+
try:
|
|
184
|
+
if_else_if_expr = parse_expression(match_if_else_if.group('expr'), line_number, script_name, True)
|
|
185
|
+
except BareScriptParserError as error:
|
|
186
|
+
column_number = len(match_if_else_if.group('elif')) + error.column_number
|
|
187
|
+
raise BareScriptParserError(error.error, line, column_number, start_line_number + ix_line, script_name)
|
|
188
|
+
|
|
171
189
|
# Generate the next if-then jump statement
|
|
172
190
|
prev_label = ifthen['jump']['label']
|
|
173
191
|
ifthen['jump'] = {
|
|
174
192
|
'label': f"__bareScriptIf{label_index}",
|
|
175
|
-
'expr': {'unary': {'op': '!', 'expr':
|
|
193
|
+
'expr': {'unary': {'op': '!', 'expr': if_else_if_expr}},
|
|
176
194
|
**statement_base
|
|
177
195
|
}
|
|
178
196
|
label_index += 1
|
|
@@ -226,12 +244,19 @@ def parse_script(script_text, start_line_number=1, script_name=None):
|
|
|
226
244
|
# While-do begin?
|
|
227
245
|
match_while_begin = _R_SCRIPT_WHILE_BEGIN.match(line)
|
|
228
246
|
if match_while_begin:
|
|
247
|
+
# Parse the while-do expression
|
|
248
|
+
try:
|
|
249
|
+
while_begin_expr = parse_expression(match_while_begin.group('expr'), line_number, script_name, True)
|
|
250
|
+
except BareScriptParserError as error:
|
|
251
|
+
column_number = len(match_while_begin.group('while')) + error.column_number
|
|
252
|
+
raise BareScriptParserError(error.error, line, column_number, start_line_number + ix_line, script_name)
|
|
253
|
+
|
|
229
254
|
# Add the while-do label
|
|
230
255
|
whiledo = {
|
|
231
256
|
'loop': f'__bareScriptLoop{label_index}',
|
|
232
257
|
'continue': f'__bareScriptLoop{label_index}',
|
|
233
258
|
'done': f'__bareScriptDone{label_index}',
|
|
234
|
-
'expr':
|
|
259
|
+
'expr': while_begin_expr,
|
|
235
260
|
'line': line,
|
|
236
261
|
'lineNumber': start_line_number + ix_line
|
|
237
262
|
}
|
|
@@ -282,11 +307,18 @@ def parse_script(script_text, start_line_number=1, script_name=None):
|
|
|
282
307
|
label_defs.append({'for': foreach})
|
|
283
308
|
label_index += 1
|
|
284
309
|
|
|
310
|
+
# Parse the for-each expression
|
|
311
|
+
try:
|
|
312
|
+
for_begin_expr = parse_expression(match_for_begin.group('values'), line_number, script_name, True)
|
|
313
|
+
except BareScriptParserError as error:
|
|
314
|
+
column_number = len(match_for_begin.group('for')) + error.column_number
|
|
315
|
+
raise BareScriptParserError(error.error, line, column_number, start_line_number + ix_line, script_name)
|
|
316
|
+
|
|
285
317
|
# Add the for-each header statements
|
|
286
318
|
statements.extend([
|
|
287
319
|
{'expr': {
|
|
288
320
|
'name': foreach['values'],
|
|
289
|
-
'expr':
|
|
321
|
+
'expr': for_begin_expr,
|
|
290
322
|
**statement_base
|
|
291
323
|
}},
|
|
292
324
|
{'expr': {
|
|
@@ -453,15 +485,15 @@ _R_SCRIPT_JUMP = re.compile(r'^(?P<jump>\s*(?:jump|jumpif\s*\((?P<expr>.+)\)))\s
|
|
|
453
485
|
_R_SCRIPT_RETURN = re.compile(r'^(?P<return>\s*return(?:\s+(?P<expr>[^#\s].*))?)' + _R_PART_COMMENT)
|
|
454
486
|
_R_SCRIPT_INCLUDE = re.compile(r"^\s*include\s+(?P<delim>')(?P<url>(?:\\'|[^'])*)'" + _R_PART_COMMENT)
|
|
455
487
|
_R_SCRIPT_INCLUDE_SYSTEM = re.compile(r'^\s*include\s+(?P<delim><)(?P<url>[^>]*)>' + _R_PART_COMMENT)
|
|
456
|
-
_R_SCRIPT_IF_BEGIN = re.compile(r'
|
|
457
|
-
_R_SCRIPT_IF_ELSE_IF = re.compile(r'
|
|
488
|
+
_R_SCRIPT_IF_BEGIN = re.compile(r'^(?P<if>\s*if\s+)(?P<expr>.+)\s*:' + _R_PART_COMMENT)
|
|
489
|
+
_R_SCRIPT_IF_ELSE_IF = re.compile(r'^(?P<elif>\s*elif\s+)(?P<expr>.+)\s*:' + _R_PART_COMMENT)
|
|
458
490
|
_R_SCRIPT_IF_ELSE = re.compile(r'^\s*else\s*:' + _R_PART_COMMENT)
|
|
459
491
|
_R_SCRIPT_IF_END = re.compile(r'^\s*endif' + _R_PART_COMMENT)
|
|
460
492
|
_R_SCRIPT_FOR_BEGIN = re.compile(
|
|
461
|
-
r'
|
|
493
|
+
r'^(?P<for>\s*for\s+(?P<value>[A-Za-z_]\w*)(?:\s*,\s*(?P<index>[A-Za-z_]\w*))?\s+in\s+)(?P<values>.+)\s*:' + _R_PART_COMMENT
|
|
462
494
|
)
|
|
463
495
|
_R_SCRIPT_FOR_END = re.compile(r'^\s*endfor' + _R_PART_COMMENT)
|
|
464
|
-
_R_SCRIPT_WHILE_BEGIN = re.compile(r'
|
|
496
|
+
_R_SCRIPT_WHILE_BEGIN = re.compile(r'^(?P<while>\s*while\s+)(?P<expr>.+)\s*:' + _R_PART_COMMENT)
|
|
465
497
|
_R_SCRIPT_WHILE_END = re.compile(r'^\s*endwhile' + _R_PART_COMMENT)
|
|
466
498
|
_R_SCRIPT_BREAK = re.compile(r'^\s*break' + _R_PART_COMMENT)
|
|
467
499
|
_R_SCRIPT_CONTINUE = re.compile(r'^\s*continue' + _R_PART_COMMENT)
|
|
@@ -637,22 +669,22 @@ def _parse_unary_expression(expr_text, array_literals):
|
|
|
637
669
|
arg_text = arg_text[len(match_object_close.group(0)):]
|
|
638
670
|
break
|
|
639
671
|
|
|
640
|
-
#
|
|
672
|
+
# Key/value pair separator
|
|
641
673
|
if args:
|
|
642
|
-
|
|
643
|
-
if
|
|
674
|
+
match_object_separator = _R_EXPR_OBJECT_SEPARATOR.match(arg_text)
|
|
675
|
+
if match_object_separator is None:
|
|
644
676
|
raise BareScriptParserError('Syntax error', arg_text, 1, None, None)
|
|
645
|
-
arg_text = arg_text[len(
|
|
677
|
+
arg_text = arg_text[len(match_object_separator.group(0)):]
|
|
646
678
|
|
|
647
679
|
# Get the key
|
|
648
680
|
arg_key, arg_text = _parse_binary_expression(arg_text, None, array_literals)
|
|
649
681
|
args.append(arg_key)
|
|
650
682
|
|
|
651
|
-
#
|
|
652
|
-
|
|
653
|
-
if
|
|
683
|
+
# Key/value separator
|
|
684
|
+
match_object_separator_key = _R_EXPR_OBJECT_SEPARATOR_KEY.match(arg_text)
|
|
685
|
+
if match_object_separator_key is None:
|
|
654
686
|
raise BareScriptParserError('Syntax error', arg_text, 1, None, None)
|
|
655
|
-
arg_text = arg_text[len(
|
|
687
|
+
arg_text = arg_text[len(match_object_separator_key.group(0)):]
|
|
656
688
|
|
|
657
689
|
# Get the value
|
|
658
690
|
arg_value, arg_text = _parse_binary_expression(arg_text, None, array_literals)
|
|
@@ -719,8 +751,8 @@ _R_EXPR_ARRAY_OPEN = re.compile(r'^\s*\[')
|
|
|
719
751
|
_R_EXPR_ARRAY_SEPARATOR = re.compile(r'^\s*,')
|
|
720
752
|
_R_EXPR_ARRAY_CLOSE = re.compile(r'^\s*\]')
|
|
721
753
|
_R_EXPR_OBJECT_OPEN = re.compile(r'^\s*\{')
|
|
722
|
-
|
|
723
|
-
|
|
754
|
+
_R_EXPR_OBJECT_SEPARATOR_KEY = re.compile(r'^\s*:')
|
|
755
|
+
_R_EXPR_OBJECT_SEPARATOR = re.compile(r'^\s*,')
|
|
724
756
|
_R_EXPR_OBJECT_CLOSE = re.compile(r'^\s*\}')
|
|
725
757
|
_R_EXPR_STRING = re.compile(r"^\s*'((?:\\\\|\\'|[^'])*)'")
|
|
726
758
|
_R_EXPR_STRING_DOUBLE = re.compile(r'^\s*"((?:\\\\|\\"|[^"])*)"')
|
|
@@ -151,7 +151,7 @@ def _execute_script_helper(script, statements, options, locals_):
|
|
|
151
151
|
warning_prefix = f'BareScript: Include "{include_url}" static analysis...'
|
|
152
152
|
log_fn(f'{warning_prefix} {len(warnings)} warning{"s" if len(warnings) > 1 else ""}:')
|
|
153
153
|
for warning in warnings:
|
|
154
|
-
log_fn(f'BareScript:
|
|
154
|
+
log_fn(f'BareScript: {warning}')
|
|
155
155
|
|
|
156
156
|
# Execute the include script
|
|
157
157
|
include_options = options.copy()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|