java.lang.NullPointerException # Wrapper around flex that: # - ensures lex.backup is created in a private directory # - can error out if lex.backup is created (--no-backup) # - works around concurrency issues with win_flex.exe: # https://github.com/lexxmark/winflexbison/issues/86
import argparse
import os
import subprocess
import sys
from os.path import abspath
parser.add_argument('--no-backup', action='store_true',
help='whether no_backup is enabled or not')
parser.add_argument('flex_flags', nargs='*', help='flags passed on to flex')
args = parser.parse_args()
# Since 'lex.backup' is always named that and ninja uses the top level build # directory as current directory for all commands, change directory to # temporary directory to avoid conflicts between concurrent flex # invocations. Only unreleased versions of flex have an argument to change # lex.filename to be named differently. ifnot os.path.isdir(args.privatedir):
os.mkdir(args.privatedir)
os.chdir(args.privatedir)
# win_flex.exe generates names in a racy way, sometimes leading to random # "error deleting file" failures and sometimes to intermingled file # contents. Set FLEX_TMP_DIR to the target private directory to avoid # that. That environment variable isn't consulted on other platforms, so we # don't even need to make this conditional.
env = {'FLEX_TMP_DIR': args.privatedir}
# create .c file from .l file
sp = subprocess.run(command, env=env) if sp.returncode != 0:
sys.exit(sp.returncode)
# check lex.backup if args.no_backup:
with open('lex.backup') as lex: if len(lex.readlines()) != 1:
sys.exit('Scanner requires backup; see lex.backup.')
os.remove('lex.backup')
sys.exit(0)
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-09-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.