diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 1e6a3cdfe..b4dcde713 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "ghul.compiler": { - "version": "0.8.7", + "version": "0.8.8", "commands": [ "ghul-compiler" ] diff --git a/Directory.Build.props b/Directory.Build.props index d549a03e5..7d7d57cde 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.8.7-alpha.14 + 0.8.9-alpha.2 $(NoWarn);NU1507 diff --git a/src/logging/diagnostics_store.ghul b/src/logging/diagnostics_store.ghul index be54877b7..7143fe2cc 100644 --- a/src/logging/diagnostics_store.ghul +++ b/src/logging/diagnostics_store.ghul @@ -365,6 +365,9 @@ namespace Logging is speculate_then_backtrack() -> LOGGER_SPECULATE_THEN_BACKTRACK => new LOGGER_SPECULATE_THEN_BACKTRACK(self); + mark_then_release() -> MARK_THEN_RELEASE => + new MARK_THEN_RELEASE(self); + merge(state: DIAGNOSTICS_STATE) is top.merge(state); si diff --git a/src/logging/logger.ghul b/src/logging/logger.ghul index 9c68fb78b..e59a7485d 100644 --- a/src/logging/logger.ghul +++ b/src/logging/logger.ghul @@ -105,6 +105,7 @@ namespace Logging is speculate_then_commit() -> LOGGER_SPECULATE_THEN_COMMIT; speculate_then_backtrack() -> LOGGER_SPECULATE_THEN_BACKTRACK; + mark_then_release() -> MARK_THEN_RELEASE; start_analysis(); end_analysis(); @@ -132,52 +133,36 @@ namespace Logging is is_speculating: bool => _logger != null; init(logger: Logger) is - debug_enter(); - debug(">> logger speculate then commit..."); - _logger = logger; _logger.speculate(); si backtrack() -> DIAGNOSTICS_STATE is - debug("-- logger state: explicit backtrack"); - let result = _logger.roll_back(); _logger = null; return result; si backtrack_and_restart() -> DIAGNOSTICS_STATE is - debug("-- logger state: explicit backtrack and restart"); - let result = _logger.roll_back(); _logger.speculate(); return result; si commit() is - debug("-- logger state: explicit commit"); - _logger.commit(); _logger = null; si cancel() is - debug("-- logger state: explicit cancel"); - _logger = null; si dispose() is if _logger != null then - debug("-- logger state: implicit commit"); - _logger.commit(); _logger = null; fi - - debug("<< logger state exit"); - debug_exit(); si si @@ -187,52 +172,50 @@ namespace Logging is is_speculating: bool => _logger != null; init(logger: Logger) is - debug_enter(); - debug(">> logger speculate then backtrack..."); - _logger = logger; _logger.speculate(); si backtrack() -> DIAGNOSTICS_STATE is - debug("-- logger state: explicit backtrack"); - let result = _logger.roll_back(); _logger = null; return result; si backtrack_and_restart() -> DIAGNOSTICS_STATE is - debug("-- logger state: explicit backtrack and restart"); - let result = _logger.roll_back(); _logger.speculate(); return result; si commit() is - debug("-- logger state: explicit commit"); - _logger.commit(); _logger = null; si cancel() is - debug("-- logger state: explicit cancel"); - _logger = null; si dispose() is if _logger != null then - debug("-- logger state: implicit backtrack"); - _logger.roll_back(); _logger = null; fi + si + si - debug("<< logger state exit"); - debug_exit(); + struct MARK_THEN_RELEASE: Disposable is + _logger: Logger; + _mark: int; + + init(logger: Logger) is + _logger = logger; + _mark = _logger.mark(); + si + + dispose() is + _logger.release(_mark); si si si diff --git a/src/syntax/parsers/context.ghul b/src/syntax/parsers/context.ghul index 611874bca..776098e3f 100644 --- a/src/syntax/parsers/context.ghul +++ b/src/syntax/parsers/context.ghul @@ -10,59 +10,43 @@ namespace Syntax.Parsers is is_speculating: bool => _context != null; init(context: CONTEXT) is - debug_enter(); - debug(">> token lookahead speculate then commit..."); - _context = context; _context.tokenizer_speculate(); si backtrack() is - debug("-- token lookahead state: explicit backtrack"); - _context.tokenizer_backtrack(); _context = null; si backtrack_if_speculating() is if _context != null then - debug("-- token lookahead state: explicit backtrack"); - _context.tokenizer_backtrack(); _context = null; fi si commit() is - debug("-- token lookahead state: explicit commit"); - _context.tokenizer_commit(); _context = null; si commit_if_speculating() is if _context != null then - debug("-- token lookahead state: explicit commit"); - _context.tokenizer_commit(); _context = null; fi si cancel() is - debug("-- token lookahead state: explicit cancel"); _context = null; si dispose() is if _context != null then - debug("-- token lookahead state: implicit commit"); _context.tokenizer_commit(); _context = null; fi - - debug("<< token state exit"); - debug_exit(); si si @@ -72,61 +56,43 @@ namespace Syntax.Parsers is is_speculating: bool => _context != null; init(context: CONTEXT) is - debug_enter(); - debug(">> token lookahead speculate then backtrack..."); - _context = context; _context.tokenizer_speculate(); si backtrack() is - debug("-- token lookahead state: explicit backtrack"); - _context.tokenizer_backtrack(); _context = null; si backtrack_if_speculating() is if _context != null then - debug("-- token lookahead state: explicit backtrack"); - _context.tokenizer_backtrack(); _context = null; fi si commit() is - debug("-- token lookahead state: explicit commit"); - _context.tokenizer_commit(); _context = null; si commit_if_speculating() is if _context != null then - debug("-- token lookahead state: explicit commit"); - _context.tokenizer_commit(); _context = null; fi si cancel() is - debug("-- token lookahead state: explicit cancel"); - _context = null; si dispose() is if _context != null then - debug("-- token lookahead state: implicit backtrack"); - _context.tokenizer_backtrack(); _context = null; fi - - debug("<< token state exit"); - debug_exit(); si si diff --git a/src/syntax/parsers/definitions/class.ghul b/src/syntax/parsers/definitions/class.ghul index f7bc7a229..d514a3a1a 100644 --- a/src/syntax/parsers/definitions/class.ghul +++ b/src/syntax/parsers/definitions/class.ghul @@ -115,7 +115,6 @@ namespace Syntax.Parsers.Definitions is return result; finally context.in_classy = false; - debug_exit(); yrt si