Commit b6b7cf16 authored by Jason Graham's avatar Jason Graham
Browse files

Update file asn_process.py

parent 8bc90830
Loading
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
import logging
import json
import re
from pathlib import Path
from subprocess import run
from shutil import which
@@ -77,12 +78,8 @@ duplicateObjects = {
def fixDuplicateObjects(filename):
    stringContent = filename.read_text()
    for object in duplicateObjects[filename.as_posix()]:
        stringContent = stringContent.replace(f"{object} ::=", f"Native{object} ::=", 1)
        stringContent = stringContent.replace(
            f"SEQUENCE OF {object}", f"SEQUENCE OF Native{object}"
        )
        # stringContent = sub(f"]\\w{object}", f"] Native{object}", stringContent)

        stringContent = re.sub(f"^({object} ::=)", 'Native\\1', stringContent, flags=re.MULTILINE)
        stringContent = re.sub(f"^SEQUENCE (\(SIZE\(\d+\.\.(\d+|MAX)\)\) )*OF ({object})", 'SEQUENCE \\1OF Native\\2', stringContent, flags=re.MULTILINE)
    Path("temp.asn").write_text(stringContent)
    return "temp.asn"