diff options
| author | bptato <nincsnevem662@gmail.com> | 2023-08-01 19:05:45 +0200 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2023-08-01 19:37:48 +0200 |
| commit | af3dbce840d0d0956663ffb20012329a4c22d5dd (patch) | |
| tree | da3c2bad567d9b08f585cbc973aac61ef4eb05ae /src/css | |
| parent | cab49aa0952c24941bcfb9a5b483f796158bf373 (diff) | |
| download | chawan-af3dbce840d0d0956663ffb20012329a4c22d5dd.tar.gz | |
Fixes & workarounds to compile on Nim 2.0.0
* Import punycode, as it has been removed from stdlib.
* Fix some syntax errors
* Apparently you can no longer compare distinct pointers with nil.
Add explicit comparisons with typeof(nil) instead.
* htmlparser: rename _ to other, as semantics of _ have changed.
(Quite a shame, it looked better with _. Oh well.)
* Explicitly specify mm:refc, as the browser OOMs with orc for
some reason.
Confirmed to compile & run on 2.0.0, 1.6.14, 1.6.12, 1.6.10 and 1.6.8.
(<1.6.8 it's broken & wontfix.)
Diffstat (limited to 'src/css')
| -rw-r--r-- | src/css/cssparser.nim | 5 | ||||
| -rw-r--r-- | src/css/match.nim | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/css/cssparser.nim b/src/css/cssparser.nim index fb8b0cfa..c5448599 100644 --- a/src/css/cssparser.nim +++ b/src/css/cssparser.nim @@ -195,7 +195,8 @@ proc next3startsWithIdentSequence(state: var CSSTokenizerState): bool = case state.peek() of '-': - return state.has(1) and state.peek(1) in IdentStart + {'-'} or state.has(2) and isValidEscape(state.peek(1), state.peek(2)): + return state.has(1) and state.peek(1) in IdentStart + {'-'} or + state.has(2) and isValidEscape(state.peek(1), state.peek(2)) of IdentStart: return true of '\\': @@ -239,7 +240,7 @@ proc consumeEscape(state: var CSSTokenizerState): string = inc i if state.peek().isWhitespace(): discard state.consume() - if num == 0 or num > 0x10FFFF or num in {0xD800..0xDFFF}: + if num == 0 or num > 0x10FFFF or num in 0xD800..0xDFFF: return $Rune(0xFFFD) else: return $Rune(num) diff --git a/src/css/match.nim b/src/css/match.nim index 6f684e8b..810cdbe4 100644 --- a/src/css/match.nim +++ b/src/css/match.nim @@ -142,7 +142,7 @@ func complexSelectorMatches[T: Element|StyledNode](elem: T, cxsel: ComplexSelect var match = false case sels.ct of NO_COMBINATOR: - match = e.selectorsMatch(sels, felem): + match = e.selectorsMatch(sels, felem) of DESCENDANT_COMBINATOR: e = e.parentElement while e != nil: |