|
Last change
on this file since 8624d1f was 8624d1f, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago |
|
Update some files that use shell-style comments
|
-
Property mode
set to
100644
|
|
File size:
671 bytes
|
| Line | |
|---|
| 1 | #
|
|---|
| 2 | # SPDX-FileCopyrightText: 2010 Martin Decky
|
|---|
| 3 | #
|
|---|
| 4 | # SPDX-License-Identifier: BSD-3-Clause
|
|---|
| 5 | #
|
|---|
| 6 | """
|
|---|
| 7 | Helper routines for parsing jobfiles
|
|---|
| 8 | """
|
|---|
| 9 |
|
|---|
| 10 | def parse_arg(record):
|
|---|
| 11 | "Parse jobfile line arguments"
|
|---|
| 12 |
|
|---|
| 13 | arg = []
|
|---|
| 14 | i = 0
|
|---|
| 15 | current = ""
|
|---|
| 16 | nil = True
|
|---|
| 17 | inside = False
|
|---|
| 18 |
|
|---|
| 19 | while (i < len(record)):
|
|---|
| 20 | if (inside):
|
|---|
| 21 | if (record[i] == "}"):
|
|---|
| 22 | inside = False
|
|---|
| 23 | else:
|
|---|
| 24 | current = "%s%s" % (current, record[i])
|
|---|
| 25 | else:
|
|---|
| 26 | if (record[i] == "{"):
|
|---|
| 27 | nil = False
|
|---|
| 28 | inside = True
|
|---|
| 29 | elif (record[i] == ","):
|
|---|
| 30 | arg.append(current)
|
|---|
| 31 | current = ""
|
|---|
| 32 | nil = True
|
|---|
| 33 | else:
|
|---|
| 34 | print("Unexpected '%s'" % record[i])
|
|---|
| 35 | return False
|
|---|
| 36 |
|
|---|
| 37 | i += 1
|
|---|
| 38 |
|
|---|
| 39 | if (not nil):
|
|---|
| 40 | arg.append(current)
|
|---|
| 41 |
|
|---|
| 42 | return arg
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.