diff options
author | bptato <nincsnevem662@gmail.com> | 2023-06-29 12:38:44 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-06-29 12:38:44 +0200 |
commit | 6588a60d8d62c0cd947d2b1217d6f0aa51f23208 (patch) | |
tree | b3abeaef84ea022df5776733e779b48897628e08 /src | |
parent | 7e0d0d96e4b8143509ae7d118f9e3dfc1077c468 (diff) | |
download | chawan-6588a60d8d62c0cd947d2b1217d6f0aa51f23208.tar.gz |
cssparser: remove unused function, cast instead of collect
Diffstat (limited to 'src')
-rw-r--r-- | src/css/cssparser.nim | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/css/cssparser.nim b/src/css/cssparser.nim index 222ad92d..fb8b0cfa 100644 --- a/src/css/cssparser.nim +++ b/src/css/cssparser.nim @@ -1,6 +1,5 @@ import options import streams -import sugar import unicode import js/exception @@ -712,9 +711,7 @@ proc parseListOfRules(state: var CSSParseState): seq[CSSRule] = proc parseListOfRules*(cvals: seq[CSSComponentValue]): seq[CSSRule] = var state = CSSParseState() - state.tokens = collect(newSeq): - for cval in cvals: - CSSParsedItem(cval) + state.tokens = cast[seq[CSSParsedItem]](cvals) return state.parseListOfRules() proc parseRule(state: var CSSParseState): Result[CSSRule, DOMException] = @@ -769,9 +766,7 @@ proc parseListOfDeclarations(state: var CSSParseState): seq[CSSParsedItem] = proc parseListOfDeclarations*(cvals: seq[CSSComponentValue]): seq[CSSParsedItem] = var state: CSSParseState - state.tokens = collect(newSeq): - for cval in cvals: - CSSParsedItem(cval) + state.tokens = cast[seq[CSSParsedItem]](cvals) return state.consumeListOfDeclarations() proc parseListOfDeclarations*(inputStream: Stream): seq[CSSParsedItem] = @@ -784,9 +779,7 @@ proc parseListOfDeclarations2(state: var CSSParseState): seq[CSSDeclaration] = proc parseListOfDeclarations2*(cvals: seq[CSSComponentValue]): seq[CSSDeclaration] = var state: CSSParseState - state.tokens = collect(newSeq): - for cval in cvals: - CSSParsedItem(cval) + state.tokens = cast[seq[CSSParsedItem]](cvals) return state.consumeListOfDeclarations2() proc parseListOfDeclarations2*(inputStream: Stream): seq[CSSDeclaration] = @@ -837,14 +830,7 @@ proc parseCommaSeparatedListOfComponentValues(state: var CSSParseState): seq[seq proc parseCommaSeparatedListOfComponentValues*(cvals: seq[CSSComponentValue]): seq[seq[CSSComponentValue]] = var state: CSSParseState - state.tokens = collect(newSeq): - for cval in cvals: - CSSParsedItem(cval) - return state.parseCommaSeparatedListOfComponentValues() - -proc parseCommaSeparatedListOfComponentValues(inputStream: Stream): seq[seq[CSSComponentValue]] = - var state = CSSParseState() - state.tokens = tokenizeCSS(inputStream) + state.tokens = cast[seq[CSSParsedItem]](cvals) return state.parseCommaSeparatedListOfComponentValues() proc parseAnB*(state: var CSSParseState): Option[CSSAnB] = @@ -998,9 +984,7 @@ proc parseAnB*(state: var CSSParseState): Option[CSSAnB] = proc parseAnB*(cvals: seq[CSSComponentValue]): (Option[CSSAnB], int) = var state: CSSParseState - state.tokens = collect(newSeq): - for cval in cvals: - CSSParsedItem(cval) + state.tokens = cast[seq[CSSParsedItem]](cvals) let anb = state.parseAnB() return (anb, state.at) |