diff options
author | bptato <nincsnevem662@gmail.com> | 2022-07-29 22:10:13 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-07-29 22:23:41 +0200 |
commit | 54f4d71325c4f12b23113c945625796bda78e3c6 (patch) | |
tree | bc63f561f49ef106c55ec9a39dee3bd87a57e3c7 /src/css/selectorparser.nim | |
parent | d207bf1d5ec19bfaac8f65e600cab05ddd35f74e (diff) | |
download | chawan-54f4d71325c4f12b23113c945625796bda78e3c6.tar.gz |
Update CSS tokenizer
It was slightly outdated and in many places incorrect.
Diffstat (limited to 'src/css/selectorparser.nim')
-rw-r--r-- | src/css/selectorparser.nim | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/css/selectorparser.nim b/src/css/selectorparser.nim index 7c4834e6..012d6e68 100644 --- a/src/css/selectorparser.nim +++ b/src/css/selectorparser.nim @@ -191,11 +191,11 @@ proc parseSelectorToken(state: var SelectorParser, csstoken: CSSToken) = of CSS_IDENT_TOKEN: case state.query of QUERY_CLASS: - state.addSelector(Selector(t: CLASS_SELECTOR, class: $csstoken.value)) + state.addSelector(Selector(t: CLASS_SELECTOR, class: csstoken.value)) of QUERY_TYPE: - state.addSelector(Selector(t: TYPE_SELECTOR, tag: tagType($csstoken.value))) + state.addSelector(Selector(t: TYPE_SELECTOR, tag: tagType(csstoken.value))) of QUERY_PSEUDO: - case $csstoken.value + case csstoken.value of "before": state.addSelector(Selector(t: PSELEM_SELECTOR, elem: PSEUDO_BEFORE)) of "after": @@ -213,7 +213,7 @@ proc parseSelectorToken(state: var SelectorParser, csstoken: CSSToken) = of "checked": state.addSelector(Selector(t: PSEUDO_SELECTOR, pseudo: PSEUDO_CHECKED)) of QUERY_PSELEM: - case $csstoken.value + case csstoken.value of "before": state.addSelector(Selector(t: PSELEM_SELECTOR, elem: PSEUDO_BEFORE)) of "after": @@ -238,7 +238,7 @@ proc parseSelectorToken(state: var SelectorParser, csstoken: CSSToken) = state.addSelector(Selector(t: UNIVERSAL_SELECTOR)) else: discard of CSS_HASH_TOKEN: - state.addSelector(Selector(t: ID_SELECTOR, id: $csstoken.value)) + state.addSelector(Selector(t: ID_SELECTOR, id: csstoken.value)) of CSS_COMMA_TOKEN: if state.selectors[^1].len > 0: state.addSelectorList() @@ -264,15 +264,15 @@ proc parseSelectorSimpleBlock(state: var SelectorParser, cssblock: CSSSimpleBloc case state.query of QUERY_ATTR: state.query = QUERY_DELIM - state.addSelector(Selector(t: ATTR_SELECTOR, attr: $csstoken.value, rel: ' ')) + state.addSelector(Selector(t: ATTR_SELECTOR, attr: csstoken.value, rel: ' ')) of QUERY_VALUE: - state.getLastSel().value = $csstoken.value + state.getLastSel().value = csstoken.value break else: discard of CSS_STRING_TOKEN: case state.query of QUERY_VALUE: - state.getLastSel().value = $csstoken.value + state.getLastSel().value = csstoken.value break else: discard of CSS_DELIM_TOKEN: @@ -291,7 +291,7 @@ proc parseSelectorSimpleBlock(state: var SelectorParser, cssblock: CSSSimpleBloc else: discard proc parseSelectorFunction(state: var SelectorParser, cssfunction: CSSFunction) = - case $cssfunction.name + case cssfunction.name of "not", "is": if state.query != QUERY_PSEUDO: return @@ -309,7 +309,7 @@ proc parseSelectorFunction(state: var SelectorParser, cssfunction: CSSFunction) state.query = QUERY_TYPE return else: return - var fun = Selector(t: FUNC_SELECTOR, name: $cssfunction.name) + var fun = Selector(t: FUNC_SELECTOR, name: cssfunction.name) state.addSelector(fun) let osels = state.selectors |