File tree Expand file tree Collapse file tree 3 files changed +10
-14
lines changed Expand file tree Collapse file tree 3 files changed +10
-14
lines changed Original file line number Diff line number Diff 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 :
Original file line number Diff line number Diff line change 11import 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
1313type
Original file line number Diff line number Diff line change 11# Package
22
3- version = " 0.1.2 "
3+ version = " 0.1.3 "
44author = " Huy Doan"
55description = " Pure Nim XML parser"
66license = " MIT"
77srcDir = " src"
88
99# Dependencies
1010
11- requires " nim >= 0.19.6 "
11+ requires " nim >= 1.0.4 "
You can’t perform that action at this time.
0 commit comments