Allow comments in enum definition file

This change allow comments around the enum member definitions in matlab
enum definition files. The comments is not transfered to the generated
source code.

Change-Id: I1770f1cdfc8e9cba83f58417c1d0b03a17ecb1d3
This commit is contained in:
Lindgren 2025-01-22 15:03:40 +01:00
parent dce0d1910b
commit f939ff9242
3 changed files with 155 additions and 6 deletions
NOTICE
powertrain_build
tests/powertrain_build/reference_files/enums

156
NOTICE

@ -41,7 +41,64 @@ voluptuous 0.15.2: http://pypi.python.org/pypi/voluptuous : BSD 3-clause "New" o
Copyright Text:
Coverage 7.6.10 pypi:coverage/7.6.10: http://nedbatchelder.com/code/modules/coverage.html
No Copyrights found
(c)
else:
c.post_fork()
self._collectors[:] = keep_collectors
if self._collectors:
(c)
yield code
(c)
else:
c.post_fork()
self._collectors[:] = keep_collectors
if self._collectors:
(c)
yield code
(c) for c in re.split(r"(\d
def human_sorted(strings: Iterable[str]) -> list[str]:
(c) for c in re.split(r"(\d
def human_sorted(strings: Iterable[str]) -> list[str]:
(c) for c in self.code)
def add_line(self, line: str) -> None:
(c) for c in self.code)
def add_line(self, line: str) -> None:
(c) for c in text
print(u"All OK with {encoding}")
encoding = "{encoding}"
""",
(c) for c in text
source_text = source.format(encoding=encoding, text=text, ords=ords)
zf.writestr(filename, source_text.encode(encoding))
with zipfile.ZipFile("tests/zip1.zip", "w") as zf:
(c)?c:a(c)):null
Copyright 2001 Gareth Rees. All rights reserved.
Copyright 2004-
)
Copyright 2004-2024 Ned Batchelder. All rights reserved.
Copyright 2004.
Copyright Software Freedom Conservancy, Inc.
exceptiongroup 1.2.2 pypi:exceptiongroup/1.2.2: https://github.com/python-trio/exceptiongroup
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -53,9 +110,69 @@ flake8 7.1.1 pypi:flake8/7.1.1: https://gitlab.com/pycqa/flake8
Copyright (C) 2012-2016 Ian Cordasco <graffatcolmingov@gmail.com>
gitdb 4.0.12 pypi:gitdb/4.0.12: http://github.com/gitpython-developers/gitdb
No Copyrights found
(c)
# end handle interpreter
return hdr
Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
#
# This module is part of GitDB and is released under
Copyright (C) 2010, 2011 Sebastian Thiel and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the GitDB project nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
GitPython 3.1.44 pypi:GitPython/3.1.44: https://github.com/gitpython-developers/GitPython
No Copyrights found
(c) < 32 or ord(c) == 127:
raise ValueError(f"Invalid reference '{ref_path}': references cannot contain ASCII control characters")
one_before_previous = previous
previous = c
Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
Copyright (C) 2008, 2009 Michael Trier and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the GitPython project nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
Copyright (C) 2008, 2009 Michael Trier and contributors, 2010-2015 Sebastian Thiel"
# The version info for the project you're documenting, acts as replacement for |version|
# and |release|, also used in various other places throughout the built documents.
idna 3.10 pypi:idna/3.10: https://github.com/kjd/idna
Copyright (c) 2013-2024, Kim Davies and contributors.
All rights reserved.
@ -13500,7 +13617,38 @@ package originally developed by Stephen G. Nash in Fortran.
copyright: Copyright 2015 Jon Lund Steffensen. Based on extlinks by
smmap 5.0.2 pypi:smmap/5.0.2: https://github.com/gitpython-developers/smmap
No Copyrights found
(c)
assert man_optimal.num_file_handles() == 1
# PERFORMANCE
# blast away with random access and a full mapping - we don't want to
# exaggerate the manager's overhead, but measure the buffer overhead
# We do it once with an optimal setting, and with a worse manager which
# will produce small mappings only !
max_num_accesses = 100
fd = os.open(fc.path, os.O_RDONLY)
for item in (fc.path, fd):
Copyright (C) 2010, 2011 Sebastian Thiel and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the async project nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
tomli 2.2.1 pypi:tomli/2.2.1: https://github.com/hukkin/tomli
Copyright (c) 2021 Taneli Hukkinen

@ -393,7 +393,7 @@ class UserDefinedTypes(ProblemLogger):
enum_name = enum_file.stem
members_part = re.search(
r'\s+enumeration\n'
r'(\s*\w+\(\d+\)\n)+'
r'(\s*\w+\(\d+\)(\s*%.*)?\n|\s*(%.*)?\n)+'
r'\s+end',
enum_file_content,
flags=re.MULTILINE

@ -1,8 +1,9 @@
classdef EnumTest < Simulink.IntEnumType
enumeration
% Test comment 1
ClimaOff(0)
ClimaHeatgToHvacAndHvBatt(1)
ClimaHeatgToHvacAndHvBatt(1) % Test comment 2
ClimaHeatgToHvBatt(2)
ClimaHeatgToHvac(3)
ClimaFlow(4)