stm32/make-stmconst.py: Improve regex to parse more constants.

A few RTC constants weren't being parsed properly due to whitespace
differences, and this patch makes certain whitespace optional.  Changes
made:

- allow for no space between /*!< and EXTI, eg for:
  __IO uint32_t IMR; /*!<EXTI Interrupt mask register, Address offset: 0x00 */

- allow for no space between semicolon and start of comment, eg for:
  __IO uint32_t ALRMASSR;/*!< RTC alarm A sub second register, Address offset: 0x44 */
This commit is contained in:
Dave Hylands 2019-02-14 11:56:02 -08:00 committed by Damien George
parent 9441f4b682
commit 92fec603d0
1 changed files with 2 additions and 2 deletions

View File

@ -48,8 +48,8 @@ class Lexer:
('{', re.compile(r'{$')),
('}', re.compile(r'}$')),
('} TypeDef', re.compile(r'} *(?P<id>[A-Z][A-Za-z0-9_]+)_(?P<global>([A-Za-z0-9_]+)?)TypeDef;$')),
('IO reg', re.compile(re_io_reg + r'; +/\*!< ' + re_comment + r', +' + re_addr_offset + r' *\*/')),
('IO reg array', re.compile(re_io_reg + r'\[(?P<array>[2-8])\]; +/\*!< ' + re_comment + r', +' + re_addr_offset + r'-(0x[0-9A-Z]{2,3}) *\*/')),
('IO reg', re.compile(re_io_reg + r'; */\*!< *' + re_comment + r', +' + re_addr_offset + r' *\*/')),
('IO reg array', re.compile(re_io_reg + r'\[(?P<array>[2-8])\]; */\*!< *' + re_comment + r', +' + re_addr_offset + r'-(0x[0-9A-Z]{2,3}) *\*/')),
)
def __init__(self, filename):