From ab41d548db376c6b52869004d1b6e21b88b4c9c8 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 6 Feb 2024 16:30:31 -0800 Subject: Improve Capability System (#3555) * Improve capability system. * Update documentation. * Tuning semantics. * LSP: hierarchical diagnostics. * Fix test. * Fix test. --- source/core/slang-string-util.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/core/slang-string-util.cpp') diff --git a/source/core/slang-string-util.cpp b/source/core/slang-string-util.cpp index a6a18d4a0..c7625e1e0 100644 --- a/source/core/slang-string-util.cpp +++ b/source/core/slang-string-util.cpp @@ -727,6 +727,12 @@ int StringUtil::parseIntAndAdvancePos(UnownedStringSlice text, Index& pos) pos++; continue; } + bool isNeg = false; + if (pos < text.getLength() && text[pos] == '-') + { + pos++; + isNeg = true; + } while (pos < text.getLength()) { if (text[pos] >= '0' && text[pos] <= '9') @@ -740,6 +746,8 @@ int StringUtil::parseIntAndAdvancePos(UnownedStringSlice text, Index& pos) break; } } + if (isNeg) + result = -result; return result; } -- cgit v1.2.3