Skip to content

Commit d638372

Browse files
committed
split token on colon and remove leading plus sign
Reference: aboutcode-org#4229 Signed-off-by: Alok Kumar <alokkumarjipura9973@gmail.com>
1 parent 4b57a7f commit d638372

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/cluecode/copyrights.py

+17
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,23 @@ def get_tokens(numbered_lines, splitter=re.compile(r'[\t =;]+').split):
437437
.strip()
438438
)
439439

440+
# remove leading plus sign
441+
if tok.startswith('+'):
442+
tok = tok.lstrip('+')
443+
# convert 'AUTHOR' to ('author' or 'Author')
444+
if tok == 'AUTHOR':
445+
tok = 'author'
446+
447+
# Split tokens like 'Author:Frankie.Chu' into 'Author' and 'Frankie.Chu'
448+
if tok.startswith("Author:"):
449+
parts = tok.split(":", 1)
450+
for part in parts:
451+
part = part.strip()
452+
if part and part not in ':.':
453+
yield Token(value=part, start_line=start_line, pos=pos)
454+
pos += 1
455+
continue
456+
440457
# the tokenizer allows a single colon or dot to be a token and we discard these
441458
if tok and tok not in ':.':
442459
yield Token(value=tok, start_line=start_line, pos=pos)

0 commit comments

Comments
 (0)