Skip to content

Commit 73dcafe

Browse files
committed
compatible update
1 parent 2f7a17a commit 73dcafe

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

src/xml.nim

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ iterator tokens*(input: string): XmlToken {.inline.} =
5757
length = input.len
5858
is_cdata = false
5959
is_text = false
60-
61-
var ch = input[pos]
60+
ch: char
6261

6362
while pos < length and input[pos] != '\0':
64-
let ch = input[pos]
63+
ch = input[pos]
6564
if ch in Whitespace:
6665
inc(pos)
6766
continue
@@ -86,7 +85,6 @@ iterator tokens*(input: string): XmlToken {.inline.} =
8685
inc(pos, 6)
8786
elif input[pos..pos+1] == "--":
8887
# skips comment
89-
let comment_start = pos-2
9088
skip_until("-->")
9189
# print out full of comment
9290
#echo input[comment_start..<pos]
@@ -138,9 +136,7 @@ iterator tokens*(input: string): XmlToken {.inline.} =
138136
pos = text_end
139137
is_text = false
140138
else:
141-
var
142-
name = ""
143-
name_start = pos
139+
var name = ""
144140
var c = input[pos]
145141
if c in IdentStartChars:
146142
while c in NameIdentChars:

src/xml/selector.nim

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import pegs, strutils, ../xml
2-
from streams import newStringStream
3-
from strtabs import hasKey
42

5-
6-
let
3+
const
74
attribute = r"[a-zA-Z][a-zA-Z0-9_\-]*"
85
classes = r"{\.[a-zA-Z0-9_][a-zA-Z0-9_\-]*}"
96
attributes = r"{\[" & attribute & r"\s*([\*\^\$\~]?\=\s*[\'""]?(\s*\ident\s*)+[\'""]?)?\]}"
10-
pselectors = peg(r"\s*{\ident}?({'#'\ident})? (" & classes & ")* " & attributes & "*")
7+
selectors = r"\s*{\ident}?({'#'\ident})? (" & classes & ")* " & attributes & "*"
8+
9+
let
10+
pselectors = peg(selectors)
1111
pattributes = peg(r"{\[{" & attribute & r"}\s*({[\*\^\$\~]?}\=\s*[\'""]?{(\s*\ident\s*)+}[\'""]?)?\]}")
1212

1313
type

xml.nimble

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Package
22

3-
version = "0.1.2"
3+
version = "0.1.3"
44
author = "Huy Doan"
55
description = "Pure Nim XML parser"
66
license = "MIT"
77
srcDir = "src"
88

99
# Dependencies
1010

11-
requires "nim >= 0.19.6"
11+
requires "nim >= 1.0.4"

0 commit comments

Comments
 (0)