Fix MacOs lexer compile error (#7314) (#7315)

This commit is contained in:
Tracy Narine 2026-03-24 14:30:15 -04:00 committed by GitHub
parent 5060f884b5
commit c58df87c27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -256,6 +256,7 @@ Tom Manner
Tomasz Gorochowik
Topa Topino
Toru Niina
Tracy Narine
Trung Nguyen
Tudor Timi
Tymoteusz Blazejczyk

View File

@ -14,6 +14,7 @@
import re
import sys
import platform
for line in sys.stdin:
# Fix flex 2.6.1 warning
@ -47,5 +48,14 @@ for line in sys.stdin:
line = re.sub(r'(#line \d+ ".*)_pretmp', r'\1', line)
# Fix 'register' storage class specifier is deprecated and incompatible with C++17
line = re.sub(r'register ', '', line)
# Change int to size_t on LexerInput/LexerOutput when using macOS Tahoe
if platform.system() == "Darwin":
try:
osv = platform.mac_ver()[0] # Example "26.2"
if len(osv) > 2 and osv[2] == "." and int(osv[:2]) >= 26:
if "::LexerInput(" in line or "::LexerOutput(" in line:
line = re.sub(r'int ', r'size_t ', line)
except IndexError as e:
print(f"Unexpected index error {e}")
print(line, end='')